Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753305AbbG0RT3 (ORCPT ); Mon, 27 Jul 2015 13:19:29 -0400 Received: from mga09.intel.com ([134.134.136.24]:52370 "EHLO mga09.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752187AbbG0RT2 convert rfc822-to-8bit (ORCPT ); Mon, 27 Jul 2015 13:19:28 -0400 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.15,555,1432623600"; d="scan'208";a="772203332" From: "Liang, Kan" To: Jiri Olsa 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" , "Hunter, Adrian" , "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 Thread-Topic: [PATCH V2 5/6] perf,tools: caculate and save freq/CPU%/CORE_BUSY% in he_stat Thread-Index: AQHQxlQ55LgR0xFrwkOv+h4nJQMiWJ3tbjSAgAIj22A= Date: Mon, 27 Jul 2015 17:19:23 +0000 Message-ID: <37D7C6CF3E00A74B8858931C1DB2F077018CCDE5@SHSMSX103.ccr.corp.intel.com> References: <1437745712-16649-1-git-send-email-kan.liang@intel.com> <1437745712-16649-6-git-send-email-kan.liang@intel.com> <20150726163113.GB24646@krava.brq.redhat.com> In-Reply-To: <20150726163113.GB24646@krava.brq.redhat.com> Accept-Language: zh-CN, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.239.127.40] Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 8BIT MIME-Version: 1.0 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1455 Lines: 41 > > -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 ? > Yes, we can initialize it in normal process. But we only need the freq_perf_info when "--show-freq-perf" is set. For most of the cases, it wastes time to calculate the unused information for each sample. That could impact the performance for processing. Thanks, Kan -- 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/