linux-perf-users.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Arnaldo Carvalho de Melo <acme@kernel.org>
To: Namhyung Kim <namhyung@kernel.org>
Cc: Ian Rogers <irogers@google.com>,
	Kan Liang <kan.liang@linux.intel.com>,
	Jiri Olsa <jolsa@kernel.org>,
	Adrian Hunter <adrian.hunter@intel.com>,
	Peter Zijlstra <peterz@infradead.org>,
	Ingo Molnar <mingo@kernel.org>,
	LKML <linux-kernel@vger.kernel.org>,
	linux-perf-users@vger.kernel.org,
	Athira Rajeev <atrajeev@linux.vnet.ibm.com>
Subject: Re: [PATCH 3/6] perf annotate: Pass annotation_print_data to annotaiton_line__write()
Date: Thu, 5 Jun 2025 17:44:44 -0300	[thread overview]
Message-ID: <aEIBvIVWmi8vsCHS@x1> (raw)
In-Reply-To: <20250601065302.12531-4-namhyung@kernel.org>

There is a typo in the subject: annotaiton_line__write()
                                      ^^

- Arnaldo

On Sat, May 31, 2025 at 11:52:59PM -0700, Namhyung Kim wrote:
> Signed-off-by: Namhyung Kim <namhyung@kernel.org>
> ---
>  tools/perf/ui/browsers/annotate.c | 13 ++++++++++--
>  tools/perf/util/annotate.c        | 35 +++++++++++++++++--------------
>  tools/perf/util/annotate.h        | 15 +++++++++++--
>  3 files changed, 43 insertions(+), 20 deletions(-)
> 
> diff --git a/tools/perf/ui/browsers/annotate.c b/tools/perf/ui/browsers/annotate.c
> index af3e52ce4da62eb9..0057fb485e85aaaf 100644
> --- a/tools/perf/ui/browsers/annotate.c
> +++ b/tools/perf/ui/browsers/annotate.c
> @@ -28,6 +28,8 @@ struct annotate_browser {
>  	struct annotation_line	   *selection;
>  	struct arch		   *arch;
>  	struct hist_entry	   *he;
> +	struct debuginfo	   *dbg;
> +	struct evsel		   *evsel;
>  	bool			    searching_backwards;
>  	char			    search_bf[128];
>  };
> @@ -108,12 +110,18 @@ static void annotate_browser__write(struct ui_browser *browser, void *entry, int
>  		.printf			 = annotate_browser__printf,
>  		.write_graph		 = annotate_browser__write_graph,
>  	};
> +	struct annotation_print_data apd = {
> +		.he = ab->he,
> +		.arch = ab->arch,
> +		.evsel = ab->evsel,
> +		.dbg = ab->dbg,
> +	};
>  
>  	/* The scroll bar isn't being used */
>  	if (!browser->navkeypressed)
>  		ops.width += 1;
>  
> -	annotation_line__write(al, notes, &ops);
> +	annotation_line__write(al, notes, &ops, &apd);
>  
>  	if (ops.current_entry)
>  		ab->selection = al;
> @@ -902,7 +910,7 @@ static int annotate_browser__run(struct annotate_browser *browser,
>  			continue;
>  		}
>  		case 'P':
> -			map_symbol__annotation_dump(ms, evsel);
> +			map_symbol__annotation_dump(ms, evsel, browser->he);
>  			continue;
>  		case 't':
>  			if (symbol_conf.show_total_period) {
> @@ -987,6 +995,7 @@ int __hist_entry__tui_annotate(struct hist_entry *he, struct map_symbol *ms,
>  			.use_navkeypressed = true,
>  		},
>  		.he = he,
> +		.evsel = evsel,
>  	};
>  	struct dso *dso;
>  	int ret = -1, err;
> diff --git a/tools/perf/util/annotate.c b/tools/perf/util/annotate.c
> index 48fac08c4c9502b1..7df726b99541a571 100644
> --- a/tools/perf/util/annotate.c
> +++ b/tools/perf/util/annotate.c
> @@ -765,15 +765,6 @@ __hist_entry__get_data_type(struct hist_entry *he, struct arch *arch,
>  			    struct debuginfo *dbg, struct disasm_line *dl,
>  			    int *type_offset);
>  
> -struct annotation_print_data {
> -	struct hist_entry *he;
> -	struct evsel *evsel;
> -	struct arch *arch;
> -	struct debuginfo *dbg;
> -	u64 start;
> -	int addr_fmt_width;
> -};
> -
>  static int
>  annotation_line__print(struct annotation_line *al, struct annotation_print_data *apd,
>  		       struct annotation_options *opts, int printed,
> @@ -1230,7 +1221,6 @@ int hist_entry__annotate_printf(struct hist_entry *he, struct evsel *evsel)
>  	struct annotation_print_data apd = {
>  		.he = he,
>  		.evsel = evsel,
> -		.start = map__rip_2objdump(map, sym->start),
>  	};
>  	int printed = 2, queue_len = 0;
>  	int more = 0;
> @@ -1357,7 +1347,8 @@ static void FILE__write_graph(void *fp, int graph)
>  	fputs(s, fp);
>  }
>  
> -static int symbol__annotate_fprintf2(struct symbol *sym, FILE *fp)
> +static int symbol__annotate_fprintf2(struct symbol *sym, FILE *fp,
> +				     struct annotation_print_data *apd)
>  {
>  	struct annotation *notes = symbol__annotation(sym);
>  	struct annotation_write_ops wops = {
> @@ -1374,7 +1365,7 @@ static int symbol__annotate_fprintf2(struct symbol *sym, FILE *fp)
>  	list_for_each_entry(al, &notes->src->source, node) {
>  		if (annotation_line__filter(al))
>  			continue;
> -		annotation_line__write(al, notes, &wops);
> +		annotation_line__write(al, notes, &wops, apd);
>  		fputc('\n', fp);
>  		wops.first_line = false;
>  	}
> @@ -1382,13 +1373,18 @@ static int symbol__annotate_fprintf2(struct symbol *sym, FILE *fp)
>  	return 0;
>  }
>  
> -int map_symbol__annotation_dump(struct map_symbol *ms, struct evsel *evsel)
> +int map_symbol__annotation_dump(struct map_symbol *ms, struct evsel *evsel,
> +				struct hist_entry *he)
>  {
>  	const char *ev_name = evsel__name(evsel);
>  	char buf[1024];
>  	char *filename;
>  	int err = -1;
>  	FILE *fp;
> +	struct annotation_print_data apd = {
> +		.he = he,
> +		.evsel = evsel,
> +	};
>  
>  	if (asprintf(&filename, "%s.annotation", ms->sym->name) < 0)
>  		return -1;
> @@ -1404,7 +1400,7 @@ int map_symbol__annotation_dump(struct map_symbol *ms, struct evsel *evsel)
>  
>  	fprintf(fp, "%s() %s\nEvent: %s\n\n",
>  		ms->sym->name, dso__long_name(map__dso(ms->map)), ev_name);
> -	symbol__annotate_fprintf2(ms->sym, fp);
> +	symbol__annotate_fprintf2(ms->sym, fp, &apd);
>  
>  	fclose(fp);
>  	err = 0;
> @@ -1655,6 +1651,10 @@ int hist_entry__tty_annotate2(struct hist_entry *he, struct evsel *evsel)
>  	struct symbol *sym = ms->sym;
>  	struct rb_root source_line = RB_ROOT;
>  	struct hists *hists = evsel__hists(evsel);
> +	struct annotation_print_data apd = {
> +		.he = he,
> +		.evsel = evsel,
> +	};
>  	char buf[1024];
>  	int err;
>  
> @@ -1677,7 +1677,7 @@ int hist_entry__tty_annotate2(struct hist_entry *he, struct evsel *evsel)
>  	hists__scnprintf_title(hists, buf, sizeof(buf));
>  	fprintf(stdout, "%s, [percent: %s]\n%s() %s\n",
>  		buf, percent_type_str(annotate_opts.percent_type), sym->name, dso__long_name(dso));
> -	symbol__annotate_fprintf2(sym, stdout);
> +	symbol__annotate_fprintf2(sym, stdout, &apd);
>  
>  	annotated_source__purge(symbol__annotation(sym)->src);
>  
> @@ -1935,7 +1935,8 @@ int annotation_br_cntr_entry(char **str, int br_cntr_nr,
>  }
>  
>  void annotation_line__write(struct annotation_line *al, struct annotation *notes,
> -			    struct annotation_write_ops *wops)
> +			    struct annotation_write_ops *wops,
> +			    struct annotation_print_data *apd)
>  {
>  	bool current_entry = wops->current_entry;
>  	double percent_max = annotation_line__max_percent(al, annotate_opts.percent_type);
> @@ -2112,6 +2113,8 @@ void annotation_line__write(struct annotation_line *al, struct annotation *notes
>  		disasm_line__write(disasm_line(al), notes, obj, bf, sizeof(bf), obj__printf, obj__write_graph);
>  
>  		obj__printf(obj, "%-*s", width - pcnt_width - cycles_width - 3 - printed, bf);
> +
> +		(void)apd;
>  	}
>  
>  }
> diff --git a/tools/perf/util/annotate.h b/tools/perf/util/annotate.h
> index 9cd723b8b987db1a..bc195bd0429e039d 100644
> --- a/tools/perf/util/annotate.h
> +++ b/tools/perf/util/annotate.h
> @@ -199,8 +199,18 @@ struct annotation_write_ops {
>  	void (*write_graph)(void *obj, int graph);
>  };
>  
> +struct annotation_print_data {
> +	struct hist_entry *he;
> +	struct evsel *evsel;
> +	struct arch *arch;
> +	struct debuginfo *dbg;
> +	u64 start;
> +	int addr_fmt_width;
> +};
> +
>  void annotation_line__write(struct annotation_line *al, struct annotation *notes,
> -			    struct annotation_write_ops *ops);
> +			    struct annotation_write_ops *ops,
> +			    struct annotation_print_data *apd);
>  
>  int __annotation__scnprintf_samples_period(struct annotation *notes,
>  					   char *bf, size_t size,
> @@ -462,7 +472,8 @@ void symbol__annotate_zero_histogram(struct symbol *sym, struct evsel *evsel);
>  void symbol__annotate_decay_histogram(struct symbol *sym, struct evsel *evsel);
>  void annotated_source__purge(struct annotated_source *as);
>  
> -int map_symbol__annotation_dump(struct map_symbol *ms, struct evsel *evsel);
> +int map_symbol__annotation_dump(struct map_symbol *ms, struct evsel *evsel,
> +				struct hist_entry *he);
>  
>  bool ui__has_annotation(void);
>  
> -- 
> 2.49.0

  reply	other threads:[~2025-06-05 20:44 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-06-01  6:52 [PATCHSET 0/6] perf annotate: Support --code-with-type on TUI (v1) Namhyung Kim
2025-06-01  6:52 ` [PATCH 1/6] perf annotate: Rename to __hist_entry__tui_annotate() Namhyung Kim
2025-06-01  6:52 ` [PATCH 2/6] perf annotate: Remove __annotation_line__write() Namhyung Kim
2025-06-05 19:55   ` Arnaldo Carvalho de Melo
2025-06-05 19:59     ` Arnaldo Carvalho de Melo
2025-06-06  2:59       ` Namhyung Kim
2025-06-01  6:52 ` [PATCH 3/6] perf annotate: Pass annotation_print_data to annotaiton_line__write() Namhyung Kim
2025-06-05 20:44   ` Arnaldo Carvalho de Melo [this message]
2025-06-06  3:00     ` Namhyung Kim
2025-06-01  6:53 ` [PATCH 4/6] perf annotate: Simplify width calculation in annotation_line__write() Namhyung Kim
2025-06-01  6:53 ` [PATCH 5/6] perf annotate: Add --code-with-type support for TUI Namhyung Kim
2025-06-01  6:53 ` [PATCH 6/6] perf annotate: Add 'y' hot key to toggle data type display Namhyung Kim
2025-06-05 20:46   ` Arnaldo Carvalho de Melo
2025-06-05 21:12     ` Arnaldo Carvalho de Melo
2025-06-06  3:11       ` Namhyung Kim
2025-06-06  3:04     ` Namhyung Kim

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=aEIBvIVWmi8vsCHS@x1 \
    --to=acme@kernel.org \
    --cc=adrian.hunter@intel.com \
    --cc=atrajeev@linux.vnet.ibm.com \
    --cc=irogers@google.com \
    --cc=jolsa@kernel.org \
    --cc=kan.liang@linux.intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-perf-users@vger.kernel.org \
    --cc=mingo@kernel.org \
    --cc=namhyung@kernel.org \
    --cc=peterz@infradead.org \
    /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).