Received: by 10.223.176.5 with SMTP id f5csp2460826wra; Thu, 1 Feb 2018 00:39:50 -0800 (PST) X-Google-Smtp-Source: AH8x225VWJuRIP+cmfRGA4z05yn1VQCVO4heM5g+zCjXxS2pnPSuIRTDzUZ0jcGKnF/IQLayipqg X-Received: by 2002:a17:902:780f:: with SMTP id p15-v6mr15771976pll.161.1517474389958; Thu, 01 Feb 2018 00:39:49 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1517474389; cv=none; d=google.com; s=arc-20160816; b=Rh7imozOK3n0zn9Slc5XoTYaulwjwKm7/aulhbAZp1MjDCtDXV7iaJmvOlfAwJICx1 CyMFxPFUaQMHtKLyhFQen4KF0TRY3HwDVTsKHu6VbBJO/wEV6FCR8VbhVNIWY4diLhX0 C+mEkEjHJyCk4E/qUIXsXlbek5SD+WBNc88xZWiILqMGWqi4vp/ZSNcVHgCuB29nyT2C McAYmNT90Yj4mU6kP7y621qF7HPOAeIToSiuz/tBgka0cjV0vBZf3omHA4YDooEaxT5D dHA0xguDORJUsiWJuFYxGvhChK3O21r14lBnBy7+3C2ntjG9BEvx7QjYLl9SHg0NDmaq JJKw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:arc-authentication-results; bh=aODQZ/ylG78HYpxVEYuXYN1caOVLvO3/jnGU0ISE6B8=; b=YSH5IkgJMhqk4KspNgAhQ0U7VZ/TBT2nZ4yXv6w22hErkF8q3sXxjpxraZY7wZqxkc YidCr/Ikdgx7INediOs2ptwGbhkFiz8U0bsbvYCIEFUDSfRcB29hYL1q/d0gdXMTilvZ BFQ8QUpBIUyn9zOCkg9Wz8WtkAThzwgzT6PTScOskN3gnnh3qUXrYGFunlUhBWaIJeSk oitQH+CSSwpwqDBzZoLg/PMcQJJkqgKaLVEyd1OENSdLI1O28Zz0U+aSQeF8ZYNB1xUH zugV+Oy7q4AzoXhZETvL0zUQEgS3lshVCrIcV1uQG2q3oru1ZYSTrbY2IyDMJ53DmQoD 9l+w== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id w61-v6si1589229plb.412.2018.02.01.00.39.35; Thu, 01 Feb 2018 00:39:49 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751980AbeBAIib (ORCPT + 99 others); Thu, 1 Feb 2018 03:38:31 -0500 Received: from mx1.redhat.com ([209.132.183.28]:37472 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751910AbeBAIiX (ORCPT ); Thu, 1 Feb 2018 03:38:23 -0500 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id D85AC5AFC4; Thu, 1 Feb 2018 08:38:22 +0000 (UTC) Received: from krava.redhat.com (ovpn-204-213.brq.redhat.com [10.40.204.213]) by smtp.corp.redhat.com (Postfix) with ESMTP id D8949620CB; Thu, 1 Feb 2018 08:38:19 +0000 (UTC) From: Jiri Olsa To: Arnaldo Carvalho de Melo Cc: lkml , Ingo Molnar , Namhyung Kim , David Ahern , Andi Kleen , Alexander Shishkin , Peter Zijlstra , Stephane Eranian Subject: [PATCH 2/3] perf record: Fix period option handling Date: Thu, 1 Feb 2018 09:38:11 +0100 Message-Id: <20180201083812.11359-3-jolsa@kernel.org> In-Reply-To: <20180201083812.11359-1-jolsa@kernel.org> References: <20180201083812.11359-1-jolsa@kernel.org> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.39]); Thu, 01 Feb 2018 08:38:23 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Stephan reported we don't unset PERIOD sample type when --no-period is specified. Adding the unset check and reset PERIOD if --no-period is specified. Reported-by: Stephane Eranian Link: http://lkml.kernel.org/n/tip-b89ggszz9x26hm7ztor29b0s@git.kernel.org Signed-off-by: Jiri Olsa --- tools/perf/builtin-record.c | 3 ++- tools/perf/perf.h | 1 + tools/perf/util/evsel.c | 11 ++++++++--- 3 files changed, 11 insertions(+), 4 deletions(-) diff --git a/tools/perf/builtin-record.c b/tools/perf/builtin-record.c index f251e824edac..907267206973 100644 --- a/tools/perf/builtin-record.c +++ b/tools/perf/builtin-record.c @@ -1566,7 +1566,8 @@ static struct option __record_options[] = { OPT_BOOLEAN_SET('T', "timestamp", &record.opts.sample_time, &record.opts.sample_time_set, "Record the sample timestamps"), - OPT_BOOLEAN('P', "period", &record.opts.period, "Record the sample period"), + OPT_BOOLEAN_SET('P', "period", &record.opts.period, &record.opts.period_set, + "Record the sample period"), OPT_BOOLEAN('n', "no-samples", &record.opts.no_samples, "don't sample"), OPT_BOOLEAN_SET('N', "no-buildid-cache", &record.no_buildid_cache, diff --git a/tools/perf/perf.h b/tools/perf/perf.h index 2357f4ccc9c7..cfe46236a5e5 100644 --- a/tools/perf/perf.h +++ b/tools/perf/perf.h @@ -50,6 +50,7 @@ struct record_opts { bool sample_time_set; bool sample_cpu; bool period; + bool period_set; bool running_time; bool full_auxtrace; bool auxtrace_snapshot_mode; diff --git a/tools/perf/util/evsel.c b/tools/perf/util/evsel.c index f2f2eaafde6d..ff359c9ece2e 100644 --- a/tools/perf/util/evsel.c +++ b/tools/perf/util/evsel.c @@ -971,9 +971,6 @@ void perf_evsel__config(struct perf_evsel *evsel, struct record_opts *opts, if (target__has_cpu(&opts->target) || opts->sample_cpu) perf_evsel__set_sample_bit(evsel, CPU); - if (opts->period) - perf_evsel__set_sample_bit(evsel, PERIOD); - /* * When the user explicitly disabled time don't force it here. */ @@ -1075,6 +1072,14 @@ void perf_evsel__config(struct perf_evsel *evsel, struct record_opts *opts, apply_config_terms(evsel, opts, track); evsel->ignore_missing_thread = opts->ignore_missing_thread; + + /* The --period option takes the precedence. */ + if (opts->period_set) { + if (opts->period) + perf_evsel__set_sample_bit(evsel, PERIOD); + else + perf_evsel__reset_sample_bit(evsel, PERIOD); + } } static int perf_evsel__alloc_fd(struct perf_evsel *evsel, int ncpus, int nthreads) -- 2.13.6