#include <stdlib.h>
#include <stdio.h>
#include "op_parse_event.h"
#include "op_alloc_counter.h"
#include "op_events.h"
#include "op_hw_config.h"
#include "op_cpu_type.h"
Go to the source code of this file.
Data Structures | |
struct | allocated_counter |
Defines | |
#define | MAX_EVENTS 20 |
Enumerations | |
enum | failure_type { no_failure, fail_to_find_event, fail_to_alloc_counter } |
Functions | |
static void | show_events (char const *const *events) |
static void | show_counter_map (size_t const *counter_map, size_t nr_events) |
static void | do_test (struct allocated_counter const *it) |
int | main (void) |
Variables | |
static char const *const | events_alpha_ev4_1 [] |
static char const *const | events_alpha_ev4_2 [] |
static char const *const | events_ppro_1 [] |
static char const *const | events_ppro_2 [] |
static char const *const | events_ppro_3 [] |
static char const *const | events_ppro_4 [] |
static char const *const | events_ppro_5 [] |
static char const *const | events_p4_1 [] |
static char const *const | events_p4_2 [] |
static char const *const | events_mips_34k [] |
static struct allocated_counter const | tests [] |
Definition in file alloc_counter_tests.c.
#define MAX_EVENTS 20 |
Definition at line 23 of file alloc_counter_tests.c.
enum failure_type |
Definition at line 27 of file alloc_counter_tests.c.
static void do_test | ( | struct allocated_counter const * | it | ) | [static] |
Definition at line 147 of file alloc_counter_tests.c.
References allocated_counter::alloc_map, allocated_counter::cpu_type, allocated_counter::events, fail_to_alloc_counter, fail_to_find_event, allocated_counter::failure, find_event_by_name(), map_event_to_counter(), op_event::name, no_failure, nr_events, op_events(), op_free_events(), op_get_cpu_type_str(), parse_events(), show_counter_map(), show_events(), and unit_mask.
Referenced by main().
int main | ( | void | ) |
Definition at line 207 of file alloc_counter_tests.c.
References CPU_NO_GOOD, allocated_counter::cpu_type, and do_test().
static void show_counter_map | ( | size_t const * | counter_map, | |
size_t | nr_events | |||
) | [static] |
Definition at line 138 of file alloc_counter_tests.c.
Referenced by do_test().
static void show_events | ( | char const *const * | events | ) | [static] |
Definition at line 131 of file alloc_counter_tests.c.
Referenced by do_test().
char const* const events_alpha_ev4_1[] [static] |
{
"ISSUES:4096:0:1:1",
NULL
}
Definition at line 43 of file alloc_counter_tests.c.
char const* const events_alpha_ev4_2[] [static] |
{
"UNKNOWN_EVENT:4096:0:1:1",
NULL
}
Definition at line 48 of file alloc_counter_tests.c.
char const* const events_mips_34k[] [static] |
{ "DTLB_MISSES:500:0:1:1", "JR_31_INSNS:500:0:1:1", NULL }
Definition at line 108 of file alloc_counter_tests.c.
char const* const events_p4_1[] [static] |
{ "BRANCH_RETIRED:4096:1:1:1", "MISPRED_BRANCH_RETIRED:4096:1:1:1", "BPU_FETCH_REQUEST:4096:1:1:1", "ITLB_REFERENCE:4096:1:1:1", "MEMORY_CANCEL:4096:4:1:1", "MEMORY_COMPLETE:4096:1:1:1", "TC_MS_XFER:4096:1:1:1", "UOP_QUEUE_WRITES:4096:1:1:1", NULL }
Definition at line 83 of file alloc_counter_tests.c.
char const* const events_p4_2[] [static] |
{ "BRANCH_RETIRED:4096:1:1:1", "MISPRED_BRANCH_RETIRED:4096:1:1:1", "INSTR_RETIRED:4096:1:1:1", "BPU_FETCH_REQUEST:4096:1:1:1", "ITLB_REFERENCE:4096:1:1:1", "MEMORY_CANCEL:4096:4:1:1", "MEMORY_COMPLETE:4096:1:1:1", "TC_MS_XFER:4096:1:1:1", NULL }
Definition at line 95 of file alloc_counter_tests.c.
char const* const events_ppro_1[] [static] |
{
"CPU_CLK_UNHALTED:4096:0:1:1",
NULL
}
Definition at line 53 of file alloc_counter_tests.c.
char const* const events_ppro_2[] [static] |
{ "CPU_CLK_UNHALTED:4096:0:1:1", "DATA_MEM_REFS:4096:0:1:1", NULL }
Definition at line 58 of file alloc_counter_tests.c.
char const* const events_ppro_3[] [static] |
{ "COMP_FLOP_RET:4096:0:1:1", "FLOPS:4096:0:1:1", NULL }
Definition at line 64 of file alloc_counter_tests.c.
char const* const events_ppro_4[] [static] |
{ "FLOPS:4096:0:1:1", "FP_ASSIST:4096:0:1:1", NULL }
Definition at line 71 of file alloc_counter_tests.c.
char const* const events_ppro_5[] [static] |
{ "FP_ASSIST:4096:0:1:1", "FLOPS:4096:0:1:1", NULL }
Definition at line 77 of file alloc_counter_tests.c.
struct allocated_counter const tests[] [static] |
{ { CPU_AXP_EV4, events_alpha_ev4_1, { 0 }, no_failure }, { CPU_AXP_EV4, events_alpha_ev4_2, { -1 }, fail_to_find_event }, { CPU_PPRO, events_ppro_1, { 0 }, no_failure }, { CPU_PPRO, events_ppro_2, { 0, 1 }, no_failure }, { CPU_PPRO, events_ppro_3, { -1 }, fail_to_alloc_counter }, { CPU_PPRO, events_ppro_4, { 0, 1 }, no_failure }, { CPU_PPRO, events_ppro_5, { 1, 0 }, no_failure }, { CPU_P4, events_p4_1, { 3, 7, 0, 4, 2, 6, 1, 5 }, no_failure }, { CPU_P4, events_p4_2, { -1 }, fail_to_alloc_counter }, { CPU_MIPS_34K, events_mips_34k, { 1, 0 }, no_failure }, { CPU_NO_GOOD, 0, { 0 }, 0 } }
Definition at line 116 of file alloc_counter_tests.c.