From nobody Thu Feb 12 01:24:04 2026 Received: from mail-pf1-f181.google.com (mail-pf1-f181.google.com [209.85.210.181]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id AE6F18F58 for ; Mon, 1 Apr 2024 06:28:11 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.181 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711952893; cv=none; b=BTAK1kw+iWlpd5Y65fFQRfqJaJbeRYky0s8GLXipCrwh3954TESDghO8lY4bqfykrX/Dlmr11oG4qR8zxPv3kjGWg/MN4pHQpTy1oRmAb+FlqQSDeZCbhKxPtob6ZbJ7LkrSwYa0ADVmUN2PvFyCgg+EazRLxEQpsRx/cHi7Ko8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711952893; c=relaxed/simple; bh=PW9Ga3dVjqVka4C+ses3fsScJkII9AHQ7Dt9OdB+RoI=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=uRw0Mgnqp5AmXcs7n4IByvBYZWxYE0mZpAWrQ5wNYt4L9ytSD1Y7E+7q+G1NPK6vgfM7+7cWjLQq7K3j+4FPvFGOcI0itb454nU9L+Dc9KpbZdG9AsxfJ+GXQFRWmcbhvYVOeeklmO9j6sDKepc/MPCIszvbXPK3RfR+guhQ298= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=bytedance.com; spf=pass smtp.mailfrom=bytedance.com; dkim=pass (2048-bit key) header.d=bytedance.com header.i=@bytedance.com header.b=L2XoCqrs; arc=none smtp.client-ip=209.85.210.181 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=bytedance.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=bytedance.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=bytedance.com header.i=@bytedance.com header.b="L2XoCqrs" Received: by mail-pf1-f181.google.com with SMTP id d2e1a72fcca58-6e6ee9e3cffso2443440b3a.1 for ; Sun, 31 Mar 2024 23:28:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bytedance.com; s=google; t=1711952891; x=1712557691; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=bXoaKmE0CgaaZOerStXHwchE8/DtZMSE2DNCNaIY420=; b=L2XoCqrstpPcDFwxEL3jwkEAdiHdbg43bP/hyNH8akWIghvtQJ79wci36XQtFLMfug MqhvNe1lGUn86RRZCJdpitaJd4Q+WRyLib2joVzjD7hsbEQqFMyWrH/02GvN8zIJRLcY uGkRac4n0y6OP1Z/pnWcQs2D7Uao7Q14jwYLAzCSkehAj5GJf1mNE3IP8JCHq5Bpkqss tIdd/tzs57GTbKGgdRtsdBj1jxeHZOSw0iMuP0vPYHM1MMIJ/AaeorPvqUfypKn0QymO IljhHdzt8wIgBLoy1jRVDOxPfMSKoKFuGcOOb0nCwqJ7MLh/3S3Oeuw8TiMKr86VUgo4 CW3A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1711952891; x=1712557691; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=bXoaKmE0CgaaZOerStXHwchE8/DtZMSE2DNCNaIY420=; b=JaQXsfl91AkuipS+iSC49dchRQQgDtJQsKfuD9XPyd+6E0Eia1E0jJUs2mw2ub2z+3 3LLRTPNYTyQeWl24TpzeJ7GILBPkoRx+l7w7b0IvKCEqcYSytfuM5ujz3OS02YYvTjEJ s0LPwtc6b5Y7pLYB1dE/gFEBHsgt5+ZaF2zIsIxs65kDqdFJrRKupA8LbXZI/GH57Aqq hnn/3tcrIXyLT2cgpEUS6T1YBbQLo4mNUDDSa6Cx5uUN+S+XpdFEMEDBMpktt0u1uWIa pFiDl/AvxrpnUxRtd5sZB7of0CaG0C/mAeIaTiz84XteZ7UlwR3Bsp5hsXaq7xS9bsr0 /Hcg== X-Forwarded-Encrypted: i=1; AJvYcCX8T2nIZLvGq77zrDnLcwd3RjYZv2YK84ZEDh+wTKo9AsMy5Uf9FymMi10uqgPoqXj7F1Xq2E5o8zpmKFjuoKjBw1j4/iC6SHyeFwIB X-Gm-Message-State: AOJu0Yy1asAfKf1ps4O+Lha7C6dEKRIwDenbY/8NIc/N3lEp88olFeoY y95kQ27KO+lPm1CiaSgR7/6I8jkLva2euzjBbfr2je5uo0dT8GAPLcecuzh7FcY= X-Google-Smtp-Source: AGHT+IGyJO6W7a9vGA42zEISDyPq8pZfWTwyac2IL1hq0cjIwwyYuw6FlByJVnomVlsCtwxbGFTVjg== X-Received: by 2002:a05:6a00:1484:b0:6e8:a703:d911 with SMTP id v4-20020a056a00148400b006e8a703d911mr18653599pfu.1.1711952891072; Sun, 31 Mar 2024 23:28:11 -0700 (PDT) Received: from ubuntu20.04 ([203.208.189.8]) by smtp.gmail.com with ESMTPSA id y15-20020a056a00038f00b006e6b2ba1577sm7102001pfs.138.2024.03.31.23.28.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 31 Mar 2024 23:28:10 -0700 (PDT) From: Yang Jihong To: peterz@infradead.org, mingo@redhat.com, acme@kernel.org, namhyung@kernel.org, mark.rutland@arm.com, alexander.shishkin@linux.intel.com, jolsa@kernel.org, irogers@google.com, adrian.hunter@intel.com, kan.liang@linux.intel.com, james.clark@arm.com, linux-perf-users@vger.kernel.org, linux-kernel@vger.kernel.org Cc: yangjihong@bytedance.com Subject: [PATCH v2 1/2] perf sched timehist: Fix -g/--call-graph option failure Date: Mon, 1 Apr 2024 14:27:23 +0800 Message-Id: <20240401062724.1006010-2-yangjihong@bytedance.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20240401062724.1006010-1-yangjihong@bytedance.com> References: <20240401062724.1006010-1-yangjihong@bytedance.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" When perf-sched enables the call-graph recording, sample_type of dummy event does not have PERF_SAMPLE_CALLCHAIN, timehist_check_attr() checks that the evsel does not have a callchain, and set show_callchain to 0. Currently perf sched timehist only saves callchain when processing sched:sched_switch event, timehist_check_attr() only needs to determine whether the event has PERF_SAMPLE_CALLCHAIN. Before: # perf sched record -g true [ perf record: Woken up 0 times to write data ] [ perf record: Captured and wrote 4.153 MB perf.data (7536 samples) ] # perf sched timehist Samples do not have callchains. time cpu task name wait time sch de= lay run time [tid/pid] (msec) (ms= ec) (msec) --------------- ------ ------------------------------ --------- ------= --- --------- 147851.826019 [0000] perf[285035] 0.000 0.= 000 0.000 147851.826029 [0000] migration/0[15] 0.000 0.= 003 0.009 147851.826063 [0001] perf[285035] 0.000 0.= 000 0.000 147851.826069 [0001] migration/1[21] 0.000 0.= 003 0.006 After: # perf sched record -g true [ perf record: Woken up 1 times to write data ] [ perf record: Captured and wrote 2.572 MB perf.data (822 samples) ] # perf sched timehist time cpu task name wait time sch de= lay run time [tid/pid] (msec) (ms= ec) (msec) --------------- ------ ------------------------------ --------- ------= --- --------- 144193.035164 [0000] perf[277062] 0.000 0.= 000 0.000 __traceiter_sched_switch <- __traceiter_sched_switch <- _= _sched_text_start <- preempt_schedule_common <- __cond_resched <- __wait_fo= r_common <- wait_for_completion 144193.035174 [0000] migration/0[15] 0.000 0.= 003 0.009 __traceiter_sched_switch <- __traceiter_sched_switch <- _= _sched_text_start <- smpboot_thread_fn <- kthread <- ret_from_fork 144193.035207 [0001] perf[277062] 0.000 0.= 000 0.000 __traceiter_sched_switch <- __traceiter_sched_switch <- _= _sched_text_start <- preempt_schedule_common <- __cond_resched <- __wait_fo= r_common <- wait_for_completion 144193.035214 [0001] migration/1[21] 0.000 0.= 003 0.007 __traceiter_sched_switch <- __traceiter_sched_switch <- _= _sched_text_start <- smpboot_thread_fn <- kthread <- ret_from_fork Fixes: 9c95e4ef0657 ("perf evlist: Add evlist__findnew_tracking_event() hel= per") Signed-off-by: Yang Jihong Reviewed-by: Ian Rogers --- tools/perf/builtin-sched.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/tools/perf/builtin-sched.c b/tools/perf/builtin-sched.c index b248c433529a..1bfb22347371 100644 --- a/tools/perf/builtin-sched.c +++ b/tools/perf/builtin-sched.c @@ -2963,8 +2963,11 @@ static int timehist_check_attr(struct perf_sched *sc= hed, return -1; } =20 - if (sched->show_callchain && !evsel__has_callchain(evsel)) { - pr_info("Samples do not have callchains.\n"); + /* only need to save callchain related to sched_switch event */ + if (sched->show_callchain && + evsel__name_is(evsel, "sched:sched_switch") && + !evsel__has_callchain(evsel)) { + pr_info("Samples of sched_switch event do not have callchains.\n"); sched->show_callchain =3D 0; symbol_conf.use_callchain =3D 0; } --=20 2.25.1 From nobody Thu Feb 12 01:24:04 2026 Received: from mail-oi1-f169.google.com (mail-oi1-f169.google.com [209.85.167.169]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 2753D8F6F for ; Mon, 1 Apr 2024 06:28:19 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.167.169 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711952901; cv=none; b=OU8mHeAZHb8lhQ9DWf89XNnIlEI+6T1GfbqgHVpDQHEaUa1i1iO9JwYhe5c5dTSRBWmuUSyCe7oWxHYdKTHZDbelrFxVXtojvocxGf20EQIe93oZo9N1N5iFPvM4A5hxXYv6OZm7CHXKZf/Gcrtr4dOD0uOeAOccwGZntSbuKMw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711952901; c=relaxed/simple; bh=DQXvKpO1rEy2B5qFpeFFi2Ewi9nm8JCW+OWHChzWmT8=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=LKAQy9cvYW4tDMzNttxUDCt92P4U8FhRNMkUPsVWxU3XmnQEERPuO5JQBjEM3cxzUMa/ZPRmjxdR8cgw+oiTd/bJ3itEeHN2I0mLX9K27IlAKpChsrrb8qeuy8NR5TZOZNqB4DwUHkg1Afa1unSh8OwhMzo/X57kODGDI0RPksU= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=bytedance.com; spf=pass smtp.mailfrom=bytedance.com; dkim=pass (2048-bit key) header.d=bytedance.com header.i=@bytedance.com header.b=bioxSWDa; arc=none smtp.client-ip=209.85.167.169 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=bytedance.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=bytedance.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=bytedance.com header.i=@bytedance.com header.b="bioxSWDa" Received: by mail-oi1-f169.google.com with SMTP id 5614622812f47-3c397193878so2375154b6e.3 for ; Sun, 31 Mar 2024 23:28:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bytedance.com; s=google; t=1711952898; x=1712557698; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=hSf2vAhcQ3pOxdj1mWuxA0G409t04uxcVataEyECxYU=; b=bioxSWDay2QAdh8dFGYD9XUsqPRVmO7xO1CJt9yMviHxRgab2VqmTrH1bipOT4b8VH P2fZdEpzcqGQbvm6BriWs/RflBtoMFFAa2leGSIxub2qkLoWowhaKYAiUI395lb8RT8N WjZ4exVweErNnvpBFjsYyd/MXSdH8jF4gwlenSJltMoOgLry/y3GpYdWIbadARB1BalX zcV38vt2vR2TchZ4EwwBlesVs9bNLycF9Xz4B3tbl4rmdJxbN8p5pe8VzfUDLgUOtdDU 6yeVO8S3hqnGcuswdLOeMwcxVliphNFmjC4gc9XjLlgIx71s0hiatx2cegVyiMP8FUVq MdzQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1711952898; x=1712557698; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=hSf2vAhcQ3pOxdj1mWuxA0G409t04uxcVataEyECxYU=; b=GDnAOS2HQvi1bPn0rFCsBXGs+81RVjVNf53pj0UvLbCMj53smCubuAScEyD5Swwyxd +7BZNd9h8TIoKGY+tXA7X/d7/Xf0gA+DBgOXc5vL0eBCi2Hrwpvn4wHrz5o8lqd2YpVo sIIYGx+eVQKNlWtCRjAB7E9FqHOpWMiDAHciG6bLoqRTaW4gA9Ut2PQcrz2PdxeCayER E3iM4HcyzDiVqQqWX7gIowvi0EHr+OHhpY/d26a3bHP87g1ookm6uB7HQ9MR+Kt6AvtF eg0UnQKQEgo47dC2by30MhyDpwJsB0weikQUui5u2hbMVaUSY6JJ00HOW/YVl0LeKAdo 8L+Q== X-Forwarded-Encrypted: i=1; AJvYcCU2elG4ATF8IKPbdNLhC7QPr/mJTzh/VHwe8YTUarOi7zud2IuXBPH7/RaEhX6deKILLBMwL2MoIbAGcRwc79ahiPFvOEzLR2iQ5hel X-Gm-Message-State: AOJu0YyULGbcrMOUMnrxoo9K3cKmwxPDkAZFJq1F/UycOrPmQOx82Xtm +cQX6uY27dssqlE3Q0CgiIidxVtSVQBqNA9BUf69vBkjCxl0InQSGu1bkAd17L4= X-Google-Smtp-Source: AGHT+IFE4zFY5oDG3RDXbEPGYCxij5ssu6TmeNR7lKTyF0VXFdu13aY+9lvDD8LviyQ8f/HKbT1wxg== X-Received: by 2002:a05:6808:3196:b0:3c3:df89:c220 with SMTP id cd22-20020a056808319600b003c3df89c220mr10728948oib.19.1711952898121; Sun, 31 Mar 2024 23:28:18 -0700 (PDT) Received: from ubuntu20.04 ([203.208.189.8]) by smtp.gmail.com with ESMTPSA id y15-20020a056a00038f00b006e6b2ba1577sm7102001pfs.138.2024.03.31.23.28.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 31 Mar 2024 23:28:17 -0700 (PDT) From: Yang Jihong To: peterz@infradead.org, mingo@redhat.com, acme@kernel.org, namhyung@kernel.org, mark.rutland@arm.com, alexander.shishkin@linux.intel.com, jolsa@kernel.org, irogers@google.com, adrian.hunter@intel.com, kan.liang@linux.intel.com, james.clark@arm.com, linux-perf-users@vger.kernel.org, linux-kernel@vger.kernel.org Cc: yangjihong@bytedance.com Subject: [PATCH v2 2/2] perf evsel: Use evsel__name_is() helper Date: Mon, 1 Apr 2024 14:27:24 +0800 Message-Id: <20240401062724.1006010-3-yangjihong@bytedance.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20240401062724.1006010-1-yangjihong@bytedance.com> References: <20240401062724.1006010-1-yangjihong@bytedance.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Code cleanup, replace strcmp(evsel__name(evsel, {NAME})) with evsel__name_is() helper. No functional change. Signed-off-by: Yang Jihong Reviewed-by: Ian Rogers --- tools/perf/builtin-kmem.c | 2 +- tools/perf/builtin-sched.c | 4 +-- tools/perf/builtin-script.c | 2 +- tools/perf/builtin-trace.c | 4 +-- tools/perf/tests/evsel-roundtrip-name.c | 4 +-- tools/perf/tests/parse-events.c | 39 +++++++++---------------- 6 files changed, 22 insertions(+), 33 deletions(-) diff --git a/tools/perf/builtin-kmem.c b/tools/perf/builtin-kmem.c index 9714327fd0ea..6fd95be5032b 100644 --- a/tools/perf/builtin-kmem.c +++ b/tools/perf/builtin-kmem.c @@ -1408,7 +1408,7 @@ static int __cmd_kmem(struct perf_session *session) } =20 evlist__for_each_entry(session->evlist, evsel) { - if (!strcmp(evsel__name(evsel), "kmem:mm_page_alloc") && + if (evsel__name_is(evsel, "kmem:mm_page_alloc") && evsel__field(evsel, "pfn")) { use_pfn =3D true; break; diff --git a/tools/perf/builtin-sched.c b/tools/perf/builtin-sched.c index 1bfb22347371..0fce7d8986c0 100644 --- a/tools/perf/builtin-sched.c +++ b/tools/perf/builtin-sched.c @@ -2148,7 +2148,7 @@ static bool is_idle_sample(struct perf_sample *sample, struct evsel *evsel) { /* pid 0 =3D=3D swapper =3D=3D idle task */ - if (strcmp(evsel__name(evsel), "sched:sched_switch") =3D=3D 0) + if (evsel__name_is(evsel, "sched:sched_switch")) return evsel__intval(evsel, sample, "prev_pid") =3D=3D 0; =20 return sample->pid =3D=3D 0; @@ -2375,7 +2375,7 @@ static bool timehist_skip_sample(struct perf_sched *s= ched, } =20 if (sched->idle_hist) { - if (strcmp(evsel__name(evsel), "sched:sched_switch")) + if (!evsel__name_is(evsel, "sched:sched_switch")) rc =3D true; else if (evsel__intval(evsel, sample, "prev_pid") !=3D 0 && evsel__intval(evsel, sample, "next_pid") !=3D 0) diff --git a/tools/perf/builtin-script.c b/tools/perf/builtin-script.c index 37088cc0ff1b..cc981531ec00 100644 --- a/tools/perf/builtin-script.c +++ b/tools/perf/builtin-script.c @@ -3471,7 +3471,7 @@ static int check_ev_match(char *dir_name, char *scrip= tname, =20 match =3D 0; evlist__for_each_entry(session->evlist, pos) { - if (!strcmp(evsel__name(pos), evname)) { + if (evsel__name_is(pos, evname)) { match =3D 1; break; } diff --git a/tools/perf/builtin-trace.c b/tools/perf/builtin-trace.c index 90eaff8c0f6e..9b93807a1906 100644 --- a/tools/perf/builtin-trace.c +++ b/tools/perf/builtin-trace.c @@ -4902,7 +4902,7 @@ int cmd_trace(int argc, const char **argv) goto out; } trace.syscalls.events.bpf_output =3D evlist__last(trace.evlist); - assert(!strcmp(evsel__name(trace.syscalls.events.bpf_output), "__augmente= d_syscalls__")); + assert(evsel__name_is(trace.syscalls.events.bpf_output), "__augmented_sys= calls__"); skip_augmentation: #endif err =3D -1; @@ -4959,7 +4959,7 @@ int cmd_trace(int argc, const char **argv) */ if (trace.syscalls.events.bpf_output) { evlist__for_each_entry(trace.evlist, evsel) { - bool raw_syscalls_sys_exit =3D strcmp(evsel__name(evsel), "raw_syscalls= :sys_exit") =3D=3D 0; + bool raw_syscalls_sys_exit =3D evsel__name_is(evsel, "raw_syscalls:sys_= exit"); =20 if (raw_syscalls_sys_exit) { trace.raw_augmented_syscalls =3D true; diff --git a/tools/perf/tests/evsel-roundtrip-name.c b/tools/perf/tests/evs= el-roundtrip-name.c index 15ff86f9da0b..1922cac13a24 100644 --- a/tools/perf/tests/evsel-roundtrip-name.c +++ b/tools/perf/tests/evsel-roundtrip-name.c @@ -37,7 +37,7 @@ static int perf_evsel__roundtrip_cache_name_test(void) continue; } evlist__for_each_entry(evlist, evsel) { - if (strcmp(evsel__name(evsel), name)) { + if (!evsel__name_is(evsel, name)) { pr_debug("%s !=3D %s\n", evsel__name(evsel), name); ret =3D TEST_FAIL; } @@ -71,7 +71,7 @@ static int perf_evsel__name_array_test(const char *const = names[], int nr_names) continue; } evlist__for_each_entry(evlist, evsel) { - if (strcmp(evsel__name(evsel), names[i])) { + if (!evsel__name_is(evsel, names[i])) { pr_debug("%s !=3D %s\n", evsel__name(evsel), names[i]); ret =3D TEST_FAIL; } diff --git a/tools/perf/tests/parse-events.c b/tools/perf/tests/parse-event= s.c index feb5727584d1..0b70451451b3 100644 --- a/tools/perf/tests/parse-events.c +++ b/tools/perf/tests/parse-events.c @@ -470,8 +470,7 @@ static int test__checkevent_breakpoint_modifier(struct = evlist *evlist) TEST_ASSERT_VAL("wrong exclude_kernel", evsel->core.attr.exclude_kernel); TEST_ASSERT_VAL("wrong exclude_hv", evsel->core.attr.exclude_hv); TEST_ASSERT_VAL("wrong precise_ip", !evsel->core.attr.precise_ip); - TEST_ASSERT_VAL("wrong name", - !strcmp(evsel__name(evsel), "mem:0:u")); + TEST_ASSERT_VAL("wrong name", evsel__name_is(evsel, "mem:0:u")); =20 return test__checkevent_breakpoint(evlist); } @@ -484,8 +483,7 @@ static int test__checkevent_breakpoint_x_modifier(struc= t evlist *evlist) TEST_ASSERT_VAL("wrong exclude_kernel", !evsel->core.attr.exclude_kernel); TEST_ASSERT_VAL("wrong exclude_hv", evsel->core.attr.exclude_hv); TEST_ASSERT_VAL("wrong precise_ip", !evsel->core.attr.precise_ip); - TEST_ASSERT_VAL("wrong name", - !strcmp(evsel__name(evsel), "mem:0:x:k")); + TEST_ASSERT_VAL("wrong name", evsel__name_is(evsel, "mem:0:x:k")); =20 return test__checkevent_breakpoint_x(evlist); } @@ -498,8 +496,7 @@ static int test__checkevent_breakpoint_r_modifier(struc= t evlist *evlist) TEST_ASSERT_VAL("wrong exclude_kernel", evsel->core.attr.exclude_kernel); TEST_ASSERT_VAL("wrong exclude_hv", !evsel->core.attr.exclude_hv); TEST_ASSERT_VAL("wrong precise_ip", evsel->core.attr.precise_ip); - TEST_ASSERT_VAL("wrong name", - !strcmp(evsel__name(evsel), "mem:0:r:hp")); + TEST_ASSERT_VAL("wrong name", evsel__name_is(evsel, "mem:0:r:hp")); =20 return test__checkevent_breakpoint_r(evlist); } @@ -512,8 +509,7 @@ static int test__checkevent_breakpoint_w_modifier(struc= t evlist *evlist) TEST_ASSERT_VAL("wrong exclude_kernel", evsel->core.attr.exclude_kernel); TEST_ASSERT_VAL("wrong exclude_hv", evsel->core.attr.exclude_hv); TEST_ASSERT_VAL("wrong precise_ip", evsel->core.attr.precise_ip); - TEST_ASSERT_VAL("wrong name", - !strcmp(evsel__name(evsel), "mem:0:w:up")); + TEST_ASSERT_VAL("wrong name", evsel__name_is(evsel, "mem:0:w:up")); =20 return test__checkevent_breakpoint_w(evlist); } @@ -526,8 +522,7 @@ static int test__checkevent_breakpoint_rw_modifier(stru= ct evlist *evlist) TEST_ASSERT_VAL("wrong exclude_kernel", !evsel->core.attr.exclude_kernel); TEST_ASSERT_VAL("wrong exclude_hv", evsel->core.attr.exclude_hv); TEST_ASSERT_VAL("wrong precise_ip", evsel->core.attr.precise_ip); - TEST_ASSERT_VAL("wrong name", - !strcmp(evsel__name(evsel), "mem:0:rw:kp")); + TEST_ASSERT_VAL("wrong name", evsel__name_is(evsel, "mem:0:rw:kp")); =20 return test__checkevent_breakpoint_rw(evlist); } @@ -540,8 +535,7 @@ static int test__checkevent_breakpoint_modifier_name(st= ruct evlist *evlist) TEST_ASSERT_VAL("wrong exclude_kernel", evsel->core.attr.exclude_kernel); TEST_ASSERT_VAL("wrong exclude_hv", evsel->core.attr.exclude_hv); TEST_ASSERT_VAL("wrong precise_ip", !evsel->core.attr.precise_ip); - TEST_ASSERT_VAL("wrong name", - !strcmp(evsel__name(evsel), "breakpoint")); + TEST_ASSERT_VAL("wrong name", evsel__name_is(evsel, "breakpoint")); =20 return test__checkevent_breakpoint(evlist); } @@ -554,8 +548,7 @@ static int test__checkevent_breakpoint_x_modifier_name(= struct evlist *evlist) TEST_ASSERT_VAL("wrong exclude_kernel", !evsel->core.attr.exclude_kernel); TEST_ASSERT_VAL("wrong exclude_hv", evsel->core.attr.exclude_hv); TEST_ASSERT_VAL("wrong precise_ip", !evsel->core.attr.precise_ip); - TEST_ASSERT_VAL("wrong name", - !strcmp(evsel__name(evsel), "breakpoint")); + TEST_ASSERT_VAL("wrong name", evsel__name_is(evsel, "breakpoint")); =20 return test__checkevent_breakpoint_x(evlist); } @@ -568,8 +561,7 @@ static int test__checkevent_breakpoint_r_modifier_name(= struct evlist *evlist) TEST_ASSERT_VAL("wrong exclude_kernel", evsel->core.attr.exclude_kernel); TEST_ASSERT_VAL("wrong exclude_hv", !evsel->core.attr.exclude_hv); TEST_ASSERT_VAL("wrong precise_ip", evsel->core.attr.precise_ip); - TEST_ASSERT_VAL("wrong name", - !strcmp(evsel__name(evsel), "breakpoint")); + TEST_ASSERT_VAL("wrong name", evsel__name_is(evsel, "breakpoint")); =20 return test__checkevent_breakpoint_r(evlist); } @@ -582,8 +574,7 @@ static int test__checkevent_breakpoint_w_modifier_name(= struct evlist *evlist) TEST_ASSERT_VAL("wrong exclude_kernel", evsel->core.attr.exclude_kernel); TEST_ASSERT_VAL("wrong exclude_hv", evsel->core.attr.exclude_hv); TEST_ASSERT_VAL("wrong precise_ip", evsel->core.attr.precise_ip); - TEST_ASSERT_VAL("wrong name", - !strcmp(evsel__name(evsel), "breakpoint")); + TEST_ASSERT_VAL("wrong name", evsel__name_is(evsel, "breakpoint")); =20 return test__checkevent_breakpoint_w(evlist); } @@ -596,8 +587,7 @@ static int test__checkevent_breakpoint_rw_modifier_name= (struct evlist *evlist) TEST_ASSERT_VAL("wrong exclude_kernel", !evsel->core.attr.exclude_kernel); TEST_ASSERT_VAL("wrong exclude_hv", evsel->core.attr.exclude_hv); TEST_ASSERT_VAL("wrong precise_ip", evsel->core.attr.precise_ip); - TEST_ASSERT_VAL("wrong name", - !strcmp(evsel__name(evsel), "breakpoint")); + TEST_ASSERT_VAL("wrong name", evsel__name_is(evsel, "breakpoint")); =20 return test__checkevent_breakpoint_rw(evlist); } @@ -609,12 +599,12 @@ static int test__checkevent_breakpoint_2_events(struc= t evlist *evlist) TEST_ASSERT_VAL("wrong number of entries", 2 =3D=3D evlist->core.nr_entri= es); =20 TEST_ASSERT_VAL("wrong type", PERF_TYPE_BREAKPOINT =3D=3D evsel->core.att= r.type); - TEST_ASSERT_VAL("wrong name", !strcmp(evsel__name(evsel), "breakpoint1")); + TEST_ASSERT_VAL("wrong name", evsel__name_is(evsel, "breakpoint1")); =20 evsel =3D evsel__next(evsel); =20 TEST_ASSERT_VAL("wrong type", PERF_TYPE_BREAKPOINT =3D=3D evsel->core.att= r.type); - TEST_ASSERT_VAL("wrong name", !strcmp(evsel__name(evsel), "breakpoint2")); + TEST_ASSERT_VAL("wrong name", evsel__name_is(evsel, "breakpoint2")); =20 return TEST_OK; } @@ -691,15 +681,14 @@ static int test__checkevent_pmu_name(struct evlist *e= vlist) TEST_ASSERT_VAL("wrong number of entries", 2 =3D=3D evlist->core.nr_entri= es); TEST_ASSERT_VAL("wrong type", PERF_TYPE_RAW =3D=3D evsel->core.attr.type); TEST_ASSERT_VAL("wrong config", test_config(evsel, 1)); - TEST_ASSERT_VAL("wrong name", !strcmp(evsel__name(evsel), "krava")); + TEST_ASSERT_VAL("wrong name", evsel__name_is(evsel, "krava")); =20 /* cpu/config=3D2/u" */ evsel =3D evsel__next(evsel); TEST_ASSERT_VAL("wrong number of entries", 2 =3D=3D evlist->core.nr_entri= es); TEST_ASSERT_VAL("wrong type", PERF_TYPE_RAW =3D=3D evsel->core.attr.type); TEST_ASSERT_VAL("wrong config", test_config(evsel, 2)); - TEST_ASSERT_VAL("wrong name", - !strcmp(evsel__name(evsel), "cpu/config=3D2/u")); + TEST_ASSERT_VAL("wrong name", evsel__name_is(evsel, "cpu/config=3D2/u")); =20 return TEST_OK; } --=20 2.25.1