Linux Perf
cs-etm.c File Reference
#include <linux/bitops.h>
#include <linux/err.h>
#include <linux/kernel.h>
#include <linux/log2.h>
#include <linux/types.h>
#include <stdlib.h>
#include "auxtrace.h"
#include "color.h"
#include "cs-etm.h"
#include "cs-etm-decoder/cs-etm-decoder.h"
#include "debug.h"
#include "evlist.h"
#include "intlist.h"
#include "machine.h"
#include "map.h"
#include "perf.h"
#include "thread.h"
#include "thread_map.h"
#include "thread-stack.h"
#include "util.h"
Include dependency graph for cs-etm.c:

Go to the source code of this file.

Classes

struct  cs_etm_auxtrace
 
struct  cs_etm_queue
 
struct  cs_etm_synth
 

Macros

#define MAX_TIMESTAMP   (~0ULL)
 
#define A64_INSTR_SIZE   4
 

Functions

static int cs_etm__update_queues (struct cs_etm_auxtrace *etm)
 
static int cs_etm__process_timeless_queues (struct cs_etm_auxtrace *etm, pid_t tid, u64 time_)
 
static void cs_etm__packet_dump (const char *pkt_string)
 
static void cs_etm__dump_event (struct cs_etm_auxtrace *etm, struct auxtrace_buffer *buffer)
 
static int cs_etm__flush_events (struct perf_session *session, struct perf_tool *tool)
 
static void cs_etm__free_queue (void *priv)
 
static void cs_etm__free_events (struct perf_session *session)
 
static void cs_etm__free (struct perf_session *session)
 
static u32 cs_etm__mem_access (struct cs_etm_queue *etmq, u64 address, size_t size, u8 *buffer)
 
static struct cs_etm_queuecs_etm__alloc_queue (struct cs_etm_auxtrace *etm, unsigned int queue_nr)
 
static int cs_etm__setup_queue (struct cs_etm_auxtrace *etm, struct auxtrace_queue *queue, unsigned int queue_nr)
 
static int cs_etm__setup_queues (struct cs_etm_auxtrace *etm)
 
static void cs_etm__copy_last_branch_rb (struct cs_etm_queue *etmq)
 
static void cs_etm__reset_last_branch_rb (struct cs_etm_queue *etmq)
 
static u64 cs_etm__last_executed_instr (struct cs_etm_packet *packet)
 
static u64 cs_etm__instr_count (const struct cs_etm_packet *packet)
 
static u64 cs_etm__instr_addr (const struct cs_etm_packet *packet, u64 offset)
 
static void cs_etm__update_last_branch_rb (struct cs_etm_queue *etmq)
 
static int cs_etm__inject_event (union perf_event *event, struct perf_sample *sample, u64 type)
 
static int cs_etm__get_trace (struct cs_etm_buffer *buff, struct cs_etm_queue *etmq)
 
static void cs_etm__set_pid_tid_cpu (struct cs_etm_auxtrace *etm, struct auxtrace_queue *queue)
 
static int cs_etm__synth_instruction_sample (struct cs_etm_queue *etmq, u64 addr, u64 period)
 
static int cs_etm__synth_branch_sample (struct cs_etm_queue *etmq)
 
static int cs_etm__event_synth (struct perf_tool *tool, union perf_event *event, struct perf_sample *sample __maybe_unused, struct machine *machine __maybe_unused)
 
static int cs_etm__synth_event (struct perf_session *session, struct perf_event_attr *attr, u64 id)
 
static int cs_etm__synth_events (struct cs_etm_auxtrace *etm, struct perf_session *session)
 
static int cs_etm__sample (struct cs_etm_queue *etmq)
 
static int cs_etm__flush (struct cs_etm_queue *etmq)
 
static int cs_etm__run_decoder (struct cs_etm_queue *etmq)
 
static int cs_etm__process_event (struct perf_session *session, union perf_event *event, struct perf_sample *sample, struct perf_tool *tool)
 
static int cs_etm__process_auxtrace_event (struct perf_session *session, union perf_event *event, struct perf_tool *tool __maybe_unused)
 
static bool cs_etm__is_timeless_decoding (struct cs_etm_auxtrace *etm)
 
static void cs_etm__print_auxtrace_info (u64 *val, int num)
 
int cs_etm__process_auxtrace_info (union perf_event *event, struct perf_session *session)
 

Variables

static const char *const cs_etm_global_header_fmts []
 
static const char *const cs_etm_priv_fmts []
 
static const char *const cs_etmv4_priv_fmts []
 

Macro Definition Documentation

◆ A64_INSTR_SIZE

#define A64_INSTR_SIZE   4

