HPCToolkit
perf_skid.c File Reference
#include <stdlib.h>
#include <limits.h>
#include <ctype.h>
#include <string.h>
#include <unistd.h>
#include <sys/syscall.h>
#include <linux/perf_event.h>
#include "perf_constants.h"
#include "perf_skid.h"
#include "perf_event_open.h"
Include dependency graph for perf_skid.c:

Go to the source code of this file.

Macros

#define HPCRUN_OPTION_PRECISE_IP   "HPCRUN_PRECISE_IP"
 
#define PRECISE_IP_CHAR_MODIFIER   'p'
 
#define PRECISE_IP_SUFFIX   ":p"
 
#define PRECISE_IP_MAX_SUFFIX   ":P"
 
#define DELIMITER_HOWOFTEN   '@'
 

Functions

static long getEnvLong (const char *env_var, long default_value)
 
static char * strlaststr (const char *haystack, const char *needle)
 
static const char * find_precise_suffix (const char *s, const char *suffix, char allowed)
 
int perf_skid_set_max_precise_ip (struct perf_event_attr *attr)
 
u64 perf_skid_get_precise_ip (struct perf_event_attr *attr)
 
int perf_skid_parse_event (const char *event_string, char **event_string_without_skidmarks)
 

Variables

const int perf_skid_precision []
 
const int perf_skid_flavors = sizeof(perf_skid_precision)/sizeof(int)
 

Macro Definition Documentation

◆ DELIMITER_HOWOFTEN

#define DELIMITER_HOWOFTEN   '@'

Definition at line 84 of file perf_skid.c.

◆ HPCRUN_OPTION_PRECISE_IP

#define HPCRUN_OPTION_PRECISE_IP   "HPCRUN_PRECISE_IP"

Definition at line 77 of file perf_skid.c.

◆ PRECISE_IP_CHAR_MODIFIER

#define PRECISE_IP_CHAR_MODIFIER   'p'

Definition at line 79 of file perf_skid.c.

◆ PRECISE_IP_MAX_SUFFIX

#define PRECISE_IP_MAX_SUFFIX   ":P"

Definition at line 82 of file perf_skid.c.

◆ PRECISE_IP_SUFFIX

#define PRECISE_IP_SUFFIX   ":p"

Definition at line 81 of file perf_skid.c.

Function Documentation

◆ find_precise_suffix()

static const char* find_precise_suffix ( const char *  s,
const char *  suffix,
char  allowed 
)
static

Definition at line 143 of file perf_skid.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ getEnvLong()

static long getEnvLong ( const char *  env_var,
long  default_value 
)
static

Definition at line 109 of file perf_skid.c.

Here is the caller graph for this function:

◆ perf_skid_get_precise_ip()

u64 perf_skid_get_precise_ip ( struct perf_event_attr *  attr)

Definition at line 207 of file perf_skid.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ perf_skid_parse_event()

int perf_skid_parse_event ( const char *  event_string,
char **  event_string_without_skidmarks 
)

Definition at line 243 of file perf_skid.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ perf_skid_set_max_precise_ip()

int perf_skid_set_max_precise_ip ( struct perf_event_attr *  attr)

set precise_ip attribute to the max value

TODO: this method only works on some platforms, and not general enough on all the platforms.

Definition at line 176 of file perf_skid.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ strlaststr()

static char* strlaststr ( const char *  haystack,
const char *  needle 
)
static

Definition at line 126 of file perf_skid.c.

Here is the caller graph for this function:

Variable Documentation

◆ perf_skid_flavors

const int perf_skid_flavors = sizeof(perf_skid_precision)/sizeof(int)

Definition at line 98 of file perf_skid.c.

◆ perf_skid_precision

const int perf_skid_precision[]
Initial value:
= {
}
#define PERF_EVENT_SKID_ZERO_REQUIRED
Definition: perf_skid.h:50
#define PERF_EVENT_SKID_CONSTANT
Definition: perf_skid.h:52
#define PERF_EVENT_SKID_ARBITRARY
Definition: perf_skid.h:53
#define PERF_EVENT_SKID_ZERO_REQUESTED
Definition: perf_skid.h:51

Definition at line 91 of file perf_skid.c.