Received: by 2002:a05:7412:d8a:b0:e2:908c:2ebd with SMTP id b10csp52689rdg; Wed, 11 Oct 2023 20:53:30 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGhoopLZDXeh6yT3AlWeFz13xGcViuJqDyfPMg7diRVdEg3uIx57JKv9wFqFZuUI9JwhLge X-Received: by 2002:a05:6a20:3d17:b0:157:54fd:5c26 with SMTP id y23-20020a056a203d1700b0015754fd5c26mr26076590pzi.38.1697082810357; Wed, 11 Oct 2023 20:53:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697082810; cv=none; d=google.com; s=arc-20160816; b=uYUTSlkv5hRlTBwmrZ/2HtilAL6b5fuzrxs6izxb8Ktbpz7G0RmVRA8vmAhCROdofi 6aqr2VfoQ96OUwiUw9o2wmOyevHfS2M7gVgWQBYSwWizqV9i/LjRbrekqd7wto/kMi0h 8tZEPNBbB1m9gA7/HiKZpOnfRne4dYdLykZUBq4ndMH6dz50gJFKVPLryfmhjsazn59W NQEeIwmQXptkISqv9sZntq6ngwMpM2PtnGmjhVChb9qf1Nc5BHGavWq40vTsnpyNCBtW j11z5JhRdYZuJtV8KxjNt8b6Vyl5jUzguSIYMd1HdXaWm/Dauj2ADUoyMpxVZdgK0Pki Uo5Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from:sender :dkim-signature; bh=ZII5vF3dprwXJP49CiS8ixHpGtBs+wAGFWOW7yk/k14=; fh=7Id7wL2M+oCJXD4imOzx4OKioxBXSOZqypDprm7aO4E=; b=d6/kAUQXcksDWYmygK3F+U8JmCuXo2nMnU2PTbj5nYX1BcBvFx7oDaSIfOWTvvS3bN 7GXx/YrYalbfla88ory2eLxfTnmIuC3tqt7UjIR7jIqpWpebQTrhfZkkNYkynXI75jWI KmqTMVmZmicxcx/dB4VppKo3loLoxfwAazvD8NB7Z/KrxZMgsmeuBZs0E/IpPlt7q39F +6GtO2reSUX7aich64L7ufDGpWysB6M0/JTj33kF2JarWeXd9IjqEJleNirN9u3neFEC WKq4yMEdggE5ZveQKQBWJmnedaiB7DBXd+9KVux8sbmF3GVVN28vVepUIE8q6l/ZfW7Y u1cg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=kKTQafDw; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from howler.vger.email (howler.vger.email. [23.128.96.34]) by mx.google.com with ESMTPS id l11-20020a170903244b00b001c72476ca30si1267806pls.281.2023.10.11.20.53.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 11 Oct 2023 20:53:30 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 as permitted sender) client-ip=23.128.96.34; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=kKTQafDw; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by howler.vger.email (Postfix) with ESMTP id B16E48021386; Wed, 11 Oct 2023 20:53:19 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at howler.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1347051AbjJLDw4 (ORCPT + 99 others); Wed, 11 Oct 2023 23:52:56 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39912 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1377097AbjJLDwV (ORCPT ); Wed, 11 Oct 2023 23:52:21 -0400 Received: from mail-pl1-x636.google.com (mail-pl1-x636.google.com [IPv6:2607:f8b0:4864:20::636]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E6F32138; Wed, 11 Oct 2023 20:51:38 -0700 (PDT) Received: by mail-pl1-x636.google.com with SMTP id d9443c01a7336-1bdf4752c3cso4012275ad.2; Wed, 11 Oct 2023 20:51:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1697082696; x=1697687496; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:sender:from:to:cc:subject:date :message-id:reply-to; bh=ZII5vF3dprwXJP49CiS8ixHpGtBs+wAGFWOW7yk/k14=; b=kKTQafDwBS3LnqLJJl/sGP0kPj0dFyOBIdszVkK/c2O2NsyGGINKG2UTmdGs5LyK0q DbrAzKI97ANciQ9bHroC3HygOoGshLomfSW6ohN3RIj2iQn24zWWBmiehttQ1HkWg24Z wR2xqRRF46EOmQ2FeklYlhbmWIVXuAH4wsfUQuf7UfzF8WZ4FC5nkOtV5KcEP3Fs3u5z vy0T369S9P++g3ZvqQuF0dbgjn/njnmSuBGsplqFcLANPntNA3mchl+8B0InJ0CMF4Os /Bt0RODOFS06ypD4T3hxCSQ3LoszGLIX2yvAgZ827FhrVARijcvvTz+VGxyMEfA5I60m BCng== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697082696; x=1697687496; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:sender:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=ZII5vF3dprwXJP49CiS8ixHpGtBs+wAGFWOW7yk/k14=; b=C4JwWdn4wVVKkSHJMuRHfY7MuX/Op71+9xPubXesNCeizBGlVnFPiH2GDEyG+cX1ed G97ceBTOzws+e3UYGrpXswelTycUG4BauNw8CjCdiZvUd2MHAoFsP+DC8efxBdG/BejH sNLK/XuwLJSmFMClTQ269Jpq1hzfz8AmZ+sCZGhr8LJQ1H4M9U0+Yk6vHppdz0qWrGtX umsAnXet5JHil0KS7airM/yAFVmManFDrAAzXAKhwO9fDRmq12HP5Y2c1dFxplQ4YtA8 gPTp0r9Irg1OGtiIQYDl/ydpe1HYRU3JNKdlk51JwU870uu3Yz6Rg1/qUe7bHPrH9G/m uEtg== X-Gm-Message-State: AOJu0YyCY1a3LgClmb59AeKdEjPFZiBMLg+RgKj2h6seVMl9aQVbxyOS 13GEA1RURYU7aSuFz+3s+EE= X-Received: by 2002:a17:902:6bc5:b0:1c9:bef4:e11 with SMTP id m5-20020a1709026bc500b001c9bef40e11mr5717841plt.46.1697082695866; Wed, 11 Oct 2023 20:51:35 -0700 (PDT) Received: from bangji.hsd1.ca.comcast.net ([2601:647:6780:42e0:b1b9:d490:2f5e:be06]) by smtp.gmail.com with ESMTPSA id w8-20020a170902d70800b001bc18e579aesm711374ply.101.2023.10.11.20.51.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 11 Oct 2023 20:51:35 -0700 (PDT) Sender: Namhyung Kim From: Namhyung Kim To: Arnaldo Carvalho de Melo , Jiri Olsa , Peter Zijlstra Cc: Ian Rogers , Adrian Hunter , Ingo Molnar , LKML , linux-perf-users@vger.kernel.org, Linus Torvalds , Stephane Eranian , Masami Hiramatsu , linux-toolchains@vger.kernel.org, linux-trace-devel@vger.kernel.org Subject: [PATCH 16/48] perf report: Support data type profiling Date: Wed, 11 Oct 2023 20:50:39 -0700 Message-ID: <20231012035111.676789-17-namhyung@kernel.org> X-Mailer: git-send-email 2.42.0.655.g421f12c284-goog In-Reply-To: <20231012035111.676789-1-namhyung@kernel.org> References: <20231012035111.676789-1-namhyung@kernel.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-1.0 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on howler.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (howler.vger.email [0.0.0.0]); Wed, 11 Oct 2023 20:53:20 -0700 (PDT) Enable type annotation when the 'type' sort key is used. It shows type of variables the samples access at the moment. Users can see which types are accessed frequently. $ perf report -s dso,type --stdio ... # Overhead Shared Object Data Type # ........ ................. ......... # 35.47% [kernel.kallsyms] (unknown) 1.62% [kernel.kallsyms] struct sched_entry 1.23% [kernel.kallsyms] struct cfs_rq 0.83% [kernel.kallsyms] struct task_struct 0.34% [kernel.kallsyms] struct list_head 0.30% [kernel.kallsyms] struct mem_cgroup ... Signed-off-by: Namhyung Kim --- tools/perf/builtin-report.c | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/tools/perf/builtin-report.c b/tools/perf/builtin-report.c index dcedfe00f04d..e60c6bb32d92 100644 --- a/tools/perf/builtin-report.c +++ b/tools/perf/builtin-report.c @@ -96,6 +96,7 @@ struct report { bool stitch_lbr; bool disable_order; bool skip_empty; + bool data_type; int max_stack; struct perf_read_values show_threads_values; struct annotation_options annotation_opts; @@ -171,7 +172,7 @@ static int hist_iter__report_callback(struct hist_entry_iter *iter, struct mem_info *mi; struct branch_info *bi; - if (!ui__has_annotation() && !rep->symbol_ipc) + if (!ui__has_annotation() && !rep->symbol_ipc && !rep->data_type) return 0; if (sort__mode == SORT_MODE__BRANCH) { @@ -323,10 +324,19 @@ static int process_sample_event(struct perf_tool *tool, if (al.map != NULL) map__dso(al.map)->hit = 1; - if (ui__has_annotation() || rep->symbol_ipc || rep->total_cycles_mode) { + if (ui__has_annotation() || rep->symbol_ipc || rep->total_cycles_mode || + rep->data_type) { hist__account_cycles(sample->branch_stack, &al, sample, rep->nonany_branch_mode, &rep->total_cycles); + if (rep->data_type) { + struct symbol *sym = al.sym; + struct annotation *notes = sym ? symbol__annotation(sym) : NULL; + + /* XXX: Save annotate options here */ + if (notes) + notes->options = &rep->annotation_opts; + } } ret = hist_entry_iter__add(&iter, &al, rep->max_stack, rep); @@ -1600,6 +1610,9 @@ int cmd_report(int argc, const char **argv) sort_order = NULL; } + if (sort_order && strstr(sort_order, "type")) + report.data_type = true; + if (strcmp(input_name, "-") != 0) setup_browser(true); else @@ -1658,7 +1671,7 @@ int cmd_report(int argc, const char **argv) * so don't allocate extra space that won't be used in the stdio * implementation. */ - if (ui__has_annotation() || report.symbol_ipc || + if (ui__has_annotation() || report.symbol_ipc || report.data_type || report.total_cycles_mode) { ret = symbol__annotation_init(); if (ret < 0) -- 2.42.0.655.g421f12c284-goog