Processor Counter Monitor
Classes | Macros | Functions | Variables
pcm-core.cpp File Reference

Example of using CPU counters: implements a performance counter monitoring utility for Intel Core, Offcore events. More...

#include <iostream>
#include <unistd.h>
#include <signal.h>
#include <sys/time.h>
#include <math.h>
#include <iomanip>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <string>
#include <assert.h>
#include <bitset>
#include "cpucounters.h"
#include "utils.h"
#include <vector>
Include dependency graph for pcm-core.cpp:

Classes

struct  CoreEvent
 

Macros

#define PCM_DELAY_DEFAULT   1.0
 
#define PCM_DELAY_MIN   0.015
 
#define MAX_CORES   4096
 

Functions

void build_event (const char *argv, EventSelectRegister *reg, int idx)
 
int pcm_c_build_core_event (uint8_t idx, const char *argv)
 
int pcm_c_init ()
 
void pcm_c_start ()
 
void pcm_c_stop ()
 
uint64_t pcm_c_get_cycles (uint32_t core_id)
 
uint64_t pcm_c_get_instr (uint32_t core_id)
 
uint64_t pcm_c_get_core_event (uint32_t core_id, uint32_t event_id)
 
void print_usage (const string &progname)
 
template<class StateType >
void print_custom_stats (const StateType &BeforeState, const StateType &AfterState, bool csv, uint64 txn_rate)
 
bool match (const char *subtoken, const char *name, int *result)
 
int main (int argc, char *argv[])
 

Variables

struct CoreEvent events [PERF_MAX_CUSTOM_COUNTERS]
 
SystemCounterState globalSysBeforeState
 
SystemCounterState globalSysAfterState
 
std::vector< CoreCounterStateglobalBeforeState
 
std::vector< CoreCounterStateglobalAfterState
 
std::vector< SocketCounterStateglobalDummySocketStates
 
EventSelectRegister globalRegs [PERF_MAX_COUNTERS]
 
PCM::ExtendedCustomCoreEventDescription globalConf
 

Detailed Description

Example of using CPU counters: implements a performance counter monitoring utility for Intel Core, Offcore events.