On Wed, Jul 08, 2015 at 04:44:55AM -0400, [email protected] wrote:
> From: Kan Liang <[email protected]>
> 

SNIP

> +
> +     /*
> +      * Event parsing doesn't check the availability
> +      * Clear the bit which event parsing may be set.
> +      * Let following code check and reset if available
> +      *
> +      * Also, the sample size may be caculated mistakenly,
> +      * because event parsing may set the PERF_SAMPLE_TIME.
> +      * Remove the size which add in perf_evsel__init
> +      */
> +     if (attr->sample_type & PERF_SAMPLE_TIME) {
> +             attr->sample_type &= ~PERF_SAMPLE_TIME;
> +             evsel->sample_size -= sizeof(u64);
> +     }

why not use perf_evsel__reset_sample_bit?

> +
>       perf_evsel__set_sample_bit(evsel, IP);
>       perf_evsel__set_sample_bit(evsel, TID);
>  
> @@ -705,14 +732,15 @@ void perf_evsel__config(struct perf_evsel *evsel, 
> struct record_opts *opts)
>       /*
>        * When the user explicitely disabled time don't force it here.
>        */

SNIP

> diff --git a/tools/perf/util/parse-events.c b/tools/perf/util/parse-events.c
> index a71eeb2..9510047 100644
> --- a/tools/perf/util/parse-events.c
> +++ b/tools/perf/util/parse-events.c
> @@ -598,6 +598,13 @@ 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;
> +             if (term->val.num == 1)
> +                     attr->sample_type |= PERF_SAMPLE_TIME;

why not use perf_evsel__set_sample_bit?

> +              break;
>       case PARSE_EVENTS__TERM_TYPE_NAME:
>               CHECK_TYPE_VAL(STR);
>               break;

SNIP

jirka
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Reply via email to