Definition at line 40 of file cs-etm.c.

◆ MAX_TIMESTAMP

#define MAX_TIMESTAMP   (~0ULL)

Definition at line 32 of file cs-etm.c.

Function Documentation

◆ cs_etm__alloc_queue()

static struct cs_etm_queue* cs_etm__alloc_queue ( struct cs_etm_auxtrace etm,
unsigned int  queue_nr 
)
static

Definition at line 292 of file cs-etm.c.

Here is the call graph for this function:

◆ cs_etm__copy_last_branch_rb()

static void cs_etm__copy_last_branch_rb ( struct cs_etm_queue etmq)
inlinestatic

Definition at line 447 of file cs-etm.c.

Here is the call graph for this function:

◆ cs_etm__dump_event()

static void cs_etm__dump_event ( struct cs_etm_auxtrace etm,
struct auxtrace_buffer buffer 
)
static

Definition at line 107 of file cs-etm.c.

Here is the call graph for this function:

◆ cs_etm__event_synth()

static int cs_etm__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 748 of file cs-etm.c.

Here is the call graph for this function:

◆ cs_etm__flush()

static int cs_etm__flush ( struct cs_etm_queue etmq)
static

Definition at line 922 of file cs-etm.c.

Here is the call graph for this function:

◆ cs_etm__flush_events()

static int cs_etm__flush_events ( struct perf_session session,
struct perf_tool tool 
)
static

Definition at line 166 of file cs-etm.c.

Here is the call graph for this function:

◆ cs_etm__free()

static void cs_etm__free ( struct perf_session session)
static

Definition at line 223 of file cs-etm.c.

Here is the call graph for this function:

◆ cs_etm__free_events()

static void cs_etm__free_events ( struct perf_session session)
static

Definition at line 207 of file cs-etm.c.

Here is the call graph for this function:

◆ cs_etm__free_queue()

static void cs_etm__free_queue ( void *  priv)
static

Definition at line 190 of file cs-etm.c.

Here is the call graph for this function:

◆ cs_etm__get_trace()

static int cs_etm__get_trace ( struct cs_etm_buffer buff,
struct cs_etm_queue etmq 
)
static

Definition at line 571 of file cs-etm.c.

Here is the call graph for this function:

◆ cs_etm__inject_event()

static int cs_etm__inject_event ( union perf_event event,
struct perf_sample sample,
u64  type 
)
static

Definition at line 562 of file cs-etm.c.

Here is the call graph for this function:

◆ cs_etm__instr_addr()

static u64 cs_etm__instr_addr ( const struct cs_etm_packet packet,
u64  offset 
)
inlinestatic

Definition at line 519 of file cs-etm.c.

◆ cs_etm__instr_count()

static u64 cs_etm__instr_count ( const struct cs_etm_packet packet)
inlinestatic

Definition at line 508 of file cs-etm.c.

◆ cs_etm__is_timeless_decoding()

static bool cs_etm__is_timeless_decoding ( struct cs_etm_auxtrace etm)
static

Definition at line 1135 of file cs-etm.c.

◆ cs_etm__last_executed_instr()

static u64 cs_etm__last_executed_instr ( struct cs_etm_packet packet)
inlinestatic

Definition at line 495 of file cs-etm.c.

◆ cs_etm__mem_access()

static u32 cs_etm__mem_access ( struct cs_etm_queue etmq,
u64  address,
size_t  size,
u8 *  buffer 
)
static

Definition at line 247 of file cs-etm.c.

Here is the call graph for this function:

◆ cs_etm__packet_dump()

static void cs_etm__packet_dump ( const char *  pkt_string)
static

Definition at line 94 of file cs-etm.c.

Here is the call graph for this function:

◆ cs_etm__print_auxtrace_info()

static void cs_etm__print_auxtrace_info ( u64 *  val,
int  num 
)
static

Definition at line 1180 of file cs-etm.c.

◆ cs_etm__process_auxtrace_event()

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

Definition at line 1098 of file cs-etm.c.

Here is the call graph for this function:

◆ cs_etm__process_auxtrace_info()

int cs_etm__process_auxtrace_info ( union perf_event event,
struct perf_session session 
)

Definition at line 1200 of file cs-etm.c.

Here is the call graph for this function:

◆ cs_etm__process_event()

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

Definition at line 1057 of file cs-etm.c.

Here is the call graph for this function:

◆ cs_etm__process_timeless_queues()

static int cs_etm__process_timeless_queues ( struct cs_etm_auxtrace etm,
pid_t  tid,
u64  time_ 
)
static

Definition at line 1037 of file cs-etm.c.

