From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754050AbbICNSA (ORCPT ); Thu, 3 Sep 2015 09:18:00 -0400 Received: from mx1.redhat.com ([209.132.183.28]:40174 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752010AbbICNR7 (ORCPT ); Thu, 3 Sep 2015 09:17:59 -0400 Date: Thu, 3 Sep 2015 15:17:54 +0200 From: Jiri Olsa To: Andi Kleen Cc: acme@kernel.org, jolsa@kernel.org, linux-kernel@vger.kernel.org Subject: Re: perf, tools: Refactor and support interval and CSV metrics v3 Message-ID: <20150903131754.GI13114@krava.redhat.com> References: <1441236954-24886-1-git-send-email-andi@firstfloor.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1441236954-24886-1-git-send-email-andi@firstfloor.org> 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, Sep 02, 2015 at 04:35:45PM -0700, Andi Kleen wrote: > [v3: Addressed all review feedback. Update manpage for CSV. Various changes > (see individual patches). Remove some more redundant code > in printout callers.] > [v2: Addressed (near) all review feedback. No manpage updates so far. > Add support for --per-core metrics. Various cleanups.] > [v3: Everything compiles again. Some more cleanups.] > > Currently perf stat does not support printing computed metrics for interval (-I xxx) > or CSV (-x,) mode. For example IPC or TSX metrics over time are quite useful to know. > > This patch implements them. The main obstacle was that the > metrics printing was all open coded all over the metrics computation code. > The second patch refactors the metrics printing to work through call backs that > can be more easily changed. This also cleans up the metrics printing significantly. > The indentation is now handled through printf, no more need to manually count spaces. > > Then based on that it implements metrics printing for CSV and interval mode. > > Example output: > > % perf stat -I1000 -a sleep 1 > # time counts unit events metric multiplex > 1.001301370 12020.049593 task-clock (msec) (100.00%) > 1.001301370 3,952 context-switches # 0.329 K/sec (100.00%) > 1.001301370 69 cpu-migrations # 0.006 K/sec (100.00%) > 1.001301370 76 page-faults # 0.006 K/sec > 1.001301370 386,582,789 cycles # 0.032 GHz (100.00%) > 1.001301370 716,441,544 stalled-cycles-frontend # 185.33% frontend cycles idle (100.00%) > 1.001301370 stalled-cycles-backend > 1.001301370 101,751,678 instructions # 0.26 insn per cycle > 1.001301370 # 7.04 stalled cycles per insn (100.00%) > 1.001301370 20,914,692 branches # 1.740 M/sec (100.00%) > 1.001301370 1,943,630 branch-misses # 9.29% of all branches > > CSV mode > > % perf stat -x, -I1000 -a sleep 1 > 1.000852081,12016.143006,,task-clock > 1.000852081,4457,,context-switches,12015168277,100.00,0.371,K/sec > 1.000852081,50,,cpu-migrations,12014024424,100.00,0.004,K/sec > 1.000852081,76,,page-faults,12013076716,100.00,0.006,K/sec > 1.000852081,515854373,,cycles,12011235336,100.00,0.043,GHz > 1.000852081,1030742150,,stalled-cycles-frontend,12010984057,100.00,199.81,frontend cycles idle > 1.000852081,,,stalled-cycles-backend,0,100.00 > 1.000852081,116782495,,instructions,12011130729,100.00,0.23,insn per cycle > 1.000852081,,,,12011130729,100.00,8.83,stalled cycles per insn > 1.000852081,23748237,,branches,12010745125,100.00,1.976,M/sec > 1.000852081,1976560,,branch-misses,12010501884,100.00,8.32,of all branches > > Available in > git://git.kernel.org/pub/scm/linux/kernel/git/ak/linux-misc-2.6 perf/stat-metrics-5 can't see perf/stat-metrics-5 branch [jolsa@krava perf]$ git remote update ak Fetching ak [jolsa@krava perf]$ git branch -r | grep perf/stat-metrics- ak/perf/stat-metrics-3 ak/perf/stat-metrics-4 ak/perf/stat-metrics-refactor-2 [jolsa@krava perf]$ jirka