Home
PerfUtil Java API: PerThreadTime class
PerThreadTime
//
// Constructs PerThreadTime object
//
// - Initializes public data members
//
public PerThreadTime();
PerThreadTime Public Data Members
//
// These are set by a call to GetCurrentThreadData() method
//
int disp_cnt; // Number of dispatches
int intr_cnt; // Number of interrupts
long[] mv; // Metric values (PTT_MAX_METRICS of them)
Init
//
// Initialize Per-Thread Time facility.
//
// Input:
// - metric_cnt: Number of elements in metrics array
// - metric_ids: Event ids of metrics to enable
// - metric_names: Event names of metrics to enable
// - priv_level: Privilege level for PTT-supplied events.
//
// Returns:
// - 0: Success
// - non-zero: Error initializing PTT facility
//
// Notes:
// - Init() does nothing if issued multiple times with same metrics.
// - Init() applies system-wide. It only needs to be done once, regardless
// of the number of instances of the PerThreadTime class.
//
native int Init(int metric_cnt, int[] metric_ids, int priv_level);
native int Init(int metric_cnt, String[] metric_names, int priv_level);
Terminate
//
// Terminate Per-Thread Time facility.
//
// Returns:
// - 0: success
// - non-zero: error terminating PTT facility
//
// Notes:
// - Terminate() is system-wide. The PTT facility is terminated on the
// first invocation of this method from any instance of the PerThreadTime
// class.
//
native int Terminate();
GetCurrentThreadData
//
// Read metric values for current thread.
//
// Returns:
// - 0: success
// - non-zero: error getting thread data
//
// Sets:
// - mv[0:JPerf.PTT_MAX_METRICS-1]
// - disp_cnt
// - intr_cnt
//
// Notes:
// - Values are undefined if return code is non-zero
//
int GetCurrentThreadData();
IsSupported
//
// Returns whether (true) or not (false) the PTT facility is supported.
//
// Returns:
// - true: PTT facility is supported
// - false: Ptt facility is not supported
//
native boolean IsSupported();
IsActive
//
// Returns whether (true) or not (false) the PTT facility is active
// (in use) by this or any other process.
//
// Returns:
// - true: PTT facility has been initialized and is active
// - false: Ptt facility is not active
//
native boolean IsActive();
IsActiveForCurrentProcess
//
// Returns whether (true) or not (false) the PTT facility is active
// (in use) by this process.
//
// Returns:
// - true: PTT facility has been initialized and is active
// - false: Ptt facility is not active
//
native boolean IsActiveForCurrentProcess();
GetNumberOfMetrics
//
// Returns the number of metrics currently being measured.
//
// Returns:
// - Non-zero: Number of metrics in use
// - Zero: PTT facility is not active or error
//
native int GetNumberOfMetrics();