Received: by 2002:a05:6a10:6744:0:0:0:0 with SMTP id w4csp4836758pxu; Wed, 21 Oct 2020 06:38:34 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwak7ZtXdXVjum+fOzs0Amg3RCYHrvcihe0xRNjWGb39FOGBalAbtR93tb2EyTL2/BBeiaA X-Received: by 2002:a17:906:4a97:: with SMTP id x23mr3452089eju.471.1603287514269; Wed, 21 Oct 2020 06:38:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1603287514; cv=none; d=google.com; s=arc-20160816; b=Zbb9HHNsvVdnRLu9QkGbeHpJmnwqT7nN28aMTqQEqnmYSygfnMVee2THJEjUizOJVJ NN4Er2Tb4ZdaFYS92n9NweZLFi/EtrIUgATq4pWeT+/PG/lhiML8Q4gIybym8+kEHgz4 Q13pH1F3eo1Xn5v+9Uw5a3RpITjjuh+NFE3OfcrW1/zt1g0gTxtFKgvn4Qlvn9C2QkG5 lucyZDXX2YI9XvBEwQevkaiLaZibyfUqhKIWuzDpjTD890TN+c50sqcOjMQfP+nHe/Wa HmJrhp3kwsbMLi1KNXmYXTn/u37eXA0ZZsKzjYEP+lBS2ZkIUXc5zR08ckWKkShHpq7G BTaw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version; bh=PqFvCGU23iOTh/yBXkLIt0ccOeDmnu1NCfHunqJygNg=; b=LYxct84E3T6uDRt9s+4umPa/mrqih7cUbvIPsWFTrJAOep6arO0omxDYIcfMw05btX HdYsURpbm+85QQOTn12ZP4/1nmZIz1R4yfGL5A64GVxuk+aJAOI+qMBcQjSGnE3Gr+CX oSxXP/5jfM6UlEI79PQmrOLPrvyqei4fWrBO1LVUWkgxga7tt2pBvEN0+lC1CbSwXsCb S6XfxHJQUVHjgkgJj26bkp3MBPahv2MGI9tVa4Ag1BvA+1CRtRxDh3mp5US4qt18RlBy mM7oo1qbP5F0D6gTJQxfsGvKfjH/ltBc+mpGnHQteD5GGivPHdxn89VTtpl6MSgeXuZQ NpSQ== 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=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id h10si912072edr.423.2020.10.21.06.38.11; Wed, 21 Oct 2020 06:38:34 -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=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2439049AbgJUKvN (ORCPT + 99 others); Wed, 21 Oct 2020 06:51:13 -0400 Received: from mail-wm1-f65.google.com ([209.85.128.65]:38280 "EHLO mail-wm1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2439039AbgJUKvN (ORCPT ); Wed, 21 Oct 2020 06:51:13 -0400 Received: by mail-wm1-f65.google.com with SMTP id b127so1603465wmb.3 for ; Wed, 21 Oct 2020 03:51:11 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=PqFvCGU23iOTh/yBXkLIt0ccOeDmnu1NCfHunqJygNg=; b=B+iZLcKv24lrAvgNmf7GCutuA0vw6Y9b3zIorTochjgohW4k90PM4Ve1rIB6Vjix4L EioH0SImKmlOmV1OzuUnMWXehVx84QX6i0ndTH1GgtP9ljVmzpxV0gm51bwIkMBoGT5b mA3fkLb7iSRe4RSUmqI8kSJlDfhJ3mWRTej0TotVh8bcvJDUi7195/n8Vu7wmlhwNK98 dSEasdJ803e4Rzs8ZqrF9ulSULnQ2+3t4p33Vz0+Zr9g+U0BOzFr8b2K9vd5lqp86AfN hRDRrC5HS5QJKzIdKE2x6LhkJkvtG+o53SgMThfFoITb8FsFBuJfMayB6BRo2ILiyByU xjRw== X-Gm-Message-State: AOAM531B5cjoq2LEgcQ+lMXEQaAl83Ss+nSptDMOIZTM2YCEsXHpg4Z8 G2H9Exba4TMEPwGqnaA3GtzfH7qqtXH76F8pn4s= X-Received: by 2002:a1c:7e82:: with SMTP id z124mr2876159wmc.8.1603277471120; Wed, 21 Oct 2020 03:51:11 -0700 (PDT) MIME-Version: 1.0 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> <0dd08c91-f48d-28db-92ed-a2b014bdcb05@linux.intel.com> In-Reply-To: <0dd08c91-f48d-28db-92ed-a2b014bdcb05@linux.intel.com> From: Namhyung Kim Date: Wed, 21 Oct 2020 19:51:00 +0900 Message-ID: Subject: Re: [PATCH v1 08/15] perf record: write trace data into mmap trace files To: Alexey Budankov Cc: Arnaldo Carvalho de Melo , Jiri Olsa , Alexander Shishkin , Andi Kleen , Adrian Hunter , Peter Zijlstra , Ingo Molnar , linux-kernel Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Oct 21, 2020 at 7:25 PM Alexey Budankov wrote: > > > 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. Yep, it seems basically the same approach. But it'd be better if we could do it in a single pass (with some modification in the data collection). Thanks Namhyung