Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1728780

[PATCH 1/4] perf ui progress: Make sure we always define step value

From Jiri Olsa <jolsa@kernel.org>
Newsgroups linux.kernel
Subject [PATCH 1/4] perf ui progress: Make sure we always define step value
Date 2017-09-08 14:10 +0200
Message-ID <unqgG-6Qe-13@gated-at.bofh.it> (permalink)
References <unqgF-6Qe-3@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


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.

Link: http://lkml.kernel.org/n/tip-0zcvhmsmbhkfgoi7c670rq2x@git.kernel.org
Signed-off-by: Jiri Olsa <jolsa@kernel.org>
---
 tools/perf/ui/progress.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/perf/ui/progress.c b/tools/perf/ui/progress.c
index a0f24c7115c5..a9c15804b1f6 100644
--- a/tools/perf/ui/progress.c
+++ b/tools/perf/ui/progress.c
@@ -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;
 
-- 
2.9.5

Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

[RFC 1/4] perf ui progress: Add size info into progress bar Jiri Olsa <jolsa@kernel.org> - 2017-09-08 14:10 +0200
  [PATCH 4/4] perf ui progress: Add size info into progress bar Jiri Olsa <jolsa@kernel.org> - 2017-09-08 14:10 +0200
  [PATCH 1/4] perf ui progress: Make sure we always define step value Jiri Olsa <jolsa@kernel.org> - 2017-09-08 14:10 +0200
    Re: [PATCH 1/4] perf ui progress: Make sure we always define step value Milian Wolff <milian.wolff@kdab.com> - 2017-09-08 15:20 +0200
      Re: [PATCH 1/4] perf ui progress: Make sure we always define step  value Arnaldo Carvalho de Melo <acme@kernel.org> - 2017-09-08 15:30 +0200
        Re: [PATCH 1/4] perf ui progress: Make sure we always define step value Milian Wolff <milian.wolff@kdab.com> - 2017-09-09 12:20 +0200
  [PATCH 2/4] perf ui progress: Fix progress update Jiri Olsa <jolsa@kernel.org> - 2017-09-08 14:10 +0200
  [PATCH 3/4] perf ui progress: Add ui specific init function Jiri Olsa <jolsa@kernel.org> - 2017-09-08 14:10 +0200
  Re: [RFC 1/4] perf ui progress: Add size info into progress bar Arnaldo Carvalho de Melo <acme@kernel.org> - 2017-09-08 15:50 +0200

csiph-web