PerfExplorer 2.0

edu.uoregon.tau.perfexplorer.glue
Class DrawGraph

Object
  extended by AbstractPerformanceOperation
      extended by DrawGraph
All Implemented Interfaces:
PerformanceAnalysisOperation, Serializable
Direct Known Subclasses:
DrawBoxChartGraph, DrawMMMGraph

public class DrawGraph
extends AbstractPerformanceOperation

The DrawGraph class is a PerfExplorer Operation class for drawing a line graph from an analysis script. The creation of the graph is fairly straightforward. One or more input PerformanceResult objects are used as the input for the constructor. After the constructor, various options for the graph are set. The fields which are commonly set are the series type (setSeriesType(int)), the category type (setCategoryType(int)), and the value type (setValueType(int)). Once the options are set, the processData() method is called to generate the graph.

This class has undefined behavior when running PerfExplorer without the GUI.

Example code from Python script:


from edu.uoregon.tau.perfexplorer.glue import *
from edu.uoregon.tau.perfdmf import *
from java.util import *
from java.lang import *

True = 1
False = 0

def loadFile(fileName):
    # load the trial
    files = []
    files.append(fileName)
    input = DataSourceResult(DataSourceResult.PPK, files, False)
    return input

def loadFromFiles():
    inputs = ArrayList()
    inputs.add(loadFile("2.ppk"))
    inputs.add(loadFile("4.ppk"))
    inputs.add(loadFile("6.ppk"))
    inputs.add(loadFile("8.ppk"))
    return inputs

def drawGraph(results):
    metric = "Time"
    grapher = DrawGraph(results)
    metrics = HashSet()
    metrics.add(metric)
    grapher.setMetrics(metrics)
    grapher.setLogYAxis(False)
    grapher.setShowZero(True)
    grapher.setTitle("Graph of Multiple Trials: " + metric)
    grapher.setSeriesType(DrawGraph.EVENTNAME)
    grapher.setUnits(DrawGraph.SECONDS)
    grapher.setCategoryType(DrawGraph.PROCESSORCOUNT)
    grapher.setXAxisLabel("Processor Count")
    grapher.setValueType(AbstractResult.EXCLUSIVE)
    grapher.setYAxisLabel("Exclusive " + metric + " (seconds)")
    grapher.processData()

def main():
    print "--------------- JPython test script start ------------"
    inputs = loadFromFiles()

    # extract the event of interest
    events = ArrayList()
    events.add("MPI_Send()")
    extractor = ExtractEventOperation(inputs, events)
    extracted = extractor.processData()

    drawGraph(extracted)
    print "---------------- JPython test script end -------------"

if __name__ == "__main__":
    main()

 

CVS $Id: DrawGraph.java,v 1.14 2009/04/09 00:23:51 khuck Exp $

Since:
0.2
Version:
0.2
Author:
khuck
See Also:
Serialized Form

Field Summary
static int BILLIONS
          Constant for specifying the Y axis units for the graph should be thousands (10xe9 units).
static int EVENTNAME
          Constant for specifying that the Event Name should be used for the series name or the category axis.
static int LINECHART
          Constant for specifying the chart type should be a line chart.
static int METADATA
          Constant for specifying that a Metadata field should be used for the series name or the category axis.
static int METRICNAME
          Constant for specifying that the Metric Name should be used for the series name or the category axis.
static int MICROSECONDS
          Constant for specifying the Y axis units for the graph should be microseconds (10xe-6 seconds).
static int MILLIONS
          Constant for specifying the Y axis units for the graph should be millions (10xe6 units).
static int MILLISECONDS
          Constant for specifying the Y axis units for the graph should be milliseconds (10xe-3 seconds).
static int MINUTES
          Constant for specifying the Y axis units for the graph should be minutes.
static int PROCESSORCOUNT
          Constant for specifying that the Processor Count should be used for the series name or the category axis.
static int SECONDS
          Constant for specifying the Y axis units for the graph should be seconds.
static int STACKEDAREACHART
          Constant for specifying the chart type should be a stacked area chart.
static int STACKEDBARCHART
          Constant for specifying the chart type should be a stacked bar chart.
static int THOUSANDS
          Constant for specifying the Y axis units for the graph should be thousands (10xe3 units).
static int THREADNAME
          Constant for specifying that the Thread Name should be used for the series name or the category axis.
static int TRIALNAME
          Constant for specifying that the Trial Name should be used for the series name or the category axis.
static int USEREVENTNAME
          Constant for specifying that the UserEvent Name should be used for the series name or the category axis.
 
Constructor Summary
DrawGraph(List<PerformanceResult> inputs)
          Creates a graph drawing operator.
DrawGraph(PerformanceResult input)
          Creates a graph drawing operator.
DrawGraph(Trial trial)
          Creates a graph drawing operator.
 
