LIKWID
likwid.h
1 /*
2  * =======================================================================================
3  *
4  * Filename: likwid.h
5  *
6  * Description: Header File of likwid API
7  *
8  * Version: 4.1
9  * Released: 19.5.2016
10  *
11  * Authors: Thomas Roehl (tr), thomas.roehl@googlemail.com
12  *
13  * Project: likwid
14  *
15  * Copyright (C) 2016 RRZE, University Erlangen-Nuremberg
16  *
17  * This program is free software: you can redistribute it and/or modify it under
18  * the terms of the GNU General Public License as published by the Free Software
19  * Foundation, either version 3 of the License, or (at your option) any later
20  * version.
21  *
22  * This program is distributed in the hope that it will be useful, but WITHOUT ANY
23  * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
24  * PARTICULAR PURPOSE. See the GNU General Public License for more details.
25  *
26  * You should have received a copy of the GNU General Public License along with
27  * this program. If not, see <http://www.gnu.org/licenses/>.
28  *
29  * =======================================================================================
30  */
31 
32 #ifndef LIKWID_H
33 #define LIKWID_H
34 
35 #include <stdint.h>
36 #include <errno.h>
37 #include <string.h>
38 
39 #include <bstrlib.h>
40 
41 #define DEBUGLEV_ONLY_ERROR 0
42 #define DEBUGLEV_INFO 1
43 #define DEBUGLEV_DETAIL 2
44 #define DEBUGLEV_DEVELOP 3
45 
46 extern int perfmon_verbosity;
47 
85 #ifdef LIKWID_PERFMON
86 #define LIKWID_MARKER_INIT likwid_markerInit()
87 #define LIKWID_MARKER_THREADINIT likwid_markerThreadInit()
88 #define LIKWID_MARKER_SWITCH likwid_markerNextGroup()
89 #define LIKWID_MARKER_REGISTER(regionTag) likwid_markerRegisterRegion(regionTag)
90 #define LIKWID_MARKER_START(regionTag) likwid_markerStartRegion(regionTag)
91 #define LIKWID_MARKER_STOP(regionTag) likwid_markerStopRegion(regionTag)
92 #define LIKWID_MARKER_CLOSE likwid_markerClose()
93 #define LIKWID_MARKER_GET(regionTag, nevents, events, time, count) likwid_markerGetRegion(regionTag, nevents, events, time, count)
94 #else
95 #define LIKWID_MARKER_INIT
96 #define LIKWID_MARKER_THREADINIT
97 #define LIKWID_MARKER_SWITCH
98 #define LIKWID_MARKER_REGISTER(regionTag)
99 #define LIKWID_MARKER_START(regionTag)
100 #define LIKWID_MARKER_STOP(regionTag)
101 #define LIKWID_MARKER_CLOSE
102 #define LIKWID_MARKER_GET(regionTag, nevents, events, time, count)
103 #endif
104 
105 #ifdef __cplusplus
106 extern "C" {
107 #endif
108 
109 
110 
111 /*
112 ################################################################################
113 # Marker API related functions
114 ################################################################################
115 */
130 extern void likwid_markerInit(void) __attribute__ ((visibility ("default") ));
137 extern void likwid_markerThreadInit(void) __attribute__ ((visibility ("default") ));
142 extern void likwid_markerNextGroup(void) __attribute__ ((visibility ("default") ));
148 extern void likwid_markerClose(void) __attribute__ ((visibility ("default") ));
155 extern int likwid_markerRegisterRegion(const char* regionTag) __attribute__ ((visibility ("default") ));
163 extern int likwid_markerStartRegion(const char* regionTag) __attribute__ ((visibility ("default") ));
171 extern int likwid_markerStopRegion(const char* regionTag) __attribute__ ((visibility ("default") ));
172 
182 extern void likwid_markerGetRegion(const char* regionTag, int* nr_events, double* events, double *time, int *count) __attribute__ ((visibility ("default") ));
183 /* utility routines */
189 extern int likwid_getProcessorId() __attribute__ ((visibility ("default") ));
197 extern int likwid_pinProcess(int processorId) __attribute__ ((visibility ("default") ));
205 extern int likwid_pinThread(int processorId) __attribute__ ((visibility ("default") ));
208 /*
209 ################################################################################
210 # Access client related functions
211 ################################################################################
212 */
224 typedef enum {
227 } AccessMode;
228 
234 extern void HPMmode(int mode) __attribute__ ((visibility ("default") ));
240 extern int HPMinit() __attribute__ ((visibility ("default") ));
247 extern int HPMaddThread(int cpu_id) __attribute__ ((visibility ("default") ));
252 extern void HPMfinalize() __attribute__ ((visibility ("default") ));
255 /*
256 ################################################################################
257 # Config file related functions
258 ################################################################################
259 */
271 typedef struct {
274  char* daemonPath;
275  char* groupPath;
279 } Configuration;
280 
290 extern int init_configuration(void) __attribute__ ((visibility ("default") ));
296 extern int destroy_configuration(void) __attribute__ ((visibility ("default") ));
297 
298 
305 extern Configuration_t get_configuration(void) __attribute__ ((visibility ("default") ));
306 
313 extern int config_setGroupPath(char* path) __attribute__ ((visibility ("default") ));
314 
316 /*
317 ################################################################################
318 # CPU topology related functions
319 ################################################################################
320 */
329 typedef struct {
330  uint32_t family;
331  uint32_t model;
332  uint32_t stepping;
333  uint64_t clock;
334  int turbo;
335  char* osname;
336  char* name;
337  char* short_name;
338  char* features;
339  int isIntel;
341  uint32_t featureFlags;
342  uint32_t perf_version;
343  uint32_t perf_num_ctr;
344  uint32_t perf_width_ctr;
346 } CpuInfo;
347 
354 typedef struct {
355  uint32_t threadId;
356  uint32_t coreId;
357  uint32_t packageId;
358  uint32_t apicId;
359  uint32_t inCpuSet;
360 } HWThread;
361 
367 typedef enum {
374 } CacheType;
375 
381 typedef struct {
382  uint32_t level;
383  CacheType type;
384  uint32_t associativity;
385  uint32_t sets;
386  uint32_t lineSize;
387  uint32_t size;
388  uint32_t threads;
389  uint32_t inclusive;
390 } CacheLevel;
391 
396 typedef struct {
397  uint32_t numHWThreads;
398  uint32_t activeHWThreads;
399  uint32_t numSockets;
400  uint32_t numCoresPerSocket;
401  uint32_t numThreadsPerCore;
402  uint32_t numCacheLevels;
406 } CpuTopology;
407 
409 extern CpuInfo cpuid_info;
412 
423 extern int topology_init(void) __attribute__ ((visibility ("default") ));
429 extern CpuTopology_t get_cpuTopology(void) __attribute__ ((visibility ("default") ));
436 extern CpuInfo_t get_cpuInfo(void) __attribute__ ((visibility ("default") ));
442 extern void topology_finalize(void) __attribute__ ((visibility ("default") ));
445 extern void print_supportedCPUs(void) __attribute__ ((visibility ("default") ));
447 /*
448 ################################################################################
449 # NUMA related functions
450 ################################################################################
451 */
462 typedef struct {
463  uint32_t id;
464  uint64_t totalMemory;
465  uint64_t freeMemory;
467  uint32_t* processors;
468  uint32_t numberOfDistances;
469  uint32_t* distances;
470 } NumaNode;
471 
472 
475 typedef struct {
476  uint32_t numberOfNodes;
478 } NumaTopology;
479 
481 extern NumaTopology numa_info;
482 
485 
493 extern int numa_init(void) __attribute__ ((visibility ("default") ));
500 extern NumaTopology_t get_numaTopology(void) __attribute__ ((visibility ("default") ));
507 extern void numa_setInterleaved(int* processorList, int numberOfProcessors) __attribute__ ((visibility ("default") ));
513 extern void numa_membind(void* ptr, size_t size, int domainId) __attribute__ ((visibility ("default") ));
520 extern void numa_finalize(void) __attribute__ ((visibility ("default") ));
528 extern int likwid_getNumberOfNodes(void) __attribute__ ((visibility ("default") ));
530 /*
531 ################################################################################
532 # Affinity domains related functions
533 ################################################################################
534 */
544 typedef struct {
545  bstring tag;
547  uint32_t numberOfCores;
550 
560 typedef struct {
570 
573 
580 extern void affinity_init() __attribute__ ((visibility ("default") ));
587 extern AffinityDomains_t get_affinityDomains(void) __attribute__ ((visibility ("default") ));
593 extern void affinity_pinProcess(int processorId) __attribute__ ((visibility ("default") ));
600 extern void affinity_pinProcesses(int cpu_count, int* processorIds) __attribute__ ((visibility ("default") ));
606 extern void affinity_pinThread(int processorId) __attribute__ ((visibility ("default") ));
611 extern int affinity_processGetProcessorId() __attribute__ ((visibility ("default") ));
616 extern int affinity_threadGetProcessorId() __attribute__ ((visibility ("default") ));
623 extern void affinity_finalize() __attribute__ ((visibility ("default") ));
626 /*
627 ################################################################################
628 # CPU string parsing related functions
629 ################################################################################
630 */
645 extern int cpustr_to_cpulist(char* cpustring, int* cpulist, int length) __attribute__ ((visibility ("default") ));
655 extern int nodestr_to_nodelist(char* nodestr, int* nodes, int length) __attribute__ ((visibility ("default") ));
665 extern int sockstr_to_socklist(char* sockstr, int* sockets, int length) __attribute__ ((visibility ("default") ));
666 
669 /*
670 ################################################################################
671 # Performance monitoring related functions
672 ################################################################################
673 */
683 extern int perfmon_getGroups(char*** groups, char*** shortinfos, char*** longinfos) __attribute__ ((visibility ("default") ));
684 
692 extern void perfmon_returnGroups(int nrgroups, char** groups, char** shortinfos, char** longinfos) __attribute__ ((visibility ("default") ));
693 
702 extern int perfmon_init(int nrThreads, int threadsToCpu[]) __attribute__ ((visibility ("default") ));
703 
711 extern void perfmon_init_maps(void) __attribute__ ((visibility ("default") ));
719 extern int perfmon_addEventSet(char* eventCString) __attribute__ ((visibility ("default") ));
727 extern int perfmon_setupCounters(int groupId) __attribute__ ((visibility ("default") ));
734 extern int perfmon_startCounters(void) __attribute__ ((visibility ("default") ));
741 extern int perfmon_stopCounters(void) __attribute__ ((visibility ("default") ));
749 extern int perfmon_readCounters(void) __attribute__ ((visibility ("default") ));
758 extern int perfmon_readCountersCpu(int cpu_id) __attribute__ ((visibility ("default") ));
767 extern int perfmon_readGroupCounters(int groupId) __attribute__ ((visibility ("default") ));
776 extern int perfmon_readGroupThreadCounters(int groupId, int threadId) __attribute__ ((visibility ("default") ));
784 extern int perfmon_switchActiveGroup(int new_group) __attribute__ ((visibility ("default") ));
790 extern void perfmon_finalize(void) __attribute__ ((visibility ("default") ));
800 extern double perfmon_getResult(int groupId, int eventId, int threadId) __attribute__ ((visibility ("default") ));
810 extern double perfmon_getLastResult(int groupId, int eventId, int threadId) __attribute__ ((visibility ("default") ));
819 extern double perfmon_getMetric(int groupId, int metricId, int threadId) __attribute__ ((visibility ("default") ));
828 extern double perfmon_getLastMetric(int groupId, int metricId, int threadId) __attribute__ ((visibility ("default") ));
829 
834 extern int perfmon_getNumberOfGroups(void) __attribute__ ((visibility ("default") ));
840 extern int perfmon_getNumberOfEvents(int groupId) __attribute__ ((visibility ("default") ));
846 extern double perfmon_getTimeOfGroup(int groupId) __attribute__ ((visibility ("default") ));
851 extern int perfmon_getIdOfActiveGroup(void) __attribute__ ((visibility ("default") ));
856 extern int perfmon_getNumberOfThreads(void) __attribute__ ((visibility ("default") ));
857 
858 
862 extern void perfmon_setVerbosity(int verbose) __attribute__ ((visibility ("default") ));
863 
871 extern char* perfmon_getEventName(int groupId, int eventId) __attribute__ ((visibility ("default") ));
879 extern char* perfmon_getCounterName(int groupId, int eventId) __attribute__ ((visibility ("default") ));
886 extern char* perfmon_getGroupName(int groupId) __attribute__ ((visibility ("default") ));
894 extern char* perfmon_getMetricName(int groupId, int metricId) __attribute__ ((visibility ("default") ));
902 extern char* perfmon_getGroupInfoShort(int groupId) __attribute__ ((visibility ("default") ));
910 extern char* perfmon_getGroupInfoLong(int groupId) __attribute__ ((visibility ("default") ));
911 
917 extern int perfmon_getNumberOfMetrics(int groupId) __attribute__ ((visibility ("default") ));
918 
924 extern double perfmon_getLastTimeOfGroup(int groupId) __attribute__ ((visibility ("default") ));
925 
930 extern int perfmon_readMarkerFile(const char* filename) __attribute__ ((visibility ("default") ));
933 extern void perfmon_destroyMarkerResults() __attribute__ ((visibility ("default") ));
938 extern int perfmon_getNumberOfRegions() __attribute__ ((visibility ("default") ));
944 extern int perfmon_getGroupOfRegion(int region) __attribute__ ((visibility ("default") ));
949 extern char* perfmon_getTagOfRegion(int region) __attribute__ ((visibility ("default") ));
954 extern int perfmon_getEventsOfRegion(int region) __attribute__ ((visibility ("default") ));
959 extern int perfmon_getMetricsOfRegion(int region) __attribute__ ((visibility ("default") ));
964 extern int perfmon_getThreadsOfRegion(int region) __attribute__ ((visibility ("default") ));
971 extern int perfmon_getCpulistOfRegion(int region, int count, int* cpulist) __attribute__ ((visibility ("default") ));
977 extern double perfmon_getTimeOfRegion(int region, int thread) __attribute__ ((visibility ("default") ));
983 extern int perfmon_getCountOfRegion(int region, int thread) __attribute__ ((visibility ("default") ));
990 extern double perfmon_getResultOfRegionThread(int region, int event, int thread) __attribute__ ((visibility ("default") ));
997 extern double perfmon_getMetricOfRegionThread(int region, int metricId, int threadId) __attribute__ ((visibility ("default") ));
998 
1001 /*
1002 ################################################################################
1003 # Time measurements related functions
1004 ################################################################################
1005 */
1006 
1014 typedef union
1015 {
1016  uint64_t int64;
1017  struct {uint32_t lo, hi;} int32;
1018 } TscCounter;
1019 
1022 typedef struct {
1025 } TimerData;
1026 
1029 extern void timer_init( void ) __attribute__ ((visibility ("default") ));
1035 extern double timer_print( TimerData* time) __attribute__ ((visibility ("default") ));
1041 extern uint64_t timer_printCycles( TimerData* time) __attribute__ ((visibility ("default") ));
1046 extern void timer_reset( TimerData* time ) __attribute__ ((visibility ("default") ));
1051 extern uint64_t timer_getCpuClock( void ) __attribute__ ((visibility ("default") ));
1056 extern uint64_t timer_getCpuClockCurrent( int cpu_id ) __attribute__ ((visibility ("default") ));
1061 extern uint64_t timer_getCycleClock( void ) __attribute__ ((visibility ("default") ));
1066 extern uint64_t timer_getBaseline( void ) __attribute__ ((visibility ("default") ));
1071 extern void timer_start( TimerData* time ) __attribute__ ((visibility ("default") ));
1076 extern void timer_stop ( TimerData* time) __attribute__ ((visibility ("default") ));
1081 extern int timer_sleep(unsigned long usec) __attribute__ ((visibility ("default") ));
1082 
1086 extern void timer_finalize(void) __attribute__ ((visibility ("default") ));
1087 
1090 /*
1091 ################################################################################
1092 # Power measurements related functions
1093 ################################################################################
1094 */
1103 #define NUM_POWER_DOMAINS 4
1104 
1106 extern const char* power_names[NUM_POWER_DOMAINS] __attribute__ ((visibility ("default") ));
1107 
1112 #define POWER_DOMAIN_SUPPORT_STATUS (1ULL<<0)
1113 
1117 #define POWER_DOMAIN_SUPPORT_LIMIT (1ULL<<1)
1118 
1122 #define POWER_DOMAIN_SUPPORT_POLICY (1ULL<<2)
1123 
1127 #define POWER_DOMAIN_SUPPORT_PERF (1ULL<<3)
1128 
1132 #define POWER_DOMAIN_SUPPORT_INFO (1ULL<<4)
1133 
1134 
1138 typedef struct {
1139  int numSteps;
1140  double* steps;
1141 } TurboBoost;
1142 
1146 typedef enum {
1147  PKG = 0,
1148  PP0 = 1,
1149  PP1 = 2,
1150  DRAM = 3
1151 } PowerType;
1152 
1156 typedef struct {
1158  uint32_t supportFlags;
1159  double energyUnit;
1160  double tdp;
1161  double minPower;
1162  double maxPower;
1163  double maxTimeWindow;
1164 } PowerDomain;
1165 
1168 typedef struct {
1169  double baseFrequency;
1170  double minFrequency;
1172  int hasRAPL;
1173  double powerUnit;
1174  double timeUnit;
1176 } PowerInfo;
1177 
1180 typedef struct {
1181  int domain;
1182  uint32_t before;
1183  uint32_t after;
1184 } PowerData;
1185 
1187 extern PowerInfo power_info;
1188 
1193 
1201 extern int power_init(int cpuId) __attribute__ ((visibility ("default") ));
1207 extern PowerInfo_t get_powerInfo(void) __attribute__ ((visibility ("default") ));
1214 extern int power_read(int cpuId, uint64_t reg, uint32_t *data) __attribute__ ((visibility ("default") ));
1222 extern int power_tread(int socket_fd, int cpuId, uint64_t reg, uint32_t *data) __attribute__ ((visibility ("default") ));
1230 extern int power_start(PowerData_t data, int cpuId, PowerType type) __attribute__ ((visibility ("default") ));
1238 extern int power_stop(PowerData_t data, int cpuId, PowerType type) __attribute__ ((visibility ("default") ));
1244 extern double power_printEnergy(PowerData* data) __attribute__ ((visibility ("default") ));
1250 extern double power_getEnergyUnit(int domain) __attribute__ ((visibility ("default") ));
1251 
1261 int power_limitGet(int cpuId, PowerType domain, double* power, double* time) __attribute__ ((visibility ("default") ));
1262 
1273 int power_limitSet(int cpuId, PowerType domain, double power, double time, int doClamping) __attribute__ ((visibility ("default") ));
1274 
1282 int power_limitState(int cpuId, PowerType domain) __attribute__ ((visibility ("default") ));
1283 
1286 extern void power_finalize(void) __attribute__ ((visibility ("default") ));
1289 /*
1290 ################################################################################
1291 # Thermal measurements related functions
1292 ################################################################################
1293 */
1301 extern void thermal_init(int cpuId) __attribute__ ((visibility ("default") ));
1307 extern int thermal_read(int cpuId, uint32_t *data) __attribute__ ((visibility ("default") ));
1314 extern int thermal_tread(int socket_fd, int cpuId, uint32_t *data) __attribute__ ((visibility ("default") ));
1318 /*
1319 ################################################################################
1320 # Memory sweeping related functions
1321 ################################################################################
1322 */
1331 extern void memsweep_domain(int domainId) __attribute__ ((visibility ("default") ));
1338 extern void memsweep_threadGroup(int* processorList, int numberOfProcessors) __attribute__ ((visibility ("default") ));
1341 /*
1342 ################################################################################
1343 # CPU feature related functions
1344 ################################################################################
1345 */
1350 typedef enum {
1370  CPUFEATURES_MAX
1371 } CpuFeature;
1372 
1377 extern void cpuFeatures_init() __attribute__ ((visibility ("default") ));
1383 extern void cpuFeatures_print(int cpu) __attribute__ ((visibility ("default") ));
1391 extern int cpuFeatures_get(int cpu, CpuFeature type) __attribute__ ((visibility ("default") ));
1398 extern char* cpuFeatures_name(CpuFeature type) __attribute__ ((visibility ("default") ));
1406 extern int cpuFeatures_enable(int cpu, CpuFeature type, int print) __attribute__ ((visibility ("default") ));
1414 extern int cpuFeatures_disable(int cpu, CpuFeature type, int print) __attribute__ ((visibility ("default") ));
1417 #ifdef __cplusplus
1418 }
1419 #endif
1420 
1421 #endif /*LIKWID_H*/
CpuInfo cpuid_info
Variable holding the global cpu information structure.
CpuInfo_t get_cpuInfo(void) __attribute__((visibility("default")))
Retrieve CPU information of the current machine.
Use the access daemon to access the registers.
Definition: likwid.h:226
Structure describing the topology of the HW threads in the system.
Definition: likwid.h:396
Precise Event Based Sampling (PEBS)
Definition: likwid.h:1361
int likwid_getNumberOfNodes(void) __attribute__((visibility("default")))
Retrieve the number of NUMA nodes.
PP1 domain, not clearly defined by Intel.
Definition: likwid.h:1149
Structure describing a cache level.
Definition: likwid.h:381
int sockstr_to_socklist(char *sockstr, int *sockets, int length) __attribute__((visibility("default")))
Read CPU socket selection string and resolve to available CPU socket numbers.
char * perfmon_getMetricName(int groupId, int metricId) __attribute__((visibility("default")))
Get the metric name of the specified group and metric.
uint32_t family
CPU family ID.
Definition: likwid.h:330
uint32_t perf_version
Version of Intel&#39;s performance monitoring facility.
Definition: likwid.h:342
int power_limitState(int cpuId, PowerType domain) __attribute__((visibility("default")))
Get the state of a energy limit, activated or deactivated NOT IMPLEMENTED.
Configuration_t get_configuration(void) __attribute__((visibility("default")))
Retrieve the config structure.
Cache holding instruction cache lines.
Definition: likwid.h:370
AccessMode daemonMode
Access mode to the MSR and PCI registers.
Definition: likwid.h:276
int HPMaddThread(int cpu_id) __attribute__((visibility("default")))
Add CPU to access module.
Limit CPUID Maxval.
Definition: likwid.h:1365
char * cpuFeatures_name(CpuFeature type) __attribute__((visibility("default")))
Get the name of a CPU feature.
uint32_t perf_num_ctr
Number of general purpose core-local performance monitoring counters.
Definition: likwid.h:343
void numa_setInterleaved(int *processorList, int numberOfProcessors) __attribute__((visibility("default")))
Set memory allocation policy to interleaved.
char * features
String with all features supported by the CPU.
Definition: likwid.h:338
char * osname
Name of the CPU reported by OS.
Definition: likwid.h:335
AccessMode
Enum for the access modes.
Definition: likwid.h:224
xTPR Message to set processor priority
Definition: likwid.h:1360
Structure describing an RAPL power domain.
Definition: likwid.h:1156
uint32_t numberOfCoresPerCache
Number of HW threads per LLC cache in the system.
Definition: likwid.h:565
uint32_t numberOfProcessors
umber of processors covered by the NUMA node and length of processors
Definition: likwid.h:466
Execute Disable Bit.
Definition: likwid.h:1366
uint64_t timer_printCycles(TimerData *time) __attribute__((visibility("default")))
Return the measured interval in cycles.
uint32_t perf_num_fixed_ctr
Number of fixed purpose core-local performance monitoring counters.
Definition: likwid.h:345
double perfmon_getMetric(int groupId, int metricId, int threadId) __attribute__((visibility("default")))
Get the metric result of the specified group, counter and thread.
The NumaTopology structure describes all NUMA nodes in the current system.
Definition: likwid.h:475
int likwid_pinProcess(int processorId) __attribute__((visibility("default")))
Pin the current process to given CPU.
int perfmon_getNumberOfRegions() __attribute__((visibility("default")))
Get the number of regions listed in Marker API result file.
NumaNode * nodes
List of NUMA nodes.
Definition: likwid.h:477
int init_configuration(void) __attribute__((visibility("default")))
Read the config file of LIKWID, if it exists.
int perfmon_readMarkerFile(const char *filename) __attribute__((visibility("default")))
Read the output file of the Marker API.
double baseFrequency
Base frequency of the CPU.
Definition: likwid.h:1169
AffinityDomain * domains
List of all domains in the system.
Definition: likwid.h:568
int domain
RAPL domain identifier.
Definition: likwid.h:1181
void power_finalize(void) __attribute__((visibility("default")))
Free space of power_unit.
uint32_t numberOfNodes
Number of NUMA nodes in the system and length of nodes.
Definition: likwid.h:476
uint32_t id
ID of the NUMA node.
Definition: likwid.h:463
int * processorList
List of HW thread IDs in the domain.
Definition: likwid.h:548
Cache holding data cache lines.
Definition: likwid.h:369
void cpuFeatures_print(int cpu) __attribute__((visibility("default")))
Print state of all CPU features for a given CPU.
int power_init(int cpuId) __attribute__((visibility("default")))
Initialize energy measurements on specific CPU.
void timer_init(void) __attribute__((visibility("default")))
Initialize timer by retrieving baseline frequency and cpu clock.
int perfmon_getGroups(char ***groups, char ***shortinfos, char ***longinfos) __attribute__((visibility("default")))
Get all groups.
void likwid_markerGetRegion(const char *regionTag, int *nr_events, double *events, double *time, int *count) __attribute__((visibility("default")))
Get accumulated data of a code region.
FERR# Multiplexing, must be 1 for XAPIC interrupt model.
Definition: likwid.h:1358
int perfmon_getGroupOfRegion(int region) __attribute__((visibility("default")))
Get the groupID of a region.
Struct defining the start and stop time of a time interval.
Definition: likwid.h:1022
uint64_t clock
Current clock frequency of the executing CPU.
Definition: likwid.h:333
uint32_t inCpuSet
ID of HW thread inside the CPU core.
Definition: likwid.h:359
uint32_t numHWThreads
Amount of HW threads in the system and length of threadPool.
Definition: likwid.h:397
uint64_t timer_getCycleClock(void) __attribute__((visibility("default")))
Return the cycles clock determined at timer_init.
double maxPower
Maximal power consumption of the CPU.
Definition: likwid.h:1162
double power_getEnergyUnit(int domain) __attribute__((visibility("default")))
Get energy Unit.
int perfmon_getNumberOfThreads(void) __attribute__((visibility("default")))
Get the number of threads specified at perfmon_init()
void thermal_init(int cpuId) __attribute__((visibility("default")))
Initialize thermal measurements on specific CPU.
void perfmon_returnGroups(int nrgroups, char **groups, char **shortinfos, char **longinfos) __attribute__((visibility("default")))
Free all group information.
int config_setGroupPath(char *path) __attribute__((visibility("default")))
Set group path in the config struction.
uint32_t * processors
List of HW threads in the NUMA node.
Definition: likwid.h:467
void print_supportedCPUs(void) __attribute__((visibility("default")))
Print all supported architectures.
char * perfmon_getCounterName(int groupId, int eventId) __attribute__((visibility("default")))
Get the counter name of the specified group and event.
int power_start(PowerData_t data, int cpuId, PowerType type) __attribute__((visibility("default")))
Start energy measurements.
uint64_t int64
Cycle count in 64 bit.
Definition: likwid.h:1016
int supportUncore
Flag if system has Uncore performance monitors.
Definition: likwid.h:340
void cpuFeatures_init() __attribute__((visibility("default")))
Initialize the internal feature variables for all CPUs.
The AffinityDomain data structure describes a single domain in the current system.
Definition: likwid.h:544
double maxTimeWindow
Minimal power measurement interval.
Definition: likwid.h:1163
uint64_t totalMemory
Amount of memory in the NUMA node.
Definition: likwid.h:464
void affinity_init() __attribute__((visibility("default")))
Initialize affinity information.
const char *power_names[NUM_POWER_DOMAINS] __attribute__((visibility("default")))
List of all RAPL domain names.
int perfmon_readCountersCpu(int cpu_id) __attribute__((visibility("default")))
Read the performance monitoring counters on one CPU.
TurboBoost turbo
Turbo boost information.
Definition: likwid.h:1171
DCU L1 data cache prefetcher.
Definition: likwid.h:1353
CacheType type
Type of the cache.
Definition: likwid.h:383
The AffinityDomains data structure holds different count variables describing the various system laye...
Definition: likwid.h:560
TscCounter start
Cycles at start.
Definition: likwid.h:1023
int power_limitGet(int cpuId, PowerType domain, double *power, double *time) __attribute__((visibility("default")))
Get the values of the limit register of a domain NOT IMPLEMENTED.
uint32_t numberOfAffinityDomains
Number of affinity domains in the current system and length of domains array.
Definition: likwid.h:567
int likwid_markerStopRegion(const char *regionTag) __attribute__((visibility("default")))
Stop a measurement region.
int maxNumNodes
Maximum number of NUMA nodes.
Definition: likwid.h:278
CPUs in NUMA node and general information about a NUMA domain.
Definition: likwid.h:462
double perfmon_getMetricOfRegionThread(int region, int metricId, int threadId) __attribute__((visibility("default")))
Get the metric result of a region for a metric and thread.
double perfmon_getLastTimeOfGroup(int groupId) __attribute__((visibility("default")))
Get the last measurement time a group.
Hardware performance monitoring.
Definition: likwid.h:1357
double timeUnit
Multiplier for time information.
Definition: likwid.h:1174
Information structure of CPU&#39;s turbo mode.
Definition: likwid.h:1138
int perfmon_switchActiveGroup(int new_group) __attribute__((visibility("default")))
Switch the active eventSet to a new one.
uint64_t timer_getCpuClock(void) __attribute__((visibility("default")))
Return the CPU clock determined at timer_init.
int perfmon_stopCounters(void) __attribute__((visibility("default")))
Stop performance monitoring counters.
uint32_t supportFlags
Bitmask which features are supported by the power domain.
Definition: likwid.h:1158
void timer_reset(TimerData *time) __attribute__((visibility("default")))
Reset values in TimerData.
AffinityDomains_t get_affinityDomains(void) __attribute__((visibility("default")))
Retrieve affinity structure.
void likwid_markerThreadInit(void) __attribute__((visibility("default")))
Initialize LIKWID&#39;s marker API for the current thread.
double perfmon_getTimeOfGroup(int groupId) __attribute__((visibility("default")))
Get the accumulated measurement time a group.
double powerUnit
Multiplier for power measurements.
Definition: likwid.h:1173
int perfmon_readCounters(void) __attribute__((visibility("default")))
Read the performance monitoring counters on all CPUs.
int turbo
Flag if CPU has a turbo mode.
Definition: likwid.h:334
PowerInfo_t get_powerInfo(void) __attribute__((visibility("default")))
Get a pointer to the energy facility information.
int perfmon_getNumberOfMetrics(int groupId) __attribute__((visibility("default")))
Get the number of configured metrics for group.
char * perfmon_getGroupInfoLong(int groupId) __attribute__((visibility("default")))
Get the long descriptive string of the specified group.
double minPower
Minimal power consumption of the CPU.
Definition: likwid.h:1161
double perfmon_getLastResult(int groupId, int eventId, int threadId) __attribute__((visibility("default")))
Get the last results of the specified group, counter and thread.
double tdp
Thermal Design Power (maximum amount of heat generated by the CPU)
Definition: likwid.h:1160
double perfmon_getResultOfRegionThread(int region, int event, int thread) __attribute__((visibility("default")))
Get the event result of a region for an event and thread.
void timer_start(TimerData *time) __attribute__((visibility("default")))
Start time measurement.
int nodestr_to_nodelist(char *nodestr, int *nodes, int length) __attribute__((visibility("default")))
Read NUMA node selection string and resolve to available NUMA node numbers.
uint32_t packageId
ID of CPU socket containing the HW thread.
Definition: likwid.h:357
int likwid_pinThread(int processorId) __attribute__((visibility("default")))
Pin the current thread to given CPU.
uint32_t after
Counter state at stop.
Definition: likwid.h:1183
uint32_t size
Size in bytes of the cache.
Definition: likwid.h:387
int thermal_tread(int socket_fd, int cpuId, uint32_t *data) __attribute__((visibility("default")))
Read the current thermal value using a specific communication socket.
int numSteps
Amount of turbo mode steps/frequencies.
Definition: likwid.h:1139
HWThread * threadPool
List of all HW thread descriptions.
Definition: likwid.h:403
Adjacent cache line prefetcher.
Definition: likwid.h:1352
double perfmon_getTimeOfRegion(int region, int thread) __attribute__((visibility("default")))
Get the accumulated measurement time of a region for a thread.
int hasRAPL
RAPL support flag.
Definition: likwid.h:1172
uint32_t numCoresPerSocket
Amount of physical cores in one CPU socket/package.
Definition: likwid.h:400
int power_stop(PowerData_t data, int cpuId, PowerType type) __attribute__((visibility("default")))
Stop energy measurements.
int destroy_configuration(void) __attribute__((visibility("default")))
Destroy the config structure.
uint32_t activeHWThreads
Amount of HW threads in the system and length of threadPool.
Definition: likwid.h:398
char * perfmon_getTagOfRegion(int region) __attribute__((visibility("default")))
Get the tag of a region.
uint32_t numberOfCores
Number of CPU cores in the domain.
Definition: likwid.h:547
char * configFileName
Path to the configuration file.
Definition: likwid.h:272
uint64_t timer_getBaseline(void) __attribute__((visibility("default")))
Return the baseline CPU clock determined at timer_init.
void perfmon_destroyMarkerResults() __attribute__((visibility("default")))
Free space for read in Marker API file.
double * steps
List of turbo mode steps.
Definition: likwid.h:1140
void likwid_markerNextGroup(void) __attribute__((visibility("default")))
Select next group to measure.
int perfmon_getCountOfRegion(int region, int thread) __attribute__((visibility("default")))
Get the call count of a region for a thread.
No cache used as undef value.
Definition: likwid.h:368
IP L1 data cache prefetcher.
Definition: likwid.h:1354
Information structure of CPU&#39;s power measurement facility.
Definition: likwid.h:1168
void timer_finalize(void) __attribute__((visibility("default")))
Finalize timer module.
char * short_name
Short name of the CPU.
Definition: likwid.h:337
CacheLevel * cacheLevels
List of all caches in the hierarchy.
Definition: likwid.h:404
int power_read(int cpuId, uint64_t reg, uint32_t *data) __attribute__((visibility("default")))
Read the current power value.
NumaTopology numa_info
Variable holding the global NUMA information structure.
uint32_t numCacheLevels
Amount of caches for each HW thread and length of cacheLevels.
Definition: likwid.h:402
void perfmon_init_maps(void) __attribute__((visibility("default")))
Initialize performance monitoring maps.
double minFrequency
Minimal frequency of the CPU.
Definition: likwid.h:1170
int maxNumThreads
Maximum number of HW threads.
Definition: likwid.h:277
void topology_finalize(void) __attribute__((visibility("default")))
Destroy topology structures CpuInfo_t and CpuTopology_t.
int numa_init(void) __attribute__((visibility("default")))
Initialize NUMA information.
void affinity_pinProcess(int processorId) __attribute__((visibility("default")))
Pin process to a CPU.
MONITOR/MWAIT feature to monitor write-back stores.
Definition: likwid.h:1363
uint32_t lineSize
Size in bytes of one cache line.
Definition: likwid.h:386
#define NUM_POWER_DOMAINS
Definition: likwid.h:1103
int perfmon_getThreadsOfRegion(int region) __attribute__((visibility("default")))
Get the number of threads of a region.
int cpuFeatures_disable(int cpu, CpuFeature type, int print) __attribute__((visibility("default")))
Disable a CPU feature for a specific CPU.
Structure holding values of the configuration file.
Definition: likwid.h:271
uint32_t model
CPU model ID.
Definition: likwid.h:331
int perfmon_getNumberOfEvents(int groupId) __attribute__((visibility("default")))
Get the number of configured eventSets in group.
int likwid_markerStartRegion(const char *regionTag) __attribute__((visibility("default")))
Start a measurement region.
void memsweep_domain(int domainId) __attribute__((visibility("default")))
Sweeping the memory of a NUMA node.
Access performance monitoring registers directly.
Definition: likwid.h:225
int perfmon_getNumberOfGroups(void) __attribute__((visibility("default")))
Get the number of configured event groups.
Enhanced Intel SpeedStep Technology Select Lock.
Definition: likwid.h:1364
int likwid_markerRegisterRegion(const char *regionTag) __attribute__((visibility("default")))
Register a measurement region.
CpuTopology_t get_cpuTopology(void) __attribute__((visibility("default")))
Retrieve CPU topology of the current machine.
int affinity_threadGetProcessorId() __attribute__((visibility("default")))
Return the CPU ID where the current thread runs.
PowerType type
Identifier which RAPL domain is managed by this struct.
Definition: likwid.h:1157
uint32_t coreId
ID of CPU core that executes the HW thread.
Definition: likwid.h:356
Intel Dynamic Acceleration.
Definition: likwid.h:1367
Structure with general CPU information.
Definition: likwid.h:329
uint32_t numSockets
Amount of CPU sockets/packages in the system.
Definition: likwid.h:399
uint32_t apicId
ID of HW thread retrieved through the Advanced Programmable Interrupt Controller. ...
Definition: likwid.h:358
Thermal Monitoring 2.
Definition: likwid.h:1369
uint32_t numberOfProcessorsPerCache
Number of CPU cores per LLC cache in the system.
Definition: likwid.h:566
uint32_t numberOfCacheDomains
Number of LLC caches in the system.
Definition: likwid.h:564
uint32_t associativity
Amount of cache lines hold by each set.
Definition: likwid.h:384
void affinity_pinProcesses(int cpu_count, int *processorIds) __attribute__((visibility("default")))
Pin processes to a CPU.
Intel Turbo Mode.
Definition: likwid.h:1368
int perfmon_getMetricsOfRegion(int region) __attribute__((visibility("default")))
Get the number of metrics of a region.
bstring tag
Bstring with the ID for the affinity domain. Currently possible values: N (node), SX (socket/package ...
Definition: likwid.h:545
PowerInfo * PowerInfo_t
Pointer for exporting the PowerInfo data structure.
Definition: likwid.h:1190
uint32_t inclusive
Flag if cache is inclusive (holds also cache lines available in caches nearer to the CPU) or exclusiv...
Definition: likwid.h:389
void numa_finalize(void) __attribute__((visibility("default")))
Destroy NUMA information structure.
double energyUnit
Multiplier for energy measurements.
Definition: likwid.h:1159
char * groupPath
Path of default performance group directory.
Definition: likwid.h:275
double perfmon_getResult(int groupId, int eventId, int threadId) __attribute__((visibility("default")))
Get the results of the specified group, counter and thread.
void likwid_markerInit(void) __attribute__((visibility("default")))
Initialize LIKWID&#39;s marker API.
uint32_t featureFlags
Mask of all features supported by the CPU.
Definition: likwid.h:341
uint32_t perf_width_ctr
Bit width of fixed and general purpose counters.
Definition: likwid.h:344
char * perfmon_getGroupInfoShort(int groupId) __attribute__((visibility("default")))
Get the short informational string of the specified group.
int power_tread(int socket_fd, int cpuId, uint64_t reg, uint32_t *data) __attribute__((visibility("default")))
Read the current energy value using a specific communication socket.
CpuInfo * CpuInfo_t
Pointer for exporting the CpuInfo data structure.
Definition: likwid.h:414
uint64_t timer_getCpuClockCurrent(int cpu_id) __attribute__((visibility("default")))
Return the current CPU clock read from sysfs.
int perfmon_getIdOfActiveGroup(void) __attribute__((visibility("default")))
Get the ID of the currently set up event group.
Branch Trace Storage.
Definition: likwid.h:1359
int perfmon_readGroupThreadCounters(int groupId, int threadId) __attribute__((visibility("default")))
Read the performance monitoring counters of on thread in a group.
CacheType
Enum of possible caches.
Definition: likwid.h:367
uint32_t sets
Amount of sets.
Definition: likwid.h:385
int topology_init(void) __attribute__((visibility("default")))
Initialize topology information.
int isIntel
Flag if it is an Intel CPU.
Definition: likwid.h:339
AffinityDomains * AffinityDomains_t
Pointer for exporting the AffinityDomains data structure.
Definition: likwid.h:572
int HPMinit() __attribute__((visibility("default")))
Initialize access module.
void affinity_pinThread(int processorId) __attribute__((visibility("default")))
Pin thread to a CPU.
DRAM domain, the memory modules.
Definition: likwid.h:1150
uint32_t before
Counter state at start.
Definition: likwid.h:1182
Translation Lookaside Buffer cache for data pages.
Definition: likwid.h:373
uint32_t numberOfProcessors
Number of HW threads in the domain and length of processorList.
Definition: likwid.h:546
int likwid_getProcessorId() __attribute__((visibility("default")))
Get CPU ID of the current process/thread.
void HPMfinalize() __attribute__((visibility("default")))
Close connections.
CpuTopology * CpuTopology_t
Pointer for exporting the CpuTopology data structure.
Definition: likwid.h:416
Configuration * Configuration_t
Pointer for exporting the Configuration data structure.
Definition: likwid.h:282
CpuTopology cpuid_topology
Variable holding the global cpu topology structure.
NumaTopology_t get_numaTopology(void) __attribute__((visibility("default")))
Retrieve NUMA information of the current machine.
Structure of a tree node.
Definition: tree_types.h:44
int cpuFeatures_enable(int cpu, CpuFeature type, int print) __attribute__((visibility("default")))
Enable a CPU feature for a specific CPU.
PowerType
Enum for all supported RAPL domains.
Definition: likwid.h:1146
Structure with IDs of a HW thread.
Definition: likwid.h:354
Hardware prefetcher.
Definition: likwid.h:1351
Enhanced Intel SpeedStep Technology to reduce energy consumption.
Definition: likwid.h:1362
uint64_t freeMemory
Amount of free memory in the NUMA node.
Definition: likwid.h:465
Automatic Thermal Control Circuit.
Definition: likwid.h:1356
void HPMmode(int mode) __attribute__((visibility("default")))
Set access mode.
char * name
Name of the CPU as identified by LIKWID.
Definition: likwid.h:336
uint32_t threads
Number of HW thread connected to the cache.
Definition: likwid.h:388
void numa_membind(void *ptr, size_t size, int domainId) __attribute__((visibility("default")))
Allocate memory from a specific specific NUMA node.
int perfmon_init(int nrThreads, int threadsToCpu[]) __attribute__((visibility("default")))
Initialize performance monitoring facility.
void memsweep_threadGroup(int *processorList, int numberOfProcessors) __attribute__((visibility("default")))
Sweeping the memory of all NUMA nodes covered by CPU list.
uint32_t level
Level of the cache in the hierarchy.
Definition: likwid.h:382
PP0 domain, not clearly defined by Intel.
Definition: likwid.h:1148
uint32_t numberOfNumaDomains
Number of NUMA nodes in the system.
Definition: likwid.h:562
double timer_print(TimerData *time) __attribute__((visibility("default")))
Return the measured interval in seconds.
PowerInfo power_info
Variable holding the global power information structure.
char * perfmon_getEventName(int groupId, int eventId) __attribute__((visibility("default")))
Get the event name of the specified group and event.
double power_printEnergy(PowerData *data) __attribute__((visibility("default")))
Print energy measurements gathered by power_start() and power_stop()
void likwid_markerClose(void) __attribute__((visibility("default")))
Close LIKWID&#39;s marker API.
int affinity_processGetProcessorId() __attribute__((visibility("default")))
Return the CPU ID where the current process runs.
Fast-strings feature.
Definition: likwid.h:1355
void perfmon_setVerbosity(int verbose) __attribute__((visibility("default")))
Set verbosity of LIKWID library.
uint32_t numberOfSocketDomains
Number of CPU sockets/packages in the system.
Definition: likwid.h:561
double perfmon_getLastMetric(int groupId, int metricId, int threadId) __attribute__((visibility("default")))
Get the last metric result of the specified group, counter and thread.
int perfmon_getCpulistOfRegion(int region, int count, int *cpulist) __attribute__((visibility("default")))
Get the cpulist of a region.
struct treeNode * topologyTree
Anchor for a tree structure describing the system topology.
Definition: likwid.h:405
uint32_t stepping
Stepping (version) of the CPU.
Definition: likwid.h:332
void perfmon_finalize(void) __attribute__((visibility("default")))
Close the perfomance monitoring facility of LIKWID.
void timer_stop(TimerData *time) __attribute__((visibility("default")))
Stop time measurement.
Power measurement data for start/stop measurements.
Definition: likwid.h:1180
char * topologyCfgFileName
Path to the topology file.
Definition: likwid.h:273
TscCounter stop
Cycles at stop.
Definition: likwid.h:1024
PKG domain, mostly one CPU socket/package.
Definition: likwid.h:1147
uint32_t * distances
List of distances to the other NUMA nodes and self.
Definition: likwid.h:469
int perfmon_readGroupCounters(int groupId) __attribute__((visibility("default")))
Read the performance monitoring counters of all threads in a group.
int power_limitSet(int cpuId, PowerType domain, double power, double time, int doClamping) __attribute__((visibility("default")))
Set the values of the limit register of a domain NOT IMPLEMENTED.
uint32_t threadId
ID of HW thread inside the CPU core.
Definition: likwid.h:355
int perfmon_startCounters(void) __attribute__((visibility("default")))
Start performance monitoring counters.
NumaTopology * NumaTopology_t
Pointer for exporting the NumaTopology data structure.
Definition: likwid.h:484
int perfmon_setupCounters(int groupId) __attribute__((visibility("default")))
Setup all performance monitoring counters of an eventSet.
int timer_sleep(unsigned long usec) __attribute__((visibility("default")))
Sleep for specified usecs.
CpuFeature
Definition: likwid.h:1350
int cpuFeatures_get(int cpu, CpuFeature type) __attribute__((visibility("default")))
Get state of a CPU feature for a given CPU.
Translation Lookaside Buffer cache for instruction pages.
Definition: likwid.h:372
Struct defining the start and stop time of a time interval.
Definition: likwid.h:1014
uint32_t numberOfProcessorsPerSocket
Number of HW threads per socket/package in the system.
Definition: likwid.h:563
uint32_t numThreadsPerCore
Amount of HW threads in one physical CPU core.
Definition: likwid.h:401
PowerData * PowerData_t
Pointer for exporting the PowerData data structure.
Definition: likwid.h:1192
void affinity_finalize() __attribute__((visibility("default")))
Destroy affinity information structure.
int perfmon_addEventSet(char *eventCString) __attribute__((visibility("default")))
Add an event string to LIKWID.
int cpustr_to_cpulist(char *cpustring, int *cpulist, int length) __attribute__((visibility("default")))
Read CPU selection string and resolve to available CPU numbers.
Cache holding both instruction and data cache lines.
Definition: likwid.h:371
char * perfmon_getGroupName(int groupId) __attribute__((visibility("default")))
Get the name group.
int thermal_read(int cpuId, uint32_t *data) __attribute__((visibility("default")))
Read the current thermal value.
char * daemonPath
Path of the access daemon.
Definition: likwid.h:274
int perfmon_getEventsOfRegion(int region) __attribute__((visibility("default")))
Get the number of events of a region.
uint32_t numberOfDistances
Amount of distances to the other NUMA nodes in the system and self.
Definition: likwid.h:468