Linux Perf
stat-shadow.c File Reference
#include <stdio.h>
#include "evsel.h"
#include "stat.h"
#include "color.h"
#include "pmu.h"
#include "rblist.h"
#include "evlist.h"
#include "expr.h"
#include "metricgroup.h"
Include dependency graph for stat-shadow.c:

Go to the source code of this file.

Classes

struct  saved_value
 

Enumerations

enum  grc_type { GRC_STALLED_CYCLES_FE, GRC_STALLED_CYCLES_BE, GRC_CACHE_MISSES, GRC_MAX_NR }
 

Functions

static int saved_value_cmp (struct rb_node *rb_node, const void *entry)
 
static struct rb_node * saved_value_new (struct rblist *rblist __maybe_unused, const void *entry)
 
static void saved_value_delete (struct rblist *rblist __maybe_unused, struct rb_node *rb_node)
 
static struct saved_valuesaved_value_lookup (struct perf_evsel *evsel, int cpu, bool create, enum stat_type type, int ctx, struct runtime_stat *st)
 
void runtime_stat__init (struct runtime_stat *st)
 
void runtime_stat__exit (struct runtime_stat *st)
 
void perf_stat__init_shadow_stats (void)
 
static int evsel_context (struct perf_evsel *evsel)
 
static void reset_stat (struct runtime_stat *st)
 
void perf_stat__reset_shadow_stats (void)
 
void perf_stat__reset_shadow_per_stat (struct runtime_stat *st)
 
static void update_runtime_stat (struct runtime_stat *st, enum stat_type type, int ctx, int cpu, u64 count)
 
void perf_stat__update_shadow_stats (struct perf_evsel *counter, u64 count, int cpu, struct runtime_stat *st)
 
static const char * get_ratio_color (enum grc_type type, double ratio)
 
static struct perf_evselperf_stat__find_event (struct perf_evlist *evsel_list, const char *name)
 
void perf_stat__collect_metric_expr (struct perf_evlist *evsel_list)
 
static double runtime_stat_avg (struct runtime_stat *st, enum stat_type type, int ctx, int cpu)
 
static double runtime_stat_n (struct runtime_stat *st, enum stat_type type, int ctx, int cpu)
 
static void print_stalled_cycles_frontend (int cpu, struct perf_evsel *evsel, double avg, struct perf_stat_output_ctx *out, struct runtime_stat *st)
 
static void print_stalled_cycles_backend (int cpu, struct perf_evsel *evsel, double avg, struct perf_stat_output_ctx *out, struct runtime_stat *st)
 
static void print_branch_misses (int cpu, struct perf_evsel *evsel, double avg, struct perf_stat_output_ctx *out, struct runtime_stat *st)
 
static void print_l1_dcache_misses (int cpu, struct perf_evsel *evsel, double avg, struct perf_stat_output_ctx *out, struct runtime_stat *st)
 
static void print_l1_icache_misses (int cpu, struct perf_evsel *evsel, double avg, struct perf_stat_output_ctx *out, struct runtime_stat *st)
 
static void print_dtlb_cache_misses (int cpu, struct perf_evsel *evsel, double avg, struct perf_stat_output_ctx *out, struct runtime_stat *st)
 
static void print_itlb_cache_misses (int cpu, struct perf_evsel *evsel, double avg, struct perf_stat_output_ctx *out, struct runtime_stat *st)
 
static void print_ll_cache_misses (int cpu, struct perf_evsel *evsel, double avg, struct perf_stat_output_ctx *out, struct runtime_stat *st)
 
static double sanitize_val (double x)
 
static double td_total_slots (int ctx, int cpu, struct runtime_stat *st)
 
static double td_bad_spec (int ctx, int cpu, struct runtime_stat *st)
 
static double td_retiring (int ctx, int cpu, struct runtime_stat *st)
 
static double td_fe_bound (int ctx, int cpu, struct runtime_stat *st)
 
static double td_be_bound (int ctx, int cpu, struct runtime_stat *st)
 
static void print_smi_cost (int cpu, struct perf_evsel *evsel, struct perf_stat_output_ctx *out, struct runtime_stat *st)
 
static void generic_metric (const char *metric_expr, struct perf_evsel **metric_events, char *name, const char *metric_name, double avg, int cpu, struct perf_stat_output_ctx *out, struct runtime_stat *st)
 
void perf_stat__print_shadow_stats (struct perf_evsel *evsel, double avg, int cpu, struct perf_stat_output_ctx *out, struct rblist *metric_events, struct runtime_stat *st)
 

Variables

static bool have_frontend_stalled
 
struct runtime_stat rt_stat
 
struct stats walltime_nsecs_stats
 

Enumeration Type Documentation

◆ grc_type

enum grc_type
Enumerator
GRC_STALLED_CYCLES_FE 
GRC_STALLED_CYCLES_BE 
GRC_CACHE_MISSES 
GRC_MAX_NR 

Definition at line 274 of file stat-shadow.c.

Function Documentation

◆ evsel_context()

static int evsel_context ( struct perf_evsel evsel)
static

Definition at line 147 of file stat-shadow.c.

◆ generic_metric()

static void generic_metric ( const char *  metric_expr,
struct perf_evsel **  metric_events,
char *  name,
const char *  metric_name,
double  avg,
int  cpu,
struct perf_stat_output_ctx out,
struct runtime_stat st 
)
static

Definition at line 701 of file stat-shadow.c.

Here is the call graph for this function:

◆ get_ratio_color()

static const char* get_ratio_color ( enum grc_type  type,
double  ratio 
)
static

Definition at line 281 of file stat-shadow.c.

◆ perf_stat__collect_metric_expr()

void perf_stat__collect_metric_expr ( struct perf_evlist evsel_list)

Definition at line 313 of file stat-shadow.c.

Here is the call graph for this function:

◆ perf_stat__find_event()

static struct perf_evsel* perf_stat__find_event ( struct perf_evlist evsel_list,
const char *  name 
)
static

Definition at line 300 of file stat-shadow.c.

◆ perf_stat__init_shadow_stats()

void perf_stat__init_shadow_stats ( void  )

Definition at line 141 of file stat-shadow.c.

Here is the call graph for this function:

◆ perf_stat__print_shadow_stats()

void perf_stat__print_shadow_stats ( struct perf_evsel evsel,
double  avg,
int  cpu,
struct perf_stat_output_ctx out,
struct rblist metric_events,
struct runtime_stat st 
)

Definition at line 753 of file stat-shadow.c.

Here is the call graph for this function:

◆ perf_stat__reset_shadow_per_stat()

void perf_stat__reset_shadow_per_stat ( struct runtime_stat st)

Definition at line 187 of file stat-shadow.c.

Here is the call graph for this function:

◆ perf_stat__reset_shadow_stats()

void perf_stat__reset_shadow_stats ( void  )

Definition at line 181 of file stat-shadow.c.

Here is the call graph for this function:

◆ perf_stat__update_shadow_stats()

void perf_stat__update_shadow_stats ( struct perf_evsel counter,
u64  count,
int  cpu,
struct runtime_stat st 
)

Definition at line 208 of file stat-shadow.c.

Here is the call graph for this function:

◆ print_branch_misses()

static void print_branch_misses ( int  cpu,
struct perf_evsel evsel,
double  avg,
struct perf_stat_output_ctx out,
struct runtime_stat st 
)
static

Definition at line 455 of file stat-shadow.c.

Here is the call graph for this function:

◆ print_dtlb_cache_misses()

static void print_dtlb_cache_misses ( int  cpu,
struct perf_evsel evsel,
double  avg,
struct perf_stat_output_ctx out,
struct runtime_stat st 
)
static

Definition at line 516 of file stat-shadow.c.

Here is the call graph for this function:

◆ print_itlb_cache_misses()

static void print_itlb_cache_misses ( int  cpu,
struct perf_evsel evsel,
double  avg,
struct perf_stat_output_ctx out,
struct runtime_stat st 
)
static

Definition at line 535 of file stat-shadow.c.

Here is the call graph for this function:

◆ print_l1_dcache_misses()

static void print_l1_dcache_misses ( int  cpu,
struct perf_evsel evsel,
double  avg,
struct perf_stat_output_ctx out,
struct runtime_stat st 
)
static

Definition at line 475 of file stat-shadow.c.

Here is the call graph for this function:

◆ print_l1_icache_misses()

static void print_l1_icache_misses ( int  cpu,
struct perf_evsel evsel,
double  avg,
struct perf_stat_output_ctx out,
struct runtime_stat st 
)
static

Definition at line 496 of file stat-shadow.c.

Here is the call graph for this function:

◆ print_ll_cache_misses()

static void print_ll_cache_misses ( int  cpu,
struct perf_evsel evsel,
double  avg,
struct perf_stat_output_ctx out,
struct runtime_stat st 
)
static

Definition at line 554 of file stat-shadow.c.

Here is the call graph for this function:

◆ print_smi_cost()

static void print_smi_cost ( int  cpu,
struct perf_evsel evsel,
struct perf_stat_output_ctx out,
struct runtime_stat st 
)
static

Definition at line 677 of file stat-shadow.c.

Here is the call graph for this function:

◆ print_stalled_cycles_backend()

static void print_stalled_cycles_backend ( int  cpu,
struct perf_evsel evsel,
double  avg,
struct perf_stat_output_ctx out,
struct runtime_stat st 
)
static

Definition at line 436 of file stat-shadow.c.

Here is the call graph for this function:

◆ print_stalled_cycles_frontend()

static void print_stalled_cycles_frontend ( int  cpu,
struct perf_evsel evsel,
double  avg,
struct perf_stat_output_ctx out,
struct runtime_stat st 
)
static

Definition at line 413 of file stat-shadow.c.

Here is the call graph for this function:

◆ reset_stat()

static void reset_stat ( struct runtime_stat st)
static

Definition at line 165 of file stat-shadow.c.

Here is the call graph for this function:

◆ runtime_stat__exit()

void runtime_stat__exit ( struct runtime_stat st)

Definition at line 136 of file stat-shadow.c.

Here is the call graph for this function:

◆ runtime_stat__init()

void runtime_stat__init ( struct runtime_stat st)

Definition at line 126 of file stat-shadow.c.

Here is the call graph for this function:

◆ runtime_stat_avg()

static double runtime_stat_avg ( struct runtime_stat st,
enum stat_type  type,
int  ctx,
int  cpu 
)
static

Definition at line 389 of file stat-shadow.c.

Here is the call graph for this function:

◆ runtime_stat_n()

static double runtime_stat_n ( struct runtime_stat st,
enum stat_type  type,
int  ctx,
int  cpu 
)
static

Definition at line 401 of file stat-shadow.c.

Here is the call graph for this function:

◆ sanitize_val()

static double sanitize_val ( double  x)
static

Definition at line 615 of file stat-shadow.c.

◆ saved_value_cmp()

static int saved_value_cmp ( struct rb_node *  rb_node,
const void *  entry 
)
static

Definition at line 34 of file stat-shadow.c.

Here is the call graph for this function:

◆ saved_value_delete()

static void saved_value_delete ( struct rblist *rblist  __maybe_unused,
struct rb_node *  rb_node 
)
static

Definition at line 85 of file stat-shadow.c.

Here is the call graph for this function:

◆ saved_value_lookup()

static struct saved_value* saved_value_lookup ( struct perf_evsel evsel,
int  cpu,
bool  create,
enum stat_type  type,
int  ctx,
struct runtime_stat st 
)
static

Definition at line 95 of file stat-shadow.c.

Here is the call graph for this function:

◆ saved_value_new()

static struct rb_node* saved_value_new ( struct rblist *rblist  __maybe_unused,
const void *  entry 
)
static

Definition at line 74 of file stat-shadow.c.

Here is the call graph for this function:

◆ td_bad_spec()

static double td_bad_spec ( int  ctx,
int  cpu,
struct runtime_stat st 
)
static

Definition at line 627 of file stat-shadow.c.

Here is the call graph for this function:

◆ td_be_bound()

static double td_be_bound ( int  ctx,
int  cpu,
struct runtime_stat st 
)
static

Definition at line 667 of file stat-shadow.c.

Here is the call graph for this function:

◆ td_fe_bound()

static double td_fe_bound ( int  ctx,
int  cpu,
struct runtime_stat st 
)
static

Definition at line 655 of file stat-shadow.c.

Here is the call graph for this function:

◆ td_retiring()

static double td_retiring ( int  ctx,
int  cpu,
struct runtime_stat st 
)
static

Definition at line 643 of file stat-shadow.c.

Here is the call graph for this function:

◆ td_total_slots()

static double td_total_slots ( int  ctx,
int  cpu,
struct runtime_stat st 
)
static

Definition at line 622 of file stat-shadow.c.

Here is the call graph for this function:

◆ update_runtime_stat()

static void update_runtime_stat ( struct runtime_stat st,
enum stat_type  type,
int  ctx,
int  cpu,
u64  count 
)
static

Definition at line 192 of file stat-shadow.c.

Here is the call graph for this function:

Variable Documentation

◆ have_frontend_stalled

bool have_frontend_stalled
static

Definition at line 19 of file stat-shadow.c.

◆ rt_stat

struct runtime_stat rt_stat

Definition at line 21 of file stat-shadow.c.

◆ walltime_nsecs_stats

struct stats walltime_nsecs_stats

Definition at line 22 of file stat-shadow.c.