Received: by 2002:a05:7412:e794:b0:fa:551:50a7 with SMTP id o20csp2598942rdd; Fri, 12 Jan 2024 15:13:50 -0800 (PST) X-Google-Smtp-Source: AGHT+IEbu3zph8+ofhodY+nXfkAPftBoQGwu0v7U8Z8LA3so0HsRKUjCWF/4adMZuVHSqprk9g9p X-Received: by 2002:a17:903:22c3:b0:1d5:4e76:6853 with SMTP id y3-20020a17090322c300b001d54e766853mr1972651plg.125.1705101230071; Fri, 12 Jan 2024 15:13:50 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1705101230; cv=none; d=google.com; s=arc-20160816; b=Za3rsYj4cPT/I/dQyySCrY7NKVWvh0QW9fdjzYfInaxw5ZoCE1deVsDFTbUo2/WoJj 5h/mtGNAvimEF8SpXmlhSoP/7IB0G0F1egP/V8wcV7oqu6769KtjZ4Pf9vr3Evd01vTX MgTmibNGwB4/96q4s+XATABuGqa8n/0WZK3wps6xaBKYM+PSPqxw8Du95z4URJMa13im CRVRAj92pU/lBY6rXHRJ9ytoCAgjVDZcrhole3l17W7F27jtdVeDiyYwvAsuvdECgoYf 4LLJAuRuayQRXCBePhp9v7a8ko1H6CrrhnRcs19BfQPblTvIPRtRFMA//I+0j6mMXmhw dATg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:message-id:date:subject:cc:to :from:dkim-signature; bh=CxCH1v03jgjbi0a26IIpIq42CgloIN5JtOhnEAQ+6gw=; fh=/TViaxNXj9Ubl1KVZseJCqJutBKG0dvzf3DPkf/1G64=; b=p8O4VIHVEkmZPzZRDPxsziPuQ3Nrzz8/4CQVLVO24pH0YWk8tcT3JlG4aib6jCRWOe fp6VeNTQIek+E1DuhoVMLtr6Kb81S9Dfrw3Japy4+9sKBp3VNoJJb+Al5tNB1p7lpH9S tcw1Y6vKVBx0fj6G2ghS0Mk3lOXm+GpDWT7q0DaknVmZft6oNLJ/o1bAjFQdhvPWGuJO 2gLFSX7dyjnL5vF46wUDDd8Wnr1peigKcs/mF0Uy/5L2Nc3pLFu1iR66rxeTTL6SKTNB YxPqsK0wtS355faIQ5+3kssFU8m+jkXbI4HKNhG3mrAQ9l17IHbkehtEeAXGIVjt5MN+ gwCA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=Hcko2455; spf=pass (google.com: domain of linux-kernel+bounces-25092-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-25092-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id p2-20020a170902eac200b001d5b5ed6776si389872pld.327.2024.01.12.15.13.49 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 12 Jan 2024 15:13:50 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-25092-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=Hcko2455; spf=pass (google.com: domain of linux-kernel+bounces-25092-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-25092-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id BB449281C3C for ; Fri, 12 Jan 2024 23:13:49 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id A98A418E37; Fri, 12 Jan 2024 23:13:42 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="Hcko2455" Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id D576215E94; Fri, 12 Jan 2024 23:13:41 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E9BD9C433F1; Fri, 12 Jan 2024 23:13:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1705101221; bh=7GMP78E4NMNKdOfNqFB86WG7sun6VlpU0NIMPtc+prQ=; h=From:To:Cc:Subject:Date:From; b=Hcko2455G9v58pCVQ3YQlJgYmvSrayyEAoyZ5hPnJw2L9f5D6+txRUFLqX8cklv5C CJ07chwf8w78jv+1bu/FJT2reJIEuhaDS9XJAc2gpNhnnI98oT8+waRy/NQxkhwks0 p4MLbkT8Z47NJ/VXy9LvzEFJbWhI8X0lKl7YGHLi3h8d4YXH2dZW8ybZytzlsH6cmk kQhaOm76LZOPYIALPuiVUvO0+bOMonhYqZfKZGsuepWL5ZHgm+d2UCR1VjjDLNWuN1 8H7jhSEnowr/d4bygYXQTwyxIv6nFnKDem3lMVgwpQsjwRMYlb/wz4+lL5ubJl8Y5v pdAMgZzW/lCxg== From: Namhyung Kim To: Arnaldo Carvalho de Melo , Jiri Olsa Cc: Ian Rogers , Adrian Hunter , Peter Zijlstra , Ingo Molnar , LKML , linux-perf-users@vger.kernel.org Subject: [PATCH] perf record: Display data size on pipe mode Date: Fri, 12 Jan 2024 15:13:40 -0800 Message-ID: <20240112231340.779469-1-namhyung@kernel.org> X-Mailer: git-send-email 2.43.0.275.g3460e3d667-goog Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Currently pipe mode doesn't set the file size and it results in a misleading message of 0 data size at the end. Although it might miss some accounting for pipe header or more, just displaying the data size would reduce the possible confusion. Before: $ perf record -o- perf test -w noploop | perf report -i- -q --percent-limit=1 [ perf record: Woken up 1 times to write data ] [ perf record: Captured and wrote 0.000 MB - ] <====== (here) 99.58% perf perf [.] noploop After: $ perf record -o- perf test -w noploop | perf report -i- -q --percent-limit=1 [ perf record: Woken up 1 times to write data ] [ perf record: Captured and wrote 0.229 MB - ] 99.46% perf perf [.] noploop Signed-off-by: Namhyung Kim --- tools/perf/builtin-record.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/tools/perf/builtin-record.c b/tools/perf/builtin-record.c index 91e6828c38cc..21ebcb04f1d8 100644 --- a/tools/perf/builtin-record.c +++ b/tools/perf/builtin-record.c @@ -1773,8 +1773,11 @@ record__finish_output(struct record *rec) struct perf_data *data = &rec->data; int fd = perf_data__fd(data); - if (data->is_pipe) + if (data->is_pipe) { + /* Just to display approx. size */ + data->file.size = rec->bytes_written; return; + } rec->session->header.data_size += rec->bytes_written; data->file.size = lseek(perf_data__fd(data), 0, SEEK_CUR); -- 2.43.0.275.g3460e3d667-goog