MeasureInc Function

Action

Increments the value of a custom counter. When this function is called for a specified custom counter for the first time, the counter is automatically allocated and initialized. You do not need to call any other measure functions when using a Silk Performer measure for counting purposes.

Include file

Kernel.bdh

Syntax

MeasureInc( in sMeasure : string,
            in nInc     : number optional,
            in nType    : number optional): number;

Return value

The value of the custom counter after the increment operation.

Parameter Description
sMeasure Measure name identifying the custom counter to increment
nInc

Increment value (optional). If this parameter is omitted, the custom counter is incremented by 1.

This parameter must not be negative or zero.

nType

Specifies the type of the custom counter. By default, this function adds up all values that are passed on successive calls.

Pass the MEASURE_KIND_AVERAGE flag to the function to calculate the average value instead of the sum. In this case, treat the custom counter as an average counter when you retrieve its value with the MeasureGet function.

Example

dcluser
  user
    TestUser
  transactions
    TInit : begin;
    TMain : 10;
    TShutdown : end; 

dcltrans
  transaction TInit
  begin
    // start custom time measurement
    MeasureStart("TimeMeasure");
  end TInit; 

  transaction TMain
  begin
    // increment custom counter
    MeasureInc("TranCounter");
    wait 0.3;
  end TMain; 

  transaction TShutdown
  var
    fValue: float;
  begin
    // stop custom time measurement
    MeasureStop("TimeMeasure");
    MeasureGet("TimeMeasure", MEASURE_TIMER_RESPONSETIME, MEASURE_KIND_SUM, fValue);
    write("Transaction execution took "); write(fValue);
    write(" seconds"); writeln;
    MeasureGet("TINIT", MEASURE_TRANS_TRANSOK, MEASURE_KIND_COUNT, fValue);
    write("TInit transaction was executed "); write(fValue);
    write(" times"); writeln;
    MeasureGet("TranCounter", MEASURE_COUNTER_CUSTOMCOUNTER, MEASURE_KIND_SUM, fValue);
    write("TMain transaction was executed "); write(fValue);
    write(" times"); writeln;
  end TShutdown;

Sample scripts

Measure02.bdf