Intel(r) Performance Counter Monitor
Public Member Functions | Protected Member Functions | Protected Attributes | Friends | List of all members
BasicCounterState Class Reference

Basic core counter state. More...

#include <cpucounters.h>

Inheritance diagram for BasicCounterState:
CoreCounterState SocketCounterState SystemCounterState

Public Member Functions

BasicCounterStateoperator+= (const BasicCounterState &o)
 
int32 getThermalHeadroom () const
 Returns current thermal headroom below TjMax.
 

Protected Member Functions

void readAndAggregate (SafeMsrHandle *)
 

Protected Attributes

uint64 InstRetiredAny
 
uint64 CpuClkUnhaltedThread
 
uint64 CpuClkUnhaltedRef
 
union {
   uint64   L3Miss
 
   uint64   Event0
 
   uint64   ArchLLCMiss
 
}; 
 
union {
   uint64   L3UnsharedHit
 
   uint64   Event1
 
   uint64   ArchLLCRef
 
}; 
 
union {
   uint64   L2HitM
 
   uint64   Event2
 
}; 
 
union {
   uint64   L2Hit
 
   uint64   Event3
 
}; 
 
uint64 InvariantTSC
 
uint64 CStateResidency [PCM::MAX_C_STATE+1]
 
int32 ThermalHeadroom
 
uint64 L3Occupancy
 

Friends

class PCM
 
template<class CounterStateType >
double getExecUsage (const CounterStateType &before, const CounterStateType &after)
 Computes average number of retired instructions per time intervall. More...
 
template<class CounterStateType >
double getIPC (const CounterStateType &before, const CounterStateType &after)
 Computes average number of retired instructions per core cycle (IPC) More...
 
template<class CounterStateType >
double getAverageFrequency (const CounterStateType &before, const CounterStateType &after)
 Computes average core frequency also taking Intel Turbo Boost technology into account. More...
 
template<class CounterStateType >
double getActiveAverageFrequency (const CounterStateType &before, const CounterStateType &after)
 Computes average core frequency when not in powersaving C0-state (also taking Intel Turbo Boost technology into account) More...
 
template<class CounterStateType >
double getCyclesLostDueL3CacheMisses (const CounterStateType &before, const CounterStateType &after)
 Estimates how many core cycles were potentially lost due to L3 cache misses. More...
 
template<class CounterStateType >
double getCyclesLostDueL2CacheMisses (const CounterStateType &before, const CounterStateType &after)
 Estimates how many core cycles were potentially lost due to missing L2 cache but still hitting L3 cache. More...
 
template<class CounterStateType >
double getRelativeFrequency (const CounterStateType &before, const CounterStateType &after)
 Computes average core frequency also taking Intel Turbo Boost technology into account. More...
 
template<class CounterStateType >
double getActiveRelativeFrequency (const CounterStateType &before, const CounterStateType &after)
 Computes average core frequency when not in powersaving C0-state (also taking Intel Turbo Boost technology into account) More...
 
template<class CounterStateType >
double getL2CacheHitRatio (const CounterStateType &before, const CounterStateType &after)
 Computes L2 cache hit ratio. More...
 
template<class CounterStateType >
double getL3CacheHitRatio (const CounterStateType &before, const CounterStateType &after)
 Computes L3 cache hit ratio. More...
 
template<class CounterStateType >
uint64 getL3CacheMisses (const CounterStateType &before, const CounterStateType &after)
 Computes number of L3 cache misses. More...
 
template<class CounterStateType >
uint64 getL2CacheMisses (const CounterStateType &before, const CounterStateType &after)
 Computes number of L2 cache misses. More...
 
template<class CounterStateType >
uint64 getL2CacheHits (const CounterStateType &before, const CounterStateType &after)
 Computes number of L2 cache hits. More...
 
template<class CounterStateType >
uint64 getL3CacheOccupancy (const CounterStateType &now)
 Computes L3 Cache Occupancy. More...
 
template<class CounterStateType >
uint64 getCycles (const CounterStateType &before, const CounterStateType &after)
 Computes the number core clock cycles when signal on a specific core is running (not halted) More...
 
template<class CounterStateType >
uint64 getInstructionsRetired (const CounterStateType &before, const CounterStateType &after)
 Computes the number of retired instructions. More...
 
template<class CounterStateType >
uint64 getCycles (const CounterStateType &now)
 Computes the number executed core clock cycles. More...
 
template<class CounterStateType >
uint64 getInstructionsRetired (const CounterStateType &now)
 Computes the number of retired instructions. More...
 
template<class CounterStateType >
uint64 getL3CacheHitsNoSnoop (const CounterStateType &before, const CounterStateType &after)
 Computes number of L3 cache hits where no snooping in sibling L2 caches had to be done. More...
 
template<class CounterStateType >
uint64 getL3CacheHitsSnoop (const CounterStateType &before, const CounterStateType &after)
 Computes number of L3 cache hits where snooping in sibling L2 caches had to be done. More...
 
template<class CounterStateType >
uint64 getL3CacheHits (const CounterStateType &before, const CounterStateType &after)
 Computes total number of L3 cache hits. More...
 
