Linux Perf
intel-bts.c File Reference
#include <endian.h>
#include <errno.h>
#include <byteswap.h>
#include <inttypes.h>
#include <linux/kernel.h>
#include <linux/types.h>
#include <linux/bitops.h>
#include <linux/log2.h>
#include "cpumap.h"
#include "color.h"
#include "evsel.h"
#include "evlist.h"
#include "machine.h"
#include "session.h"
#include "util.h"
#include "thread.h"
#include "thread-stack.h"
#include "debug.h"
#include "tsc.h"
#include "auxtrace.h"
#include "intel-pt-decoder/intel-pt-insn-decoder.h"
#include "intel-bts.h"
Include dependency graph for intel-bts.c:

Go to the source code of this file.

Classes

struct  intel_bts
 
struct  intel_bts_queue
 
struct  branch
 
struct  intel_bts_synth
 

Macros

#define MAX_TIMESTAMP   (~0ULL)
 
#define INTEL_BTS_ERR_NOINSN   5
 
#define INTEL_BTS_ERR_LOST   9
 
#define le64_to_cpu   bswap_64
 

Functions

static void intel_bts_dump (struct intel_bts *bts __maybe_unused, unsigned char *buf, size_t len)
 
static void intel_bts_dump_event (struct intel_bts *bts, unsigned char *buf, size_t len)
 
static int intel_bts_lost (struct intel_bts *bts, struct perf_sample *sample)
 
static struct intel_bts_queueintel_bts_alloc_queue (struct intel_bts *bts, unsigned int queue_nr)
 
static int intel_bts_setup_queue (struct intel_bts *bts, struct auxtrace_queue *queue, unsigned int queue_nr)
 
static int intel_bts_setup_queues (struct intel_bts *bts)
 
static int intel_bts_update_queues (struct intel_bts *bts)
 
static unsigned char * intel_bts_find_overlap (unsigned char *buf_a, size_t len_a, unsigned char *buf_b, size_t len_b)
 
static int intel_bts_do_fix_overlap (struct auxtrace_queue *queue, struct auxtrace_buffer *b)
 
static int intel_bts_synth_branch_sample (struct intel_bts_queue *btsq, struct branch *branch)
 
static int intel_bts_get_next_insn (struct intel_bts_queue *btsq, u64 ip)
 
static int intel_bts_synth_error (struct intel_bts *bts, int cpu, pid_t pid, pid_t tid, u64 ip)
 
static int intel_bts_get_branch_type (struct intel_bts_queue *btsq, struct branch *branch)
 
static int intel_bts_process_buffer (struct intel_bts_queue *btsq, struct auxtrace_buffer *buffer, struct thread *thread)
 
static int intel_bts_process_queue (struct intel_bts_queue *btsq, u64 *timestamp)
 
static int intel_bts_flush_queue (struct intel_bts_queue *btsq)
 
static int intel_bts_process_tid_exit (struct intel_bts *bts, pid_t tid)
 
static int intel_bts_process_queues (struct intel_bts *bts, u64 timestamp)
 
static int intel_bts_process_event (struct perf_session *session, union perf_event *event, struct perf_sample *sample, struct perf_tool *tool)
 
static int intel_bts_process_auxtrace_event (struct perf_session *session, union perf_event *event, struct perf_tool *tool __maybe_unused)
 
static int intel_bts_flush (struct perf_session *session, struct perf_tool *tool __maybe_unused)
 
static void intel_bts_free_queue (void *priv)
 
static void intel_bts_free_events (struct perf_session *session)
 
static void intel_bts_free (struct perf_session *session)
 
static int intel_bts_event_synth (struct perf_tool *tool, union perf_event *event, struct perf_sample *sample __maybe_unused, struct machine *machine __maybe_unused)
 
static int intel_bts_synth_event (struct perf_session *session, struct perf_event_attr *attr, u64 id)
 
static int intel_bts_synth_events (struct intel_bts *bts, struct perf_session *session)
 
static void intel_bts_print_info (u64 *arr, int start, int finish)
 
