Linux Perf
intel-pt.c File Reference
#include <errno.h>
#include <stdbool.h>
#include <linux/kernel.h>
#include <linux/types.h>
#include <linux/bitops.h>
#include <linux/log2.h>
#include <cpuid.h>
#include "../../perf.h"
#include "../../util/session.h"
#include "../../util/event.h"
#include "../../util/evlist.h"
#include "../../util/evsel.h"
#include "../../util/cpumap.h"
#include <subcmd/parse-options.h>
#include "../../util/parse-events.h"
#include "../../util/pmu.h"
#include "../../util/debug.h"
#include "../../util/auxtrace.h"
#include "../../util/tsc.h"
#include "../../util/intel-pt.h"
Include dependency graph for intel-pt.c:

Go to the source code of this file.

Classes

struct  intel_pt_snapshot_ref
 
struct  intel_pt_recording
 

Macros

#define KiB(x)   ((x) * 1024)
 
#define MiB(x)   ((x) * 1024 * 1024)
 
#define KiB_MASK(x)   (KiB(x) - 1)
 
#define MiB_MASK(x)   (MiB(x) - 1)
 
#define INTEL_PT_PSB_PERIOD_NEAR   256
 

Functions

static int intel_pt_parse_terms_with_default (struct list_head *formats, const char *str, u64 *config)
 
static int intel_pt_parse_terms (struct list_head *formats, const char *str, u64 *config)
 
static u64 intel_pt_masked_bits (u64 mask, u64 bits)
 
static int intel_pt_read_config (struct perf_pmu *intel_pt_pmu, const char *str, struct perf_evlist *evlist, u64 *res)
 
static size_t intel_pt_psb_period (struct perf_pmu *intel_pt_pmu, struct perf_evlist *evlist)
 
static int intel_pt_pick_bit (int bits, int target)
 
static u64 intel_pt_default_config (struct perf_pmu *intel_pt_pmu)
 
static int intel_pt_parse_snapshot_options (struct auxtrace_record *itr, struct record_opts *opts, const char *str)
 
struct perf_event_attr * intel_pt_pmu_default_config (struct perf_pmu *intel_pt_pmu)
 
static const char * intel_pt_find_filter (struct perf_evlist *evlist, struct perf_pmu *intel_pt_pmu)
 
static size_t intel_pt_filter_bytes (const char *filter)
 
static size_t intel_pt_info_priv_size (struct auxtrace_record *itr, struct perf_evlist *evlist)
 
static void intel_pt_tsc_ctc_ratio (u32 *n, u32 *d)
 
static int intel_pt_info_fill (struct auxtrace_record *itr, struct perf_session *session, struct auxtrace_info_event *auxtrace_info, size_t priv_size)
 
static int intel_pt_track_switches (struct perf_evlist *evlist)
 
static void intel_pt_valid_str (char *str, size_t len, u64 valid)
 
static int intel_pt_val_config_term (struct perf_pmu *intel_pt_pmu, const char *caps, const char *name, const char *supported, u64 config)
 
static int intel_pt_validate_config (struct perf_pmu *intel_pt_pmu, struct perf_evsel *evsel)
 
static int intel_pt_recording_options (struct auxtrace_record *itr, struct perf_evlist *evlist, struct record_opts *opts)
 
static int intel_pt_snapshot_start (struct auxtrace_record *itr)
 
static int intel_pt_snapshot_finish (struct auxtrace_record *itr)
 
static int intel_pt_alloc_snapshot_refs (struct intel_pt_recording *ptr, int idx)
 
static void intel_pt_free_snapshot_refs (struct intel_pt_recording *ptr)
 
static void intel_pt_recording_free (struct auxtrace_record *itr)
 
static int intel_pt_alloc_snapshot_ref (struct intel_pt_recording *ptr, int idx, size_t snapshot_buf_size)
 
static size_t intel_pt_snapshot_ref_buf_size (struct intel_pt_recording *ptr, size_t snapshot_buf_size)
 
static int intel_pt_snapshot_init (struct intel_pt_recording *ptr, size_t snapshot_buf_size)
 
static bool intel_pt_compare_buffers (void *buf1, size_t compare_size, void *buf2, size_t offs2, size_t buf2_size)
 
static bool intel_pt_compare_ref (void *ref_buf, size_t ref_offset, size_t ref_size, size_t buf_size, void *data, size_t head)
 
static void intel_pt_copy_ref (void *ref_buf, size_t ref_size, size_t buf_size, void *data, size_t head)
 
static bool intel_pt_wrapped (struct intel_pt_recording *ptr, int idx, struct auxtrace_mmap *mm, unsigned char *data, u64 head)
 
static bool intel_pt_first_wrap (u64 *data, size_t buf_size)
 
static int intel_pt_find_snapshot (struct auxtrace_record *itr, int idx, struct auxtrace_mmap *mm, unsigned char *data, u64 *head, u64 *old)
 
