From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755202AbbBBIgx (ORCPT ); Mon, 2 Feb 2015 03:36:53 -0500 Received: from mga14.intel.com ([192.55.52.115]:44993 "EHLO mga14.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752994AbbBBIgw (ORCPT ); Mon, 2 Feb 2015 03:36:52 -0500 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.09,505,1418112000"; d="scan'208";a="646040994" Message-ID: <54CF36AA.50508@intel.com> Date: Mon, 02 Feb 2015 10:34:50 +0200 From: Adrian Hunter Organization: Intel Finland Oy, Registered Address: PL 281, 00181 Helsinki, Business Identity Code: 0357606 - 4, Domiciled in Helsinki User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.4.0 MIME-Version: 1.0 To: Jiri Olsa , Namhyung Kim CC: Arnaldo Carvalho de Melo , Ingo Molnar , Peter Zijlstra , LKML , David Ahern , Andi Kleen , Stephane Eranian , Frederic Weisbecker Subject: Re: [PATCH 14/42] perf record: Add --index option for building index table References: <1422518843-25818-1-git-send-email-namhyung@kernel.org> <1422518843-25818-15-git-send-email-namhyung@kernel.org> <20150201180635.GA6317@krava.brq.redhat.com> In-Reply-To: <20150201180635.GA6317@krava.brq.redhat.com> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 01/02/15 20:06, Jiri Olsa wrote: > On Thu, Jan 29, 2015 at 05:06:55PM +0900, Namhyung Kim wrote: >> The new --index option will create indexed data file which can be >> processed by multiple threads parallelly. It saves meta event and >> sample data in separate files and merges them with an index table. >> >> To build an index table, it needs to know exact offsets and sizes for >> each sample data. However the offset only can be calculated after the >> feature data is fixed, and to save feature data it needs to access to >> the sample data because it needs to mark used DSOs for build-id table. >> >> So I ended up with reserving 1MB hole for the feature data area and then >> put sample data and calculated offsets. Now an indexed perf data file >> will look like below: >> >> +---------------------+ >> | file header | >> |---------------------| >> | | >> | meta events | >> | | >> |---------------------| >> | feature data | >> | (contains index) -+--+ >> |---------------------| | >> | ~1MB hole | | >> |---------------------| | >> | | | >> | sample data[1] <-+--+ >> | | | >> |---------------------| | >> | | | >> | sample data[2] <-|--+ >> | | | >> |---------------------| | >> | ... | ... >> +---------------------+ > > I also dont see how to store it in a nice way under current header layout, > but how about bump up the header version for this feature? ;-) > > currently it's: > > struct perf_file_header { > u64 magic; > u64 size; > u64 attr_size; > struct perf_file_section attrs; > struct perf_file_section data; > /* event_types is ignored */ > struct perf_file_section event_types; > DECLARE_BITMAP(adds_features, HEADER_FEAT_BITS); > }; > > > - we already store attrs as a FEATURE so we could omit that > - your patch stores only synthesized data into 'data' section (-1 idx) > this could be stored into separate file and get merged with the rest > - new header version would have 'features' section, so the features > position wouldnt depend on the 'data' end as of now and we could > easily store after all data is merged: > > struct perf_file_header { > u64 magic; > u64 size; > u64 attr_size; > struct perf_file_section features; > DECLARE_BITMAP(adds_features, HEADER_FEAT_BITS); > }; > > > thoughts? How come the features are being written before the sample data anyway? I would have expected: - write the data (update the index in memory) - write the features (including index)