static void check_event(struct parsed_event * pev, struct op_event const * event) { int ret; int min_count; int const callgraph_min_count_scale = 15; if (!event) { fprintf(stderr, "No event named %s is available.\n", pev->name); exit(EXIT_FAILURE); } ret = op_check_events(0, event->val, pev->unit_mask, cpu_type); if (ret & OP_INVALID_UM) { fprintf(stderr, "Invalid unit mask 0x%x for event %s\n", pev->unit_mask, pev->name); exit(EXIT_FAILURE); } min_count = event->min_count; if (callgraph_depth) min_count *= callgraph_min_count_scale; if (pev->count < min_count) { fprintf(stderr, "Count %d for event %s is below the " "minimum %d\n", pev->count, pev->name, min_count); exit(EXIT_FAILURE); } }
static void check_event(struct parsed_event * pev, struct op_event const * event) { int ret; int min_count; int const callgraph_min_count_scale = 15; if (!event) { event = find_event_by_name(pev->name, 0, 0); if (event) fprintf(stderr, "Invalid unit mask %x for event %s\n", pev->unit_mask, pev->name); else fprintf(stderr, "No event named %s is available.\n", pev->name); exit(EXIT_FAILURE); } op_resolve_unit_mask(pev, NULL); // If a named UM is passed, op_resolve_unit_mask will resolve that into a // valid unit mask, so we don't need to call op_check_events. if (pev->unit_mask_name) ret = 0; else ret = op_check_events(0, event->val, pev->unit_mask, cpu_type); if (ret & OP_INVALID_UM) { fprintf(stderr, "Invalid unit mask 0x%x for event %s\n", pev->unit_mask, pev->name); exit(EXIT_FAILURE); } min_count = event->min_count; if (callgraph_depth) min_count *= callgraph_min_count_scale; if (!ignore_count && pev->count < min_count) { fprintf(stderr, "Count %d for event %s is below the " "minimum %d\n", pev->count, pev->name, min_count); exit(EXIT_FAILURE); } }