blob: 4f52c37b2f099a82195879e1d2fc2c43f6b14444 [file] [log] [blame]
Greg Kroah-Hartmanb2441312017-11-01 15:07:57 +01001/* SPDX-License-Identifier: GPL-2.0 */
Arnaldo Carvalho de Melo34cea7f2010-08-08 19:56:47 -03002#ifndef _PERF_UI_PROGRESS_H_
3#define _PERF_UI_PROGRESS_H_ 1
4
Borislav Petkovd944c4e2014-04-25 21:31:02 +02005#include <linux/types.h>
Arnaldo Carvalho de Melo34cea7f2010-08-08 19:56:47 -03006
Arnaldo Carvalho de Melo4d3001f2013-10-23 15:40:38 -03007void ui_progress__finish(void);
Arnaldo Carvalho de Melo48000a12014-12-17 17:24:45 -03008
Arnaldo Carvalho de Melo4d3001f2013-10-23 15:40:38 -03009struct ui_progress {
10 const char *title;
11 u64 curr, next, step, total;
Jiri Olsa82338222017-09-08 14:05:10 +020012 bool size;
Arnaldo Carvalho de Melo4d3001f2013-10-23 15:40:38 -030013};
Arnaldo Carvalho de Melo48000a12014-12-17 17:24:45 -030014
Jiri Olsa82338222017-09-08 14:05:10 +020015void __ui_progress__init(struct ui_progress *p, u64 total,
16 const char *title, bool size);
17
18#define ui_progress__init(p, total, title) \
19 __ui_progress__init(p, total, title, false)
20
21#define ui_progress__init_size(p, total, title) \
22 __ui_progress__init(p, total, title, true)
23
Arnaldo Carvalho de Melo4d3001f2013-10-23 15:40:38 -030024void ui_progress__update(struct ui_progress *p, u64 adv);
25
Arnaldo Carvalho de Melo4779a2e2013-10-23 14:08:48 -030026struct ui_progress_ops {
Jiri Olsa25cc4eb2017-09-08 14:05:09 +020027 void (*init)(struct ui_progress *p);
Arnaldo Carvalho de Melo4d3001f2013-10-23 15:40:38 -030028 void (*update)(struct ui_progress *p);
Namhyung Kima5580f32012-11-13 22:30:34 +090029 void (*finish)(void);
Namhyung Kim688f2f52012-11-13 22:30:32 +090030};
31
Arnaldo Carvalho de Melo4779a2e2013-10-23 14:08:48 -030032extern struct ui_progress_ops *ui_progress__ops;
Namhyung Kim688f2f52012-11-13 22:30:32 +090033
Arnaldo Carvalho de Melo34cea7f2010-08-08 19:56:47 -030034#endif