From: Philippe E. <ph...@us...> - 2004-02-15 03:08:29
|
Update of /cvsroot/oprofile/oprofile/libop In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv27364/libop Modified Files: op_events.c op_parse_event.c Log Message: minor fix related to unit mask handling, side effect is the needed fix to unit_mask description for Itanium2 (trivial) and amd64 (done through doc inspection) Index: op_events.c =================================================================== RCS file: /cvsroot/oprofile/oprofile/libop/op_events.c,v retrieving revision 1.52 retrieving revision 1.53 diff -u -p -d -r1.52 -r1.53 --- op_events.c 11 Feb 2004 02:24:38 -0000 1.52 +++ op_events.c 15 Feb 2004 03:01:31 -0000 1.53 @@ -370,6 +370,46 @@ next: } +/* usefull for make check */ +static void check_unit_mask(struct op_unit_mask const * um, + char const * cpu_name) +{ + u16 i; + + if (!um->used) { + fprintf(stderr, "um %s is not used\n", um->name); + exit(EXIT_FAILURE); + } + + if (um->unit_type_mask == utm_mandatory && um->num != 1) { + fprintf(stderr, "mandatory um %s doesn't contain exactly one " + "entry (%s)\n", um->name, cpu_name); + exit(EXIT_FAILURE); + } else if (um->unit_type_mask == utm_bitmask) { + u16 default_mask = um->default_mask; + for (i = 0; i < um->num; ++i) { + default_mask &= ~um->um[i].value; + } + if (default_mask) { + fprintf(stderr, "um %s default mask is not valid " + "(%s)\n", um->name, cpu_name); + exit(EXIT_FAILURE); + } + } else { + for (i = 0; i < um->num; ++i) { + if (um->default_mask == um->um[i].value) + break; + } + + if (i == um->num) { + fprintf(stderr, "exclusive um %s default value is not " + "valid (%s)\n", um->name, cpu_name); + exit(EXIT_FAILURE); + } + } +} + + static void load_events(op_cpu cpu_type) { char const * cpu_name = op_get_cpu_name(cpu_type); @@ -408,9 +448,8 @@ static void load_events(op_cpu cpu_type) /* sanity check: all unit mask must be used */ list_for_each(pos, &um_list) { struct op_unit_mask * um = list_entry(pos, struct op_unit_mask, um_next); - if (!um->used) { - fprintf(stderr, "um %s is not used\n", um->name); - } + + check_unit_mask(um, cpu_name); } Index: op_parse_event.c =================================================================== RCS file: /cvsroot/oprofile/oprofile/libop/op_parse_event.c,v retrieving revision 1.4 retrieving revision 1.5 diff -u -p -d -r1.4 -r1.5 --- op_parse_event.c 10 Feb 2004 03:03:54 -0000 1.4 +++ op_parse_event.c 15 Feb 2004 03:01:31 -0000 1.5 @@ -82,7 +82,7 @@ size_t parse_events(struct parsed_event part = next_part(&cp); if (!part) { - fprintf(stderr, "Invalid event %s\n", events[i]); + fprintf(stderr, "Invalid count for event %s\n", events[i]); exit(EXIT_FAILURE); } |