Received: by 2002:ab2:687:0:b0:1f4:6588:b3a7 with SMTP id s7csp111352lqe; Tue, 9 Apr 2024 16:51:11 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVfN/ruREpc17cM3RgKoM5zM1Ll7H0Ojdwj8EW31HyjtfKLTfq72xlwKNJx5pYklgSYoxne0V8KhY5IFRm2ALiGFEmxSP6Rpi+ShEAdTw== X-Google-Smtp-Source: AGHT+IHRAkeMPuai7lf5AQhMftUNvUWGQIuDHNCed3Z7RVDYGdBggbDjNVx3KmWbJCRYqjUKiRrl X-Received: by 2002:a05:6a20:324f:b0:1a9:447b:68b6 with SMTP id hm15-20020a056a20324f00b001a9447b68b6mr1492773pzc.25.1712706670990; Tue, 09 Apr 2024 16:51:10 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1712706670; cv=pass; d=google.com; s=arc-20160816; b=rdGnoNI4Yhb3gv+npLQ+KVqfSKf0HhHt21kq/dSye30Z6mms+pag5L7eQKXfN8RKF3 gN6z+hkpkEFZ212hb61i+Vfqz76QZbT5gXsXrbHg6orDrPK3stF7B2a1z/DYDZ0BcWTz aUfeLk/mCx7GFVBdS83JnQ56sfWTJpECIVuExsCApuxSrVpNMO2oU4jdSDucH92t2rj7 xAAlr2gI71Y3cXs0CWQwX8uMUxPLSJDSwpdrAtQ0SKDNLi8cpFiqiDAJG3T/U7VSz9ga X9g7UbtGT76phkqE2/yWQ8yeN2RbvJF/BZEZceOzfQHrwZEor1x6QBkX/kpEAkglCCkF YVpA== 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=RA2OHa/8WuPKAnMbiTDKsV6r0kEjHLg0Oop72ierhQg=; fh=fHhbvXgCev/wpffLVpfaAi8pPyv7hrTyhVPgsZ7HNrs=; b=PhEWsRbJUZlvHN8cuVcwLCjdQLG+m1rxDYnx/mrDOdxfmurDd/5wYroV3Zi+UbFfir 9pasVCg/M3nVoDFguvorHbFi6Qw0kw64p9fkY95uSJiR3FoOjpWict6MCi+63NLgdX6J Shs5+WpPtOqnSU4DtZ2scbfq/slkm7EpbSYC1cFQcZcUAfNOprEi15UwS4IhfHUVsSqB BCNdKsVsh2NklecZiXZFkOS/S4SDQZvPZk72nz3x9SDu0rfxbex99a9AqgWG15lz25X0 y5o+cl/CVm3JXJIlEUg1R/wcl8bmpCR778j6kNKydTPYwmJUxOGFYexWQZOqU/w3Ae99 qv4w==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=ev7SBIF+; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-137730-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-137730-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id fn13-20020a056a002fcd00b006e68d11c37bsi9230824pfb.396.2024.04.09.16.51.10 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 09 Apr 2024 16:51:10 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-137730-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=ev7SBIF+; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-137730-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-137730-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 A0844283A8B for ; Tue, 9 Apr 2024 23:51:10 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id F034915A496; Tue, 9 Apr 2024 23:50:05 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="ev7SBIF+" 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 82FB6159579; Tue, 9 Apr 2024 23:50:04 +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=1712706604; cv=none; b=hQRthOxiyrKQf/jgD23V+Ff6OoP8SbcAASF1PqVxq3nORdRflgQuPCMNf/27AmF0iHWMpUloZR7uffJwqDcDcKvTVAwSha0vFcEPDnJ3VM7n846RAveD8r0NlHZ8sFyt05Z9cVRCu4DoqfcDL/beQmORoePKYk4PatnkcX6WZQA= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712706604; c=relaxed/simple; bh=nieDE0/teF2k6LWCPMxAt6MAUAfm9geljBFjmb2K5NY=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=l3LGyoj42drbabr29FtdCtqTuMeY9LHIlIoHkDf0V2hdZTaBGYv2WbYDPbpvGJKAyezzobcOMTmKXyPFM3jL73cy1zTrpzmUMOnFVnXE36GjIF2+jWKAgsOtDuUeVBduPkOQGA1gJo5Juk4ML14GitjdV83F1GjA3c6tVPeeaSo= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=ev7SBIF+; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 92549C43142; Tue, 9 Apr 2024 23:50:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1712706603; bh=nieDE0/teF2k6LWCPMxAt6MAUAfm9geljBFjmb2K5NY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ev7SBIF+29xcCVsiUduIJI+ak9pMOKAhVuW4chcL2NPgr97/MDmzRdLiob+0rYG2+ 8KbuhgdxgNHSrYbnMo4AReadDlCbx8b3T4DT7GRkCy0WLnYwZ678zDM9rUC8NdC012 NRKUKUPg0QxEcShsoQLmKh/HgrlEwqmMybkAecQCkojKq/5p1SPA6pyCo8ZmQLSUwM RcMzpmiEplbWWup9PPKx5ti7alXAr7mbtyQ45CE1VZ/8LL5ozvkctvwwp6/kmMSSMy qyVdrP0DgpehmRzasyZ7pRVY3xndLSeX3H4dX+RgTcRuaDBSACSCv1rQzxxtQqvL+U +6aF4x1LJ/UqA== From: Namhyung Kim To: Arnaldo Carvalho de Melo , Ian Rogers , Kan Liang Cc: Jiri Olsa , Adrian Hunter , Peter Zijlstra , Ingo Molnar , LKML , linux-perf-users@vger.kernel.org Subject: [PATCH 5/6] perf report: Add a menu item to annotate data type in TUI Date: Tue, 9 Apr 2024 16:49:59 -0700 Message-ID: <20240409235000.1893969-6-namhyung@kernel.org> X-Mailer: git-send-email 2.44.0.478.gd926399ef9-goog In-Reply-To: <20240409235000.1893969-1-namhyung@kernel.org> References: <20240409235000.1893969-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 When the hist entry has the type info, it should be able to display the annotation browser for the type like in `perf annotate --data-type`. Signed-off-by: Namhyung Kim --- tools/perf/builtin-report.c | 5 +++++ tools/perf/ui/browsers/hists.c | 31 +++++++++++++++++++++++++++++++ 2 files changed, 36 insertions(+) diff --git a/tools/perf/builtin-report.c b/tools/perf/builtin-report.c index dcd93ee5fc24..aaa6427a1224 100644 --- a/tools/perf/builtin-report.c +++ b/tools/perf/builtin-report.c @@ -1694,6 +1694,11 @@ int cmd_report(int argc, const char **argv) else use_browser = 0; + if (report.data_type && use_browser == 1) { + symbol_conf.annotate_data_member = true; + symbol_conf.annotate_data_sample = true; + } + if (sort_order && strstr(sort_order, "ipc")) { parse_options_usage(report_usage, options, "s", 1); goto error; diff --git a/tools/perf/ui/browsers/hists.c b/tools/perf/ui/browsers/hists.c index 0c02b3a8e121..71b32591d61a 100644 --- a/tools/perf/ui/browsers/hists.c +++ b/tools/perf/ui/browsers/hists.c @@ -38,6 +38,7 @@ #include "../ui.h" #include "map.h" #include "annotate.h" +#include "annotate-data.h" #include "srcline.h" #include "string2.h" #include "units.h" @@ -2505,6 +2506,32 @@ add_annotate_opt(struct hist_browser *browser __maybe_unused, return 1; } +static int +do_annotate_type(struct hist_browser *browser, struct popup_action *act) +{ + struct hist_entry *he = browser->he_selection; + + hist_entry__annotate_data_tui(he, act->evsel, browser->hbt); + ui_browser__handle_resize(&browser->b); + return 0; +} + +static int +add_annotate_type_opt(struct hist_browser *browser, + struct popup_action *act, char **optstr, + struct hist_entry *he) +{ + if (he == NULL || he->mem_type == NULL || he->mem_type->histograms == NULL) + return 0; + + if (asprintf(optstr, "Annotate type %s", he->mem_type->self.type_name) < 0) + return 0; + + act->evsel = hists_to_evsel(browser->hists); + act->fn = do_annotate_type; + return 1; +} + static int do_zoom_thread(struct hist_browser *browser, struct popup_action *act) { @@ -3307,6 +3334,10 @@ static int evsel__hists_browse(struct evsel *evsel, int nr_events, const char *h browser->he_selection->ip); } skip_annotation: + nr_options += add_annotate_type_opt(browser, + &actions[nr_options], + &options[nr_options], + browser->he_selection); nr_options += add_thread_opt(browser, &actions[nr_options], &options[nr_options], thread); nr_options += add_dso_opt(browser, &actions[nr_options], -- 2.44.0.478.gd926399ef9-goog