Quantcast
Channel: How to implement efficient C++ runtime statistics - Stack Overflow
Viewing all articles
Browse latest Browse all 8

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

$
0
0

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 time the "stat" thread asks for a data, there's a critical section accessing this data (counters, etc.) and it means that the worker thread is blocked for the time this data is being retrieved. It turned out, that under heavy load of worker threads, this 10Hz stat querying affected overall performance of the workers.

So I switched to a slightly different stat reporting model - instead of actively querying worker threads from the main threads, I now have worker threads to report their basic stat counters to their exclusive statistics repos, which can be queried by the main thread at any time with no direct impact on the workers.


Viewing all articles
Browse latest Browse all 8

Trending Articles