Quantcast
Channel: How to implement efficient C++ runtime statistics - Stack Overflow
Browsing latest articles
Browse All 8 View Live

Answer by kroiz for How to implement efficient C++ runtime statistics

If you are on C++11 you could use std::atomic<>#include <atomic>class GlobalStatistics {public: static GlobalStatistics &get() { static GlobalStatistics instance; return instance; }...

View Article



Answer by peetonn for How to implement efficient C++ runtime statistics

That's a good answer, @John Dibling! I had a system quite similar to this. However, my "stat" thread was querying workers 10 times per second and it affected performance of the worker threads as each...

View Article

Answer by Thomas Matthews for How to implement efficient C++ runtime statistics

In embedded systems, a common technique is to reserve a block of memory for a "log" and treat it like a circular queue. Write some code that can read this block of memory; which will help take...

View Article

Answer by Paul Coccoli for How to implement efficient C++ runtime statistics

Use shared memory (POSIX, System V, mmap or whatever you have available). Put a fixed length array of volatile unsigned 32- or 64-bit integers (i.e. the largest you can atomically increment on your...

View Article

Answer by John Dibling for How to implement efficient C++ runtime statistics

I gather you are trying to implement the gathering of run-time statistics -- things like how many bytes you sent, how long you've been running, and how many times the user has activated a particular...

View Article


Answer by W. Goeman for How to implement efficient C++ runtime statistics

Have a look at valgrind/callgrind. It can be used for profiling, which is what I understand you are looking for. I do not think it works at runtime though, but it can generate after your process...

View Article

Answer by jxh for How to implement efficient C++ runtime statistics

I would recommend that in your code, you maintain counters that get incremented. The counters can be static class members or globals. If you use a class to define your counter, you can have the...

View Article

How to implement efficient C++ runtime statistics

I would like to know if there is a good way to monitor my application internals, ideally in the form of an existing library.My application is heavily multithreaded, and uses a messaging system to...

View Article

Browsing latest articles
Browse All 8 View Live




Latest Images