Wednesday, 13 December 2017

x86 - Determine fixed counter to event mapping with libpfm4

I'm using href="http://perfmon2.sourceforge.net/docs_v4.html" rel="nofollow
noreferrer">libpfm4 to determine Intel performance monitor counter
encodings (e.g., to map between a human-readable name and the
encoding).




Intel PMUs have a number
of "fixed counters" which can be enabled or disabled, but when enabled always count the
same event. libpfc exposes the number of fixed counters in
pfm_pmu_info_t.num_fixed_cntrs, but how can I determine what
events these fixed counters map too?



The events
that the fixed counters cover are listed in the event lists, but it's the general
encoding so you'd have to waste a general purpose counter to program it that
way.



For Intel, there are generally 3 fixed
counters on all recent0
chips:



INST_RETIRED.ANY
CPU_CLK_UNHALTED.THREAD
CPU_CLK_UNHALTED.REF_TSC



Details
can be found in table 18-2 of Vol. 3B of the href="https://software.intel.com/en-us/articles/intel-sdm" rel="nofollow
noreferrer">Intel
SDM1.



/>

0 In particular, anything
that supports at least Architecural PMU version 2, which are Intel Core 2 Duo
processor T7700 and newer processors based on Intel Core
microarchitecture
.



1
The table is Table 18-2. Association of Fixed-Function Performance
Counters with Architectural Performance Events
, in the December 2016
edition.

No comments:

Post a Comment

php - file_get_contents shows unexpected output while reading a file

I want to output an inline jpg image as a base64 encoded string, however when I do this : $contents = file_get_contents($filename); print &q...