From: Maynard J. <may...@us...> - 2009-03-10 22:09:12
|
We recently discovered that 'make distcheck' fails the libop/tests/allocate_counter_tests. This testcase dummies up some events for various cpu types and uses map_event_to_counter to try to verify the allocation of the events to counters. For each invocation of map_event_to_counter, the testcase passes in the cpu_type it's doing the test on. A problem occurs because map_event_to_counter computes nr_counters by scanning /dev/oprofile, looking for *native* counter files in oprofilefs. If the number of native counter files is less than what is defined for the number of counters for the passed cpu_type, then the testcase fails. Besides allocate_counter_tests, I also found that ophelp calls map_event_to_counter and can potentially pass in a non-native cpu_type. With the right (or maybe I should say "wrong") selection of cpu_type and events, ophelp will fail in the same way that allocate_counter_tests fails. The attached patch fixes map_event_to_counter so that it recognizes when the passed cpu_type is not the native cpu_type and won't try to use the native counter files in /dev/oprofile. Suravee, can you please review and test this patch. Signed-off-by: Maynard Johnson <may...@us...> -Maynard |