4

Is there something out there that would allow me to create static object in my class or extend my class and give me functions to start, stop time configure statistics collection with properties file and bunch of other goodies I don't even know about.

I'm working on app that has crazy amount of threads running at any given moment and making sense out of the log files is becoming increasingly difficult. That's why I'm looking for some kind of a solution to help me with that.

Ideally I would like to have bean in my spring application context that would pretty much automate all the tracking of running treads based on annotation which would allow to configure the names of threads and accuracy of the stopwatch. Also ability to hooking it up with database instead of just log file would be great as well.

MatBanik
  • 26,356
  • 39
  • 116
  • 178
  • Are you most interested in the performance aspects or the details of what each thread is doing? If mostly performance, a profiler may help give you additional visibility. – Rob Tanzola Jun 23 '11 at 14:41

3 Answers3

6

Maybe you want the apache commons StopWatch class?

MatBanik
  • 26,356
  • 39
  • 116
  • 178
Rocky Pulley
  • 22,531
  • 20
  • 68
  • 106
  • oh, i could have guessed it - apache commons is always there for you :-) – Peter Perháč Jun 23 '11 at 14:00
  • @Mat if you want more specific answers, then ask a more specific question - what features exactly are you looking for (don't say vague things like "a bunch of other goodies I don't even know about")? If *you* don't even know what you need, then how is someone else supposed to know? – Jesper Jun 23 '11 at 14:17
4

Since you are already using Spring, you could use the Spring StopWatch, though it does not meet your additional goals of being able to persist the data. Note that it is not intended for production use, just for additional information during development and testing.

Rob Tanzola
  • 1,785
  • 14
  • 11
3

I'm not entirely sure I understand what you are trying to achieve.

Are you looking for keeping statistics on some time-line and exporting those to a a data source using some plugin API?

It might be worth your while to look at the Stats package of Twitter commons, they just open-sourced it not too long ago, so documentation and examples are still scarce, you will need to understand it mostly on your own, but I think this is what you are after.

Asaf
  • 6,384
  • 1
  • 23
  • 44