PerfMonGet Function

Action

Retrieves the value of a Windows NT Performance Monitor counter and writes the value to both report and time series data files.

Include file

Kernel.bdh

Syntax

PerfMonGet( in  hPerf     :number,
            in  nScale    : number optional,
            out sName     : string optional,
            in  sNameSize : number optional ): float;

Return value

The current value of the specified Performance Monitor counter.

Parameter Description
hPerf Handle to a Performance Monitor counter that was created with PerfMonAdd.
nScale Scale for the counter (optional). For example, set this parameter to 1024 to retrieve the amount of data in KB instead of in bytes.
sName String receiving the name of the custom counter that is used for writing the counter to report and time series data files (optional). The name is required to retrieve the counter value with the MeasureGet function as well.
nNameSize Size of the string that receives the name of the custom counter (optional).

Example

var  hCounter: array [3] of number; 

dcltrans
  transaction TInit
  begin
    PerfMonAdd(hCounter[1], "localhost", "System",
               "% Total Processor Time");
    PerfMonAdd(hCounter[2], "localhost", "Processor",
               "% Processor Time", "0");
    PerfMonAdd(hCounter[3], "localhost", "Memory",
               "Committed Bytes");
  end TInit; 

  transaction TMain
  var
    i: number;
  begin
    ThinkTime(1.0);
    for i := 1 to 3 do PerfMonGet(hCounter[i]) end;
  end TMain;