I have the source code to a collector program in Windows which records data from ~20 different counters (cpu usage, L2 cache misses, etc) every 500ms for two hours. I need to adapt this code to Linux and have no knowledge of how write hardware counter code. Is there/what is the best library in C/C++ for pulling data such as this off a Linux machine? I appreciate any help!
            Asked
            
        
        
            Active
            
        
            Viewed 928 times
        
    0
            
            
        - 
                    1I don't know if it's the "best", but [OProfile](http://oprofile.sourceforge.net/) does that. You can also use [Valgrind](http://valgrind.org/) (the Cachegrind and Callgrind tools) for cycle-accurate (but very slow) measurement on emulated hardware. – Mike Seymour Oct 30 '13 at 19:33
- 
                    1You can get information from psuedo processes, see: http://stackoverflow.com/questions/1420426/calculating-cpu-usage-of-a-process-in-linux – resigned Oct 30 '13 at 20:18
