Looking at this quickly, I have two observations.
1. I'd look at dumping this to a file as Grant suggested. That can be very useful - it depends. I have to think more on what you are trying to achieve and tinker with your code.
2. You may want to setup an MDW with a Data Collector and pull the info you are seeking out of the ring buffer and store it in a normalized fashion within a database. IMHO this can be useful for historical research and to more easily manipulate the data.
I know I said two, but I am curious if you have considered using a histogram target (looks like you are trying this in 2012). If I understand the basic needs - this could be a useful output.
Lastly, to make sure I am understanding correctly as I set out to test, could you provide some semblance of how you want the data to be represented?
Jason...AKA CirqueDeSQLeil
_______________________________________________
I have given a name to my pain...MCM SQL Server, MVP
SQL RNNR
Posting Performance Based Questions - Gail Shaw[/url]
Learn Extended Events