stable.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
To: linux-kernel@vger.kernel.org
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	stable@vger.kernel.org,
	Florian Fischer <florian.fischer@muhq.space>,
	Arnaldo Carvalho de Melo <acme@redhat.com>,
	Peter Zijlstra <peterz@infradead.org>,
	Xing Zhengjun <zhengjun.xing@linux.intel.com>,
	Sasha Levin <sashal@kernel.org>
Subject: [PATCH 5.15 79/83] perf list: Print all available tool events
Date: Mon,  3 Oct 2022 09:11:44 +0200	[thread overview]
Message-ID: <20221003070723.978824952@linuxfoundation.org> (raw)
In-Reply-To: <20221003070721.971297651@linuxfoundation.org>

From: Florian Fischer <florian.fischer@muhq.space>

[ Upstream commit 75eafc970bd9d36d906960a81376549f5dc99696 ]

Introduce names for the new tool events 'user_time' and 'system_time'.

  $ perf list
  ...
  duration_time                                      [Tool event]
  user_time                                          [Tool event]
  system_time                                        [Tool event]
  ...

Committer testing:

Before:

  $ perf list | grep Tool
  duration_time                                      [Tool event]
  $

After:

  $ perf list | grep Tool
    duration_time                                    [Tool event]
    user_time                                        [Tool event]
    system_time                                      [Tool event]
  $

Signed-off-by: Florian Fischer <florian.fischer@muhq.space>
Tested-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Xing Zhengjun <zhengjun.xing@linux.intel.com>
Link: http://lore.kernel.org/lkml/20220420174244.1741958-2-florian.fischer@muhq.space
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Stable-dep-of: 71c86cda750b ("perf parse-events: Remove "not supported" hybrid cache events")
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 tools/perf/util/evsel.c        | 19 ++++++++++------
 tools/perf/util/evsel.h        |  1 +
 tools/perf/util/parse-events.c | 40 +++++++++++++++++++++++++++++-----
 3 files changed, 47 insertions(+), 13 deletions(-)

diff --git a/tools/perf/util/evsel.c b/tools/perf/util/evsel.c
index 1e43fac90fc8..dbb27b61e0de 100644
--- a/tools/perf/util/evsel.c
+++ b/tools/perf/util/evsel.c
@@ -600,6 +600,17 @@ static int evsel__sw_name(struct evsel *evsel, char *bf, size_t size)
 	return r + evsel__add_modifiers(evsel, bf + r, size - r);
 }
 
+const char *evsel__tool_names[PERF_TOOL_MAX] = {
+	"duration_time",
+	"user_time",
+	"system_time",
+};
+
+static int evsel__tool_name(enum perf_tool_event ev, char *bf, size_t size)
+{
+	return scnprintf(bf, size, "%s", evsel__tool_names[ev]);
+}
+
 static int __evsel__bp_name(char *bf, size_t size, u64 addr, u64 type)
 {
 	int r;
@@ -726,12 +737,6 @@ static int evsel__raw_name(struct evsel *evsel, char *bf, size_t size)
 	return ret + evsel__add_modifiers(evsel, bf + ret, size - ret);
 }
 
