public class PS_MetricDefinition
extends java.lang.Object
Constructor and Description |
---|
PS_MetricDefinition(java.lang.String filename,
boolean needsResourceGeneration)
Constructs a
PS_MetricDefinition object,
given the name of a metric definition file,
and a flag indicating whether resource files for
localized description strings need to be generated. |
Modifier and Type | Method and Description |
---|---|
java.util.Map<java.lang.String,java.util.List<java.lang.String>> |
getDefinitionMap()
Returns a map of metric definition.
|
java.lang.String |
getResourceFileBaseName()
Returns the base name of the resource files associated with
this metric definition file.
|
java.lang.String |
toString()
Returns a string representation of the metric definitions,
including the expression definition and descriptions of various
languages for each metric defined in the metric definition file.
|
public PS_MetricDefinition(java.lang.String filename, boolean needsResourceGeneration) throws java.io.FileNotFoundException
PS_MetricDefinition
object,
given the name of a metric definition file,
and a flag indicating whether resource files for
localized description strings need to be generated.
If the flag is true, resource files will be generated
in the current working directory.
For example, if the given metric definition file name is
"/foo/bar/xyz.xml", and it contains description strings of
the languages "en_US", "en_UK",
"es" and "it",
then the base name, as return value of the
getResourceFileBaseName
method, will be "xyz",
and the generated resource files will be named
"xyz_en_US.properties", "xyz_en_UK.properties",
"xyz_es.properties", "xyz_it.properties",
and "xyz.properties". The last one,
"xyz.properties", is the default file to be used if
the current locale does not match any of the above 4 locales.
Two (2) standard metric definition files are included in the PerfSuite distribution: "PAPI_metrics.xml" and "perfmon_metrics.xml". Their corresponding resource files containing localized description strings are included as well, and will be installed when "make install" is performed.
filename
- the name of a metric definition fileneedsResourceGeneration
- a flag indicating whether resource files for
localized description strings need to be generated.
Its value should be false
if one of the standard metric definition files is used;
and true
if a non-standard metric definition file
is used.java.io.FileNotFoundException
- if the file filename
does not exist,
is a directory rather than a regular file,
or for some other reason cannot be opened for reading.java.lang.IllegalArgumentException
- if filename
is null
.public java.util.Map<java.lang.String,java.util.List<java.lang.String>> getDefinitionMap()
For each entry in the map, the key is the name of the metric, and the value is a list of expression tokens as defined in the metric definition file. Currently the expression is in postfix notation order, also known as reverse Polish notation. But there is no commitment to maintain this order forever.
An example map entry is:
key: "PS_RATIO_GFPINS_CYC",
value: a list containing 3 strings in the following order:
"PAPI_FP_INS", "PAPI_TOT_CYC", and "/".
public java.lang.String toString()
toString
in class java.lang.Object
public java.lang.String getResourceFileBaseName()