File oprofile-improve-error-message-for-non-unique-unit-mask.patch of Package oprofile
Author: Andi Kleen <ak@linux.intel.com>
Date: Thu Jul 17 12:55:42 2014 -0500
Subject: Improve error message for non-unique unit mask
Git-commit: 893c18c2a2ba955bc77140bbd7696cc2d3f6e1dc
References: FATE#318978
Signed-off-by: Tony Jones <tonyj@suse.de>
Improve error message for non-unique unit mask
For the case where the user does not specify a UM and the default UM
is a non-unique hex value, the error message printed is the following:
Default unit mask not supported for this event.
Please specify a unit mask by name, using the first word of the unit mask description.
For cases where the user wrongly specifies a non-unique hex value for a UM
when they should have specified it by name, the message will be like the
following example:
Unit mask (0x1) is non unique.
Please specify a unit mask by name, using the first word of the unit mask description.
Signed-off-by: Andi Kleen <ak@linux.intel.com>
diff --git a/libop/op_events.c b/libop/op_events.c
index 9c27e6c..b8900a5 100644
--- a/libop/op_events.c
+++ b/libop/op_events.c
@@ -1389,6 +1389,7 @@ static void do_resolve_unit_mask(struct op_event *e,
if (pe->unit_mask_name == NULL) {
/* For numerical unit mask */
int found = 0;
+ int old_um_valid = pe->unit_mask_valid;
/* Use default unitmask if not specified */
if (!pe->unit_mask_valid) {
@@ -1404,9 +1405,16 @@ static void do_resolve_unit_mask(struct op_event *e,
found++;
}
if (found > 1) {
- fprintf(stderr, "Unit mask (0x%x) is non unique.\n"
- "Please specify the unit mask using the first "
- "word of the description\n",
+ if (!old_um_valid)
+ fprintf(stderr,
+ "Default unit mask not supported for this event.\n"
+ "Please speicfy a unit mask by name, using the first "
+ "word of the unit mask description\n");
+ else
+ fprintf(stderr,
+ "Unit mask (0x%x) is non unique.\n"
+ "Please specify the unit mask using the first "
+ "word of the description\n",
pe->unit_mask);
exit(EXIT_FAILURE);
}