-static int evsel__tool_name(char *bf, size_t size)
-{
-	int ret = scnprintf(bf, size, "duration_time");
-	return ret;
-}
-
 const char *evsel__name(struct evsel *evsel)
 {
 	char bf[128];
@@ -757,7 +762,7 @@ const char *evsel__name(struct evsel *evsel)
 
 	case PERF_TYPE_SOFTWARE:
 		if (evsel->tool_event)
-			evsel__tool_name(bf, sizeof(bf));
+			evsel__tool_name(evsel->tool_event, bf, sizeof(bf));
 		else
 			evsel__sw_name(evsel, bf, sizeof(bf));
 		break;
diff --git a/tools/perf/util/evsel.h b/tools/perf/util/evsel.h
index 45476a888942..cd3e38ed3dfa 100644
--- a/tools/perf/util/evsel.h
+++ b/tools/perf/util/evsel.h
@@ -257,6 +257,7 @@ extern const char *evsel__hw_cache_op[PERF_COUNT_HW_CACHE_OP_MAX][EVSEL__MAX_ALI
 extern const char *evsel__hw_cache_result[PERF_COUNT_HW_CACHE_RESULT_MAX][EVSEL__MAX_ALIASES];
 extern const char *evsel__hw_names[PERF_COUNT_HW_MAX];
 extern const char *evsel__sw_names[PERF_COUNT_SW_MAX];
+extern const char *evsel__tool_names[PERF_TOOL_MAX];
 extern char *evsel__bpf_counter_events;
 bool evsel__match_bpf_counter_events(const char *name);
 
diff --git a/tools/perf/util/parse-events.c b/tools/perf/util/parse-events.c
index 533c4b216ae2..e6b51810e85c 100644
--- a/tools/perf/util/parse-events.c
+++ b/tools/perf/util/parse-events.c
@@ -156,6 +156,21 @@ struct event_symbol event_symbols_sw[PERF_COUNT_SW_MAX] = {
 	},
 };
 
+struct event_symbol event_symbols_tool[PERF_TOOL_MAX] = {
+	[PERF_TOOL_DURATION_TIME] = {
+		.symbol = "duration_time",
+		.alias  = "",
+	},
+	[PERF_TOOL_USER_TIME] = {
+		.symbol = "user_time",
+		.alias  = "",
+	},
+	[PERF_TOOL_SYSTEM_TIME] = {
+		.symbol = "system_time",
+		.alias  = "",
+	},
+};
+
 #define __PERF_EVENT_FIELD(config, name) \
 	((config & PERF_EVENT_##name##_MASK) >> PERF_EVENT_##name##_SHIFT)
 
@@ -2934,21 +2949,34 @@ int print_hwcache_events(const char *event_glob, bool name_only)
 	return evt_num;
 }
 
-static void print_tool_event(const char *name, const char *event_glob,
+static void print_tool_event(const struct event_symbol *syms, const char *event_glob,
 			     bool name_only)
 {
-	if (event_glob && !strglobmatch(name, event_glob))
+	if (syms->symbol == NULL)
+		return;
+
+	if (event_glob && !(strglobmatch(syms->symbol, event_glob) ||
+	      (syms->alias && strglobmatch(syms->alias, event_glob))))
 		return;
+
 	if (name_only)
-		printf("%s ", name);
-	else
+		printf("%s ", syms->symbol);
+	else {
+		char name[MAX_NAME_LEN];
+		if (syms->alias && strlen(syms->alias))
+			snprintf(name, MAX_NAME_LEN, "%s OR %s", syms->symbol, syms->alias);
+		else
+			strlcpy(name, syms->symbol, MAX_NAME_LEN);
 		printf("  %-50s [%s]\n", name, "Tool event");
-
+	}
 }
 
 void print_tool_events(const char *event_glob, bool name_only)
 {
-	print_tool_event("duration_time", event_glob, name_only);
+	// Start at 1 because the first enum entry symbols no tool event
+	for (int i = 1; i < PERF_TOOL_MAX; ++i) {
+		print_tool_event(event_symbols_tool + i, event_glob, name_only);
+	}
 	if (pager_in_use())
 		printf("\n");
 }
-- 
2.35.1




  parent reply	other threads:[~2022-10-03  7:31 UTC|newest]

Thread overview: 97+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-10-03  7:10 [PATCH 5.15 00/83] 5.15.72-rc1 review Greg Kroah-Hartman
2022-10-03  7:10 ` [PATCH 5.15 01/83] ALSA: hda: Do disconnect jacks at codec unbind Greg Kroah-Hartman
2022-10-03  7:10 ` [PATCH 5.15 02/83] ALSA: hda: Fix hang at HD-audio codec unbinding due to refcount saturation Greg Kroah-Hartman
2022-10-03  7:10 ` [PATCH 5.15 03/83] ALSA: hda: Fix Nvidia dp infoframe Greg Kroah-Hartman
2022-10-03  7:10 ` [PATCH 5.15 04/83] ALSA: hda/realtek: fix speakers and micmute on HP 855 G8 Greg Kroah-Hartman
2022-10-03  7:10 ` [PATCH 5.15 05/83] cgroup: reduce dependency on cgroup_mutex Greg Kroah-Hartman
2022-10-03  7:10 ` [PATCH 5.15 06/83] cgroup: cgroup_get_from_id() must check the looked-up kn is a directory Greg Kroah-Hartman
2022-10-03  7:10 ` [PATCH 5.15 07/83] uas: add no-uas quirk for Hiksemi usb_disk Greg Kroah-Hartman
2022-10-03  7:10 ` [PATCH 5.15 08/83] usb-storage: Add Hiksemi USB3-FW to IGNORE_UAS Greg Kroah-Hartman
2022-10-03  7:10 ` [PATCH 5.15 09/83] uas: ignore UAS for Thinkplus chips Greg Kroah-Hartman
2022-10-03  7:10 ` [PATCH 5.15 10/83] usb: typec: ucsi: Remove incorrect warning Greg Kroah-Hartman
2022-10-03  7:10 ` [PATCH 5.15 11/83] thunderbolt: Explicitly reset plug events delay back to USB4 spec value Greg Kroah-Hartman
2022-10-03  7:10 ` [PATCH 5.15 12/83] net: usb: qmi_wwan: Add new usb-id for Dell branded EM7455 Greg Kroah-Hartman
2022-10-03  7:10 ` [PATCH 5.15 13/83] Input: snvs_pwrkey - fix SNVS_HPVIDR1 register address Greg Kroah-Hartman
2022-10-03  7:10 ` [PATCH 5.15 14/83] can: c_can: dont cache TX messages for C_CAN cores Greg Kroah-Hartman
2022-10-03  7:10 ` [PATCH 5.15 15/83] clk: ingenic-tcu: Properly enable registers before accessing timers Greg Kroah-Hartman
2022-10-03  7:10 ` [PATCH 5.15 16/83] x86/sgx: Do not fail on incomplete sanitization on premature stop of ksgxd Greg Kroah-Hartman
2022-10-03  7:10 ` [PATCH 5.15 17/83] ARM: dts: integrator: Tag PCI host with device_type Greg Kroah-Hartman
2022-10-03  7:10 ` [PATCH 5.15 18/83] ntfs: fix BUG_ON in ntfs_lookup_inode_by_name() Greg Kroah-Hartman
2022-10-03  7:10 ` [PATCH 5.15 19/83] mm/damon/dbgfs: fix memory leak when using debugfs_lookup() Greg Kroah-Hartman
2022-10-03  7:10 ` [PATCH 5.15 20/83] net: mt7531: only do PLL once after the reset Greg Kroah-Hartman
2022-10-03  7:10 ` [PATCH 5.15 21/83] Revert "firmware: arm_scmi: Add clock management to the SCMI power domain" Greg Kroah-Hartman
2022-10-03  7:10 ` [PATCH 5.15 22/83] powerpc/64s/radix: dont need to broadcast IPI for radix pmd collapse flush Greg Kroah-Hartman
2022-10-03  7:10 ` [PATCH 5.15 23/83] drm/i915/gt: Restrict forced preemption to the active context Greg Kroah-Hartman
2022-10-03  7:10 ` [PATCH 5.15 24/83] drm/amdgpu: Add amdgpu suspend-resume code path under SRIOV Greg Kroah-Hartman
2022-10-03  7:10 ` [PATCH 5.15 25/83] vduse: prevent uninitialized memory accesses Greg Kroah-Hartman
2022-10-03  7:10 ` [PATCH 5.15 26/83] libata: add ATA_HORKAGE_NOLPM for Pioneer BDR-207M and BDR-205 Greg Kroah-Hartman
2022-10-03  7:10 ` [PATCH 5.15 27/83] mmc: moxart: fix 4-bit bus width and remove 8-bit bus width Greg Kroah-Hartman
2022-10-03  7:10 ` [PATCH 5.15 28/83] mmc: hsq: Fix data stomping during mmc recovery Greg Kroah-Hartman
2022-10-03  7:10 ` [PATCH 5.15 29/83] mm/page_alloc: fix race condition between build_all_zonelists and page allocation Greg Kroah-Hartman
2022-10-03  7:10 ` [PATCH 5.15 30/83] mm: prevent page_frag_alloc() from corrupting the memory Greg Kroah-Hartman
2022-10-03  7:10 ` [PATCH 5.15 31/83] mm: fix dereferencing possible ERR_PTR Greg Kroah-Hartman
2022-10-03  7:10 ` [PATCH 5.15 32/83] mm/migrate_device.c: flush TLB while holding PTL Greg Kroah-Hartman
2022-10-03  7:10 ` [PATCH 5.15 33/83] mm: fix madivse_pageout mishandling on non-LRU page Greg Kroah-Hartman
2022-10-03  7:10 ` [PATCH 5.15 34/83] mm,hwpoison: check mm when killing accessing process Greg Kroah-Hartman
2022-10-03  7:11 ` [PATCH 5.15 35/83] media: dvb_vb2: fix possible out of bound access Greg Kroah-Hartman
2022-10-03  7:11 ` [PATCH 5.15 36/83] media: rkvdec: Disable H.264 error detection Greg Kroah-Hartman
2022-10-03  7:11 ` [PATCH 5.15 37/83] media: v4l2-compat-ioctl32.c: zero buffer passed to v4l2_compat_get_array_args() Greg Kroah-Hartman
2022-10-03  7:11 ` [PATCH 5.15 38/83] swiotlb: max mapping size takes min align mask into account Greg Kroah-Hartman
2022-10-03  7:11 ` [PATCH 5.15 39/83] ARM: dts: am33xx: Fix MMCHS0 dma properties Greg Kroah-Hartman
2022-10-03  7:11 ` [PATCH 5.15 40/83] reset: imx7: Fix the iMX8MP PCIe PHY PERST support Greg Kroah-Hartman
2022-10-03  7:11 ` [PATCH 5.15 41/83] ARM: dts: am5748: keep usb4_tm disabled Greg Kroah-Hartman
2022-10-03  7:11 ` [PATCH 5.15 42/83] soc: sunxi: sram: Actually claim SRAM regions Greg Kroah-Hartman
2022-10-03  7:11 ` [PATCH 5.15 43/83] soc: sunxi: sram: Prevent the driver from being unbound Greg Kroah-Hartman
2022-10-03  7:11 ` [PATCH 5.15 44/83] soc: sunxi_sram: Make use of the helper function devm_platform_ioremap_resource() Greg Kroah-Hartman
2022-10-03  7:11 ` [PATCH 5.15 45/83] soc: sunxi: sram: Fix probe function ordering issues Greg Kroah-Hartman
2022-10-03  7:11 ` [PATCH 5.15 46/83] soc: sunxi: sram: Fix debugfs info for A64 SRAM C Greg Kroah-Hartman
2022-10-03  7:11 ` [PATCH 5.15 47/83] ASoC: imx-card: Fix refcount issue with of_node_put Greg Kroah-Hartman
2022-10-03  7:11 ` [PATCH 5.15 48/83] arm64: dts: qcom: sm8350: fix UFS PHY serdes size Greg Kroah-Hartman
2022-10-03  7:11 ` [PATCH 5.15 49/83] ASoC: tas2770: Reinit regcache on reset Greg Kroah-Hartman
2022-10-03  7:11 ` [PATCH 5.15 50/83] drm/bridge: lt8912b: add vsync hsync Greg Kroah-Hartman
2022-10-03  7:11 ` [PATCH 5.15 51/83] drm/bridge: lt8912b: set hdmi or dvi mode Greg Kroah-Hartman
2022-10-03  7:11 ` [PATCH 5.15 52/83] drm/bridge: lt8912b: fix corrupted image output Greg Kroah-Hartman
2022-10-03  7:11 ` [PATCH 5.15 53/83] Revert "drm: bridge: analogix/dp: add panel prepare/unprepare in suspend/resume time" Greg Kroah-Hartman
2022-10-03  7:11 ` [PATCH 5.15 54/83] Input: melfas_mip4 - fix return value check in mip4_probe() Greg Kroah-Hartman
2022-10-03  7:11 ` [PATCH 5.15 55/83] gpio: mvebu: Fix check for pwm support on non-A8K platforms Greg Kroah-Hartman
2022-10-03  7:11 ` [PATCH 5.15 56/83] usbnet: Fix memory leak in usbnet_disconnect() Greg Kroah-Hartman
2022-10-03  7:11 ` [PATCH 5.15 57/83] net: sched: act_ct: fix possible refcount leak in tcf_ct_init() Greg Kroah-Hartman
2022-10-03  7:11 ` [PATCH 5.15 58/83] cxgb4: fix missing unlock on ETHOFLD desc collect fail path Greg Kroah-Hartman
2022-10-03  7:11 ` [PATCH 5.15 59/83] net/mlxbf_gige: Fix an IS_ERR() vs NULL bug in mlxbf_gige_mdio_probe Greg Kroah-Hartman
2022-10-03  7:11 ` [PATCH 5.15 60/83] nvme: Fix IOC_PR_CLEAR and IOC_PR_RELEASE ioctls for nvme devices Greg Kroah-Hartman
2022-10-03  7:11 ` [PATCH 5.15 61/83] wifi: mac80211: fix regression with non-QoS drivers Greg Kroah-Hartman
2022-10-03  7:11 ` [PATCH 5.15 62/83] net: stmmac: power up/down serdes in stmmac_open/release Greg Kroah-Hartman
2022-10-03  7:11 ` [PATCH 5.15 63/83] net: phy: Dont WARN for PHY_UP state in mdio_bus_phy_resume() Greg Kroah-Hartman
2022-10-03  7:11 ` [PATCH 5.15 64/83] selftests: Fix the if conditions of in test_extra_filter() Greg Kroah-Hartman
2022-10-03  7:11 ` [PATCH 5.15 65/83] vdpa/ifcvf: fix the calculation of queuepair Greg Kroah-Hartman
2022-10-03  7:11 ` [PATCH 5.15 66/83] fs: split off setxattr_copy and do_setxattr function from setxattr Greg Kroah-Hartman
2022-10-03  7:11 ` [PATCH 5.15 67/83] dont use __kernel_write() on kmap_local_page() Greg Kroah-Hartman
2022-10-03  7:11 ` [PATCH 5.15 68/83] clk: imx: imx6sx: remove the SET_RATE_PARENT flag for QSPI clocks Greg Kroah-Hartman
2022-10-03  7:11 ` [PATCH 5.15 69/83] clk: iproc: Do not rely on node name for correct PLL setup Greg Kroah-Hartman
2022-10-03  7:11 ` [PATCH 5.15 70/83] KVM: x86: Hide IA32_PLATFORM_DCA_CAP[31:0] from the guest Greg Kroah-Hartman
2022-10-03  7:11 ` [PATCH 5.15 71/83] perf metric: Add documentation and rename a variable Greg Kroah-Hartman
2022-10-03  7:11 ` [PATCH 5.15 72/83] perf metric: Only add a referenced metric once Greg Kroah-Hartman
2022-10-03  7:11 ` [PATCH 5.15 73/83] perf parse-events: Add const to evsel name Greg Kroah-Hartman
2022-10-03  7:11 ` [PATCH 5.15 74/83] perf parse-events: Add new "metric-id" term Greg Kroah-Hartman
2022-10-03  7:11 ` [PATCH 5.15 75/83] perf parse-events: Identify broken modifiers Greg Kroah-Hartman
2022-10-03  7:11 ` [PATCH 5.15 76/83] perf list: Display hybrid PMU events with cpu type Greg Kroah-Hartman
2022-10-03  7:11 ` [PATCH 5.15 77/83] perf tools: Check vmlinux/kallsyms arguments in all tools Greg Kroah-Hartman
2022-10-03  7:11 ` [PATCH 5.15 78/83] perf tools: Enhance the matching of sub-commands abbreviations Greg Kroah-Hartman
2022-10-03  7:11 ` Greg Kroah-Hartman [this message]
2022-10-03  7:11 ` [PATCH 5.15 80/83] x86/alternative: Fix race in try_get_desc() Greg Kroah-Hartman
2022-10-03  7:11 ` [PATCH 5.15 81/83] drm/i915/gem: Really move i915_gem_context.link under ref protection Greg Kroah-Hartman
2022-10-03  7:11 ` [PATCH 5.15 82/83] perf pmu: Fix alias events list Greg Kroah-Hartman
2022-10-03  7:11 ` [PATCH 5.15 83/83] perf evsel: Add tool event helpers Greg Kroah-Hartman
2022-10-03 11:31 ` [PATCH 5.15 00/83] 5.15.72-rc1 review Jon Hunter
2022-10-03 14:26 ` Guenter Roeck
2022-10-03 18:23   ` Florian Fainelli
2022-10-04 17:45   ` Greg Kroah-Hartman
2022-10-03 17:52 ` Guenter Roeck
2022-10-03 18:40 ` Ron Economos
2022-10-03 21:30 ` Shuah Khan
2022-10-03 22:12   ` Shuah Khan
2022-10-03 21:30 ` Slade Watkins
2022-10-04  4:02 ` Bagas Sanjaya
2022-10-04  8:05 ` Naresh Kamboju
2022-10-04 11:41 ` Sudip Mukherjee (Codethink)
2022-10-05  1:45 ` Kelsey Steele

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20221003070723.978824952@linuxfoundation.org \
    --to=gregkh@linuxfoundation.org \
    --cc=acme@redhat.com \
    --cc=florian.fischer@muhq.space \
    --cc=linux-kernel@vger.kernel.org \
    --cc=peterz@infradead.org \
    --cc=sashal@kernel.org \
    --cc=stable@vger.kernel.org \
    --cc=zhengjun.xing@linux.intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).