Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp70450imm; Wed, 5 Sep 2018 15:10:14 -0700 (PDT) X-Google-Smtp-Source: ANB0VdarRgXu+5XeY4lezP98ztmsTkGWqpKa4L4CGBGxICKgbwJY1fQQ8GR95J2JAk+eImp55mx1 X-Received: by 2002:a63:5a65:: with SMTP id k37-v6mr38547911pgm.143.1536185413874; Wed, 05 Sep 2018 15:10:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1536185413; cv=none; d=google.com; s=arc-20160816; b=zYvANk22QANY9QxWSmIL2pM63RFCHKHR+uAGFQUGaReq2JV7uow+zCnDlxX4Bxdya4 TexjV0ep/aR95K/vJ/HcWJiVQhbhWDhETiz+bFpg515kncyWRTzZxxPCvuoyNvPUN4an o5OjmnHD6NmcePNpK8gcOUI3+QE57V5ZG5vF+QaaWuzLldb86jDU0L6hPRtJ/oCwBTTW ZsqFtSuGTMQVHEF/VG/4d3shNO+3Z9gbrt9644xn6jzqmtGU35BAVD9QjlR07KDk8PJJ 2XVSPUZxhIFLYWCaR+I+5U4f1xGaSKLhHeLFhabZVJufa9KNEXqHCotff1VWLJaJfzZB 5VKQ== 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:dkim-signature; bh=6zUejeCWTb1RXBQCarU8wA3XK+6qeTyXKo2UZuVsQS4=; b=XNhGuLm3vpKqL2mzWNGzdNlvuQPWJbw8ntsMZazU8w4UiVHZNi2XBfEUyFsNC8icRo XvTl9ldE6uSDgrNbU9Ev6XBK9zrHi3xVXy6aQrgtgn3JnRztLMFFI3ywShpX1bJVuhms HFi6JCO0p/vQhiH/BPMh7aMDLFSckwXTaujF1y5MNB/z7XLOXcLtSx1C6bLemj8Edj2F +ojsi/mLDrSqOMO4IoakozH+mXB7ODvr90anilBXGU92+4xgSjBbDyK2zBs5BLazq/RC FSsR2qqspZluseD9b9sZafhqkH6gsad/CwhwiVw/xKomrJZOs1QZktEjPaLGR2cbbXl/ sqmw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=LuDPJTn8; 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 h8-v6si3356809pli.14.2018.09.05.15.09.58; Wed, 05 Sep 2018 15:10:13 -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=LuDPJTn8; 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 S1728873AbeIFCji (ORCPT + 99 others); Wed, 5 Sep 2018 22:39:38 -0400 Received: from mail.kernel.org ([198.145.29.99]:54496 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727593AbeIFCji (ORCPT ); Wed, 5 Sep 2018 22:39:38 -0400 Received: from jouet.infradead.org (unknown [179.97.41.186]) (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 6CBD62083D; Wed, 5 Sep 2018 22:07:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1536185245; bh=lQo9ysQgUgAMdDiLSv0M/0ig8TxFwd4EHAgWakgbEHE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=LuDPJTn8eL0qvCAS9tm5aCRaqVj0tm+f/uxAwsSdUYny6+hWbkJ5ytZZbY04qHRO7 OLyUZTcxXZiaKsg+dZGgVOPHrPWbxz55+3MLTTfzbnT5W1GRFATaNxBcPwVsEP3Q9v nJFEeyZBlykhDMN+I3jLFVaCUWZZWoew05KeS7wE= From: Arnaldo Carvalho de Melo To: Ingo Molnar Cc: Clark Williams , linux-kernel@vger.kernel.org, linux-perf-users@vger.kernel.org, Jiri Olsa , Alexander Shishkin , Andi Kleen , David Ahern , Namhyung Kim , Peter Zijlstra , Arnaldo Carvalho de Melo Subject: [PATCH 56/77] perf stat: Add 'walltime_nsecs_stats' pointer to 'struct perf_stat_config' Date: Wed, 5 Sep 2018 19:04:19 -0300 Message-Id: <20180905220440.20256-57-acme@kernel.org> X-Mailer: git-send-email 2.14.4 In-Reply-To: <20180905220440.20256-1-acme@kernel.org> References: <20180905220440.20256-1-acme@kernel.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Jiri Olsa Add 'walltime_nsecs_stats' pointer to 'struct perf_stat_config', so that it can be passed around and used outside the 'perf stat' command. It's initialized to point to stat's walltime_nsecs_stats value. Signed-off-by: Jiri Olsa Cc: Alexander Shishkin Cc: Andi Kleen Cc: David Ahern Cc: Namhyung Kim Cc: Peter Zijlstra Link: http://lkml.kernel.org/r/20180830063252.23729-32-jolsa@kernel.org Signed-off-by: Arnaldo Carvalho de Melo --- tools/perf/builtin-stat.c | 15 ++++++++------- tools/perf/util/stat.h | 1 + 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/tools/perf/builtin-stat.c b/tools/perf/builtin-stat.c index 2711d8f6e4b8..381549a989b4 100644 --- a/tools/perf/builtin-stat.c +++ b/tools/perf/builtin-stat.c @@ -195,11 +195,12 @@ static struct perf_stat perf_stat; static volatile int done = 0; static struct perf_stat_config stat_config = { - .aggr_mode = AGGR_GLOBAL, - .scale = true, - .unit_width = 4, /* strlen("unit") */ - .run_count = 1, - .metric_only_len = METRIC_ONLY_LEN, + .aggr_mode = AGGR_GLOBAL, + .scale = true, + .unit_width = 4, /* strlen("unit") */ + .run_count = 1, + .metric_only_len = METRIC_ONLY_LEN, + .walltime_nsecs_stats = &walltime_nsecs_stats, }; static bool is_duration_time(struct perf_evsel *evsel) @@ -1671,7 +1672,7 @@ static double timeval2double(struct timeval *t) static void print_footer(struct perf_stat_config *config) { - double avg = avg_stats(&walltime_nsecs_stats) / NSEC_PER_SEC; + double avg = avg_stats(config->walltime_nsecs_stats) / NSEC_PER_SEC; FILE *output = config->output; int n; @@ -1690,7 +1691,7 @@ static void print_footer(struct perf_stat_config *config) fprintf(output, " %17.9f seconds sys\n", ru_stime); } } else { - double sd = stddev_stats(&walltime_nsecs_stats) / NSEC_PER_SEC; + double sd = stddev_stats(config->walltime_nsecs_stats) / NSEC_PER_SEC; /* * Display at most 2 more significant * digits than the stddev inaccuracy. diff --git a/tools/perf/util/stat.h b/tools/perf/util/stat.h index e70e6d93ee1b..35550e3efd81 100644 --- a/tools/perf/util/stat.h +++ b/tools/perf/util/stat.h @@ -105,6 +105,7 @@ struct perf_stat_config { struct runtime_stat *stats; int stats_num; const char *csv_sep; + struct stats *walltime_nsecs_stats; }; void update_stats(struct stats *stats, u64 val); -- 2.14.4