Received: by 2002:a05:6a10:6744:0:0:0:0 with SMTP id w4csp5141862pxu; Wed, 21 Oct 2020 14:54:18 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxCSLtEKCHWNtWhES8VLZMQnQCd9yMPt0LsY5LhzLcY2xSJhnB7vaQud6mNXQcjqa2xk8oD X-Received: by 2002:a17:906:6bce:: with SMTP id t14mr5765102ejs.118.1603317258226; Wed, 21 Oct 2020 14:54:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1603317258; cv=none; d=google.com; s=arc-20160816; b=LR3Ty1QVDIFSaI/sQNvs40bLISLVRdZUFLps/5BlUQkXvboaNtA8tH8qqLL/1ZLDbj EUlOhWtVhqXEhaUbqcIAfGMiHJUSifw/9+x+BUJ90V+D0auYrW7gAcibfnl3Ek2JVX0K +pL2jzTY0hMxsIhh0ckSU+ZDQhBSi5hkfNu8QiFBsrtkMsDTbMYeLwYZARHXTonqtZDB HcK/nCvW5RWMy5uY3MZXkX98J7dBkK0Ejmt0Csv8dS0Y1Nhfv0NORsRxDUc1BIzNNhJI sRObu8aVfR6eWcHFmlEd+k2LfY8q5DEoB/Ag1BmFlOcFozEaJVouwrnrp4tTX91s7uxX le6Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :in-reply-to:mime-version:user-agent:date:message-id:organization :from:references:cc:to:subject:ironport-sdr:ironport-sdr; bh=J1jRR2qcQnVlyXT+InIpec6k8L84Z58d+Oq6eiCywbc=; b=aXpUfe/mCimeYVe8ua4ZFfmm0uJL80Pehx6d4sU2DP+1sGrQoglBpm9O1b9XrDqDjp vI+50n68oH1e5WtGdrWl5B3y5y/PaCuNha9Fv2zxqEBiIOLnr096C4WniNB2vSgUsUQY bIB76oeS7yf6gFRjYqy+BtzXJ8TPEPwR+zhRGpVSd4NJ/3aM2/f4/BpUjanGj2RiDWmu XwcR/eAk1nzE8XC5gAldlupij2ZKyDnaAfEcdYTtbFsgLBfOSXOETBiDRSO1grLztjU7 yElHGOZFM0Kx176GopPAJjN+tZjPdR3G1/u1jGJ3BYC8r9CN385zz1MApWj3gni6pSPo ScuA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id z3si2159219ejc.327.2020.10.21.14.53.55; Wed, 21 Oct 2020 14:54:18 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2438776AbgJUKY6 (ORCPT + 99 others); Wed, 21 Oct 2020 06:24:58 -0400 Received: from mga03.intel.com ([134.134.136.65]:55048 "EHLO mga03.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2438725AbgJUKY5 (ORCPT ); Wed, 21 Oct 2020 06:24:57 -0400 IronPort-SDR: Mj1gIrXPwCh4MNgT4PYTA1v/2OO7+DZvJVocOW3WJpZyaLOJYQqPRRBBVsc9BPSj42mPl+YU5/ Al3emVbaDjLQ== X-IronPort-AV: E=McAfee;i="6000,8403,9780"; a="167435164" X-IronPort-AV: E=Sophos;i="5.77,401,1596524400"; d="scan'208";a="167435164" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga002.jf.intel.com ([10.7.209.21]) by orsmga103.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 21 Oct 2020 03:24:55 -0700 IronPort-SDR: GxYVx1fs+TdezQoCM+vHwGMX1s64m/NG2JC+8znqUeZIuR0g4Iw15XKK6kXJCyL6a4FTL3kDso XyWw7SkZX7Ag== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.77,401,1596524400"; d="scan'208";a="332541940" Received: from linux.intel.com ([10.54.29.200]) by orsmga002.jf.intel.com with ESMTP; 21 Oct 2020 03:24:55 -0700 Received: from [10.249.225.226] (abudanko-mobl.ccr.corp.intel.com [10.249.225.226]) by linux.intel.com (Postfix) with ESMTP id A374F5802BC; Wed, 21 Oct 2020 03:24:52 -0700 (PDT) Subject: Re: [PATCH v1 08/15] perf record: write trace data into mmap trace files To: Namhyung Kim Cc: Arnaldo Carvalho de Melo , Jiri Olsa , Alexander Shishkin , Andi Kleen , Adrian Hunter , Peter Zijlstra , Ingo Molnar , linux-kernel References: <810f3a69-0004-9dff-a911-b7ff97220ae0@linux.intel.com> <0652b8dd-e753-7c10-27e9-af9524e7ccc5@linux.intel.com> <81ffefab-ac4e-c51c-809a-b9ba96d6d867@linux.intel.com> From: Alexey Budankov Organization: Intel Corp. Message-ID: <0dd08c91-f48d-28db-92ed-a2b014bdcb05@linux.intel.com> Date: Wed, 21 Oct 2020 13:24:51 +0300 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:68.0) Gecko/20100101 Thunderbird/68.12.1 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 21.10.2020 10:34, Namhyung Kim wrote: > On Wed, Oct 14, 2020 at 9:09 PM Alexey Budankov > wrote: >> >> Hi, >> >> On 14.10.2020 13:52, Namhyung Kim wrote: >>> Hi, >>> >>> On Mon, Oct 12, 2020 at 6:01 PM Alexey Budankov >>> wrote: >>>> >>>> >>>> Write trace data into per mmap trace files located >>>> at data directory. Streaming thread adjusts its affinity >>>> according to mask of the buffer being processed. >>>> >>>> Signed-off-by: Alexey Budankov >>>> --- >>> [SNIP] >>>> @@ -1184,8 +1203,12 @@ static int record__mmap_read_evlist(struct record *rec, struct evlist *evlist, >>>> /* >>>> * Mark the round finished in case we wrote >>>> * at least one event. >>>> + * >>>> + * No need for round events in directory mode, >>>> + * because per-cpu maps and files have data >>>> + * sorted by kernel. >>>> */ >>>> - if (bytes_written != rec->bytes_written) >>>> + if (!record__threads_enabled(rec) && bytes_written != rec->bytes_written) >>>> rc = record__write(rec, NULL, &finished_round_event, sizeof(finished_round_event)); >>> >>> This means it needs to keep all events in the ordered events queue >>> when perf report processes the data, right? >> >> Looks so. > > Maybe it's not related to this directly. But we need to think about > how to make perf report faster and more efficient as well. Makes sense. Agreed. > > In my previous attempt, I separated samples from other events > to be in different mmaps so they were saved to different files > (or in a separate part of the data file). > > And perf report processes the meta events (FORK/MMAP/...) > first to construct the system image and then processes samples > with multi-threads. Looks like separation to global, per-process events and per-thread ones. Alternative algorithm could possibly be multi-passing of trace data. First pass is to capture global events and build process state overtime progress picture. Second pass is to capture and map per-thread samples and/or other events into process state according to samples and events time. > > Once it has the image, it could bypass the ordered events queue > entirely. > > Thanks > > Namhyung > Thanks, Alexei