^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1) /* SPDX-License-Identifier: GPL-2.0 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 2) #ifndef _PERF_UI_PROGRESS_H_
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 3) #define _PERF_UI_PROGRESS_H_ 1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 4)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 5) #include <linux/types.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 6)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 7) void ui_progress__finish(void);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 8)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 9) struct ui_progress {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 10) const char *title;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 11) u64 curr, next, step, total;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 12) bool size;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 13) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 14)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 15) void __ui_progress__init(struct ui_progress *p, u64 total,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 16) const char *title, bool size);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 17)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 18) #define ui_progress__init(p, total, title) \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 19) __ui_progress__init(p, total, title, false)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 20)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 21) #define ui_progress__init_size(p, total, title) \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 22) __ui_progress__init(p, total, title, true)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 23)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 24) void ui_progress__update(struct ui_progress *p, u64 adv);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 25)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 26) struct ui_progress_ops {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 27) void (*init)(struct ui_progress *p);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 28) void (*update)(struct ui_progress *p);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 29) void (*finish)(void);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 30) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 31)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 32) extern struct ui_progress_ops *ui_progress__ops;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 33)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 34) #endif