Here is the call graph for this function:

◆ cs_etm__reset_last_branch_rb()

static void cs_etm__reset_last_branch_rb ( struct cs_etm_queue etmq)
inlinestatic

Definition at line 489 of file cs-etm.c.

◆ cs_etm__run_decoder()

static int cs_etm__run_decoder ( struct cs_etm_queue etmq)
static

Definition at line 956 of file cs-etm.c.

Here is the call graph for this function:

◆ cs_etm__sample()

static int cs_etm__sample ( struct cs_etm_queue etmq)
static

Definition at line 852 of file cs-etm.c.

Here is the call graph for this function:

◆ cs_etm__set_pid_tid_cpu()

static void cs_etm__set_pid_tid_cpu ( struct cs_etm_auxtrace etm,
struct auxtrace_queue queue 
)
static

Definition at line 614 of file cs-etm.c.

Here is the call graph for this function:

◆ cs_etm__setup_queue()

static int cs_etm__setup_queue ( struct cs_etm_auxtrace etm,
struct auxtrace_queue queue,
unsigned int  queue_nr 
)
static

Definition at line 399 of file cs-etm.c.

Here is the call graph for this function:

◆ cs_etm__setup_queues()

static int cs_etm__setup_queues ( struct cs_etm_auxtrace etm)
static

Definition at line 423 of file cs-etm.c.

Here is the call graph for this function:

◆ cs_etm__synth_branch_sample()

static int cs_etm__synth_branch_sample ( struct cs_etm_queue etmq)
static

Definition at line 686 of file cs-etm.c.

Here is the call graph for this function:

◆ cs_etm__synth_event()

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

Definition at line 760 of file cs-etm.c.

Here is the call graph for this function:

◆ cs_etm__synth_events()

static int cs_etm__synth_events ( struct cs_etm_auxtrace etm,
struct perf_session session 
)
static

Definition at line 772 of file cs-etm.c.

Here is the call graph for this function:

◆ cs_etm__synth_instruction_sample()

static int cs_etm__synth_instruction_sample ( struct cs_etm_queue etmq,
u64  addr,
u64  period 
)
static

Definition at line 634 of file cs-etm.c.

Here is the call graph for this function:

◆ cs_etm__update_last_branch_rb()

static void cs_etm__update_last_branch_rb ( struct cs_etm_queue etmq)
static

Definition at line 531 of file cs-etm.c.

Here is the call graph for this function:

◆ cs_etm__update_queues()

static int cs_etm__update_queues ( struct cs_etm_auxtrace etm)
static

Definition at line 437 of file cs-etm.c.

Here is the call graph for this function:

Variable Documentation

◆ cs_etm_global_header_fmts

const char* const cs_etm_global_header_fmts[]
static
Initial value:
= {
[CS_HEADER_VERSION_0] = " Header version %llx\n",
[CS_PMU_TYPE_CPUS] = " PMU type/num cpus %llx\n",
[CS_ETM_SNAPSHOT] = " Snapshot %llx\n",
}

Definition at line 1153 of file cs-etm.c.

◆ cs_etm_priv_fmts

const char* const cs_etm_priv_fmts[]
static
Initial value:
= {
[CS_ETM_MAGIC] = " Magic number %llx\n",
[CS_ETM_CPU] = " CPU %lld\n",
[CS_ETM_ETMCR] = " ETMCR %llx\n",
[CS_ETM_ETMTRACEIDR] = " ETMTRACEIDR %llx\n",
[CS_ETM_ETMCCER] = " ETMCCER %llx\n",
[CS_ETM_ETMIDR] = " ETMIDR %llx\n",
}

Definition at line 1159 of file cs-etm.c.

◆ cs_etmv4_priv_fmts

const char* const cs_etmv4_priv_fmts[]
static
Initial value:
= {
[CS_ETM_MAGIC] = " Magic number %llx\n",
[CS_ETM_CPU] = " CPU %lld\n",
[CS_ETMV4_TRCCONFIGR] = " TRCCONFIGR %llx\n",
[CS_ETMV4_TRCTRACEIDR] = " TRCTRACEIDR %llx\n",
[CS_ETMV4_TRCIDR0] = " TRCIDR0 %llx\n",
[CS_ETMV4_TRCIDR1] = " TRCIDR1 %llx\n",
[CS_ETMV4_TRCIDR2] = " TRCIDR2 %llx\n",
[CS_ETMV4_TRCIDR8] = " TRCIDR8 %llx\n",
[CS_ETMV4_TRCAUTHSTATUS] = " TRCAUTHSTATUS %llx\n",
}

Definition at line 1168 of file cs-etm.c.