Received: by 2002:a05:7412:3b8b:b0:fc:a2b0:25d7 with SMTP id nd11csp2898296rdb; Mon, 12 Feb 2024 23:53:51 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCX4/7CMXqnloQ3W2X3mU+gQo6jffST8HfTa+GvRiNKHt23hEOsRuZJe1wkg1/A/8xQaDhN3NdZLa9WUYpbvinB0yYu6eLfcZUmSrw7Mgg== X-Google-Smtp-Source: AGHT+IEvzY54FNBOU2zP0ACzJFptgzyqZnoGTGtp+ZwajIMRaRq/Qavkwe6XAM33E2gTsRxXiIx2 X-Received: by 2002:a17:902:be14:b0:1d9:a609:dd7e with SMTP id r20-20020a170902be1400b001d9a609dd7emr9851458pls.55.1707810831213; Mon, 12 Feb 2024 23:53:51 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707810831; cv=pass; d=google.com; s=arc-20160816; b=yNqnNUe1Xgj+aW0HfUkkUxZV7PRPu8ssgp+ZDNB45HKlHcfFn+OuizCSrVkxlqLJwu pKAbitBX/V7Goiuy0bBXKzoYLNhG81BrJT7eWmZ6tq9A9TAUi5kSwMhotKwbmT7bVAT0 A0LLjjzRARa3CzrU147hDMd6AAk0H0oHsIYp4bwOuG/Jnf7nzsBhrCl/hCsLUF2VQmTZ spSGqcESKV3dT/dusCgel7cow3sBScQHXwEQ6Z0infWYKAhCfPMdItYynMRn6CNTp9A/ c2D7AiF6LItqZ4k7KuGQGo+1jDIhYmfMbn9I8Fph6QFWoIfxnFmPb0YDBBXUh/wsvefT lmVQ== 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=lBdmvlUm4aDnvkwY31s3C2SviLIZPNazugZHHae6E9A=; b=oG0s5hfEYsi6l/zwxQmOehvSHLwXzXVimysjed9J7q9Tf/aX1zOiFgjeT+U1HUbzqq Bms54p0c3Dej0yN2lqUq7LHZlAbZt+63XauNmHNDQDY2CAAi9zcJ2XvGkB2lwbzR79IV oZnAZx03jtze0XVr5eQKB17Osg/3khZ2Wm6RIXlr2SNpWZhpDT4veqTM23OUJny4OKfs GQq0bfebbUdQG1CaOpa0znUnuRx7gqTMJ4RVjNJDiGaEn18T9w8jTOAYfJbGu8NR0Hsa iGkuCKMZ0Pd7N7RKLqKet6M0S/JU6CAmdBX0xL2YRfxYW1bPJWvvDvB8FLe9FCgTMfwH Nxxw==; 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-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-63065-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org X-Forwarded-Encrypted: i=2; AJvYcCUjQqA4Ya008BoYaR/sJB6LCmjMMEtc1zVxq+WuJolZJwlQkkpXY93bTHoFS7ShLwoCUkjUCtruFjt+8bWGFGzDaXcJTmyMgjJAx/Z7cw== Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id f7-20020a170902ce8700b001d9e1ab2acbsi1673195plg.356.2024.02.12.23.53.50 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 12 Feb 2024 23:53:51 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-63065-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::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-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-63065-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 DA789283DD3 for ; Tue, 13 Feb 2024 07:53:50 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 2E62F1C680; Tue, 13 Feb 2024 07:53:00 +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 Content-Transfer-Encoding: 8bit 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); } -- 2.43.0.687.g38aa6559b0-goog