static u64 intel_pt_reference (struct auxtrace_record *itr __maybe_unused)
 
static int intel_pt_read_finish (struct auxtrace_record *itr, int idx)
 
struct auxtrace_recordintel_pt_recording_init (int *err)
 

Macro Definition Documentation

◆ INTEL_PT_PSB_PERIOD_NEAR

#define INTEL_PT_PSB_PERIOD_NEAR   256

Definition at line 43 of file intel-pt.c.

◆ KiB

#define KiB (   x)    ((x) * 1024)

Definition at line 38 of file intel-pt.c.

◆ KiB_MASK

#define KiB_MASK (   x)    (KiB(x) - 1)

Definition at line 40 of file intel-pt.c.

◆ MiB

#define MiB (   x)    ((x) * 1024 * 1024)

Definition at line 39 of file intel-pt.c.

◆ MiB_MASK

#define MiB_MASK (   x)    (MiB(x) - 1)

Definition at line 41 of file intel-pt.c.

Function Documentation

◆ intel_pt_alloc_snapshot_ref()

static int intel_pt_alloc_snapshot_ref ( struct intel_pt_recording ptr,
int  idx,
size_t  snapshot_buf_size 
)
static

Definition at line 848 of file intel-pt.c.

Here is the call graph for this function:

◆ intel_pt_alloc_snapshot_refs()

static int intel_pt_alloc_snapshot_refs ( struct intel_pt_recording ptr,
int  idx 
)
static

Definition at line 806 of file intel-pt.c.

Here is the call graph for this function:

◆ intel_pt_compare_buffers()

static bool intel_pt_compare_buffers ( void *  buf1,
size_t  compare_size,
void *  buf2,
size_t  offs2,
size_t  buf2_size 
)
static

intel_pt_compare_buffers - compare bytes in a buffer to a circular buffer. : first buffer : number of bytes to compare : second buffer (a circular buffer) : offset in second buffer : size of second buffer

The comparison allows for the possibility that the bytes to compare in the circular buffer are not contiguous. It is assumed that <= . This function returns false if the bytes are identical, true otherwise.

Definition at line 916 of file intel-pt.c.

◆ intel_pt_compare_ref()

static bool intel_pt_compare_ref ( void *  ref_buf,
size_t  ref_offset,
size_t  ref_size,
size_t  buf_size,
void *  data,
size_t  head 
)
static

Definition at line 933 of file intel-pt.c.

Here is the call graph for this function:

◆ intel_pt_copy_ref()

static void intel_pt_copy_ref ( void *  ref_buf,
size_t  ref_size,
size_t  buf_size,
void *  data,
size_t  head 
)
static

Definition at line 950 of file intel-pt.c.

Here is the call graph for this function:

◆ intel_pt_default_config()

static u64 intel_pt_default_config ( struct perf_pmu intel_pt_pmu)
static

Definition at line 188 of file intel-pt.c.

Here is the call graph for this function:

◆ intel_pt_filter_bytes()

static size_t intel_pt_filter_bytes ( const char *  filter)
static

Definition at line 292 of file intel-pt.c.

◆ intel_pt_find_filter()

static const char* intel_pt_find_filter ( struct perf_evlist evlist,
struct perf_pmu intel_pt_pmu 
)
static

Definition at line 279 of file intel-pt.c.

◆ intel_pt_find_snapshot()

static int intel_pt_find_snapshot ( struct auxtrace_record itr,
int  idx,
struct auxtrace_mmap mm,
unsigned char *  data,
u64 *  head,
u64 *  old 
)
static

Definition at line 996 of file intel-pt.c.

Here is the call graph for this function:

◆ intel_pt_first_wrap()

static bool intel_pt_first_wrap ( u64 *  data,
size_t  buf_size 
)
static

Definition at line 979 of file intel-pt.c.

◆ intel_pt_free_snapshot_refs()

static void intel_pt_free_snapshot_refs ( struct intel_pt_recording ptr)
static

Definition at line 830 of file intel-pt.c.

◆ intel_pt_info_fill()

static int intel_pt_info_fill ( struct auxtrace_record itr,
struct perf_session session,
struct auxtrace_info_event auxtrace_info,
size_t  priv_size 
)
static

Definition at line 321 of file intel-pt.c.

Here is the call graph for this function:

◆ intel_pt_info_priv_size()

static size_t intel_pt_info_priv_size ( struct auxtrace_record itr,
struct perf_evlist evlist 
)
static

Definition at line 300 of file intel-pt.c.

Here is the call graph for this function:

◆ intel_pt_masked_bits()

static u64 intel_pt_masked_bits ( u64  mask,
u64  bits 
)
static

Definition at line 101 of file intel-pt.c.

◆ intel_pt_parse_snapshot_options()

static int intel_pt_parse_snapshot_options ( struct auxtrace_record itr,
struct record_opts opts,
const char *  str 
)
static