Method Summary
 void drawChartToFile(String fileName)
          Draws the graph to the file name specified.
 List<PerformanceResult> processData()
          Performs the analysis operation.
 void setCategoryType(int categoryType)
          Set the category type for the graph.
 void setEvents(Set<String> events)
          Set the events used for the graph.
 void setLogYAxis(boolean logYAxis)
          Set whether or not the Y axis is a log scale.
 void setMetadataField(String metadataField)
          The metadata field to use for either the series name or the category name.
 void setMetrics(Set<String> metrics)
          Set the metrics used for the graph.
 void setSeriesType(int seriesType)
          Set the series type for the graph.
 void setShortenNames(boolean shortenNames)
          Sets whether to remove parameters and line numbers from function names.
 void setShowZero(boolean showZero)
          Set whether or not to have the Y axis go all the way from 0 as a minimum value.
 void setThreads(Set<Integer> threads)
          Set the threads used for the graph.
 void setTitle(String title)
          Set the title for the graph.
 void setType(int type)
          Set the type for the graph.
 void setUnits(int units)
          Set the units to use for the graph.
 void setUserEvents(boolean userEvents)
          Set whether or not to use user events from the trials.
 void setValueType(int valueType)
          Set the value type for the graph.
 void setXAxisLabel(String xAxisLabel)
          Set the label used for the X Axis.
 void setYAxisLabel(String yAxisLabel)
          Set the label used for the Y Axis.
 
Methods inherited from class AbstractPerformanceOperation
addInput, addInput, getId, getInputs, getOutputAtIndex, getOutputs, reset, setId, setInput, setInput, setInputs, setInputsTrials, setOutputs, toString
 
Methods inherited from class Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

BILLIONS

public static final int BILLIONS
Constant for specifying the Y axis units for the graph should be thousands (10xe9 units).

See Also:
setUnits(int), Constant Field Values

EVENTNAME

public static final int EVENTNAME
Constant for specifying that the Event Name should be used for the series name or the category axis.

See Also:
setSeriesType(int), setCategoryType(int), Constant Field Values

LINECHART

public static final int LINECHART
Constant for specifying the chart type should be a line chart.

See Also:
#setChartType, Constant Field Values

METADATA

public static final int METADATA
Constant for specifying that a Metadata field should be used for the series name or the category axis. setMetadataField(java.lang.String) should be called to specify which metadata field to use.

See Also:
setSeriesType(int), setCategoryType(int), setMetadataField(java.lang.String), Constant Field Values

METRICNAME

public static final int METRICNAME
Constant for specifying that the Metric Name should be used for the series name or the category axis.

See Also:
setSeriesType(int), setCategoryType(int), Constant Field Values

MICROSECONDS

public static final int MICROSECONDS
Constant for specifying the Y axis units for the graph should be microseconds (10xe-6 seconds). This is the default.

See Also:
setUnits(int), Constant Field Values

MILLIONS

public static final int MILLIONS
Constant for specifying the Y axis units for the graph should be millions (10xe6 units).

See Also:
setUnits(int), Constant Field Values

MILLISECONDS

public static final int MILLISECONDS
Constant for specifying the Y axis units for the graph should be milliseconds (10xe-3 seconds).

See Also:
setUnits(int), Constant Field Values

MINUTES

public static final int MINUTES
Constant for specifying the Y axis units for the graph should be minutes.

See Also:
setUnits(int), Constant Field Values

PROCESSORCOUNT

public static final int PROCESSORCOUNT
Constant for specifying that the Processor Count should be used for the series name or the category axis.

See Also:
setSeriesType(int), setCategoryType(int), Constant Field Values

SECONDS

public static final int SECONDS
Constant for specifying the Y axis units for the graph should be seconds.

See Also:
setUnits(int), Constant Field Values

STACKEDAREACHART

public static final int STACKEDAREACHART
Constant for specifying the chart type should be a stacked area chart.

See Also:
#setChartType, Constant Field Values

STACKEDBARCHART

public static final int STACKEDBARCHART
Constant for specifying the chart type should be a stacked bar chart.

See Also:
#setChartType, Constant Field Values

THOUSANDS

public static final int THOUSANDS
Constant for specifying the Y axis units for the graph should be thousands (10xe3 units).

See Also:
setUnits(int), Constant Field Values

THREADNAME

public static final int THREADNAME
Constant for specifying that the Thread Name should be used for the series name or the category axis.

See Also:
setSeriesType(int), setCategoryType(int), Constant Field Values

TRIALNAME

public static final int TRIALNAME
Constant for specifying that the Trial Name should be used for the series name or the category axis.

See Also:
setSeriesType(int), setCategoryType(int), Constant Field Values

USEREVENTNAME

public static final int USEREVENTNAME
Constant for specifying that the UserEvent Name should be used for the series name or the category axis.

