Re: [PATCH RFC V6 4/6] perf,tool: per-event time support

From: Jiri Olsa
Date: Wed Jul 29 2015 - 07:02:57 EST


On Mon, Jul 27, 2015 at 08:21:37AM -0400, Kan Liang wrote:

SNIP

>
> diff --git a/tools/perf/util/parse-events.c b/tools/perf/util/parse-events.c
> index 09bee93..b10a5c0 100644
> --- a/tools/perf/util/parse-events.c
> +++ b/tools/perf/util/parse-events.c
> @@ -603,6 +603,11 @@ do { \
> * attr->branch_sample_type = term->val.num;
> */
> break;
> + case PARSE_EVENTS__TERM_TYPE_TIME:
> + CHECK_TYPE_VAL(NUM);
> + if (term->val.num > 1)
> + return -EINVAL;

you might want to add the error info stuff to get:

[jolsa@krava perf]$ ./perf record -e 'cpu/cpu-cycles,time=111111111/' --no-timestamp ls
event syntax error: '..es,time=111111111/'
\___ expected 0 or 1


---
diff --git a/tools/perf/util/parse-events.c b/tools/perf/util/parse-events.c
index b10a5c03ec3e..a6cb9afc20e2 100644
--- a/tools/perf/util/parse-events.c
+++ b/tools/perf/util/parse-events.c
@@ -605,8 +605,11 @@ do { \
break;
case PARSE_EVENTS__TERM_TYPE_TIME:
CHECK_TYPE_VAL(NUM);
- if (term->val.num > 1)
+ if (term->val.num > 1) {
+ err->str = strdup("expected 0 or 1");
+ err->idx = term->err_val;
return -EINVAL;
+ }
break;
case PARSE_EVENTS__TERM_TYPE_NAME:
CHECK_TYPE_VAL(STR);
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/