Definition at line 240 of file intel-pt.c.

◆ intel_pt_parse_terms()

static int intel_pt_parse_terms ( struct list_head *  formats,
const char *  str,
u64 *  config 
)
static

Definition at line 94 of file intel-pt.c.

Here is the call graph for this function:

◆ intel_pt_parse_terms_with_default()

static int intel_pt_parse_terms_with_default ( struct list_head *  formats,
const char *  str,
u64 *  config 
)
static

Definition at line 65 of file intel-pt.c.

Here is the call graph for this function:

◆ intel_pt_pick_bit()

static int intel_pt_pick_bit ( int  bits,
int  target 
)
static

Definition at line 172 of file intel-pt.c.

◆ intel_pt_pmu_default_config()

struct perf_event_attr* intel_pt_pmu_default_config ( struct perf_pmu intel_pt_pmu)

Definition at line 264 of file intel-pt.c.

Here is the call graph for this function:

◆ intel_pt_psb_period()

static size_t intel_pt_psb_period ( struct perf_pmu intel_pt_pmu,
struct perf_evlist evlist 
)
static

Definition at line 142 of file intel-pt.c.

Here is the call graph for this function:

◆ intel_pt_read_config()

static int intel_pt_read_config ( struct perf_pmu intel_pt_pmu,
const char *  str,
struct perf_evlist evlist,
u64 *  res 
)
static

Definition at line 120 of file intel-pt.c.

Here is the call graph for this function:

◆ intel_pt_read_finish()

static int intel_pt_read_finish ( struct auxtrace_record itr,
int  idx 
)
static

Definition at line 1066 of file intel-pt.c.

Here is the call graph for this function:

◆ intel_pt_recording_free()

static void intel_pt_recording_free ( struct auxtrace_record itr)
static

Definition at line 839 of file intel-pt.c.

Here is the call graph for this function:

◆ intel_pt_recording_init()

struct auxtrace_record* intel_pt_recording_init ( int *  err)

Definition at line 1080 of file intel-pt.c.

Here is the call graph for this function:

◆ intel_pt_recording_options()

static int intel_pt_recording_options ( struct auxtrace_record itr,
struct perf_evlist evlist,
struct record_opts opts 
)
static

Definition at line 548 of file intel-pt.c.

Here is the call graph for this function:

◆ intel_pt_reference()

static u64 intel_pt_reference ( struct auxtrace_record *itr  __maybe_unused)
static

Definition at line 1061 of file intel-pt.c.

Here is the call graph for this function:

◆ intel_pt_snapshot_finish()

static int intel_pt_snapshot_finish ( struct auxtrace_record itr)
static

Definition at line 793 of file intel-pt.c.

Here is the call graph for this function:

◆ intel_pt_snapshot_init()

static int intel_pt_snapshot_init ( struct intel_pt_recording ptr,
size_t  snapshot_buf_size 
)
static

Definition at line 889 of file intel-pt.c.

Here is the call graph for this function:

◆ intel_pt_snapshot_ref_buf_size()

static size_t intel_pt_snapshot_ref_buf_size ( struct intel_pt_recording ptr,
size_t  snapshot_buf_size 
)
static

Definition at line 864 of file intel-pt.c.

Here is the call graph for this function:

◆ intel_pt_snapshot_start()

static int intel_pt_snapshot_start ( struct auxtrace_record itr)
static

Definition at line 780 of file intel-pt.c.

Here is the call graph for this function:

◆ intel_pt_track_switches()

static int intel_pt_track_switches ( struct perf_evlist evlist)
static

Definition at line 409 of file intel-pt.c.

Here is the call graph for this function:

◆ intel_pt_tsc_ctc_ratio()

static void intel_pt_tsc_ctc_ratio ( u32 *  n,
u32 *  d 
)
static

Definition at line 312 of file intel-pt.c.

Here is the call graph for this function:

◆ intel_pt_val_config_term()

static int intel_pt_val_config_term ( struct perf_pmu intel_pt_pmu,
const char *  caps,
const char *  name,
const char *  supported,
u64  config 
)
static

Definition at line 483 of file intel-pt.c.

Here is the call graph for this function:

◆ intel_pt_valid_str()

static void intel_pt_valid_str ( char *  str,
size_t  len,
u64  valid 
)
static

Definition at line 437 of file intel-pt.c.

◆ intel_pt_validate_config()

static int intel_pt_validate_config ( struct perf_pmu intel_pt_pmu,
struct perf_evsel evsel 
)
static

Definition at line 523 of file intel-pt.c.

Here is the call graph for this function:

◆ intel_pt_wrapped()

static bool intel_pt_wrapped ( struct intel_pt_recording ptr,
int  idx,
struct auxtrace_mmap mm,
unsigned char *  data,
u64  head 
)
static

Definition at line 962 of file intel-pt.c.

Here is the call graph for this function: