Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp2529812imm; Thu, 7 Jun 2018 12:11:44 -0700 (PDT) X-Google-Smtp-Source: ADUXVKL+YwmDfnKSX8oDKlCFD0L9D6vyJSuTpX1TNvzW7PnhTtVdi+JXTtH8l7rlnFVdxZC3VTtT X-Received: by 2002:a17:902:6b44:: with SMTP id g4-v6mr3222941plt.390.1528398704232; Thu, 07 Jun 2018 12:11:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1528398704; cv=none; d=google.com; s=arc-20160816; b=e1i3YZdkZic1y3jlNFiHxYSoPqQyOqVo2neV3rdyQR0NcPZyxL1UIs9nX9ZdrBUNxZ gArbo0uFw5IqzT+6dPCHARVTCl01qi0a6p1gb6LPo/ika4BBkTxkVam1/iovFapsm2T8 AsMvvI3YHbJ7ixa2FKt4wyskiWss3Ido+mxnGuAQR+LLbzNxg2JNrcfcuV19T7fpuI2M YW640lxa77do38lACcj7XdfwxDLZpwQUmL8zo/hCAFam+P75qYgPL2XrejeqWFoIsk13 lZplKE38RYmMAOanf3Kad/0QxQUNF/3mqqWhPCr8Y+Qp7uyyiE+4jCy9n4rfFXKuTu6C FvTw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature:arc-authentication-results; bh=cJhg6klV89YaK/bzqcb6Bo6MO+CScHg/oDQkOiXPhnU=; b=TO4kqLGxhx2KWn9VNamg2GH/XNqaVBjAlx/50Zlb7PeeQzkhm/Z4Vmc7LY5x8cJpT5 XRkQJ0AB7Tse8v7pGzc/qyrr8fQB3KanUB1jRauLh/YnvT7YoSUg52PUGMYZDhljXMGE +CNqnh6Db7vPcNeXkfunJAArv7yHMiUx24MeU1vrXfL2KQ95m1BVnHIlkeqaDnV0zBjc OTgriVhE1xF6tL0LxtTrwCH8YWg/FPLcGfuql5AlMVahOOfYKVC5HX6UaDmXUp6RYQ4H Fl1pd2lj06ZVaYHTBPbRqSk5EcYH6jKda3WYSkS9kYm11edjkDHEsVgPLPAnUKGCEDd1 i5Hg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=FsZfM6qB; 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=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id i9-v6si13051014pgs.418.2018.06.07.12.11.30; Thu, 07 Jun 2018 12:11:44 -0700 (PDT) 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=@kernel.org header.s=default header.b=FsZfM6qB; 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=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933014AbeFGS6C (ORCPT + 99 others); Thu, 7 Jun 2018 14:58:02 -0400 Received: from mail.kernel.org ([198.145.29.99]:37872 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932747AbeFGS6A (ORCPT ); Thu, 7 Jun 2018 14:58:00 -0400 Received: from jouet.infradead.org (unknown [190.15.121.82]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 8E0DF20895; Thu, 7 Jun 2018 18:57:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1528397880; bh=yEv351XTOTYXz0eD8cEy9PYciOpHlAo8TanyUNw6a9Y=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=FsZfM6qBYWzgFw/Zn1qhVpWomur8U/d9muh8m+ORfbdSf2CAAWMObotLX6vawu3m1 90gkeU1okfFtzNsHkt3lAltj4VE5psbnNyYebxy1PCFA14G4ek2a/5YjxY0EJOUROZ NUCQPAbVQIiPY7O80QoS3cv4px+NGWKx5mNI1rn0= Received: by jouet.infradead.org (Postfix, from userid 1000) id 4E98D1468B9; Thu, 7 Jun 2018 15:57:57 -0300 (-03) Date: Thu, 7 Jun 2018 15:57:57 -0300 From: Arnaldo Carvalho de Melo To: Jiri Olsa Cc: Peter Zijlstra , lkml , Ingo Molnar , Namhyung Kim , David Ahern , Alexander Shishkin , Stephane Eranian , Milian Wolff , Andi Kleen , Frederic Weisbecker Subject: Re: [PATCH 03/10] perf stat: Add --interval-clear option Message-ID: <20180607185757.GB17292@kernel.org> References: <20180606221513.11302-1-jolsa@kernel.org> <20180606221513.11302-4-jolsa@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20180606221513.11302-4-jolsa@kernel.org> X-Url: http://acmel.wordpress.com User-Agent: Mutt/1.9.2 (2017-12-15) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Em Thu, Jun 07, 2018 at 12:15:06AM +0200, Jiri Olsa escreveu: > Adding --interval-clear option to clear the screen > before next interval. Better than: watch -n 0 perf stat -a sleep 1 :-) Tested and applied, - Arnaldo > Link: http://lkml.kernel.org/n/tip-8zobiwghr6t9f9a4o886cmau@git.kernel.org > Signed-off-by: Jiri Olsa > --- > tools/perf/Documentation/perf-stat.txt | 3 +++ > tools/perf/builtin-stat.c | 11 +++++++++-- > 2 files changed, 12 insertions(+), 2 deletions(-) > > diff --git a/tools/perf/Documentation/perf-stat.txt b/tools/perf/Documentation/perf-stat.txt > index 5dfe102fb5b5..b10a90b6a718 100644 > --- a/tools/perf/Documentation/perf-stat.txt > +++ b/tools/perf/Documentation/perf-stat.txt > @@ -178,6 +178,9 @@ Print count deltas for fixed number of times. > This option should be used together with "-I" option. > example: 'perf stat -I 1000 --interval-count 2 -e cycles -a' > > +--interval-clear:: > +Clear the screen before next interval. > + > --timeout msecs:: > Stop the 'perf stat' session and print count deltas after N milliseconds (minimum: 10 ms). > This option is not supported with the "-I" option. > diff --git a/tools/perf/builtin-stat.c b/tools/perf/builtin-stat.c > index fce46252f89c..067d8b5b2c83 100644 > --- a/tools/perf/builtin-stat.c > +++ b/tools/perf/builtin-stat.c > @@ -65,6 +65,7 @@ > #include "util/tool.h" > #include "util/string2.h" > #include "util/metricgroup.h" > +#include "util/top.h" > #include "asm/bug.h" > > #include > @@ -173,6 +174,7 @@ static struct cpu_map *aggr_map; > static aggr_get_id_t aggr_get_id; > static bool append_file; > static bool interval_count; > +static bool interval_clear; > static const char *output_name; > static int output_fd; > static int print_free_counters_hint; > @@ -1713,9 +1715,12 @@ static void print_interval(char *prefix, struct timespec *ts) > FILE *output = stat_config.output; > static int num_print_interval; > > + if (interval_clear) > + puts(CONSOLE_CLEAR); > + > sprintf(prefix, "%6lu.%09lu%s", ts->tv_sec, ts->tv_nsec, csv_sep); > > - if (num_print_interval == 0 && !csv_output) { > + if ((num_print_interval == 0 && !csv_output) || interval_clear) { > switch (stat_config.aggr_mode) { > case AGGR_SOCKET: > fprintf(output, "# time socket cpus"); > @@ -1747,7 +1752,7 @@ static void print_interval(char *prefix, struct timespec *ts) > } > } > > - if (num_print_interval == 0 && metric_only) > + if ((num_print_interval == 0 && metric_only) || interval_clear) > print_metric_headers(" ", true); > if (++num_print_interval == 25) > num_print_interval = 0; > @@ -2066,6 +2071,8 @@ static const struct option stat_options[] = { > "(overhead is possible for values <= 100ms)"), > OPT_INTEGER(0, "interval-count", &stat_config.times, > "print counts for fixed number of times"), > + OPT_BOOLEAN(0, "interval-clear", &interval_clear, > + "clear screen in between new interval"), > OPT_UINTEGER(0, "timeout", &stat_config.timeout, > "stop workload and print counts after a timeout period in ms (>= 10ms)"), > OPT_SET_UINT(0, "per-socket", &stat_config.aggr_mode, > -- > 2.13.6