From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752744AbbGNGzD (ORCPT ); Tue, 14 Jul 2015 02:55:03 -0400 Received: from mx1.redhat.com ([209.132.183.28]:37711 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751018AbbGNGzA (ORCPT ); Tue, 14 Jul 2015 02:55:00 -0400 Date: Tue, 14 Jul 2015 08:54:58 +0200 From: Jiri Olsa To: kan.liang@intel.com Cc: acme@kernel.org, jolsa@kernel.org, namhyung@kernel.org, ak@linux.intel.com, linux-kernel@vger.kernel.org Subject: Re: [PATCH RFC V3 3/5] perf,tool: partial time support Message-ID: <20150714065458.GG22977@krava.local> References: <1436345097-11113-1-git-send-email-kan.liang@intel.com> <1436345097-11113-4-git-send-email-kan.liang@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1436345097-11113-4-git-send-email-kan.liang@intel.com> User-Agent: Mutt/1.5.23 (2014-03-12) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Jul 08, 2015 at 04:44:55AM -0400, kan.liang@intel.com wrote: > From: Kan Liang > 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