Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755333AbbGZQbi (ORCPT ); Sun, 26 Jul 2015 12:31:38 -0400 Received: from mx1.redhat.com ([209.132.183.28]:52876 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755284AbbGZQbd (ORCPT ); Sun, 26 Jul 2015 12:31:33 -0400 Date: Sun, 26 Jul 2015 18:31:29 +0200 From: Jiri Olsa To: kan.liang@intel.com Cc: a.p.zijlstra@chello.nl, acme@kernel.org, luto@kernel.org, mingo@redhat.com, eranian@google.com, ak@linux.intel.com, mark.rutland@arm.com, adrian.hunter@intel.com, jolsa@kernel.org, namhyung@kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH V2 3/6] perf,tools: Dump per-sample freq/CPU%/CORE_BUSY% in report -D Message-ID: <20150726163129.GD24646@krava.brq.redhat.com> References: <1437745712-16649-1-git-send-email-kan.liang@intel.com> <1437745712-16649-4-git-send-email-kan.liang@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1437745712-16649-4-git-send-email-kan.liang@intel.com> 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 Content-Length: 2026 Lines: 58 On Fri, Jul 24, 2015 at 09:48:29AM -0400, kan.liang@intel.com wrote: SNIP > diff --git a/tools/perf/util/session.c b/tools/perf/util/session.c > index ed9dc25..7f628d9 100644 > --- a/tools/perf/util/session.c > +++ b/tools/perf/util/session.c > @@ -851,8 +851,14 @@ static void perf_evlist__print_tstamp(struct perf_evlist *evlist, > printf("%" PRIu64 " ", sample->time); > } > > -static void sample_read__printf(struct perf_sample *sample, u64 read_format) > +static void sample_read__printf(struct perf_evlist *evlist, > + struct perf_sample *sample, > + u64 read_format) > { > + struct perf_evsel *evsel; > + struct perf_sample_id *sid; > + u64 data[FREQ_PERF_MAX] = { 0 }; > + > printf("... sample_read:\n"); > > if (read_format & PERF_FORMAT_TOTAL_TIME_ENABLED) > @@ -875,10 +881,26 @@ static void sample_read__printf(struct perf_sample *sample, u64 read_format) > printf("..... id %016" PRIx64 > ", value %016" PRIx64 "\n", > value->id, value->value); > + > + sid = perf_evlist__id2sid(evlist, value->id); > + evsel = sid->evsel; > + if (evsel != NULL) > + SET_FREQ_PERF_VALUE(evsel, data, > + value->value); > } > } else > printf("..... id %016" PRIx64 ", value %016" PRIx64 "\n", > sample->read.one.id, sample->read.one.value); > + > + if (HAS_FREQ(data)) > + printf("..... Freq %lu MHz\n", > + (data[FREQ_PERF_CYCLES] * cpu_max_freq) / data[FREQ_PERF_REF_CYCLES]); I dont like having those numbers (cpu_max_freq, msr_pmu_type) pushed into global variables that would be used I think you should somehow push those session's values through the whole dump_sample code maybe make them both part of session::perf_session_env and push this pointer along the dump_sample call stack jirka -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/