Arnaldo Carvalho de Melo | 34cea7f | 2010-08-08 19:56:47 -0300 | [diff] [blame] | 1 | #ifndef _PERF_UI_PROGRESS_H_ |
| 2 | #define _PERF_UI_PROGRESS_H_ 1 |
| 3 | |
Borislav Petkov | d944c4e | 2014-04-25 21:31:02 +0200 | [diff] [blame] | 4 | #include <linux/types.h> |
Arnaldo Carvalho de Melo | 34cea7f | 2010-08-08 19:56:47 -0300 | [diff] [blame] | 5 | |
Arnaldo Carvalho de Melo | 4d3001f | 2013-10-23 15:40:38 -0300 | [diff] [blame] | 6 | void ui_progress__finish(void); |
Arnaldo Carvalho de Melo | 48000a1 | 2014-12-17 17:24:45 -0300 | [diff] [blame] | 7 | |
Arnaldo Carvalho de Melo | 4d3001f | 2013-10-23 15:40:38 -0300 | [diff] [blame] | 8 | struct ui_progress { |
| 9 | const char *title; |
| 10 | u64 curr, next, step, total; |
Jiri Olsa | 8233822 | 2017-09-08 14:05:10 +0200 | [diff] [blame^] | 11 | bool size; |
Arnaldo Carvalho de Melo | 4d3001f | 2013-10-23 15:40:38 -0300 | [diff] [blame] | 12 | }; |
Arnaldo Carvalho de Melo | 48000a1 | 2014-12-17 17:24:45 -0300 | [diff] [blame] | 13 | |
Jiri Olsa | 8233822 | 2017-09-08 14:05:10 +0200 | [diff] [blame^] | 14 | void __ui_progress__init(struct ui_progress *p, u64 total, |
| 15 | const char *title, bool size); |
| 16 | |
| 17 | #define ui_progress__init(p, total, title) \ |
| 18 | __ui_progress__init(p, total, title, false) |
| 19 | |
| 20 | #define ui_progress__init_size(p, total, title) \ |
| 21 | __ui_progress__init(p, total, title, true) |
| 22 | |
Arnaldo Carvalho de Melo | 4d3001f | 2013-10-23 15:40:38 -0300 | [diff] [blame] | 23 | void ui_progress__update(struct ui_progress *p, u64 adv); |
| 24 | |
Arnaldo Carvalho de Melo | 4779a2e | 2013-10-23 14:08:48 -0300 | [diff] [blame] | 25 | struct ui_progress_ops { |
Jiri Olsa | 25cc4eb | 2017-09-08 14:05:09 +0200 | [diff] [blame] | 26 | void (*init)(struct ui_progress *p); |
Arnaldo Carvalho de Melo | 4d3001f | 2013-10-23 15:40:38 -0300 | [diff] [blame] | 27 | void (*update)(struct ui_progress *p); |
Namhyung Kim | a5580f3 | 2012-11-13 22:30:34 +0900 | [diff] [blame] | 28 | void (*finish)(void); |
Namhyung Kim | 688f2f5 | 2012-11-13 22:30:32 +0900 | [diff] [blame] | 29 | }; |
| 30 | |
Arnaldo Carvalho de Melo | 4779a2e | 2013-10-23 14:08:48 -0300 | [diff] [blame] | 31 | extern struct ui_progress_ops *ui_progress__ops; |
Namhyung Kim | 688f2f5 | 2012-11-13 22:30:32 +0900 | [diff] [blame] | 32 | |
Arnaldo Carvalho de Melo | 34cea7f | 2010-08-08 19:56:47 -0300 | [diff] [blame] | 33 | #endif |