bcds.phison.sim
Class SxSeriesToGnuPlot

java.lang.Object
  extended by bcds.phison.sim.StatsExporterBase
      extended by bcds.phison.sim.SxSeriesToGnuPlot
All Implemented Interfaces:
StatsExporter, WithEnvParams

public class SxSeriesToGnuPlot
extends StatsExporterBase

The SxSeriesToGnuPlot generates a GNU Plot script for each group of statistical collectors whose members are instances of Series. Besides the .gnuplot file, one data file per series is also generated. Those files are referenced by the plot command embedded in the .gnuplot file.

Although the is a number of environment parameters that controls some aspects of the script generation, it is assumed that the user will further personalize the script (remove titles, added grid lines, define explicit ranges, etc).

By default, the plot type is lines, the output terminal is PDF (in enhanced, color mode). The data files are compressed by default (in the GZIP format). Each row contains the following data: key average stddev count min max where key is the x-value. The above text is printed as a comment on the first line of each series data file. The separator between columns is a single space character, and the US locale is used always. This is a deliberate decision so that fractional values always use a dot as a decimal separator.

Files are generated in a user-specified directory, which by default is the current directory. Files are always overwritten, so any previous content is lost.

See getEnvParams() for further details on environment parameters.

Author:
Juan Segovia S.

Constructor Summary
SxSeriesToGnuPlot()
           
 
Method Summary
 java.lang.Object[] getEnvParams()
          Returns the environment parameters used by this class.
 void run()
          Iterates over the statistical collectors and generates the GnuPlot script files and data files.
 void setup(SimStatsCollector stats, Environ env)
          Initializes this exporter.
 
Methods inherited from class bcds.phison.sim.StatsExporterBase
getEnviron, getName, sanitizeFilename, stats
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SxSeriesToGnuPlot

public SxSeriesToGnuPlot()
Method Detail

setup

public void setup(SimStatsCollector stats,
                  Environ env)
Initializes this exporter. Environment parameters are checked and cached. The following actions are performed:

Specified by:
setup in interface StatsExporter
Overrides:
setup in class StatsExporterBase
Throws:
java.lang.IllegalArgumentException - if:
  • the group name selector does not compile.
  • the replacement character is empty.
  • if the path given as output directory exists and is not a directory, or if it does not exist but cannot be created.

run

public void run()
Iterates over the statistical collectors and generates the GnuPlot script files and data files. Collectors whose group name does not match the pattern given in the respective environment parameter are skipped as well as those that do not contain instances of Series.

The actual generation of files are performed by calling generateFiles(java.lang.String, java.util.Set).


getEnvParams

public java.lang.Object[] getEnvParams()
Returns the environment parameters used by this class. The parameters are prefixed with "SxSeriesToGnuPlot.": Additionally, it accepts GraphMetric.target as a hint. See GraphMetric.run().

Specified by:
getEnvParams in interface WithEnvParams
Overrides:
getEnvParams in class StatsExporterBase