1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250
|
.TH LIKWID-PERFCTR 1 <DATE> likwid\-<VERSION>
.SH NAME
likwid-perfctr \- configure and read out hardware performance counters on x86 CPUs
.SH SYNOPSIS
.B likwid-perfctr
.RB [\-vhHmaief]
.RB [ \-c
.IR core_list ]
.RB [ \-C
.IR core_list_for_pinning ]
.RB [ \-g
.IR performance_group
or
.IR performance_event_string ]
.RB [ \-t
.IR timeline_frequency ]
.RB [ \-S
.IR monitoring_time ]
.RB [ \-T
.IR group_switch_frequency ]
.RB [ \-V
.IR verbosity ]
.RB [ \-M
.IR access_mode ]
.RB [ \-o
.IR output_file ]
.RB [ \-s
.IR skip_mask ]
.RB [ \-E
.IR search_str ]
.RB [ \-\-stats ]
.SH DESCRIPTION
.B likwid-perfctr
is a lightweight command line application to configure and read out hardware performance monitoring data
on supported x86 processors. It can measure either as wrapper without changing the measured application
or with marker API functions inside the code, which will turn on and off the counters. There are preconfigured
performance groups with useful event sets and derived metrics. Additionally, arbitrary events can be measured with
custom event sets. The marker API can measure multiple named regions and the results are accumulated over multiple region calls.
.SH OPTIONS
.TP
.B \-\^v, \-\-\^version
prints version information to standard output, then exits.
.TP
.B \-\^h, \-\-\^help
prints a help message to standard output, then exits.
.TP
.B \-\^H
prints group help message (use together with \-g switch).
.TP
.B \-\^V <level>, \-\-\^verbose <level>
verbose output during execution for debugging. 0 for only errors, 1 for informational output, 2 for detailed output and 3 for developer output
.TP
.B \-\^m
run in marker API mode
.TP
.B \-\^a
print available performance groups for current processor, then exit.
.TP
.B \-\^e
print available counters and performance events of current processor.
.TP
.B \-\^o, \-\-\^output <filename>
store all output to a file instead of stdout. For the filename the following placeholders are supported:
%j for PBS_JOBID, %r for MPI RANK (only Intel MPI at the moment), %h host name and %p for process pid.
The placeholders must be separated by underscore as, e.g., \-o test_%h_%p. You must specify a suffix to
the filename. For txt the output is printed as is to the file. Other suffixes trigger a filter on the output.
Available filters are csv (comma separated values) and xml at the moment.
.TP
.B \-\^O
print output in CSV format (conform to RFC 4180, see
.I https://tools.ietf.org/html/rfc4180
for details).
.TP
.B \-\^i, \-\-\^info
print cpuid information about processor and about Intel Performance Monitoring features, then exit.
.TP
.B \-\^c <cpu expression>
specify a numerical list of processors. The list may contain multiple
items, separated by comma, and ranges. For example 0,3,9-11.
.TP
.B \-\^C <cpu expression>
specify a numerical list of processors. The list may contain multiple
items, separated by comma, and ranges. For example 0,3,9-11. This variant will
also pin the threads to the cores. Also logical numberings can be used.
.TP
.B \-\^g, \-\-\^group <performance group> or <performance event set string>
specify which performance group to measure. This can be one of the tags output with the \-a flag.
Also a custom event set can be specified by a comma separated list of events. Each event has the format
eventId:register with the the register being one of a architecture supported performance counter registers.
.TP
.B \-\^t <frequency of measurements>
timeline mode for time resolved measurements. The time unit must be given on command line, e.g. 4s, 500ms or 900us.
.TP
.B \-\^S <waittime between measurements>
End-to-end measurement using likwid-perfctr but sleep instead of executing an application. The time unit must be given on command line, e.g. 4s, 500ms or 900us.
.TP
.B \-\^T <time between group switches>
Frequency to switch groups if multiple are given on commandline, default is 2s. Value is ignored for a single event set and default frequency of 30s is used to catch overflows. The time unit must be given on command line, e.g. 4s, 500ms or 900us.
.TP
.B \-\^s, \-\-\^skip <mask>
Specify skip mask as HEX number. For each set bit the corresponding thread is skipped.
.TP
.B \-\^f, \-\-\^force
Force writing of registers even if they are in use.
.TP
.B \-\^E <search_str>
Print only events and corresponding counters matching <search_str>
.TP
.B \-\-\^stats
Always print statistics table
.SH EXAMPLE
Because
.B likwid-perfctr
measures on processors and not single applications it is necessary to ensure
that processes and threads are pinned to dedicated resources. You can either pin the application yourself
or use the builtin pin functionality.
.IP 1. 4
As wrapper with performance group:
.TP
.B likwid-perfctr -C 0-2 -g TLB ./cacheBench -n 2 -l 1048576 -i 100 -t Stream
.PP
The parent process is pinned to processor 0, Thread 0 to processor 1 and Thread 1 to processor 2.
.IP 2. 4
As wrapper with custom event set on AMD:
.TP
.B likwid-perfctr -C 0-4 -g INSTRUCTIONS_RETIRED_SSE:PMC0,CPU_CLOCKS_UNHALTED:PMC3 ./cacheBench
.PP
It is specified that the event
.B INSTRUCTIONS_RETIRED_SSE
is measured on counter
.B PMC0
and the event
.B CPU_CLOCKS_UNHALTED
on counter
.B PMC3.
It is possible calculate the run time of all threads based on the
.B CPU_CLOCKS_UNHALTED
event. If you want this you have to include this event in your custom event string as shown above.
.IP 3. 4
As wrapper with custom event set on Intel:
.TP
.B likwid-perfctr -C 0 -g INSTR_RETIRED_ANY:FIXC0,CPU_CLK_UNHALTED_CORE:FIXC1,UNC_L3_LINES_IN_ANY:UPMC0 ./stream-icc
.PP
On Intel processors fixed events are measured on dedicated counters. These are
.B INSTR_RETIRED_ANY
and
.B CPU_CLK_UNHALTED_CORE.
If you configure these fixed counters,
.B likwid-perfctr
will calculate the run time and CPI metrics for your run.
.IP 4. 4
Using the marker API to measure only parts of your code (this can be used both with groups or custom event sets):
.TP
.B likwid-perfctr -m -C 0-4 -g INSTRUCTIONS_RETIRED_SSE:PMC0,CPU_CLOCKS_UNHALTED:PMC3 ./cacheBench
.PP
You have to link you code against liblikwid.so and use the marker API calls.
Examples can be found in examples folder <INSTALLED_PREFIX>/share/likwid/examples.
The following code snippet shows the necessary calls:
.nf
#include <likwid.h>
/* only one thread calls init */
LIKWID_MARKER_INIT;
/* Must be called by each thread the should
* perform measurements.
* If you place it in the same parallel
* region as LIKWID_MARKER_START, perform a
* barrier between the statements to avoid
* timing problems.
*/
LIKWID_MARKER_THREADINIT;
/* If you run the code region only once, register
* the region tag previously to reduce the overhead
* of START and STOP calls. Call it once for each
* thread in parallel environment.
* Note: No whitespace characters are allowed in the region tags
* This call is optional, START will do the same operations.
*/
LIKWID_MARKER_REGISTER("name");
/* Start measurement
* Note: No whitespace characters are allowed in the region tags
*/
LIKWID_MARKER_START("name");
/*
* Your code to be measured is here
* You can also nest named regions
* No whitespaces are allowed in the region names!
*/
LIKWID_MARKER_STOP("name");
/* If you want to measure multiple groups/event sets
* Switches through groups in round-robin fashion
*/
LIKWID_MARKER_SWITCH;
/* Finally */
LIKWID_MARKER_CLOSE;
.fi
.IP 5. 4
Using likwid in timeline mode:
.TP
.B likwid-perfctr -c 0-3 -g FLOPS_DP -t 300ms ./cacheBench > out.txt
.PP
This will read out the counters every 300ms on physical cores 0-3 and write the results to out.txt.
The application is not pinned to the CPUs. The output syntax of the timeline
mode is for custom event sets:
.B <groupID> <numberOfEvents> <numberOfThreads> <Timestamp> <Event1_Thread1> <Event2_Thread1> ... <Event1_Thread2> ... <EventN_ThreadM>
For performance groups with metrics:
.B <groupID> <numberOfMetrics> <numberOfThreads> <Timestamp> <Metric1_Thread1> <Metric2_Thread1> ... <Metric1_Thread2> ...<MetricN_ThreadM>
For timeline mode there is a frontend application likwid-perfscope(1), which enables live plotting of selected events. Please be aware that with high frequencies (<100ms), the values differ from the real results but the behavior of them is valid.
.IP 6. 4
Using likwid in stethoscope mode:
.TP
.B likwid-perfctr -c 0-3 -g FLOPS_DP -S 2s
.PP
This will start the counters and read them out after 2s on physical cores 0-3 and write the results to stdout.
.IP 7. 4
Using likwid with counter options:
.TP
.B likwid-perfctr -c S0:1@S1:1 -g LLC_LOOKUPS_DATA_READ:CBOX0C0:STATE=0x9 ./cacheBench
.PP
This will program the counter
.B CBOX0C0
(the counter 0 of the LLC cache box 0) to measure the event
.B LLC_LOOKUPS_DATA_READ
and filter the increments by the state of a cacheline.
.B STATE=0x9
for this event means all <invalid> and <modified> cachelines. Which options are allowed for which box is listed in LIKWID's html documentation. The values for the options can be found in the vendors performance monitoring documentations. Likwid measures the first CPU of socket 0 and the first CPU of socket 1. See likwid-pin(1) for details regarding the cpu expressions.
For more code examples have a look at the likwid WIKI pages and LIKWID's html documentation.
.SH AUTHOR
Written by Thomas Roehl <thomas.roehl@googlemail.com>.
.SH BUGS
Report Bugs on <https://github.com/RRZE-HPC/likwid/issues>.
.SH SEE ALSO
likwid-topology(1), likwid-perfscope(1), likwid-pin(1), likwid-bench(1)
|