SourceForge.net Logo
Home

CPI Measurement


The CPI measurement facility allows for easily measuring CPI for user workloads, either the entire workload or portions of a workload. There are three (3) types of CPI:

Raw CPI

Scaled CPI

On-Thread CPI

The CPI measurement facility must be initialized, via CpiInit(), prior to being used. The first CpiInit() system-wide initializes the necessary hardware and PI tools support:

The last invocation of CpiTerminate() system-wide tears down the initialization performed by CpiInit().

CPI is measured for a CPI instance. A CPI instance is the interval of time between the last CpiStart() and the current CpiGet(). Each CpiInit() signifies a new instance. There can be any number of concurrent instances. Measurements are associated with a particular instance as given by the instance handle. Thus it is conceivable to measure CPI for several portions of an application. For example:

      void * interval1, * interval2, * interval3;
      CPI_DATA data1, data2, data3;
      ...
      CpiInit(flags, &interval1);
      CpiInit(flags, &interval2);
      CpiInit(flags, &interval3);

      ...

      CpiStart(interval1);                            <---------+
        // Application code                                     1
               ...                                              1
        CpiStart(interval2);                          <------+  1
           // More application code                          2  1
                  ...                                        2  1
           CpiStart(interval3);                       <---+  2  1
              // Even more application code               3  2  1
                     ...                                  3  2  1
           CpiGet(interval3, &data3);                 <---+  2  1
           // More application code                          2  1
                  ...                                        2  1
        CpiGet(interval2, &data2);                    <------+  1
        // Application code                                     1
               ...                                              1
      CpiGet(interval1, &data1);                      <---------+

      ...

      CpiTerminate(interval1);
      CpiTerminate(interval2);
      CpiTerminate(interval3);

      ...

In the sample code above:

Instance results are returned in a CPI_DATA structure.

Trace Hook Formats




CpiInit




CpiTerminate




CpiStart




CpiGet




CpiGetAndTrace




CpiSetTraceHookId




CPI_DATA Structure




CPI measurement example