SourceForge.net Logo
Home

Per-Thread Time (PTT)


The Per-Thread Time (PTT) facility provides per-thread event (a.k.a. metric) accounting. "metrics" are user-selectable and are typically hardware performance counters set to count the event of interest. Originally PTT only accounted for time, thus the name. References to "time" apply to whatever metric is being counted. For example, if counting instructions completed then "on-thread time" means "on-thread instructions completed".

ptt is the PI command which provides command-line control of the PTT facility.

Accounting takes place in kernel which allows for low accounting overhead, most of which is subtracted out. PTT hooks the OS dispatcher and all device interrupt vectors. Exceptions interrupts (such as Page Faults) are not hooked - their overhead is considered as a normal part of running the application. Interrupt overhead is also subtracted out of the on-thread measurement.

PTT accounts for "time" in three (3) buckets:

PTT is a global facility - there is only one, system-wide. As such, processes that use the facility must coordinate use. If the facility is already initialized and another process re-initializes it, one of 2 things can happen:




PttInit




PttTerminate




PttGetCurrentThreadDataEx




PttGetThreadData    [Windows]




PttGetProcessData




PttGetCurrentProcessData




PttSetGetDataExMode




PttReturnGetCurrentThreadDataFunctionPtr




PttGetStatistics




PttGetSummaryStatistics




PttGetState




PttQueryState




PttGetMaxNumberOfMetrics




PttAllocData




PttFreeData




PttZeroData




PttAllocStats




PttFreeStats




PttZeroStats




PTT_THREAD_DATA_EX Structure




PTT_PROCESS_DATA Structure




PTT_DATA Structure




PTT_FACILITY_DATA Structure




PTT_CPU_DATA Structure




PTT_STATS Structure




PTT_SUMMARY_STATS Structure