From patchwork Tue Feb 13 07:52:56 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Namhyung Kim X-Patchwork-Id: 200254 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:bc8a:b0:106:860b:bbdd with SMTP id dn10csp383904dyb; Mon, 12 Feb 2024 23:54:27 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCWhZlTQRtAeT2DucmiQQiiD1ybfEpyGH5pvKKCiUMmMlVMkJgOWhCE0NCUxjmVNkvI75BG5LCJXfnU2dQBRLz7Z3mOcKg== X-Google-Smtp-Source: AGHT+IFbR5j8LBYxfZpeo7tgipqyl/944JJxvOW8MRrke7bq65LGVu4hRmeeeLAu6XtPv3DufTiK X-Received: by 2002:a05:6214:3005:b0:68c:ba50:a719 with SMTP id ke5-20020a056214300500b0068cba50a719mr11062555qvb.34.1707810867405; Mon, 12 Feb 2024 23:54:27 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707810867; cv=pass; d=google.com; s=arc-20160816; b=I9sgcxiEcThdWHGWROEEP8rlnGDMOjpZAIKuvgF1HPLCyUi3YgZDwCV8yE9QKZSIMN NMqUMI92GGc2oJ3xvXuT29O/hVyriAi1ROL3NdLU4j6IWngDYe12GhhyXNCw63XMU1ts MrU8jxKuvVczy2S3wbe0sLihoYlaupUm3pe4iTuHlRcslvd94G7roFp/EXdCwSXasz7P vxCjfMR0Iachqu4L5d68Ia4OOFLObzlXwaj2RYc+sUHHsJP8b0n1idO/Pe8isco4+mrb cny4wokZW8LLbIL2p+vVI/EHck40q+OrEosQEG4gOAKOCrtJeprZ/71SvvwrRq67KRUC neow== ARC-Message-Signature: i=2; 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:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=EV93rb0Q6R5n+TCg8zZEJg77C3+xBCFflkxQJoaHV7Q=; fh=6t7+iFxv1CADOrz35YbwWJNcWbjyut3mVg7QBJt1QsQ=; b=LHiF/4uz/EYjGnogjQUpmx9qXrAX9hzdaR/qHVPdQyNW9SuG2QFZ+lK7UMjWlMlcI1 eMASSAFoH9S2PHKahOZ3Nc8jBj3JvjodhVUoEfIgpDZZUmRYu41n/+kSr8Rmz0tOYoZS YklLARGuDzqXhBJ5A+pYCpGDP1vRpi+MFIzuf5vQCxarQaXpVNgeJYsIpE33nGfqi0BI sDS+Dq4qOqe/XoWusMXcGGVVsFrC3l9FikYUGoTIogm298mCM75ME4L7dDNbaPKtjK9G zf3gloDTAk5cuyzpnHV1Lh6dT7cxecS9dVeNTUPWRNTxgSStRNbnU2vGNpPGzZYz2D4s nESA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=oaBzEzXX; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-63065-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-63065-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org X-Forwarded-Encrypted: i=2; AJvYcCWRsaKg8DlmiUmbeSjkCF7h2kTKtt+NWa41ivi/xec/QxvkGA/EbG+9mvUS5KwUOe3kpmsL/sG9Trt415tlnIBV5TXOLA== Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id ke17-20020a056214301100b0068c4ee6bb81si2199535qvb.61.2024.02.12.23.54.27 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 12 Feb 2024 23:54:27 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-63065-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=oaBzEzXX; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-63065-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-63065-ouuuleilei=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 ny.mirrors.kernel.org (Postfix) with ESMTPS id 351181C2120D for ; Tue, 13 Feb 2024 07:54:27 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 11DA3224DE; Tue, 13 Feb 2024 07:53:02 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="oaBzEzXX" 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 50D6518E37; Tue, 13 Feb 2024 07:52:59 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707810779; cv=none; b=I2S4KfD89XVSxFw+fRhb1Pdvk7j77qNDQW93hnBqmgOAU7Vb1kYIuXMX/33RK2A1RRf1Rq3LagodtddqO+VJP1UW0xXRMb8qP7vntf5YI3vORJyzcmwWq1PkZBaNf7Wh9u17+bNyh1prrMana1Gsxv/72WYJhCKMf+pVCVev06Y= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707810779; c=relaxed/simple; bh=iBUiWDW8Ai4qSjFVJLHHIZ87HU0SArsopllQZXXyTrI=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=UIGdF0XCjwCMLbNdm648pA7qfvCohzEyD1IjeUfexrZcwBeoHaUx9/DDRbrOekXFmk3B3SdPGhhBaQ8+owpERmQegmYCca1amtXHmkq8lAaPN8GKIxedOu87vsT8uwsbxy/V2xDHbx7NI2dRqRFzuOy+XqHI3ci/V+uPA/A0PfQ= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=oaBzEzXX; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id DCD86C43330; Tue, 13 Feb 2024 07:52:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1707810779; bh=iBUiWDW8Ai4qSjFVJLHHIZ87HU0SArsopllQZXXyTrI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=oaBzEzXXW7jZhGtjT0gxCZeIIIhE6Lwb6H4dPRwJ6q1eZjb9RexYg508HRr2GfPDq KvulJxx3AsqX6RyjTuELeZtDIGeO0MK2DGQ9pmgPMMu7shYprG6px+fV9Hnhw6JY3c FDBuLrkBNjvZVXNU7FMgOUVp/TLq9H3GU1mwbhNREJIioP+cdWDGmkHbfctd7vF1J/ aLVp3mLYszLHvdmvQipSnmDNzsLy+EFAfayIYeLnKZhNchsVJ06EjPjoycPU4ICmEi Us9s4LccIjtvHGzehkoBi+gApsL1Vj8BV+9z0kP3TaDpUoFfESwrpBwv417w7kjbgJ L3zlI4I7AVDlw== From: Namhyung Kim To: Arnaldo Carvalho de Melo , Ian Rogers Cc: Jiri Olsa , Adrian Hunter , Peter Zijlstra , Ingo Molnar , LKML , linux-perf-users@vger.kernel.org Subject: [PATCH 4/4] perf report: Do not show dummy events with --skip-empty Date: Mon, 12 Feb 2024 23:52:56 -0800 Message-ID: <20240213075256.1983638-5-namhyung@kernel.org> X-Mailer: git-send-email 2.43.0.687.g38aa6559b0-goog In-Reply-To: <20240213075256.1983638-1-namhyung@kernel.org> References: <20240213075256.1983638-1-namhyung@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1790769488127320599 X-GMAIL-MSGID: 1790769488127320599 In system-wide mode, a dummy event was added during the perf record to save various side-band events like FORK, MMAP and so on. But this dummy event doesn't have samples for itself so it just wastes the output with all zero values. When --skip-empty option is on (by default), it can skip those (dummy) events without any samples by removing them from the evlist. Users can disable it using --no-skip-empty command line option or setting the report.skip-empty config option to false. Signed-off-by: Namhyung Kim --- tools/perf/Documentation/perf-report.txt | 3 ++- tools/perf/builtin-report.c | 14 +++++++++++++- 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/tools/perf/Documentation/perf-report.txt b/tools/perf/Documentation/perf-report.txt index d8b863e01fe0..546af27d209c 100644 --- a/tools/perf/Documentation/perf-report.txt +++ b/tools/perf/Documentation/perf-report.txt @@ -609,7 +609,8 @@ include::itrace.txt[] 'Avg Cycles' - block average sampled cycles --skip-empty:: - Do not print 0 results in the --stat output. + Do not print 0 results in the output. This means skipping dummy events + in the event list and the --stat output. include::callchain-overhead-calculation.txt[] diff --git a/tools/perf/builtin-report.c b/tools/perf/builtin-report.c index 8e16fa261e6f..60e30f13c8f8 100644 --- a/tools/perf/builtin-report.c +++ b/tools/perf/builtin-report.c @@ -752,10 +752,22 @@ static int hists__resort_cb(struct hist_entry *he, void *arg) static void report__output_resort(struct report *rep) { struct ui_progress prog; - struct evsel *pos; + struct evsel *pos, *tmp; ui_progress__init(&prog, rep->nr_entries, "Sorting events for output..."); + if (rep->skip_empty) { + evlist__for_each_entry_safe(rep->session->evlist, tmp, pos) { + struct hists *hists = evsel__hists(pos); + + if (hists->nr_entries != 0) + continue; + + evlist__remove(rep->session->evlist, pos); + evsel__delete(pos); + } + } + evlist__for_each_entry(rep->session->evlist, pos) { evsel__output_resort_cb(pos, &prog, hists__resort_cb, rep); }