#include "op_events.h"
#include "op_libiberty.h"
#include "op_fileio.h"
#include "op_string.h"
#include "op_cpufreq.h"
#include "op_hw_specific.h"
#include "op_parse_event.h"
#include <string.h>
#include <stdlib.h>
#include <stdio.h>
#include <ctype.h>
Go to the source code of this file.
Functions | |
static | LIST_HEAD (events_list) |
static | LIST_HEAD (um_list) |
static void | delete_event (struct op_event *event) |
static void | read_events (char const *file) |
static void | read_unit_masks (char const *file) |
static void | free_unit_mask (struct op_unit_mask *um) |
static char * | build_fn (const char *cpu_name, const char *fn) |
static void | parse_error (char const *context) |
static int | parse_int (char const *str) |
static int | parse_hex (char const *str) |
static u64 | parse_long_hex (char const *str) |
static void | include_um (const char *start, const char *end) |
unsigned | parse_extra (const char *s) |
static void | parse_um (struct op_unit_mask *um, char const *line) |
static void | parse_um_entry (struct op_described_um *entry, char const *line) |
static struct op_unit_mask * | new_unit_mask (void) |
static u32 | parse_counter_mask (char const *str) |
static struct op_unit_mask * | try_find_um (char const *value) |
static struct op_unit_mask * | find_um (char const *value) |
static struct op_unit_mask * | merge_um (char *value) |
static int | next_token (char const **cp, char **name, char **value) |
static void | include_events (char *value) |
static struct op_event * | new_event (void) |
static void | free_event (struct op_event *event) |
static int | check_unit_mask (struct op_unit_mask const *um, char const *cpu_name) |
static void | arch_filter_events (op_cpu cpu_type) |
static void | load_events_name (const char *cpu_name) |
static void | load_events (op_cpu cpu_type) |
struct list_head * | op_events (op_cpu cpu_type) |
static void | delete_unit_mask (struct op_unit_mask *unit) |
void | op_free_events (void) |
static struct op_event * | find_event_any (u32 nr) |
static struct op_event * | find_event_um (u32 nr, u32 um) |
static FILE * | open_event_mapping_file (char const *cpu_name) |
static char const * | get_mapping (u32 nr, FILE *fp) |
char const * | find_mapping_for_event (u32 nr, op_cpu cpu_type) |
static int | match_event (int i, struct op_event *event, unsigned um) |
struct op_event * | find_event_by_name (char const *name, unsigned um, int um_valid) |
static struct op_event * | find_next_event (struct op_event *e) |
struct op_event * | op_find_event (op_cpu cpu_type, u32 nr, u32 um) |
struct op_event * | op_find_event_any (op_cpu cpu_type, u32 nr) |
int | op_check_events (int ctr, u32 nr, u32 um, op_cpu cpu_type) |
void | op_default_event (op_cpu cpu_type, struct op_default_event_descr *descr) |
static void | extra_check (struct op_event *e, u32 unit_mask) |
static void | another_extra_check (struct op_event *e, char *name, unsigned w) |
static void | do_resolve_unit_mask (struct op_event *e, struct parsed_event *pe, u32 *extra) |
void | op_resolve_unit_mask (struct parsed_event *pe, u32 *extra) |
Variables | |
static char const * | filename |
static unsigned int | line_nr |
Details of PMC profiling events
You can have silliness here.
Definition in file op_events.c.
static void another_extra_check | ( | struct op_event * | e, | |
char * | name, | |||
unsigned | w | |||
) | [static] |
Definition at line 1231 of file op_events.c.
References op_unit_mask::op_described_um::desc, op_unit_mask::op_described_um::extra, op_unit_mask::num, op_unit_mask::um, and op_event::unit.
Referenced by do_resolve_unit_mask().
static void arch_filter_events | ( | op_cpu | cpu_type | ) | [static] |
Definition at line 619 of file op_events.c.
References arch_get_filter(), delete_event(), op_event::event_next, list_entry, and list_for_each_safe.
Referenced by load_events(), and op_events().
static char* build_fn | ( | const char * | cpu_name, | |
const char * | fn | |||
) | [static] |
Definition at line 38 of file op_events.c.
References OP_DATADIR.
Referenced by include_events(), include_um(), and load_events_name().
static int check_unit_mask | ( | struct op_unit_mask const * | um, | |
char const * | cpu_name | |||
) | [static] |
Definition at line 579 of file op_events.c.
References op_unit_mask::default_mask, op_unit_mask::name, op_unit_mask::num, op_unit_mask::um, op_unit_mask::unit_type_mask, op_unit_mask::used, utm_bitmask, utm_mandatory, and op_unit_mask::op_described_um::value.
Referenced by load_events().
static void delete_event | ( | struct op_event * | event | ) | [static] |
Definition at line 746 of file op_events.c.
References op_event::desc, op_event::event_next, list_del(), and op_event::name.
Referenced by arch_filter_events(), and op_free_events().
static void delete_unit_mask | ( | struct op_unit_mask * | unit | ) | [static] |
Definition at line 730 of file op_events.c.
References op_unit_mask::op_described_um::desc, list_del(), op_unit_mask::name, op_unit_mask::num, op_unit_mask::um, and op_unit_mask::um_next.
Referenced by op_free_events().
static void do_resolve_unit_mask | ( | struct op_event * | e, | |
struct parsed_event * | pe, | |||
u32 * | extra | |||
) | [static] |
Definition at line 1258 of file op_events.c.
References another_extra_check(), op_unit_mask::default_mask, op_unit_mask::op_described_um::desc, op_unit_mask::op_described_um::extra, extra_check(), find_next_event(), parsed_event::name, op_unit_mask::num, op_unit_mask::um, op_event::unit, parsed_event::unit_mask, parsed_event::unit_mask_name, parsed_event::unit_mask_valid, and op_unit_mask::op_described_um::value.
Referenced by op_resolve_unit_mask().
Definition at line 1214 of file op_events.c.
References op_unit_mask::num, op_unit_mask::um, op_event::unit, and op_unit_mask::op_described_um::value.
Referenced by do_resolve_unit_mask().
Definition at line 773 of file op_events.c.
References op_event::event_next, list_entry, and list_for_each.
Referenced by op_find_event_any().
struct op_event* find_event_by_name | ( | char const * | name, | |
unsigned | um, | |||
int | um_valid | |||
) | [read] |
Find a given event by name
Definition at line 958 of file op_events.c.
References op_event::event_next, list_entry, list_for_each, and match_event().
Referenced by oprof_start::alloc_selected_events(), check_event(), do_test(), get_default_event(), ibs_parse_and_set_events(), op_resolve_unit_mask(), and resolve_events().
Definition at line 786 of file op_events.c.
References op_event::event_next, list_entry, and list_for_each.
Referenced by op_find_event().
Find a mapping for a given event ID for architectures requiring additional information from what is held in the events file.
Definition at line 909 of file op_events.c.
References CPU_PPC64_970, CPU_PPC64_970MP, CPU_PPC64_IBM_COMPAT_V1, CPU_PPC64_PA6T, CPU_PPC64_POWER4, CPU_PPC64_POWER5, CPU_PPC64_POWER5p, CPU_PPC64_POWER5pp, CPU_PPC64_POWER6, CPU_PPC64_POWER7, filename, get_mapping(), op_get_cpu_name(), and open_event_mapping_file().
Referenced by main().
Definition at line 981 of file op_events.c.
References op_event::event_next, list_entry, op_event::name, and list_head::next.
Referenced by do_resolve_unit_mask().
static struct op_unit_mask* find_um | ( | char const * | value | ) | [static, read] |
Definition at line 340 of file op_events.c.
References try_find_um(), and op_unit_mask::um.
Referenced by merge_um(), and read_events().
static void free_event | ( | struct op_event * | event | ) | [static] |
Definition at line 457 of file op_events.c.
References op_event::event_next, and list_del().
Referenced by read_events().
static void free_unit_mask | ( | struct op_unit_mask * | um | ) | [static] |
Definition at line 252 of file op_events.c.
References list_del(), and op_unit_mask::um_next.
Referenced by parse_um().
static char const* get_mapping | ( | u32 | nr, | |
FILE * | fp | |||
) | [static] |
This function is PPC64-specific.
Definition at line 828 of file op_events.c.
References comment_line(), empty_line(), filename, line_nr, op_event::name, next_token(), op_get_line(), parse_error(), parse_hex(), and parse_long_hex().
Referenced by find_mapping_for_event().
static void include_events | ( | char * | value | ) | [static] |
Definition at line 433 of file op_events.c.
References build_fn(), filename, line_nr, and read_events().
Referenced by read_events().
static void include_um | ( | const char * | start, | |
const char * | end | |||
) | [static] |
Definition at line 93 of file op_events.c.
References build_fn(), filename, line_nr, and read_unit_masks().
Referenced by parse_um().
static LIST_HEAD | ( | um_list | ) | [static] |
static LIST_HEAD | ( | events_list | ) | [static] |
static void load_events | ( | op_cpu | cpu_type | ) | [static] |
Definition at line 647 of file op_events.c.
References arch_filter_events(), check_unit_mask(), op_unit_mask::op_described_um::desc, op_event::event_next, op_unit_mask::op_described_um::extra, list_empty(), list_entry, list_for_each, load_events_name(), op_unit_mask::name, op_event::name, new_event(), new_unit_mask(), op_unit_mask::num, op_cpu_has_timer_fs(), op_get_cpu_name(), op_get_nr_counters(), TIMER_EVENT_DESC, TIMER_EVENT_NAME, TIMER_EVENT_UNIT_MASK_NAME, TIMER_EVENT_VALUE, op_unit_mask::um, op_unit_mask::um_next, unit_mask, op_unit_mask::unit_type_mask, op_unit_mask::used, utm_mandatory, op_event::val, and op_unit_mask::op_described_um::value.
Referenced by op_check_events(), op_events(), op_find_event(), and op_find_event_any().
static void load_events_name | ( | const char * | cpu_name | ) | [static] |
Definition at line 632 of file op_events.c.
References build_fn(), read_events(), and read_unit_masks().
Referenced by load_events().
static int match_event | ( | int | i, | |
struct op_event * | event, | |||
unsigned | um | |||
) | [static] |
Definition at line 942 of file op_events.c.
References op_event::unit, op_unit_mask::unit_type_mask, utm_bitmask, utm_exclusive, and utm_mandatory.
Referenced by find_event_by_name().
static struct op_unit_mask* merge_um | ( | char * | value | ) | [static, read] |
Definition at line 350 of file op_events.c.
References op_unit_mask::default_mask, op_unit_mask::op_described_um::desc, find_um(), MAX_UNIT_MASK, new_unit_mask(), op_unit_mask::num, parse_error(), try_find_um(), op_unit_mask::um, op_unit_mask::unit_type_mask, utm_bitmask, and utm_exclusive.
Referenced by read_events().
static struct op_event* new_event | ( | void | ) | [static, read] |
Definition at line 448 of file op_events.c.
References list_add_tail().
Referenced by load_events(), and read_events().
static struct op_unit_mask* new_unit_mask | ( | void | ) | [static, read] |
Definition at line 243 of file op_events.c.
References list_add_tail(), op_unit_mask::um, and op_unit_mask::um_next.
Referenced by load_events(), merge_um(), and read_unit_masks().
static int next_token | ( | char const ** | cp, | |
char ** | name, | |||
char ** | value | |||
) | [static] |
Definition at line 390 of file op_events.c.
References op_xstrndup(), parse_error(), skip_nonws(), and skip_ws().
Referenced by get_mapping(), and read_events().
sanity check event values
ctr | counter number | |
event | value for counter | |
um | unit mask for counter | |
cpu_type | processor type |
Check that the counter event and unit mask values are allowed.
The function returns bitmask of failure cause 0 otherwise
Definition at line 1011 of file op_events.c.
References op_event::event_next, list_entry, list_for_each, load_events(), OP_INVALID_COUNTER, OP_INVALID_EVENT, OP_INVALID_UM, OP_OK_EVENT, and utm_bitmask.
Referenced by check_event().
void op_default_event | ( | op_cpu | cpu_type, | |
struct op_default_event_descr * | descr | |||
) |
op_default_event - return the details of the default event
cpu_type | cpu type | |
descr | filled event description |
Fills in the event description if applicable
Definition at line 1056 of file op_events.c.
References op_default_event_descr::count, CPU_ARCH_PERFMON, CPU_ARM_MPCORE, CPU_ARM_SCORPION, CPU_ARM_SCORPIONMP, CPU_ARM_V6, CPU_ARM_V7, CPU_ARM_V7_CA15, CPU_ARM_V7_CA5, CPU_ARM_V7_CA7, CPU_ARM_V7_CA9, CPU_ARM_XSCALE1, CPU_ARM_XSCALE2, CPU_ATHLON, CPU_ATOM, CPU_AVR32, CPU_AXP_EV4, CPU_AXP_EV5, CPU_AXP_EV6, CPU_AXP_EV67, CPU_AXP_PCA56, CPU_CORE, CPU_CORE_2, CPU_CORE_I7, CPU_FAMILY10, CPU_FAMILY11H, CPU_FAMILY12H, CPU_FAMILY14H, CPU_FAMILY15H, CPU_HAMMER, CPU_IA64, CPU_IA64_1, CPU_IA64_2, CPU_IVYBRIDGE, CPU_MIPS_1004K, CPU_MIPS_20K, CPU_MIPS_24K, CPU_MIPS_25K, CPU_MIPS_34K, CPU_MIPS_5K, CPU_MIPS_74K, CPU_MIPS_LOONGSON2, CPU_MIPS_R10000, CPU_MIPS_R12000, CPU_MIPS_RM7000, CPU_MIPS_RM9000, CPU_MIPS_SB1, CPU_MIPS_VR5432, CPU_MIPS_VR5500, CPU_NEHALEM, CPU_NO_GOOD, CPU_P4, CPU_P4_HT2, CPU_P6_MOBILE, CPU_PII, CPU_PIII, CPU_PPC64_970, CPU_PPC64_970MP, CPU_PPC64_CELL, CPU_PPC64_IBM_COMPAT_V1, CPU_PPC64_PA6T, CPU_PPC64_POWER4, CPU_PPC64_POWER5, CPU_PPC64_POWER5p, CPU_PPC64_POWER5pp, CPU_PPC64_POWER6, CPU_PPC64_POWER7, CPU_PPC_7450, CPU_PPC_E300, CPU_PPC_E500, CPU_PPC_E500_2, CPU_PPRO, CPU_RTC, CPU_S390_Z10, CPU_S390_Z196, CPU_SANDYBRIDGE, CPU_TILE_TILE64, CPU_TILE_TILEGX, CPU_TILE_TILEPRO, CPU_TIMER_INT, CPU_WESTMERE, MAX_CPU_TYPE, op_default_event_descr::name, op_get_nr_counters(), TIMER_EVENT_NAME, and op_default_event_descr::um.
Referenced by get_default_event(), oprof_start::setup_default_event(), and show_default_event().
Return the known events list. Idempotent
Definition at line 722 of file op_events.c.
References arch_filter_events(), and load_events().
Referenced by do_test(), oprof_start::fill_events(), get_default_event(), ibs_parse_and_set_events(), and main().
Find a given event, returns NULL on error
Definition at line 993 of file op_events.c.
References find_event_um(), and load_events().
Definition at line 1004 of file op_events.c.
References find_event_any(), and load_events().
void op_free_events | ( | void | ) |
free memory used by any call to above function. Need to be called only once
Definition at line 758 of file op_events.c.
References delete_event(), delete_unit_mask(), op_event::event_next, list_entry, list_for_each_safe, and op_unit_mask::um_next.
Referenced by clean_exit(), cleanup(), do_test(), and main().
void op_resolve_unit_mask | ( | struct parsed_event * | pe, | |
u32 * | extra | |||
) |
Definition at line 1317 of file op_events.c.
References do_resolve_unit_mask(), find_event_by_name(), and parsed_event::name.
Referenced by check_event(), resolve_events(), show_extra_mask(), and show_unit_mask().
static FILE* open_event_mapping_file | ( | char const * | cpu_name | ) | [static] |
Definition at line 804 of file op_events.c.
References filename, and OP_DATADIR.
Referenced by find_mapping_for_event().
static u32 parse_counter_mask | ( | char const * | str | ) | [static] |
Definition at line 306 of file op_events.c.
References parse_int(), and skip_ws().
Referenced by read_events().
static void parse_error | ( | char const * | context | ) | [static] |
Definition at line 51 of file op_events.c.
References filename, and line_nr.
Referenced by get_mapping(), merge_um(), next_token(), parse_extra(), parse_hex(), parse_int(), parse_long_hex(), parse_um(), parse_um_entry(), read_events(), and read_unit_masks().
unsigned parse_extra | ( | const char * | s | ) |
Definition at line 112 of file op_events.c.
References EXTRA_ANY, EXTRA_CMASK_MASK, EXTRA_CMASK_SHIFT, EXTRA_EDGE, EXTRA_INV, parse_error(), and strisprefix().
Referenced by parse_um_entry().
static int parse_hex | ( | char const * | str | ) | [static] |
Definition at line 70 of file op_events.c.
References parse_error().
Referenced by get_mapping(), parse_um(), parse_um_entry(), and read_events().
static int parse_int | ( | char const * | str | ) | [static] |
Definition at line 60 of file op_events.c.
References parse_error().
Referenced by parse_counter_mask(), and read_events().
static u64 parse_long_hex | ( | char const * | str | ) | [static] |
Definition at line 83 of file op_events.c.
References parse_error().
Referenced by get_mapping().
static void parse_um | ( | struct op_unit_mask * | um, | |
char const * | line | |||
) | [static] |
Definition at line 143 of file op_events.c.
References op_unit_mask::default_mask, free_unit_mask(), include_um(), op_unit_mask::name, op_xstrndup(), parse_error(), parse_hex(), skip_nonws(), skip_ws(), strisprefix(), op_unit_mask::unit_type_mask, utm_bitmask, utm_exclusive, and utm_mandatory.
Referenced by read_unit_masks().
static void parse_um_entry | ( | struct op_described_um * | entry, | |
char const * | line | |||
) | [static] |
Definition at line 215 of file op_events.c.
References parse_error(), parse_extra(), parse_hex(), skip_nonws(), skip_ws(), and strisprefix().
Referenced by read_unit_masks().
static void read_events | ( | char const * | file | ) | [static] |
Definition at line 465 of file op_events.c.
References arch_get_counter_mask(), comment_line(), empty_line(), filename, find_um(), free_event(), include_events(), line_nr, merge_um(), op_event::name, new_event(), next_token(), op_get_line(), parse_counter_mask(), parse_error(), parse_hex(), parse_int(), and skip_ws().
Referenced by include_events(), and load_events_name().
static void read_unit_masks | ( | char const * | file | ) | [static] |
Definition at line 262 of file op_events.c.
References comment_line(), empty_line(), filename, line_nr, MAX_UNIT_MASK, new_unit_mask(), op_unit_mask::num, op_get_line(), parse_error(), parse_um(), parse_um_entry(), and op_unit_mask::um.
Referenced by include_um(), and load_events_name().
static struct op_unit_mask* try_find_um | ( | char const * | value | ) | [static, read] |
Definition at line 326 of file op_events.c.
References list_entry, list_for_each, op_unit_mask::name, op_unit_mask::um, op_unit_mask::um_next, and op_unit_mask::used.
Referenced by find_um(), and merge_um().
char const* filename [static] |
Definition at line 30 of file op_events.c.
Referenced by create_debug_line_info(), emit_lineno_info(), find_mapping_for_event(), get_mapping(), ibs_init(), include_events(), include_um(), op_write_debug_line_info(), opd_get_module_info(), opd_read_fs_int(), open_event_mapping_file(), parse_error(), populate_for_image(), read_events(), and read_unit_masks().
unsigned int line_nr [static] |
Definition at line 31 of file op_events.c.
Referenced by get_mapping(), include_events(), include_um(), parse_error(), read_events(), and read_unit_masks().