#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <limits.h>
#include "op_version.h"
#include "op_events.h"
#include "op_popt.h"
#include "op_cpufreq.h"
#include "op_hw_config.h"
#include "op_string.h"
#include "op_alloc_counter.h"
#include "op_parse_event.h"
#include "op_libiberty.h"
#include "op_xml_events.h"
Go to the source code of this file.
Defines | |
#define | _GNU_SOURCE |
#define | LINE_LEN 99 |
#define | MAX_LINE 256 |
Functions | |
static size_t | hweight (size_t mask) |
return the Hamming weight (number of set bits) | |
static void | do_arch_specific_event_help (struct op_event *event) |
static void | word_wrap (int indent, int *column, char *msg) |
static void | help_for_event (struct op_event *event) |
static void | check_event (struct parsed_event *pev, struct op_event const *event) |
static void | resolve_events (void) |
static void | show_unit_mask (void) |
static void | show_extra_mask (void) |
static void | show_default_event (void) |
static void | get_options (int argc, char const *argv[]) |
static void | cleanup (void) |
int | main (int argc, char const *argv[]) |
Variables | |
static char const ** | chosen_events |
static int | num_chosen_events |
struct parsed_event * | parsed_events |
static op_cpu | cpu_type = CPU_NO_GOOD |
static char * | cpu_string |
static int | callgraph_depth |
static int | want_xml |
static poptContext | optcon |
static int | show_vers |
static int | get_cpu_type |
static int | check_events |
static int | unit_mask |
static int | get_default_event |
static int | extra_mask |
static struct poptOption | options [] |
Print out PMC event information
Definition in file ophelp.c.
#define LINE_LEN 99 |
Definition at line 64 of file ophelp.c.
Referenced by word_wrap().
static void check_event | ( | struct parsed_event * | pev, | |
struct op_event const * | event | |||
) | [static] |
Definition at line 169 of file ophelp.c.
References callgraph_depth, parsed_event::count, find_event_by_name(), parsed_event::name, op_check_events(), OP_INVALID_UM, op_resolve_unit_mask(), parsed_event::unit_mask, and op_event::val.
Referenced by resolve_events().
static void cleanup | ( | void | ) | [static] |
make valgrind happy
Definition at line 382 of file ophelp.c.
References num_chosen_events, op_free_events(), and optcon.
Referenced by main().
static void do_arch_specific_event_help | ( | struct op_event * | event | ) | [static] |
Definition at line 53 of file ophelp.c.
References CPU_PPC64_CELL, and op_event::val.
Referenced by help_for_event().
static void get_options | ( | int | argc, | |
char const * | argv[] | |||
) | [static] |
get_options - process command line
argc | program arg count | |
argv | program arg array |
Process the arguments, fatally complaining on error.
Definition at line 361 of file ophelp.c.
References chosen_events, num_chosen_events, op_poptGetContext(), optcon, options, show_vers, and show_version().
Referenced by main(), and run_pp_tool().
static void help_for_event | ( | struct op_event * | event | ) | [static] |
help_for_event - output event name and description
i | event number |
output an help string for the event
Definition at line 89 of file ophelp.c.
References buf, op_event::counter_mask, op_unit_mask::default_mask, op_unit_mask::op_described_um::desc, op_event::desc, do_arch_specific_event_help(), op_event::ext, op_unit_mask::op_described_um::extra, EXTRA_CMASK_MASK, EXTRA_CMASK_SHIFT, EXTRA_EDGE, EXTRA_INV, hweight(), op_event::min_count, op_unit_mask::name, op_event::name, op_get_nr_counters(), op_unit_mask::um, op_event::unit, op_unit_mask::op_described_um::value, and word_wrap().
Referenced by main().
static size_t hweight | ( | size_t | mask | ) | [static] |
return the Hamming weight (number of set bits)
Definition at line 41 of file ophelp.c.
References parsed_event::count.
Referenced by help_for_event().
int main | ( | int | argc, | |
char const * | argv[] | |||
) |
Definition at line 400 of file ophelp.c.
References check_events, chosen_events, cleanup(), close_xml_events(), 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_string, CPU_TILE_TILE64, CPU_TILE_TILEGX, CPU_TILE_TILEPRO, CPU_TIMER_INT, CPU_WESTMERE, op_event::event_next, events, extra_mask, find_mapping_for_event(), get_cpu_type, get_default_event, get_options(), help_for_event(), list_entry, list_for_each, MAX_CPU_TYPE, MAX_LINE, num_chosen_events, op_events(), op_get_cpu_number(), op_get_cpu_type(), op_get_cpu_type_str(), open_xml_events(), resolve_events(), show_default_event(), show_extra_mask(), show_unit_mask(), unit_mask, want_xml, and xml_help_for_event().
static void resolve_events | ( | void | ) | [static] |
Definition at line 208 of file ophelp.c.
References check_event(), chosen_events, parsed_event::count, find_event_by_name(), parsed_event::kernel, map_event_to_counter(), parsed_event::name, num_chosen_events, op_get_nr_counters(), op_resolve_unit_mask(), parse_events(), TIMER_EVENT_NAME, parsed_event::unit_mask, parsed_event::unit_mask_valid, and parsed_event::user.
Referenced by main().
static void show_default_event | ( | void | ) | [static] |
Definition at line 311 of file ophelp.c.
References op_default_event_descr::count, op_default_event_descr::name, op_default_event(), and op_default_event_descr::um.
Referenced by main().
static void show_extra_mask | ( | void | ) | [static] |
Definition at line 296 of file ophelp.c.
References chosen_events, parsed_event::count, num_chosen_events, op_resolve_unit_mask(), and parse_events().
Referenced by main().
static void show_unit_mask | ( | void | ) | [static] |
Definition at line 279 of file ophelp.c.
References chosen_events, parsed_event::count, num_chosen_events, op_resolve_unit_mask(), parse_events(), unit_mask, and parsed_event::unit_mask_name.
Referenced by main().
static void word_wrap | ( | int | indent, | |
int * | column, | |||
char * | msg | |||
) | [static] |
Definition at line 66 of file ophelp.c.
References LINE_LEN.
Referenced by help_for_event().
int callgraph_depth [static] |
Definition at line 34 of file ophelp.c.
Referenced by check_event().
int check_events [static] |
char const** chosen_events [static] |
Definition at line 29 of file ophelp.c.
Referenced by get_options(), main(), resolve_events(), show_extra_mask(), and show_unit_mask().
char* cpu_string [static] |
int extra_mask [static] |
int get_cpu_type [static] |
int num_chosen_events [static] |
Definition at line 30 of file ophelp.c.
Referenced by cleanup(), get_options(), main(), resolve_events(), show_extra_mask(), and show_unit_mask().
poptContext optcon [static] |
Definition at line 37 of file ophelp.c.
Referenced by cleanup(), get_options(), op_poptGetContext(), and opd_options().
struct poptOption options[] [static] |
{ { "cpu-type", 'c', POPT_ARG_STRING, &cpu_string, 0, "use the given CPU type", "cpu type", }, { "check-events", 'e', POPT_ARG_NONE, &check_events, 0, "check the given event descriptions for validity", NULL, }, { "unit-mask", 'u', POPT_ARG_NONE, &unit_mask, 0, "default unit mask for the given event", NULL, }, { "get-cpu-type", 'r', POPT_ARG_NONE, &get_cpu_type, 0, "show the auto-detected CPU type", NULL, }, { "get-default-event", 'd', POPT_ARG_NONE, &get_default_event, 0, "get the default event", NULL, }, { "callgraph", '\0', POPT_ARG_INT, &callgraph_depth, 0, "use this callgraph depth", "callgraph depth", }, { "version", 'v', POPT_ARG_NONE, &show_vers, 0, "show version", NULL, }, { "xml", 'X', POPT_ARG_NONE, &want_xml, 0, "list events as XML", NULL, }, { "extra-mask", 'E', POPT_ARG_NONE, &extra_mask, 0, "print extra mask for event", NULL, }, POPT_AUTOHELP { NULL, 0, 0, NULL, 0, NULL, NULL, }, }
Definition at line 331 of file ophelp.c.
Referenced by get_options().
struct parsed_event* parsed_events |
int show_vers [static] |
Definition at line 324 of file ophelp.c.
Referenced by get_options().
int unit_mask [static] |
Definition at line 327 of file ophelp.c.
Referenced by do_test(), load_events(), main(), and show_unit_mask().