int intel_bts_process_auxtrace_info (union perf_event *event, struct perf_session *session)
 

Variables

static const char *const intel_bts_info_fmts []
 

Macro Definition Documentation

◆ INTEL_BTS_ERR_LOST

#define INTEL_BTS_ERR_LOST   9

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

◆ INTEL_BTS_ERR_NOINSN

#define INTEL_BTS_ERR_NOINSN   5

Definition at line 42 of file intel-bts.c.

◆ le64_to_cpu

#define le64_to_cpu   bswap_64

Definition at line 46 of file intel-bts.c.

◆ MAX_TIMESTAMP

#define MAX_TIMESTAMP   (~0ULL)

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

Function Documentation

◆ intel_bts_alloc_queue()

static struct intel_bts_queue* intel_bts_alloc_queue ( struct intel_bts bts,
unsigned int  queue_nr 
)
static

Definition at line 155 of file intel-bts.c.

Here is the call graph for this function:

◆ intel_bts_do_fix_overlap()

static int intel_bts_do_fix_overlap ( struct auxtrace_queue queue,
struct auxtrace_buffer b 
)
static

Definition at line 255 of file intel-bts.c.

Here is the call graph for this function:

◆ intel_bts_dump()

static void intel_bts_dump ( struct intel_bts *bts  __maybe_unused,
unsigned char *  buf,
size_t  len 
)
static

Definition at line 93 of file intel-bts.c.

Here is the call graph for this function:

◆ intel_bts_dump_event()

static void intel_bts_dump_event ( struct intel_bts bts,
unsigned char *  buf,
size_t  len 
)
static

Definition at line 131 of file intel-bts.c.

Here is the call graph for this function:

◆ intel_bts_event_synth()

static int intel_bts_event_synth ( struct perf_tool tool,
union perf_event event,
struct perf_sample *sample  __maybe_unused,
struct machine *machine  __maybe_unused 
)
static

Definition at line 752 of file intel-bts.c.

Here is the call graph for this function:

◆ intel_bts_find_overlap()

static unsigned char* intel_bts_find_overlap ( unsigned char *  buf_a,
size_t  len_a,
unsigned char *  buf_b,
size_t  len_b 
)
static

Definition at line 236 of file intel-bts.c.

◆ intel_bts_flush()

static int intel_bts_flush ( struct perf_session session,
struct perf_tool *tool  __maybe_unused 
)
static

Definition at line 693 of file intel-bts.c.

Here is the call graph for this function:

◆ intel_bts_flush_queue()

static int intel_bts_flush_queue ( struct intel_bts_queue btsq)
static

Definition at line 538 of file intel-bts.c.

Here is the call graph for this function:

◆ intel_bts_free()

static void intel_bts_free ( struct perf_session session)
static

Definition at line 736 of file intel-bts.c.

Here is the call graph for this function:

◆ intel_bts_free_events()

static void intel_bts_free_events ( struct perf_session session)
static

Definition at line 722 of file intel-bts.c.

Here is the call graph for this function:

◆ intel_bts_free_queue()

static void intel_bts_free_queue ( void *  priv)
static

Definition at line 713 of file intel-bts.c.

Here is the call graph for this function:

◆ intel_bts_get_branch_type()

static int intel_bts_get_branch_type ( struct intel_bts_queue btsq,
struct branch branch 
)
static

Definition at line 378 of file intel-bts.c.

Here is the call graph for this function:

◆ intel_bts_get_next_insn()

static int intel_bts_get_next_insn ( struct intel_bts_queue btsq,
u64  ip 
)
static

Definition at line 318 of file intel-bts.c.

Here is the call graph for this function:

◆ intel_bts_lost()

static int intel_bts_lost ( struct intel_bts bts,
struct perf_sample sample 
)
static

Definition at line 138 of file intel-bts.c.

Here is the call graph for this function:

◆ intel_bts_print_info()

static void intel_bts_print_info ( u64 *  arr,
int  start,
int  finish 
)
static

Definition at line 853 of file intel-bts.c.

