From nobody Thu Apr 2 00:12:47 2026 Received: from mail-dl1-f73.google.com (mail-dl1-f73.google.com [74.125.82.73]) (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 B2E5332937A for ; Wed, 1 Apr 2026 05:52:14 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=74.125.82.73 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1775022735; cv=none; b=U67ctPG17s9hjHeubvrNoMklhaEM5dBmSIww0KVKKZwWoGHbbSibscsbp5RJuO1Oq6hm3V7nuOYHByVaTWgRzjXyUOMiRvK04z8TmSkCi4VpRrcI7tEJB5362Qz+elDJHrsSGG45hc6bGV29+DBeiBmnMlPgYgSqhmt7XRM9irQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1775022735; c=relaxed/simple; bh=ur1ihC43xddQznk7Ns8aDDmFgrqkWiVi+eSJlMQwVr4=; h=Date:In-Reply-To:Mime-Version:References:Message-ID:Subject:From: To:Cc:Content-Type; b=kXxg5Bd+HhHdoGT5LtWEwwYj5hDCS7PnZBeP77ueSp7uz7dAtCSlwxt2sTyF22dkjiISp0CbgsPy6j9UYpQYyaubqEutJiM1cjTES7znrVsitLnqsTqChDYU/0l5WpoBqsuFl42p5+4PLY/4wfU50Av/S2OSkagwHMh14MZwgAI= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=flex--irogers.bounces.google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=Qe56PJv6; arc=none smtp.client-ip=74.125.82.73 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=flex--irogers.bounces.google.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="Qe56PJv6" Received: by mail-dl1-f73.google.com with SMTP id a92af1059eb24-126e8ee6227so7996439c88.0 for ; Tue, 31 Mar 2026 22:52:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20251104; t=1775022734; x=1775627534; darn=vger.kernel.org; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:from:to:cc:subject:date:message-id:reply-to; bh=CzUE8o/xisKqOKJCzk2aXjzNBdGN2jfwbKU3R/mLXoE=; b=Qe56PJv6TEezovrVclkcs2pRGutqd9Uk+KIPKEvvRke1xckjAtAXbSgp4hvO27Zx+S Ega5ydgrrHfYkbwrJmNqX1Jh0HiNm3pNETOmbI7xj6z1arJQMuRoNLXPeN0MsVaSkR// VkeX07YKXg1dKvpE3YT6OIqDLkFVhg7YmiSG0JgyyRXQ2Ic+LTF3zMpblL8MhSuFzTOz E+FkP0Bd0YG8PlyitxObm++o4nWSVCuWIyhuJx5RLE2sx8taFKFURONNrh7Lp3Tz4WfC InhyVytvHK6+OaoP0VLpKzSJp5iw7rOhC+t2lEM+bDhmQ3Kn99HC6WBHpGuDymxSmaRr khzw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1775022734; x=1775627534; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=CzUE8o/xisKqOKJCzk2aXjzNBdGN2jfwbKU3R/mLXoE=; b=ejt2SG2xlqLRFCIGXz/g/oIZkurcL5o25hV8kbHZ5X2ZZAsdSSui3qDcCHKzYMrwjI xZsAUMzQGg/OlfjRrzM5mXEkSKmwffTo0CDz4aDGT2H5ApqImYJ5ZAyqjjscttx+Qk4V 2+eJBtcxjPvLMRI3PcnfBl+4fay8DwaL/yv1apBUqmb4wl3mI5FKjR/Ye1mgzpAI30mG f6iT0cCg2N/Z2XAP1D2C5M8bRpobGQSYIpomFbhd7ErIrm3fAFsgz01RkIG1jG/kuqy9 BhCXp+GvN0Zlv2R/nxoPUjoq7esm5gFHdNMi3o7ngzooMMtFPGKWwagzzWbHzPHgX5aV +aGg== X-Forwarded-Encrypted: i=1; AJvYcCV13hBh1wlSKlFE7NJuVhW+MuZZp/4p1LrfK9sto7mZPJo2gY26ym82ImzEHKknv0YYuO4lelJ421NGif8=@vger.kernel.org X-Gm-Message-State: AOJu0YwuttxXFCpzLDuaEf9E4AjM3lIf8skcfBFy6D5ApYVghkgP0rFa ifxAxOyfeeF7Nya0Lk1+srFy5bnGZpmoDYyfZyLxMyZy7UxIpCgwB9x2MApA4hSYvSVghY1UWJ4 IULBfazy3Eg== X-Received: from dlbvg26.prod.google.com ([2002:a05:7022:7f1a:b0:128:ee69:eb75]) (user=irogers job=prod-delivery.src-stubby-dispatcher) by 2002:a05:7022:602:b0:128:ccb7:7fa3 with SMTP id a92af1059eb24-12be6587e81mr1348386c88.34.1775022733680; Tue, 31 Mar 2026 22:52:13 -0700 (PDT) Date: Tue, 31 Mar 2026 22:52:01 -0700 In-Reply-To: <20260401055206.43187-1-irogers@google.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 References: <20260228065953.3226283-1-irogers@google.com> <20260401055206.43187-1-irogers@google.com> X-Mailer: git-send-email 2.53.0.1118.gaef5881109-goog Message-ID: <20260401055206.43187-3-irogers@google.com> Subject: [PATCH v3 2/7] perf header: Add utility to convert feature number to a string From: Ian Rogers To: acme@kernel.org, namhyung@kernel.org Cc: irogers@google.com, adrian.hunter@intel.com, alexander.shishkin@linux.intel.com, ashelat@redhat.com, ctshao@google.com, derek.foreman@collabora.com, howardchu95@gmail.com, hrishikesh123s@gmail.com, james.clark@linaro.org, jolsa@kernel.org, linux-kernel@vger.kernel.org, linux-perf-users@vger.kernel.org, mingo@redhat.com, peterz@infradead.org, swapnil.sapkal@amd.com, thomas.falcon@intel.com Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" For logging and debug messages it can be convenient to convert a feature number to a name. Add header_feat__name for this and reuse the data already within the feat_ops struct. Signed-off-by: Ian Rogers --- tools/perf/util/header.c | 7 +++++++ tools/perf/util/header.h | 2 ++ 2 files changed, 9 insertions(+) diff --git a/tools/perf/util/header.c b/tools/perf/util/header.c index 9142a8ba4019..fe5d21dde04f 100644 --- a/tools/perf/util/header.c +++ b/tools/perf/util/header.c @@ -3770,6 +3770,13 @@ struct header_print_data { bool full; /* extended list of headers */ }; =20 +const char *header_feat__name(unsigned int id) +{ + if (id < HEADER_LAST_FEATURE) + return feat_ops[id].name; + return "INVALID"; +} + static int perf_file_section__fprintf_info(struct perf_file_section *secti= on, struct perf_header *ph, int feat, int fd, void *data) diff --git a/tools/perf/util/header.h b/tools/perf/util/header.h index cc40ac796f52..ca22030a1434 100644 --- a/tools/perf/util/header.h +++ b/tools/perf/util/header.h @@ -132,6 +132,8 @@ struct perf_header_feature_ops { =20 extern const char perf_version_string[]; =20 +const char *header_feat__name(unsigned int id); + int perf_session__read_header(struct perf_session *session); int perf_session__write_header(struct perf_session *session, struct evlist *evlist, --=20 2.53.0.1118.gaef5881109-goog