|
PerfExplorer 2.0 | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
ObjectAbstractPerformanceOperation
DrawGraph
public class DrawGraph
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 $
| 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 |
|---|
public static final int BILLIONS
setUnits(int),
Constant Field Valuespublic static final int EVENTNAME
setSeriesType(int),
setCategoryType(int),
Constant Field Valuespublic static final int LINECHART
#setChartType,
Constant Field Valuespublic static final int METADATA
setMetadataField(java.lang.String) should
be called to specify which metadata field to use.
setSeriesType(int),
setCategoryType(int),
setMetadataField(java.lang.String),
Constant Field Valuespublic static final int METRICNAME
setSeriesType(int),
setCategoryType(int),
Constant Field Valuespublic static final int MICROSECONDS
setUnits(int),
Constant Field Valuespublic static final int MILLIONS
setUnits(int),
Constant Field Valuespublic static final int MILLISECONDS
setUnits(int),
Constant Field Valuespublic static final int MINUTES
setUnits(int),
Constant Field Valuespublic static final int PROCESSORCOUNT
setSeriesType(int),
setCategoryType(int),
Constant Field Valuespublic static final int SECONDS
setUnits(int),
Constant Field Valuespublic static final int STACKEDAREACHART
#setChartType,
Constant Field Valuespublic static final int STACKEDBARCHART
#setChartType,
Constant Field Valuespublic static final int THOUSANDS
setUnits(int),
Constant Field Valuespublic static final int THREADNAME
setSeriesType(int),
setCategoryType(int),
Constant Field Valuespublic static final int TRIALNAME
setSeriesType(int),
setCategoryType(int),
Constant Field Valuespublic static final int USEREVENTNAME
setSeriesType(int),
setCategoryType(int),
Constant Field Values| Constructor Detail |
|---|
public DrawGraph(List<PerformanceResult> inputs)
inputs - public DrawGraph(PerformanceResult input)
input - public DrawGraph(Trial trial)
trial - | Method Detail |
|---|
public void drawChartToFile(String fileName)
fileName - The filename for the graph output.public List<PerformanceResult> processData()
PerformanceAnalysisOperation
PerformanceResult,
Listpublic void setCategoryType(int categoryType)
categoryType - The category typeTRIALNAME,
EVENTNAME,
METRICNAME,
THREADNAME,
USEREVENTNAME,
PROCESSORCOUNT,
METADATApublic void setEvents(Set<String> events)
events - The Set of events used for the graph.public void setLogYAxis(boolean logYAxis)
logYAxis - Whether or not the Y Axis is a Log scalepublic void setMetadataField(String metadataField)
METADATA.
metadataField - The metadata field to use for either the series name or
the category name.setSeriesType(int),
setCategoryType(int),
METADATApublic void setMetrics(Set<String> metrics)
metrics - The Set of metrics used for the graph.public void setSeriesType(int seriesType)
seriesType - The series typeTRIALNAME,
EVENTNAME,
METRICNAME,
THREADNAME,
USEREVENTNAME,
PROCESSORCOUNT,
METADATApublic void setShortenNames(boolean shortenNames)
shortenNames - Whether to remove parameters and line numbers from function namespublic void setShowZero(boolean showZero)
showZero - Whether or not to have the Y axis go all the way from 0.public void setThreads(Set<Integer> threads)
threads - The Set of threads used for the graph.public void setTitle(String title)
title - The title of the graphpublic void setType(int type)
type - The type of the graphpublic void setUnits(int units)
units - The units to use for the graph.MICROSECONDS,
MILLISECONDS,
SECONDS,
MINUTES,
THOUSANDS,
MILLIONS,
BILLIONSpublic void setUserEvents(boolean userEvents)
userEvents - Whether or not to use user events from the trials.public void setValueType(int valueType)
valueType - The value typeAbstractResult.CALLS,
AbstractResult.EXCLUSIVE,
AbstractResult.INCLUSIVE,
AbstractResult.SUBROUTINES,
AbstractResult.USEREVENT_MAX,
AbstractResult.USEREVENT_MEAN,
AbstractResult.USEREVENT_MIN,
AbstractResult.USEREVENT_NUMEVENTS,
AbstractResult.USEREVENT_SUMSQRpublic void setXAxisLabel(String xAxisLabel)
xAxisLabel - The label used for the X Axispublic void setYAxisLabel(String yAxisLabel)
yAxisLabel - The label used for the Y Axis
|
PerfExplorer 2.0 | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||