libmsr
0.3.0
A friendlier interface to accessing MSRs on Intel platforms
|
#include <errno.h>
#include <fcntl.h>
#include <stdlib.h>
#include <string.h>
#include <sys/ioctl.h>
#include <sys/stat.h>
#include <sys/types.h>
#include <unistd.h>
#include "csr_core.h"
#include "memhdlr.h"
#include "msr_core.h"
#include "csr_imc.h"
#include "cpuid.h"
#include "libmsr_debug.h"
#include "libmsr_error.h"
Functions | |
struct pmonctrs_data * | pmon_ctr_storage (void) |
Store the PMON counter data on the heap. | |
struct pmonctr_global * | pmonctr_global_storage (void) |
the PMON global counter data on the heap. | |
int | init_pmon_ctrs (void) |
Initialize storage for PMON performance counter data. | |
int | init_pmonctr_global (void) |
Initialize storage for PMON global performance counter data. | |
int | pmon_config (uint32_t threshold, uint32_t ovf_en, uint32_t edge_det, uint32_t umask, uint8_t event, const unsigned counter) |
Configure iMC performance counters. | |
int | set_pmon_unit_ctrl (uint32_t ovf_en, uint16_t freeze_en, uint16_t freeze, uint16_t reset, uint8_t reset_cfg) |
Set PMON controls. | |
int | mem_bw_on_ctr (const unsigned counter, const int type) |
iMC memory bandwidth performance counter. | |
int | mem_pct_rw_on_ctr (const unsigned rcounter, const unsigned wcounter) |
int | mem_page_empty_on_ctr (const unsigned act_count, const unsigned pre_count, const unsigned cas_count) |
int | mem_page_miss_on_ctr (const unsigned pre_count, const unsigned cas_count) |
int | read_imc_counter_batch (const unsigned counter) |
Read iMC counters. | |
int | print_mem_bw_from_ctr (const unsigned counter, FILE *writedest) |
Print memory bandwidth. | |
int | print_mem_pct_rw_from_ctr (const unsigned rcounter, const unsigned wcounter, int type, FILE *writedest) |
Print percentage of read/write requests. | |
int | print_mem_page_empty_from_ctr (const unsigned act, const unsigned pre, const unsigned cas, FILE *writedest) |
Print percentage of read/write requests that caused a page empty. | |
int | print_mem_page_miss_from_ctr (const unsigned pre, const unsigned cas, FILE *writedest) |
Print percentage of read/write requests that caused a page miss. | |
int | print_pmon_ctrs (void) |
Print contents of iMC performance monitoring counters. | |
int init_pmon_ctrs | ( | void | ) |
Initialize storage for PMON performance counter data.
int init_pmonctr_global | ( | void | ) |
Initialize storage for PMON global performance counter data.
int mem_bw_on_ctr | ( | const unsigned | counter, |
const int | type | ||
) |
iMC memory bandwidth performance counter.
[in] | counter | Unique counter identifier. |
[in] | type | csr_data_type_e data type of event. |
int mem_page_empty_on_ctr | ( | const unsigned | act_count, |
const unsigned | pre_count, | ||
const unsigned | cas_count | ||
) |
int mem_page_miss_on_ctr | ( | const unsigned | pre_count, |
const unsigned | cas_count | ||
) |
int mem_pct_rw_on_ctr | ( | const unsigned | rcounter, |
const unsigned | wcounter | ||
) |
int pmon_config | ( | uint32_t | threshold, |
uint32_t | ovf_en, | ||
uint32_t | edge_det, | ||
uint32_t | umask, | ||
uint8_t | event, | ||
const unsigned | counter | ||
) |
Configure iMC performance counters.
[in] | threshold | Threshold used in counter comparison. |
[in] | ovf_en | When set to 1 and the counter overflows, its overflow bit is set in the local status register and global status register. |
[in] | edge_det | When set to 1, increment counter when a 0 –> 1 transition (i.e., rising edge) is detected. When 0, the counter will increment in each cycle that the event is asserted. |
[in] | umask | Select subevents to be counted within the selected event. |
[in] | event | Select event to be counted. |
[in] | counter | Unique counter identifier. |
|
read |
Store the PMON counter data on the heap.
|
read |
the PMON global counter data on the heap.
int print_mem_bw_from_ctr | ( | const unsigned | counter, |
FILE * | writedest | ||
) |
Print memory bandwidth.
[in] | counter | Unique counter identifier. |
[in] | writedest | File stream where output will be written to. |
int print_mem_page_empty_from_ctr | ( | const unsigned | act, |
const unsigned | pre, | ||
const unsigned | cas, | ||
FILE * | writedest | ||
) |
Print percentage of read/write requests that caused a page empty.
int print_mem_page_miss_from_ctr | ( | const unsigned | pre, |
const unsigned | cas, | ||
FILE * | writedest | ||
) |
Print percentage of read/write requests that caused a page miss.
int print_mem_pct_rw_from_ctr | ( | const unsigned | rcounter, |
const unsigned | wcounter, | ||
int | type, | ||
FILE * | writedest | ||
) |
Print percentage of read/write requests.
[in] | rcounter | Unique counter identifier for read requests. |
[in] | wcounter | Unique counter identifier for write requests. |
[in] | type | Indicates data is reporting read or write requests. |
[in] | writedest | File stream where output will be written to. |
int print_pmon_ctrs | ( | void | ) |
Print contents of iMC performance monitoring counters.
int read_imc_counter_batch | ( | const unsigned | counter | ) |
Read iMC counters.
[in] | counter | Unique counter identifier. |
int set_pmon_unit_ctrl | ( | uint32_t | ovf_en, |
uint16_t | freeze_en, | ||
uint16_t | freeze, | ||
uint16_t | reset, | ||
uint8_t | reset_cf | ||
) |
Set PMON controls.
[in] | ovf_en | When set to 1 and the counter overflows, its overflow bit is set in the local status register and global status register. |
[in] | freeze_en | Enable freezing of all uncore performance counters. |
[in] | freeze | Freeze all uncore performance monitors. |
[in] | reset | When set to 1, the corresponding counter will be cleared to 0. |
[in] | reset_cf | Reset to see a new freeze. |