Skip to content

Commit a5580f3

Browse files
Namhyung Kimacmel
authored andcommitted
perf ui: Add ui_progress__finish()
Sometimes we need to know when the progress bar should disappear. Checking curr >= total wasn't enough since there're cases not met that condition for the last call. So add a new ->finish callback to identify this explicitly. Currently only GTK frontend needs it. Signed-off-by: Namhyung Kim <namhyung@kernel.org> Cc: Ingo Molnar <mingo@kernel.org> Cc: Pekka Enberg <penberg@kernel.org> Cc: Peter Zijlstra <peterz@infradead.org> Link: http://lkml.kernel.org/r/1352813436-14173-4-git-send-email-namhyung@kernel.org Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
1 parent a753579 commit a5580f3

5 files changed

Lines changed: 19 additions & 0 deletions

File tree

‎tools/perf/ui/gtk/progress.c‎

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,17 @@ static void gtk_progress_update(u64 curr, u64 total, const char *title)
4040
gtk_main_iteration();
4141
}
4242

43+
static void gtk_progress_finish(void)
44+
{
45+
/* this will also destroy all of its children */
46+
gtk_widget_destroy(dialog);
47+
48+
dialog = NULL;
49+
}
50+
4351
static struct ui_progress gtk_progress_fns = {
4452
.update = gtk_progress_update,
53+
.finish = gtk_progress_finish,
4554
};
4655

4756
void perf_gtk__init_progress(void)

‎tools/perf/ui/progress.c‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,3 +18,9 @@ void ui_progress__update(u64 curr, u64 total, const char *title)
1818
{
1919
return progress_fns->update(curr, total, title);
2020
}
21+
22+
void ui_progress__finish(void)
23+
{
24+
if (progress_fns->finish)
25+
progress_fns->finish();
26+
}

‎tools/perf/ui/progress.h‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,14 @@
55

66
struct ui_progress {
77
void (*update)(u64, u64, const char *);
8+
void (*finish)(void);
89
};
910

1011
extern struct ui_progress *progress_fns;
1112

1213
void ui_progress__init(void);
1314

1415
void ui_progress__update(u64 curr, u64 total, const char *title);
16+
void ui_progress__finish(void);
1517

1618
#endif

‎tools/perf/util/debug.h‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ int ui__error(const char *format, ...) __attribute__((format(printf, 1, 2)));
2626
static inline void ui_progress__update(u64 curr __maybe_unused,
2727
u64 total __maybe_unused,
2828
const char *title __maybe_unused) {}
29+
static inline void ui_progress__finish(void) {}
2930

3031
#define ui__error(format, arg...) ui__warning(format, ##arg)
3132

‎tools/perf/util/session.c‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1458,6 +1458,7 @@ int __perf_session__process_events(struct perf_session *session,
14581458
session->ordered_samples.next_flush = ULLONG_MAX;
14591459
err = flush_sample_queue(session, tool);
14601460
out_err:
1461+
ui_progress__finish();
14611462
perf_session__warn_about_errors(session, tool);
14621463
perf_session_free_sample_buffers(session);
14631464
return err;

0 commit comments

Comments
 (0)