Perf4J

GraphingStatisticsAppender fails to write any output for Spring AOP example in Developer Guide

Details

  • Type: Bug Bug
  • Status: Resolved Resolved
  • Priority: Major Major
  • Resolution: Fixed
  • Affects Version/s: 0.9.9
  • Fix Version/s: 0.9.12
  • Component/s: None
  • Labels:
    None
  • Environment:
  • Number of attachments :
    1

Description

I followed the example in the 'Using Spring AOP to Integrate Timing Aspects' section of the Developer's Guide. I created a log4j.xml file from the 'Writing Graphs with the GraphingStatisticsAppender' section, and set the tag names to 'nextPrime'.

When I run the example on my Quad Core Dell desktop under Fedora Core 10, the 'perfGraphs.log' file is empty.

However, when I run the exact same code on my laptop under Fedora Core 8 in a virtual machine, the 'perfGraphs.log' file contains reasonable looking graph data.

I tried various 'TimeSlice' values in log4j.xml, but the 'perfGraphs.log' file is still empty on the faster machine. I also tried different JDK versions, but still empty.

Any ideas?
Thanks!

Activity

Hide
John Moscato added a comment -

I have results from running the example test on another machine:

Red Hat EL 5, Dell Precision T3400 Quad Core, JDK 1.6.0_12 (64-bit) – No output to perfGraphs.log

Windows XP virtual machine (VMWare Player on the Red Hat box), JDK 1.6.0_12 (32-bit) – No output to perfGraphs.log

Show
John Moscato added a comment - I have results from running the example test on another machine: Red Hat EL 5, Dell Precision T3400 Quad Core, JDK 1.6.0_12 (64-bit) – No output to perfGraphs.log Windows XP virtual machine (VMWare Player on the Red Hat box), JDK 1.6.0_12 (32-bit) – No output to perfGraphs.log
Hide
Alex Devine added a comment -

This issue has a similar root cause as http://jira.codehaus.org/browse/PERFFORJ-21. Fundamentally, all of the appenders that group statistics need to hold on to data in memory, and then when they get to a certain point they flush the data. In the case of the GraphingStatisticsAppender, it has an option, DataPointsPerGraph, that specifies how many data points to hold in memory before writing the graph to any downstream appenders.

The reason you see data on slower machines is that the entire run takes more than 20 seconds (the timeslice is set to 1 second, and the default DataPointsPerGraph value is 20), and thus the data is flushed before the example completes. On faster machines you don't see any output because you never get to the 20 threshold. You can check this by setting the <DataPointsPerGraph> option in the log4j.xml file to something like 10. Of course, you're still not going to see the last "fencepost" values graphed.

I'm working on a fix that makes use of the shutdown hook to flush all the data before exiting.

Show
Alex Devine added a comment - This issue has a similar root cause as http://jira.codehaus.org/browse/PERFFORJ-21. Fundamentally, all of the appenders that group statistics need to hold on to data in memory, and then when they get to a certain point they flush the data. In the case of the GraphingStatisticsAppender, it has an option, DataPointsPerGraph, that specifies how many data points to hold in memory before writing the graph to any downstream appenders. The reason you see data on slower machines is that the entire run takes more than 20 seconds (the timeslice is set to 1 second, and the default DataPointsPerGraph value is 20), and thus the data is flushed before the example completes. On faster machines you don't see any output because you never get to the 20 threshold. You can check this by setting the <DataPointsPerGraph> option in the log4j.xml file to something like 10. Of course, you're still not going to see the last "fencepost" values graphed. I'm working on a fix that makes use of the shutdown hook to flush all the data before exiting.
Hide
Alex Devine added a comment -

The GraphingStatisticsAppender is now also flushed on shutdown.

Show
Alex Devine added a comment - The GraphingStatisticsAppender is now also flushed on shutdown.

People

Vote (0)
Watch (0)

Dates

  • Created:
    Updated:
    Resolved: