xref: /linux-6.15/tools/perf/ui/progress.c (revision a5580f3e)
1688f2f5bSNamhyung Kim #include "../cache.h"
2688f2f5bSNamhyung Kim #include "progress.h"
3688f2f5bSNamhyung Kim 
4688f2f5bSNamhyung Kim static void nop_progress_update(u64 curr __maybe_unused,
5688f2f5bSNamhyung Kim 				u64 total __maybe_unused,
6688f2f5bSNamhyung Kim 				const char *title __maybe_unused)
7688f2f5bSNamhyung Kim {
8688f2f5bSNamhyung Kim }
9688f2f5bSNamhyung Kim 
10688f2f5bSNamhyung Kim static struct ui_progress default_progress_fns =
11688f2f5bSNamhyung Kim {
12688f2f5bSNamhyung Kim 	.update		= nop_progress_update,
13688f2f5bSNamhyung Kim };
14688f2f5bSNamhyung Kim 
15688f2f5bSNamhyung Kim struct ui_progress *progress_fns = &default_progress_fns;
16688f2f5bSNamhyung Kim 
17688f2f5bSNamhyung Kim void ui_progress__update(u64 curr, u64 total, const char *title)
18688f2f5bSNamhyung Kim {
19688f2f5bSNamhyung Kim 	return progress_fns->update(curr, total, title);
20688f2f5bSNamhyung Kim }
21*a5580f3eSNamhyung Kim 
22*a5580f3eSNamhyung Kim void ui_progress__finish(void)
23*a5580f3eSNamhyung Kim {
24*a5580f3eSNamhyung Kim 	if (progress_fns->finish)
25*a5580f3eSNamhyung Kim 		progress_fns->finish();
26*a5580f3eSNamhyung Kim }
27