See Also:
setSeriesType(int), setCategoryType(int), Constant Field Values
Constructor Detail

DrawGraph

public DrawGraph(List<PerformanceResult> inputs)
Creates a graph drawing operator.

Parameters:
inputs -

DrawGraph

public DrawGraph(PerformanceResult input)
Creates a graph drawing operator.

Parameters:
input -

DrawGraph

public DrawGraph(Trial trial)
Creates a graph drawing operator.

Parameters:
trial -
Method Detail

drawChartToFile

public void drawChartToFile(String fileName)
Draws the graph to the file name specified.

Parameters:
fileName - The filename for the graph output.

processData

public List<PerformanceResult> processData()
Description copied from interface: PerformanceAnalysisOperation
Performs the analysis operation.

Returns:
a List of PerformanceResult outputs
See Also:
PerformanceResult, List

setCategoryType

public void setCategoryType(int categoryType)
Set the category type for the graph.

Parameters:
categoryType - The category type
See Also:
TRIALNAME, EVENTNAME, METRICNAME, THREADNAME, USEREVENTNAME, PROCESSORCOUNT, METADATA

setEvents

public void setEvents(Set<String> events)
Set the events used for the graph.

Parameters:
events - The Set of events used for the graph.

setLogYAxis

public void setLogYAxis(boolean logYAxis)
Set whether or not the Y axis is a log scale.

Parameters:
logYAxis - Whether or not the Y Axis is a Log scale

setMetadataField

public void setMetadataField(String metadataField)
The metadata field to use for either the series name or the category name. This method only has meaning if the series type or category type have been set to METADATA.

Parameters:
metadataField - The metadata field to use for either the series name or the category name.
See Also:
setSeriesType(int), setCategoryType(int), METADATA

setMetrics

public void setMetrics(Set<String> metrics)
Set the metrics used for the graph.

Parameters:
metrics - The Set of metrics used for the graph.

setSeriesType

public void setSeriesType(int seriesType)
Set the series type for the graph.

Parameters:
seriesType - The series type
See Also:
TRIALNAME, EVENTNAME, METRICNAME, THREADNAME, USEREVENTNAME, PROCESSORCOUNT, METADATA

setShortenNames

public void setShortenNames(boolean shortenNames)
Sets whether to remove parameters and line numbers from function names.

Parameters:
shortenNames - Whether to remove parameters and line numbers from function names

setShowZero

public void setShowZero(boolean showZero)
Set whether or not to have the Y axis go all the way from 0 as a minimum value.

Parameters:
showZero - Whether or not to have the Y axis go all the way from 0.

setThreads

public void setThreads(Set<Integer> threads)
Set the threads used for the graph.

Parameters:
threads - The Set of threads used for the graph.

setTitle

public void setTitle(String title)
Set the title for the graph.

Parameters:
title - The title of the graph

setType

public void setType(int type)
Set the type for the graph.

Parameters:
type - The type of the graph

setUnits

public void setUnits(int units)
Set the units to use for the graph.

Parameters:
units - The units to use for the graph.
See Also:
MICROSECONDS, MILLISECONDS, SECONDS, MINUTES, THOUSANDS, MILLIONS, BILLIONS

setUserEvents

public void setUserEvents(boolean userEvents)
Set whether or not to use user events from the trials. If false, interval events are used.

Parameters:
userEvents - Whether or not to use user events from the trials.

setValueType

public void setValueType(int valueType)
Set the value type for the graph.

Parameters:
valueType - The value type
See Also:
AbstractResult.CALLS, AbstractResult.EXCLUSIVE, AbstractResult.INCLUSIVE, AbstractResult.SUBROUTINES, AbstractResult.USEREVENT_MAX, AbstractResult.USEREVENT_MEAN, AbstractResult.USEREVENT_MIN, AbstractResult.USEREVENT_NUMEVENTS, AbstractResult.USEREVENT_SUMSQR

setXAxisLabel

public void setXAxisLabel(String xAxisLabel)
Set the label used for the X Axis.

Parameters:
xAxisLabel - The label used for the X Axis

setYAxisLabel

public void setYAxisLabel(String yAxisLabel)
Set the label used for the Y Axis.

Parameters:
yAxisLabel - The label used for the Y Axis

PerfExplorer 2.0

****************************************************************************
Copyright 1997-2009
Department of Computer and Information Science, University of Oregon
Advanced Computing Laboratory, Los Alamos National Laboratory
Juelich Supercomputing Centre, Research Center Juelich, Germany
http://tau.uoregon.edu
****************************************************************************
Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the name of University of Oregon (UO) and Los Alamos National Laboratory (LANL) not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. The University of Oregon and LANL makes no representations about the suitability of this software for any purpose. It is provided "as is" without express or implied warranty.

THE UNIVERSITY OF OREGON AND LANL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL THE UNIVERSITY OF OREGON OR LANL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.