template<class CounterStateType >
uint64 getNumberOfCustomEvents (int32 eventCounterNr, const CounterStateType &before, const CounterStateType &after)
 Returns the number of occured custom core events. More...
 
template<class CounterStateType >
uint64 getInvariantTSC (const CounterStateType &before, const CounterStateType &after)
 Computes number of invariant time stamp counter ticks. More...
 
template<class CounterStateType >
uint64 getRefCycles (const CounterStateType &before, const CounterStateType &after)
 Computes the number of reference clock cycles while clock signal on the core is running. More...
 
template<class CounterStateType >
double getCoreCStateResidency (int state, const CounterStateType &before, const CounterStateType &after)
 Computes residency in the core C-state. More...
 

Detailed Description

Basic core counter state.

Intended only for derivation, but not for the direct use

Friends And Related Function Documentation

template<class CounterStateType >
double getActiveAverageFrequency ( const CounterStateType &  before,
const CounterStateType &  after 
)
friend

Computes average core frequency when not in powersaving C0-state (also taking Intel Turbo Boost technology into account)

Parameters
beforeCPU counter state before the experiment
afterCPU counter state after the experiment
Returns
frequency in Hz
template<class CounterStateType >
double getActiveRelativeFrequency ( const CounterStateType &  before,
const CounterStateType &  after 
)
friend

Computes average core frequency when not in powersaving C0-state (also taking Intel Turbo Boost technology into account)

Parameters
beforeCPU counter state before the experiment
afterCPU counter state after the experiment
Returns
Fraction of nominal frequency (if >1.0 then Turbo was working during the measurement)
template<class CounterStateType >
double getAverageFrequency ( const CounterStateType &  before,
const CounterStateType &  after 
)
friend

Computes average core frequency also taking Intel Turbo Boost technology into account.

Parameters
beforeCPU counter state before the experiment
afterCPU counter state after the experiment
Returns
frequency in Hz
template<class CounterStateType >
double getCoreCStateResidency ( int  state,
const CounterStateType &  before,
const CounterStateType &  after 
)
friend

Computes residency in the core C-state.

Parameters
stateC-state
beforeCPU counter state before the experiment
afterCPU counter state after the experiment
Returns
residence ratio (0..1): 0 - 0%, 1.0 - 100%
template<class CounterStateType >
uint64 getCycles ( const CounterStateType &  before,
const CounterStateType &  after 
)
friend

Computes the number core clock cycles when signal on a specific core is running (not halted)

Returns number of used cycles (halted cyles are not counted). The counter does not advance in the following conditions:

  • an ACPI C-state is other than C0 for normal operation
  • HLT
  • STPCLK+ pin is asserted
  • being throttled by TM1
  • during the frequency switching phase of a performance state transition

The performance counter for this event counts across performance state transitions using different core clock frequencies

Parameters
beforeCPU counter state before the experiment
afterCPU counter state after the experiment
Returns
number core clock cycles
template<class CounterStateType >
uint64 getCycles ( const CounterStateType &  now)
friend

Computes the number executed core clock cycles.

Returns number of used cycles (halted cyles are not counted).

Parameters
nowCurrent CPU counter state
Returns
number core clock cycles
template<class CounterStateType >
double getCyclesLostDueL2CacheMisses ( const CounterStateType &  before,
const CounterStateType &  after 
)
friend

Estimates how many core cycles were potentially lost due to missing L2 cache but still hitting L3 cache.

Parameters
beforeCPU counter state before the experiment
afterCPU counter state after the experiment
Warning
Works only in the DEFAULT_EVENTS programming mode (see program() method)
Currently not supported on Intel(R) Atom(tm) processor
Returns
ratio that is usually beetween 0 and 1 ; in some cases could be >1.0 due to a lower access latency estimation
template<class CounterStateType >
double getCyclesLostDueL3CacheMisses ( const CounterStateType &  before,
const CounterStateType &  after 
)
friend

Estimates how many core cycles were potentially lost due to L3 cache misses.

Parameters
beforeCPU counter state before the experiment
afterCPU counter state after the experiment
Warning
Works only in the DEFAULT_EVENTS programming mode (see program() method)
Returns
ratio that is usually beetween 0 and 1 ; in some cases could be >1.0 due to a lower memory latency estimation
template<class CounterStateType >
double getExecUsage ( const CounterStateType &  before,
const CounterStateType &  after 
)
friend

Computes average number of retired instructions per time intervall.

Parameters
beforeCPU counter state before the experiment
afterCPU counter state after the experiment
Returns
usage
template<class CounterStateType >
uint64 getInstructionsRetired ( const CounterStateType &  before,
const CounterStateType &  after 
)
friend

Computes the number of retired instructions.

Parameters
beforeCPU counter state before the experiment
afterCPU counter state after the experiment
Returns
number of retired instructions
template<class CounterStateType >
uint64 getInstructionsRetired ( const CounterStateType &  now)
friend

Computes the number of retired instructions.

