diff options
author | Arnaldo Carvalho de Melo <acme@redhat.com> | 2013-10-23 14:40:38 -0400 |
---|---|---|
committer | Arnaldo Carvalho de Melo <acme@redhat.com> | 2013-10-23 14:40:38 -0400 |
commit | 4d3001fdfdfacd2b35ee74ff0f037274eeebd3f6 (patch) | |
tree | 20634d8528fe514298163af38a66b37447503926 /tools/perf/ui/gtk/progress.c | |
parent | 4779a2e99af80e133ee1c70c7093dc6cc13429a1 (diff) |
perf ui progress: Per progress bar state
That will ease using a progress bar across multiple functions, like in
the upcoming patches that will present a progress bar when collapsing
histograms.
Based on a previous patch by Namhyung Kim.
Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: David Ahern <dsahern@gmail.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Stephane Eranian <eranian@google.com>
Link: http://lkml.kernel.org/n/tip-cr7lq7ud9fj21bg7wvq27w1u@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools/perf/ui/gtk/progress.c')
-rw-r--r-- | tools/perf/ui/gtk/progress.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/tools/perf/ui/gtk/progress.c b/tools/perf/ui/gtk/progress.c index 195c7f94f98e..b656655fbc39 100644 --- a/tools/perf/ui/gtk/progress.c +++ b/tools/perf/ui/gtk/progress.c | |||
@@ -7,14 +7,14 @@ | |||
7 | static GtkWidget *dialog; | 7 | static GtkWidget *dialog; |
8 | static GtkWidget *progress; | 8 | static GtkWidget *progress; |
9 | 9 | ||
10 | static void gtk_ui_progress__update(u64 curr, u64 total, const char *title) | 10 | static void gtk_ui_progress__update(struct ui_progress *p) |
11 | { | 11 | { |
12 | double fraction = total ? 1.0 * curr / total : 0.0; | 12 | double fraction = p->total ? 1.0 * p->curr / p->total : 0.0; |
13 | char buf[1024]; | 13 | char buf[1024]; |
14 | 14 | ||
15 | if (dialog == NULL) { | 15 | if (dialog == NULL) { |
16 | GtkWidget *vbox = gtk_vbox_new(TRUE, 5); | 16 | GtkWidget *vbox = gtk_vbox_new(TRUE, 5); |
17 | GtkWidget *label = gtk_label_new(title); | 17 | GtkWidget *label = gtk_label_new(p->title); |
18 | 18 | ||
19 | dialog = gtk_window_new(GTK_WINDOW_TOPLEVEL); | 19 | dialog = gtk_window_new(GTK_WINDOW_TOPLEVEL); |
20 | progress = gtk_progress_bar_new(); | 20 | progress = gtk_progress_bar_new(); |
@@ -32,7 +32,7 @@ static void gtk_ui_progress__update(u64 curr, u64 total, const char *title) | |||
32 | } | 32 | } |
33 | 33 | ||
34 | gtk_progress_bar_set_fraction(GTK_PROGRESS_BAR(progress), fraction); | 34 | gtk_progress_bar_set_fraction(GTK_PROGRESS_BAR(progress), fraction); |
35 | snprintf(buf, sizeof(buf), "%"PRIu64" / %"PRIu64, curr, total); | 35 | snprintf(buf, sizeof(buf), "%"PRIu64" / %"PRIu64, p->curr, p->total); |
36 | gtk_progress_bar_set_text(GTK_PROGRESS_BAR(progress), buf); | 36 | gtk_progress_bar_set_text(GTK_PROGRESS_BAR(progress), buf); |
37 | 37 | ||
38 | /* we didn't call gtk_main yet, so do it manually */ | 38 | /* we didn't call gtk_main yet, so do it manually */ |