Sitecore contains a lot of hidden features. Some are hidden because Sitecore haven’t got to the documentation of the feature yet, others are hidden because … well because they haven’t been documented.
One of those features is the CounterDumpAgent. This agent dumps diagnostics data from Sitecore and can be used when debugging slow or faulty websites. You can see cache clear/hit/miss informations, client data reads/writes, jobs in the pipeline, number of publishings, security and system data and much more.
The class is an Agent (as the name describes). You add the class to the list of scheduled tasks in the web.config. Here is an example:
<agent type="Sitecore.Tasks.CounterDumpAgent" method="Run" interval="01:00:00">
<dumpfile>C:\Inetpub\mysite\data\dump.{date}.{time}.{processid}.txt</dumpfile>
</agent>
The DumpFile section describes the name of the dump file. The {} marked text strings is replaced with date, time and process id.