perf machine: Move fprintf to for_each loop and a callback
authorIan Rogers <irogers@google.com>
Fri, 1 Mar 2024 05:36:41 +0000 (21:36 -0800)
committerNamhyung Kim <namhyung@kernel.org>
Mon, 4 Mar 2024 06:51:31 +0000 (22:51 -0800)
commit45ac4960d7fead9041fbfa15177fdd20b6af10f7
tree2c39e11d6214239c7c35d77f5f1ca02d0fdbb2f9
parentf178ffdf7ee5bf809837161002719e19eebff895
perf machine: Move fprintf to for_each loop and a callback

Avoid exposing the threads data structure by switching to the callback
machine__for_each_thread approach. machine__fprintf is only used in
tests and verbose >3 output so don't turn to list and sort. Add
machine__threads_nr to be refactored later.

Note, all existing *_fprintf routines ignore fprintf errors.

Signed-off-by: Ian Rogers <irogers@google.com>
Acked-by: Namhyung Kim <namhyung@kernel.org>
Cc: Yang Jihong <yangjihong1@huawei.com>
Cc: Oliver Upton <oliver.upton@linux.dev>
Signed-off-by: Namhyung Kim <namhyung@kernel.org>
Link: https://lore.kernel.org/r/20240301053646.1449657-4-irogers@google.com
tools/perf/util/machine.c