Received: by 10.223.176.5 with SMTP id f5csp2644378wra; Mon, 29 Jan 2018 01:26:49 -0800 (PST) X-Google-Smtp-Source: AH8x227K6E7U3ohmbYuT8p0aWar0q1Nrr9VxNc4iLlECbqdOwqdLwNA3vePYmHEKVl+l4w2if0nD X-Received: by 10.99.65.65 with SMTP id o62mr17082863pga.392.1517218009620; Mon, 29 Jan 2018 01:26:49 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1517218009; cv=none; d=google.com; s=arc-20160816; b=o5dqhVSmFCPizvLYPqcHsfIQRd8prafI2+CjUcGgmgy08dpbzzH2vR6clyEYrDuZAq CBPvMKab7MkLqjUmPkRty1XdYsGeoOIfjSGiRkiDoccsTHioYP+/A6L9OqfJ+RQq/gAH yXAPfNABnnmRTgYgib1CVVh1pxEQwBopowfDGWfF6xGYhD6dlBIu9AjkSMdEDDKpElJO qBRwmrBmzOay3Wy9A1jkr1SXRtbxk/AKzYOfzf2lI63wVzDsm/u7CryHWoEdvPcbzqut 8zlp5QFeplnpi4bjF2w4lb9byQH3RSSzxDb/nN4vEq1KzTTupey5C0QJqXTqma1AS6RZ lZcA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from :dkim-signature:arc-authentication-results; bh=Iw3U3isTQ6X7BbS/EuulYbpPpBIibQTV7MZIYhKNM80=; b=xtDpepZBV1cpGO3PJG/5Q54BcP4V/cw8PaGZbmN9X4zeXR6eVbNEZKZ0NV8OR4aGPu C551PwhGE9QhydPIZ2xcDiJjQp2f7kYSIJHBmH1uKKIk64RMyEwx1IcObaczsOTGXaeW 4Kl2n1gahirQtxNVV42cbc/rEtyydC3IBJZhPxbVdHLU1V/H48eLpvHuNrCm8r8T188E dT3/Gmhgwzy0sx6jq7R5Ab+d23P0+v+glbhr++YKXKHTBT7Ws8pPlTn0wB3mXFQmlYPb b/vHPZ68UlKAp27R9AQzWJWQUu31fPm4SEF7iEINpRDgBR6TOVRV9mbEOvoOw5Nc2eZ+ Tkjg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=LS7e/401; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id t3si7103723pgt.195.2018.01.29.01.26.12; Mon, 29 Jan 2018 01:26: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; dkim=pass header.i=@gmail.com header.s=20161025 header.b=LS7e/401; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751567AbeA2JZm (ORCPT + 99 others); Mon, 29 Jan 2018 04:25:42 -0500 Received: from mail-it0-f67.google.com ([209.85.214.67]:55187 "EHLO mail-it0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751473AbeA2JZj (ORCPT ); Mon, 29 Jan 2018 04:25:39 -0500 Received: by mail-it0-f67.google.com with SMTP id k131so7522209ith.4; Mon, 29 Jan 2018 01:25:39 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id; bh=Iw3U3isTQ6X7BbS/EuulYbpPpBIibQTV7MZIYhKNM80=; b=LS7e/401f9TIvJUlKN0F0aSSnUkadHSY22i/vcU/kHofXdmy4I4JVvW630PQitfa36 YsObdG9DDINl5RucOEEFBDS+RlifNFnD37Rn7iXPI0JiZ6Lv2DU+H3oqARZQ9VsqAFgo d6z2v2a1cDeTFeCyl/8AqgIGq7zNjr1EzM1R/WSCSmhQu2GNA0X8VprorZ0UJsWpEEc8 VKNTmVN8o2mpvPCXIUqylSN5Ai2wOtSZoIl+RIE233QFHKxKkVQ2lIyeze0Oc909udwy tcmVZV2/Rrm6+b7/WOR1U2/Yv2ji1pgOJb1dFCjqggoMdPrI0VEzwyiQp0FAIr/WUOJI Cdkw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=Iw3U3isTQ6X7BbS/EuulYbpPpBIibQTV7MZIYhKNM80=; b=CNGS6l/GZdpXix7kUqtngRmAwd4XrIkBm70KhXnTpz8RVsVYAkGXCqrBRyeJJKYite Cu9XVVNBtULEFHtjL3vkVn7KxyMYQj0peOv0D17D4m9GYeLj4t1q+TZCXvptYQ1D+xYp eVqEMVvPt13HSvOZNNMwVDKH220DdUd9dX6OGQXSySVkjjS3sIWyEODbNI04obC4g/J3 vB0aUBQhqalpG0vHSN3xfShpVWO106oEo202u17eES+j3JtWs6k7DMnZePkF1mreePXE nb1W725lfCd8sb9+CoMuIXxH6vOS5AIWjqM+izMyRwtsWLr3zQo/cp1k4r1mUD56xLww PahA== X-Gm-Message-State: AKwxytc/2dCaXRkACMbiVYhkWF5wAvrDTVkt6SgVyYjMt/l4EWc4ypAT WE5VdWbeVx9nYy6ygH0t7cQ= X-Received: by 10.36.164.6 with SMTP id z6mr25548081ite.2.1517217939106; Mon, 29 Jan 2018 01:25:39 -0800 (PST) Received: from node3.didichuxing.com ([40.83.124.139]) by smtp.gmail.com with ESMTPSA id j3sm3869448iob.14.2018.01.29.01.25.34 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 29 Jan 2018 01:25:38 -0800 (PST) From: ufo19890607 To: peterz@infradead.org, mingo@redhat.com, alexander.shishkin@linux.intel.com, jolsa@kernel.org, dsahern@gmail.com, namhyung@kernel.org, milian.wolff@kdab.com, arnaldo.melo@gmail.com, yuzhoujian@didichuxing.com, adrian.hunter@intel.com, wangnan0@huawei.com, Kan.liang@intel.com Cc: linux-perf-users@vger.kernel.org, linux-kernel@vger.kernel.org, acme@redhat.com Subject: [PATCH v4 0/2] perf stat: Add interval-count and time support Date: Mon, 29 Jan 2018 10:25:21 +0100 Message-Id: <1517217923-8302-1-git-send-email-ufo19890607@gmail.com> X-Mailer: git-send-email 1.8.3.1 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: yuzhoujian Introduce two new options for perf stat and update perf-stat documentation accordingly. The interval-count option can be used to print counts for fixed number of times, and it should be used specifically with "-I" option. Show below is the output of the interval-count option for perf stat. $ perf stat -I 1000 --interval-count 2 -e cycles -a # time counts unit events 1.002827089 93,884,870 cycles 2.004231506 56,573,446 cycles The time option can be used to print counts after a period of time, and it should not be used with "-I" option. Show below is the output of the time option for perf stat. $ perf stat --time 2000 -e cycles -a Performance counter stats for 'system wide': 157,260,423 cycles 2.003060766 seconds time elapsed yuzhoujian (2): perf stat: Add support to print counts for fixed times perf stat: Add support to print counts after a period of time Changes since v3: - merge interval_count check and times check to one line. - fix the wrong indent in stat.h - use stat_config.times instead of 'times' in cmd_stat function. Changes since v2: - modify the time check in __run_perf_stat func to keep some consistency with the workload case. - add the warning when the time is set between 10ms to 100ms. - add the pr_err when the time is set below 10ms. Changes since v1: - change the name of the new option "times-print" to "interval-count". - keep the interval-count option interval specifically. tools/perf/Documentation/perf-stat.txt | 10 +++++++ tools/perf/builtin-stat.c | 53 ++++++++++++++++++++++++++++++++-- tools/perf/util/stat.h | 2 ++ 3 files changed, 62 insertions(+), 3 deletions(-) -- 2.14.1