Skip to content

Commit

Permalink
perf ui progress: Make sure we always define step value
Browse files Browse the repository at this point in the history
Unlikely, but we could have ui_progress__init being called with total <
16, which would set the next and step variables to 0. That would force
unnecessary ui_progress__ops->update calls because 'next' would never
raise.

Forcing the next and step values to be always > 0.

Signed-off-by: Jiri Olsa <jolsa@kernel.org>
Cc: David Ahern <dsahern@gmail.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Link: http://lkml.kernel.org/r/20170908120510.22515-2-jolsa@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
  • Loading branch information
Jiri Olsa authored and Arnaldo Carvalho de Melo committed Sep 12, 2017
1 parent cd6379e commit 4d286c8
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion tools/perf/ui/progress.c
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ void ui_progress__update(struct ui_progress *p, u64 adv)
void ui_progress__init(struct ui_progress *p, u64 total, const char *title)
{
p->curr = 0;
p->next = p->step = total / 16;
p->next = p->step = total / 16 ?: 1;
p->total = total;
p->title = title;

Expand Down

0 comments on commit 4d286c8

Please sign in to comment.