RSE
Release 1.0

org.eclipse.rse.logging.performance
Class PerformanceLogger

java.lang.Object
  extended byorg.eclipse.rse.logging.performance.PerformanceLogger

public class PerformanceLogger
extends Object

A performance measurement class for benchmarking. This performance framework provides stopwatch functions for calculating elapsed time for an operation.

This class should be used only at development time since it prints to System.out and contains non-translated strings.

It is highly likely that this class will be deprecated in 2.0. Use TPTPs tools for performance monitoring and logging.

 Usage example
	Method_A { 
		String key = PerformanceLogger.register("RSE","WDSC","5120");
		PerformanceLogger.start(key, "OP1"); //CallerID is OP1
		Method_B();
		PerformanceLogger.stop(key);
	}
 
	Method_B {
		PerformanceLogger.start("RSE"); //"RSE" component, CalleID="class.method"
		// Do something
		PerformanceLogger.stop("RSE");
	}
 
	Method_C {
		PerformanceLogger.start(); //Use the default component for recording
		// Do something
		PerformanceLogger.stop();
	}


Field Summary
static int OPTION_GET_ALL
           
static int OPTION_GET_FEATURE
           
static int OPTION_GET_VERSION
           
 
Constructor Summary
PerformanceLogger()
           
 
Method Summary
static void deRegister()
          De-register the default component.
static void deRegister(String key)
          De-register a component.
static void enablePerformanceLogging(boolean enable)
          Enable performance logging The flag ENABLE_PERFORMANCE_LOGGING is enabled(true or false)
static String getCurrentProductInfo(int req, String comp_id)
          public String geCurrentProductInfo(int req, String comp_id) : retrieve the product information.
static String getXMLFileName(String comp_id)
          public String getXMLFileName(String comp_id) : get the XML file pathname
static boolean isPerformanceLoggingEnabled()
          Check if logging enabled.
static void listSystemProfile()
          Retrieve the system information.
static void main(String[] args)
          public static void main() : This main is used for testing this PerformanceLogger functions.
static String normalize()
          Set the normalization unit for this run.
static String register(String comp_id)
          public static String register(String comp_id) : registering a component using default
static String register(String feature, String version)
          Registers component using default component id
static String register(String comp_id, String feature, String version)
          Registering a component.
static long start()
          public static long start(): start timer using default component The Task values will be recorded in the default component XML file
static long start(String comp_id)
          public static long start(String comp_id): start timer for component comp_id using default TaskID
static long start(String comp_id, String call_id)
          public long start(String comp_id, String call_id): start the timer for registered component comp_id
static long stop()
          public static long stop(): stop timer for default component The Task values will be recorded in the default component XML file
static long stop(String comp_id)
          public long stop(String comp_id): Stopping the timer for component comp_id
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

OPTION_GET_ALL

public static final int OPTION_GET_ALL
See Also:
Constant Field Values

OPTION_GET_FEATURE

public static final int OPTION_GET_FEATURE
See Also:
Constant Field Values

OPTION_GET_VERSION

public static final int OPTION_GET_VERSION
See Also:
Constant Field Values
Constructor Detail

PerformanceLogger

public PerformanceLogger()
Method Detail

enablePerformanceLogging

public static void enablePerformanceLogging(boolean enable)
Enable performance logging The flag ENABLE_PERFORMANCE_LOGGING is enabled(true or false)

Parameters:
enable - true or false

isPerformanceLoggingEnabled

public static boolean isPerformanceLoggingEnabled()
Check if logging enabled.

Returns:
boolean ENABLE_PERFORMANCE_LOGGING

register

public static String register(String comp_id)
public static String register(String comp_id) : registering a component using default

Parameters:
comp_id - Component to be registered
Returns:
component registered with no product info

register

public static String register(String feature,
                              String version)
Registers component using default component id

Parameters:
feature - Identifier for Product Feature attribute in XML
version - Identifier for Product Version attribute in XML
Returns:
default component key

register

public static String register(String comp_id,
                              String feature,
                              String version)
Registering a component. An XML file is created by concatenating comp_id, feature and version with time stamp appended

Parameters:
comp_id - Component to be registered
feature - Identifier for Product Feature attribute in XML
version - Identifier for Product Version attribute in XML
Returns:
comp_id as the registered key

deRegister

public static void deRegister()
De-register the default component. Default component "_PERFORMANCELOGGER_" removed, start() will be disabled.


deRegister

public static void deRegister(String key)
De-register a component. component identified by key removed, start(comp_id) will be disabled.

Parameters:
key - component to be removed

normalize

public static String normalize()
Set the normalization unit for this run. Based on a standard method for class instance initialization.

Returns:
a string containing the unit.

start

public static long start()
public static long start(): start timer using default component The Task values will be recorded in the default component XML file

Returns:
- started time milliseconds

start

public static long start(String comp_id)
public static long start(String comp_id): start timer for component comp_id using default TaskID

Parameters:
comp_id - : component registered previously by register(comp_id,..)
Returns:
started time in milliseconds.

start

public static long start(String comp_id,
                         String call_id)
public long start(String comp_id, String call_id): start the timer for registered component comp_id

Parameters:
comp_id - is the registered component call_id is the "CallID" attribute value for the XML tag "Task"
Returns:
- started time in milliseconds.

stop

public static long stop()
public static long stop(): stop timer for default component The Task values will be recorded in the default component XML file

Returns:
- started time milliseconds

stop

public static long stop(String comp_id)
public long stop(String comp_id): Stopping the timer for component comp_id

Returns:
- stopped time in milliseconds.

getCurrentProductInfo

public static String getCurrentProductInfo(int req,
                                           String comp_id)
public String geCurrentProductInfo(int req, String comp_id) : retrieve the product information.

Parameters:
req - : OPTION_GET_FEATURE/OPTION_GET_VERSION comp_id : the component id
Returns:
"OPTION_GET_FEATURE":product feature as specified in register() "OPTION_GET_VERSION": product version as specified in register() no match: null

getXMLFileName

public static String getXMLFileName(String comp_id)
public String getXMLFileName(String comp_id) : get the XML file pathname

Returns:
The XML file fullpath name.

listSystemProfile

public static void listSystemProfile()
Retrieve the system information. These values will be retrieved and printed in stdout:


main

public static void main(String[] args)
public static void main() : This main is used for testing this PerformanceLogger functions. The objective is to check the XML output format for nested start() calls.


RSE
Release 1.0

Copyright (c) IBM Corporation and others 2000, 2006. All Rights Reserved.