Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 37798C433F5 for ; Mon, 6 Dec 2021 11:22:24 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242409AbhLFLZt (ORCPT ); Mon, 6 Dec 2021 06:25:49 -0500 Received: from mga09.intel.com ([134.134.136.24]:21530 "EHLO mga09.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240320AbhLFLZp (ORCPT ); Mon, 6 Dec 2021 06:25:45 -0500 X-IronPort-AV: E=McAfee;i="6200,9189,10189"; a="237107719" X-IronPort-AV: E=Sophos;i="5.87,291,1631602800"; d="scan'208";a="237107719" Received: from orsmga008.jf.intel.com ([10.7.209.65]) by orsmga102.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 06 Dec 2021 03:22:17 -0800 X-IronPort-AV: E=Sophos;i="5.87,291,1631602800"; d="scan'208";a="514701979" Received: from abaydur-mobl1.ccr.corp.intel.com (HELO [10.249.226.178]) ([10.249.226.178]) by orsmga008-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 06 Dec 2021 03:22:13 -0800 Message-ID: Date: Mon, 6 Dec 2021 14:22:11 +0300 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:91.0) Gecko/20100101 Thunderbird/91.3.2 Subject: Re: [PATCH v12 09/16] perf record: Introduce bytes written stats Content-Language: en-GB To: Jiri Olsa Cc: Arnaldo Carvalho de Melo , Namhyung Kim , Alexander Shishkin , Peter Zijlstra , Ingo Molnar , linux-kernel , Andi Kleen , Adrian Hunter , Alexander Antonov , Alexei Budankov , Riccardo Mancini References: From: "Bayduraev, Alexey V" Organization: Intel Corporation In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 05.12.2021 18:14, Jiri Olsa wrote: >> static int record__write(struct record *rec, struct mmap *map __maybe_unused, >> @@ -210,13 +223,15 @@ static int record__write(struct record *rec, struct mmap *map __maybe_unused, >> return -1; >> } >> >> - if (!(map && map->file)) >> + if (map && map->file) >> + thread->bytes_written += size; >> + else >> rec->bytes_written += size; > > ok, that's why ;-) do we actually stil need rec->bytes_written? > can't we count that under synthesizing main thread->bytes_written? Hi Jiri, No, we still need rec->bytes_written because it is used for the header in "perf.data/data", and it cannot be replaced by threads[0].bytes_written because threads[0] is used for "perf.data/data.0". Regards, Alexey > > jirka > >> >> if (record__output_max_size_exceeded(rec) && !done) { >> fprintf(stderr, "[ perf record: perf size limit reached (%" PRIu64 " KB)," >> " stopping session ]\n", >> - rec->bytes_written >> 10); >> + record__bytes_written(rec) >> 10); >> done = 1; >> } >> >> -- >> 2.19.0 >> >