Parameters
nowCurrent CPU counter state
Returns
number of retired instructions
template<class CounterStateType >
uint64 getInvariantTSC ( const CounterStateType &  before,
const CounterStateType &  after 
)
friend

Computes number of invariant time stamp counter ticks.

This counter counts irrespectively of C-, P- or T-states

Parameters
beforeCPU counter state before the experiment
afterCPU counter state after the experiment
Returns
number of time stamp counter ticks
template<class CounterStateType >
double getIPC ( const CounterStateType &  before,
const CounterStateType &  after 
)
friend

Computes average number of retired instructions per core cycle (IPC)

Parameters
beforeCPU counter state before the experiment
afterCPU counter state after the experiment
Returns
IPC
template<class CounterStateType >
double getL2CacheHitRatio ( const CounterStateType &  before,
const CounterStateType &  after 
)
friend

Computes L2 cache hit ratio.

Parameters
beforeCPU counter state before the experiment
afterCPU counter state after the experiment
Warning
Works only in the DEFAULT_EVENTS programming mode (see program() method)
Returns
value between 0 and 1
template<class CounterStateType >
uint64 getL2CacheHits ( const CounterStateType &  before,
const CounterStateType &  after 
)
friend

Computes number of L2 cache hits.

Parameters
beforeCPU counter state before the experiment
afterCPU counter state after the experiment
Warning
Works only in the DEFAULT_EVENTS programming mode (see program() method)
Returns
number of hits
template<class CounterStateType >
uint64 getL2CacheMisses ( const CounterStateType &  before,
const CounterStateType &  after 
)
friend

Computes number of L2 cache misses.

Parameters
beforeCPU counter state before the experiment
afterCPU counter state after the experiment
Warning
Works only in the DEFAULT_EVENTS programming mode (see program() method)
Returns
number of misses
template<class CounterStateType >
double getL3CacheHitRatio ( const CounterStateType &  before,
const CounterStateType &  after 
)
friend

Computes L3 cache hit ratio.

Parameters
beforeCPU counter state before the experiment
afterCPU counter state after the experiment
Warning
Works only in the DEFAULT_EVENTS programming mode (see program() method)
Returns
value between 0 and 1
template<class CounterStateType >
uint64 getL3CacheHits ( const CounterStateType &  before,
const CounterStateType &  after 
)
friend

Computes total number of L3 cache hits.

Parameters
beforeCPU counter state before the experiment
afterCPU counter state after the experiment
Warning
Works only in the DEFAULT_EVENTS programming mode (see program() method)
Returns
number of hits
template<class CounterStateType >
uint64 getL3CacheHitsNoSnoop ( const CounterStateType &  before,
const CounterStateType &  after 
)
friend

Computes number of L3 cache hits where no snooping in sibling L2 caches had to be done.

Parameters
beforeCPU counter state before the experiment
afterCPU counter state after the experiment
Warning
Works only in the DEFAULT_EVENTS programming mode (see program() method)
Returns
number of hits
template<class CounterStateType >
uint64 getL3CacheHitsSnoop ( const CounterStateType &  before,
const CounterStateType &  after 
)
friend

Computes number of L3 cache hits where snooping in sibling L2 caches had to be done.

Parameters
beforeCPU counter state before the experiment
afterCPU counter state after the experiment
Warning
Works only in the DEFAULT_EVENTS programming mode (see program() method)
Returns
number of hits
template<class CounterStateType >
uint64 getL3CacheMisses ( const CounterStateType &  before,
const CounterStateType &  after 
)
friend

Computes number of L3 cache misses.

Parameters
beforeCPU counter state before the experiment
afterCPU counter state after the experiment
Warning
Works only in the DEFAULT_EVENTS programming mode (see program() method)
Returns
number of misses
template<class CounterStateType >
uint64 getL3CacheOccupancy ( const CounterStateType &  now)
friend

Computes L3 Cache Occupancy.

template<class CounterStateType >
uint64 getNumberOfCustomEvents ( int32  eventCounterNr,
const CounterStateType &  before,
const CounterStateType &  after 
)
friend

Returns the number of occured custom core events.

Read number of events programmed with the CUSTOM_CORE_EVENTS

Parameters
eventCounterNrEvent/counter number (value from 0 to 3)
beforeCPU counter state before the experiment
afterCPU counter state after the experiment
Returns
Number of bytes
template<class CounterStateType >
uint64 getRefCycles ( const CounterStateType &  before,
const CounterStateType &  after 
)
friend

Computes the number of reference clock cycles while clock signal on the core is running.

The reference clock operates at a fixed frequency, irrespective of core frequency changes due to performance state transitions. See Intel(r) Software Developer's Manual for more details

Parameters
beforeCPU counter state before the experiment
afterCPU counter state after the experiment
Returns
number core clock cycles
template<class CounterStateType >
double getRelativeFrequency ( const CounterStateType &  before,
const CounterStateType &  after 
)
friend

Computes average core frequency also taking Intel Turbo Boost technology into account.

Parameters
beforeCPU counter state before the experiment
afterCPU counter state after the experiment
Returns
Fraction of nominal frequency

The documentation for this class was generated from the following files: