Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Macros | Functions | Variables
evsel.c File Reference
#include <byteswap.h>
#include <linux/bitops.h>
#include "asm/bug.h"
#include "debugfs.h"
#include "event-parse.h"
#include "evsel.h"
#include "evlist.h"
#include "util.h"
#include "cpumap.h"
#include "thread_map.h"
#include "target.h"
#include <linux/hw_breakpoint.h>
#include <linux/perf_event.h>
#include "perf_regs.h"

Go to the source code of this file.

Macros

#define FD(e, x, y)   (*(int *)xyarray__entry(e->fd, x, y))
 
#define MOD_PRINT(context, mod)
 
#define C(x)   PERF_COUNT_HW_CACHE_##x
 
#define CACHE_READ   (1 << C(OP_READ))
 
#define CACHE_WRITE   (1 << C(OP_WRITE))
 
#define CACHE_PREFETCH   (1 << C(OP_PREFETCH))
 
#define COP(x)   (1 << x)
 

Functions

void hists__init (struct hists *hists)
 
void perf_evsel__init (struct perf_evsel *evsel, struct perf_event_attr *attr, int idx)
 
struct perf_evselperf_evsel__new (struct perf_event_attr *attr, int idx)
 
struct event_formatevent_format__new (const char *sys, const char *name)
 
struct perf_evselperf_evsel__newtp (const char *sys, const char *name, int idx)
 
bool perf_evsel__is_cache_op_valid (u8 type, u8 op)
 
int __perf_evsel__hw_cache_type_op_res_name (u8 type, u8 op, u8 result, char *bf, size_t size)
 
const charperf_evsel__name (struct perf_evsel *evsel)
 
void perf_evsel__config (struct perf_evsel *evsel, struct perf_record_opts *opts, struct perf_evsel *first)
 
int perf_evsel__alloc_fd (struct perf_evsel *evsel, int ncpus, int nthreads)
 
int perf_evsel__set_filter (struct perf_evsel *evsel, int ncpus, int nthreads, const char *filter)
 
int perf_evsel__alloc_id (struct perf_evsel *evsel, int ncpus, int nthreads)
 
int perf_evsel__alloc_counts (struct perf_evsel *evsel, int ncpus)
 
void perf_evsel__free_fd (struct perf_evsel *evsel)
 
void perf_evsel__free_id (struct perf_evsel *evsel)
 
void perf_evsel__close_fd (struct perf_evsel *evsel, int ncpus, int nthreads)
 
void perf_evsel__exit (struct perf_evsel *evsel)
 
void perf_evsel__delete (struct perf_evsel *evsel)
 
int __perf_evsel__read_on_cpu (struct perf_evsel *evsel, int cpu, int thread, bool scale)
 
int __perf_evsel__read (struct perf_evsel *evsel, int ncpus, int nthreads, bool scale)
 
void perf_evsel__close (struct perf_evsel *evsel, int ncpus, int nthreads)
 
int perf_evsel__open (struct perf_evsel *evsel, struct cpu_map *cpus, struct thread_map *threads)
 
int perf_evsel__open_per_cpu (struct perf_evsel *evsel, struct cpu_map *cpus)
 
int perf_evsel__open_per_thread (struct perf_evsel *evsel, struct thread_map *threads)
 
int perf_evsel__parse_sample (struct perf_evsel *evsel, union perf_event *event, struct perf_sample *data)
 
int perf_event__synthesize_sample (union perf_event *event, u64 type, const struct perf_sample *sample, bool swapped)
 
struct format_fieldperf_evsel__field (struct perf_evsel *evsel, const char *name)
 
voidperf_evsel__rawptr (struct perf_evsel *evsel, struct perf_sample *sample, const char *name)
 
u64 perf_evsel__intval (struct perf_evsel *evsel, struct perf_sample *sample, const char *name)
 

Variables

const charperf_evsel__hw_names [PERF_COUNT_HW_MAX]
 
const charperf_evsel__sw_names [PERF_COUNT_SW_MAX]
 
const charperf_evsel__hw_cache [PERF_COUNT_HW_CACHE_MAX][PERF_EVSEL__MAX_ALIASES]
 
const charperf_evsel__hw_cache_op [PERF_COUNT_HW_CACHE_OP_MAX][PERF_EVSEL__MAX_ALIASES]
 
const charperf_evsel__hw_cache_result [PERF_COUNT_HW_CACHE_RESULT_MAX][PERF_EVSEL__MAX_ALIASES]
 

Macro Definition Documentation

#define C (   x)    PERF_COUNT_HW_CACHE_##x

Definition at line 283 of file evsel.c.

#define CACHE_PREFETCH   (1 << C(OP_PREFETCH))

Definition at line 286 of file evsel.c.

#define CACHE_READ   (1 << C(OP_READ))

Definition at line 284 of file evsel.c.

#define CACHE_WRITE   (1 << C(OP_WRITE))

Definition at line 285 of file evsel.c.

#define COP (   x)    (1 << x)

Definition at line 287 of file evsel.c.

#define FD (   e,
  x,
  y 
)    (*(int *)xyarray__entry(e->fd, x, y))

Definition at line 25 of file evsel.c.

#define MOD_PRINT (   context,
  mod 
)
Value:
do { \
if (!attr->exclude_##context) { \
if (!colon) colon = ++r; \
r += scnprintf(bf + r, size - r, "%c", mod); \
} } while(0)

Function Documentation

int __perf_evsel__hw_cache_type_op_res_name ( u8  type,
u8  op,
u8  result,
char bf,
size_t  size 
)

Definition at line 312 of file evsel.c.

int __perf_evsel__read ( struct perf_evsel evsel,
int  ncpus,
int  nthreads,
bool  scale 
)

Definition at line 623 of file evsel.c.

int __perf_evsel__read_on_cpu ( struct perf_evsel evsel,
int  cpu,
int  thread,
bool  scale 
)

Definition at line 596 of file evsel.c.

struct event_format* event_format__new ( const char sys,
const char name 
)
read

Definition at line 73 of file evsel.c.

void hists__init ( struct hists hists)

Definition at line 43 of file evsel.c.

int perf_event__synthesize_sample ( union perf_event event,
u64  type,
const struct perf_sample sample,
bool  swapped 
)

Definition at line 1026 of file evsel.c.

int perf_evsel__alloc_counts ( struct perf_evsel evsel,
int  ncpus 
)

Definition at line 545 of file evsel.c.

int perf_evsel__alloc_fd ( struct perf_evsel evsel,
int  ncpus,
int  nthreads 
)

Definition at line 495 of file evsel.c.

int perf_evsel__alloc_id ( struct perf_evsel evsel,
int  ncpus,
int  nthreads 
)

Definition at line 529 of file evsel.c.

void perf_evsel__close ( struct perf_evsel evsel,
int  ncpus,
int  nthreads 
)

Definition at line 737 of file evsel.c.

void perf_evsel__close_fd ( struct perf_evsel evsel,
int  ncpus,
int  nthreads 
)

Definition at line 566 of file evsel.c.

void perf_evsel__config ( struct perf_evsel evsel,
struct perf_record_opts opts,
struct perf_evsel first 
)

Definition at line 407 of file evsel.c.

void perf_evsel__delete ( struct perf_evsel evsel)

Definition at line 585 of file evsel.c.

void perf_evsel__exit ( struct perf_evsel evsel)

Definition at line 577 of file evsel.c.

struct format_field* perf_evsel__field ( struct perf_evsel evsel,
const char name 
)
read

Definition at line 1102 of file evsel.c.

void perf_evsel__free_fd ( struct perf_evsel evsel)

Definition at line 552 of file evsel.c.

void perf_evsel__free_id ( struct perf_evsel evsel)

Definition at line 558 of file evsel.c.

void perf_evsel__init ( struct perf_evsel evsel,
struct perf_event_attr attr,
int  idx 
)

Definition at line 53 of file evsel.c.

u64 perf_evsel__intval ( struct perf_evsel evsel,
struct perf_sample sample,
const char name 
)

Definition at line 1126 of file evsel.c.

bool perf_evsel__is_cache_op_valid ( u8  type,
u8  op 
)

Definition at line 304 of file evsel.c.

const char* perf_evsel__name ( struct perf_evsel evsel)

Definition at line 364 of file evsel.c.

struct perf_evsel* perf_evsel__new ( struct perf_event_attr attr,
int  idx 
)
read

Definition at line 63 of file evsel.c.

struct perf_evsel* perf_evsel__newtp ( const char sys,
const char name,
int  idx 
)
read

Definition at line 114 of file evsel.c.

int perf_evsel__open ( struct perf_evsel evsel,
struct cpu_map cpus,
struct thread_map threads 
)

Definition at line 763 of file evsel.c.

int perf_evsel__open_per_cpu ( struct perf_evsel evsel,
struct cpu_map cpus 
)

Definition at line 777 of file evsel.c.

int perf_evsel__open_per_thread ( struct perf_evsel evsel,
struct thread_map threads 
)

Definition at line 783 of file evsel.c.

int perf_evsel__parse_sample ( struct perf_evsel evsel,
union perf_event event,
struct perf_sample data 
)

Definition at line 855 of file evsel.c.

void* perf_evsel__rawptr ( struct perf_evsel evsel,
struct perf_sample sample,
const char name 
)

Definition at line 1107 of file evsel.c.

int perf_evsel__set_filter ( struct perf_evsel evsel,
int  ncpus,
int  nthreads,
const char filter 
)

Definition at line 511 of file evsel.c.

Variable Documentation

int cpus[1]

Definition at line 749 of file evsel.c.

Definition at line 748 of file evsel.c.

Initial value:
= {
{ "L1-dcache", "l1-d", "l1d", "L1-data", },
{ "L1-icache", "l1-i", "l1i", "L1-instruction", },
{ "LLC", "L2", },
{ "dTLB", "d-tlb", "Data-TLB", },
{ "iTLB", "i-tlb", "Instruction-TLB", },
{ "branch", "branches", "bpu", "btb", "bpc", },
{ "node", },
}

Definition at line 260 of file evsel.c.

Initial value:
= {
{ "load", "loads", "read", },
{ "store", "stores", "write", },
{ "prefetch", "prefetches", "speculative-read", "speculative-load", },
}

Definition at line 271 of file evsel.c.

Initial value:
= {
{ "refs", "Reference", "ops", "access", },
{ "misses", "miss", },
}

Definition at line 278 of file evsel.c.

const char* perf_evsel__hw_names[PERF_COUNT_HW_MAX]
Initial value:
= {
"cycles",
"instructions",
"cache-references",
"cache-misses",
"branches",
"branch-misses",
"bus-cycles",
"stalled-cycles-frontend",
"stalled-cycles-backend",
"ref-cycles",
}

Definition at line 146 of file evsel.c.

const char* perf_evsel__sw_names[PERF_COUNT_SW_MAX]
Initial value:
= {
"cpu-clock",
"task-clock",
"page-faults",
"context-switches",
"cpu-migrations",
"minor-faults",
"major-faults",
"alignment-faults",
"emulation-faults",
}

Definition at line 209 of file evsel.c.

int threads[1]

Definition at line 757 of file evsel.c.