I’m working on a Component that displays CPU load for processBlock() in a plugin program, and I’m hoping to achieve this by using two PerformanceCounter instances: one tracking elapsed time from the beginning to end of processBlock() and a PerformanceCounter tracking the elapsed time from the end to end of successive processBlock() calls (tracking the “full cycle” time), and so able to calculate the ratio of time spent in processBlock() with the total time. (just as @jules has suggested: thread)
However, printStatisticsAndGetResults() is returning all zeros for each variable inside the PerformanceCounter::Statistics struct, and this seems to be the only way to grab those summary statistics inside the program. I’ve given them files to dump statistics in, and I see that they are being dumped correctly that way.
Has anybody done what I’m attempting to do successfully? Am I off base here? Maybe there’s something “obvious” that I’m missing, but documentation for this class is very sparse. Like, I’m assuming that stop() returns true if there are new summary statistics available but nowhere in the documentation is this said explicitly.
I’m on Windows, if that’s important.