title: How to implement efficient C++ runtime statistics
body: <p>I would like to know if there is a good way to monitor my application internals, ideally in the form of an existing library.</p>
  
  <p>My application is heavily multithreaded, and uses a messaging system to communicate in-between threads and to the external world. My goal is to monitor what kind of messages are sent, at which frequency, etc. </p>
  
  <p>There could also be other statistics in a more general way, like how many threads are spawned every minute, how much new/delete are called, or more specific aspects of the application; you name it.</p>
  
  <p>What would be awesome is something like the "internal pages" you have for Google Chrome, like <a href="http://www.chromium.org/developers/design-documents/network-stack/view-net-internals" rel="noreferrer">net</a> or chrome://tracing , but in a command line fashion. </p>
  
  <p>If there is a library that's generic enough to accomodate for the specificities of my app, that would be great.<br>
  Otherwise I'm prepared to implement a small class that would do the job, but I don't know where to start. I think the most important thing is that the code shouldn't interfere too much, so that performances are not impacted.</p>
  
  <p>Do you guys have some pointers on this matter?</p>
  
  <p>Edit: my application runs on Linux, in an embedded environment, sadly not supported by Valgrind :(</p>