]> www.infradead.org Git - users/hch/misc.git/commitdiff
perf annotate: Return printed number from disasm_line__write()
authorNamhyung Kim <namhyung@kernel.org>
Sat, 16 Aug 2025 03:16:29 +0000 (20:16 -0700)
committerArnaldo Carvalho de Melo <acme@redhat.com>
Thu, 28 Aug 2025 15:32:58 +0000 (12:32 -0300)
Like other print functions, make disasm_line__write() return the number
of printed characters.  It'll be used to skip unnecessary operations
when the screen is full.

Signed-off-by: Namhyung Kim <namhyung@kernel.org>
Tested-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: Ian Rogers <irogers@google.com>
Cc: Ingo Molnar <mingo@kernel.org>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Kan Liang <kan.liang@linux.intel.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Link: https://lore.kernel.org/r/20250816031635.25318-7-namhyung@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
tools/perf/util/annotate.c

index 6389292ad8f95d898970f39e80352f43ebb1c40e..698bc4f559e83043ec3448c87a0818c53d5497c8 100644 (file)
@@ -1743,7 +1743,7 @@ static double annotation_line__max_percent(struct annotation_line *al,
        return percent_max;
 }
 
-static void disasm_line__write(struct disasm_line *dl, struct annotation *notes,
+static int disasm_line__write(struct disasm_line *dl, struct annotation *notes,
                               void *obj, char *bf, size_t size,
                               void (*obj__printf)(void *obj, const char *fmt, ...),
                               void (*obj__write_graph)(void *obj, int graph))
@@ -1771,8 +1771,8 @@ call_like:
                obj__printf(obj, "  ");
        }
 
-       disasm_line__scnprintf(dl, bf, size, !annotate_opts.use_offset,
-                              notes->src->widths.max_ins_name);
+       return disasm_line__scnprintf(dl, bf, size, !annotate_opts.use_offset,
+                                     notes->src->widths.max_ins_name) + 2;
 }
 
 static void ipc_coverage_string(char *bf, int size, struct annotation *notes)