How to get a List of all Stopwatch registerd

49 views
Skip to first unread message

timerons

unread,
Aug 24, 2012, 6:25:39 AM8/24/12
to java...@googlegroups.com
hi,
i like to use the annotations @Monitored on some methods. i do not want to give each annotation a name. at the end of the programm i like to print out all registerd Stopwatch.

i do not see a way to do that.

thanks for your help.

cheers timerons

timerons

unread,
Aug 24, 2012, 6:50:26 AM8/24/12
to java...@googlegroups.com

found a solution, but not so nice:

Collection<String> simonNames = SimonManager.getSimonNames();
for (String string : simonNames) {
if (string.length() > 0) {
Stopwatch stopwatch = SimonManager.getStopwatch(string);
if (stopwatch.getCounter() != 0L) {
this.logger.info("JavaSimon Result: {}", stopwatch);
}
}
}

Richard Richter

unread,
Aug 24, 2012, 7:08:28 AM8/24/12
to java...@googlegroups.com
Hi timerons

For quick and dirty output I often use just SimonUtils.simonTreeString(SimonManager.getRootSimon()) to get the raw tree like string.

Any other filtering is probably along your lines. Just be sure that your Simon is really stopwatch (not just "unknown" node).

Virgo

        }
      }
    }

--
You received this message because you are subscribed to the Google Groups "javasimon" group.
To view this discussion on the web visit https://groups.google.com/d/msg/javasimon/-/wdm2l5vjkeIJ.
To post to this group, send email to java...@googlegroups.com.
To unsubscribe from this group, send email to javasimon+...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/javasimon?hl=en.


Reply all
Reply to author
Forward
0 new messages