◆ intel_bts_process_auxtrace_event()

static int intel_bts_process_auxtrace_event ( struct perf_session session,
union perf_event event,
struct perf_tool *tool  __maybe_unused 
)
static

Definition at line 651 of file intel-bts.c.

Here is the call graph for this function:

◆ intel_bts_process_auxtrace_info()

int intel_bts_process_auxtrace_info ( union perf_event event,
struct perf_session session 
)

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

Here is the call graph for this function:

◆ intel_bts_process_buffer()

static int intel_bts_process_buffer ( struct intel_bts_queue btsq,
struct auxtrace_buffer buffer,
struct thread thread 
)
static

Definition at line 422 of file intel-bts.c.

Here is the call graph for this function:

◆ intel_bts_process_event()

static int intel_bts_process_event ( struct perf_session session,
union perf_event event,
struct perf_sample sample,
struct perf_tool tool 
)
static

Definition at line 607 of file intel-bts.c.

Here is the call graph for this function:

◆ intel_bts_process_queue()

static int intel_bts_process_queue ( struct intel_bts_queue btsq,
u64 *  timestamp 
)
static

Definition at line 461 of file intel-bts.c.

Here is the call graph for this function:

◆ intel_bts_process_queues()

static int intel_bts_process_queues ( struct intel_bts bts,
u64  timestamp 
)
static

Definition at line 568 of file intel-bts.c.

Here is the call graph for this function:

◆ intel_bts_process_tid_exit()

static int intel_bts_process_tid_exit ( struct intel_bts bts,
pid_t  tid 
)
static

Definition at line 553 of file intel-bts.c.

Here is the call graph for this function:

◆ intel_bts_setup_queue()

static int intel_bts_setup_queue ( struct intel_bts bts,
struct auxtrace_queue queue,
unsigned int  queue_nr 
)
static

Definition at line 173 of file intel-bts.c.

Here is the call graph for this function:

◆ intel_bts_setup_queues()

static int intel_bts_setup_queues ( struct intel_bts bts)
static

Definition at line 213 of file intel-bts.c.

Here is the call graph for this function:

◆ intel_bts_synth_branch_sample()

static int intel_bts_synth_branch_sample ( struct intel_bts_queue btsq,
struct branch branch 
)
static

Definition at line 272 of file intel-bts.c.

Here is the call graph for this function:

◆ intel_bts_synth_error()

static int intel_bts_synth_error ( struct intel_bts bts,
int  cpu,
pid_t  pid,
pid_t  tid,
u64  ip 
)
static

Definition at line 360 of file intel-bts.c.

Here is the call graph for this function:

◆ intel_bts_synth_event()

static int intel_bts_synth_event ( struct perf_session session,
struct perf_event_attr *  attr,
u64  id 
)
static

Definition at line 764 of file intel-bts.c.

Here is the call graph for this function:

◆ intel_bts_synth_events()

static int intel_bts_synth_events ( struct intel_bts bts,
struct perf_session session 
)
static

Definition at line 776 of file intel-bts.c.

Here is the call graph for this function:

◆ intel_bts_update_queues()

static int intel_bts_update_queues ( struct intel_bts bts)
inlinestatic

Definition at line 227 of file intel-bts.c.

Here is the call graph for this function:

Variable Documentation

◆ intel_bts_info_fmts

const char* const intel_bts_info_fmts[]
static
Initial value:
= {
[INTEL_BTS_PMU_TYPE] = " PMU Type %"PRId64"\n",
[INTEL_BTS_TIME_SHIFT] = " Time Shift %"PRIu64"\n",
[INTEL_BTS_TIME_MULT] = " Time Muliplier %"PRIu64"\n",
[INTEL_BTS_TIME_ZERO] = " Time Zero %"PRIu64"\n",
[INTEL_BTS_CAP_USER_TIME_ZERO] = " Cap Time Zero %"PRId64"\n",
[INTEL_BTS_SNAPSHOT_MODE] = " Snapshot mode %"PRId64"\n",
}

Definition at line 844 of file intel-bts.c.