Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755279AbbGZQbV (ORCPT ); Sun, 26 Jul 2015 12:31:21 -0400 Received: from mx1.redhat.com ([209.132.183.28]:43588 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755184AbbGZQbS (ORCPT ); Sun, 26 Jul 2015 12:31:18 -0400 Date: Sun, 26 Jul 2015 18:31:13 +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 5/6] perf,tools: caculate and save freq/CPU%/CORE_BUSY% in he_stat Message-ID: <20150726163113.GB24646@krava.brq.redhat.com> References: <1437745712-16649-1-git-send-email-kan.liang@intel.com> <1437745712-16649-6-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-6-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: 1319 Lines: 36 On Fri, Jul 24, 2015 at 09:48:31AM -0400, kan.liang@intel.com wrote: SNIP > }, > .parent = sym_parent, > .filtered = symbol__parent_filter(sym_parent) | al->filtered, > @@ -481,6 +486,32 @@ iter_add_next_nop_entry(struct hist_entry_iter *iter __maybe_unused, > } > > static int > +iter_add_single_freq_perf_entry(struct hist_entry_iter *iter, struct addr_location *al) > +{ > + struct perf_evsel *evsel = iter->evsel; > + struct perf_sample *sample = iter->sample; > + struct hist_entry *he; > + struct freq_perf_info info = {0}; > + u64 *data = sample->freq_perf_data; > + > + if (data[FREQ_PERF_REF_CYCLES] > 0) > + info.freq = (data[FREQ_PERF_CYCLES] * cpu_max_freq) / data[FREQ_PERF_REF_CYCLES]; > + if (data[FREQ_PERF_TSC] > 0) > + info.cpu_u = (100 * data[FREQ_PERF_REF_CYCLES]) / data[FREQ_PERF_TSC]; > + if (data[FREQ_PERF_MPERF] > 0) > + info.core_busy = (100 * data[FREQ_PERF_APERF]) / data[FREQ_PERF_MPERF]; seems to me the new iterator is too big gun for this, why not initialize 'struct freq_perf_info' in iter_prepare_normal_entry ? 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/