lkml.org 
[lkml]   [2018]   [Sep]   [13]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH 34/48] perf ui progress: Fix index progress display
Date
Display overall index files progress size instead of having
multiple (per index) progress bars.

Link: http://lkml.kernel.org/n/tip-b1alb4i6urd623bcbdqni8xp@git.kernel.org
Signed-off-by: Jiri Olsa <jolsa@kernel.org>
---
tools/perf/util/session.c | 27 +++++++++++++++++++++++----
1 file changed, 23 insertions(+), 4 deletions(-)

diff --git a/tools/perf/util/session.c b/tools/perf/util/session.c
index f21c209aeef1..e00a5d7e521e 100644
--- a/tools/perf/util/session.c
+++ b/tools/perf/util/session.c
@@ -1797,6 +1797,8 @@ fetch_mmaped_event(struct perf_session *session,
}

struct process_args {
+ struct ui_progress prog;
+
u64 data_offset;
u64 data_size;
u64 file_size;
@@ -1826,7 +1828,6 @@ static int __perf_session__process_events(struct perf_session *session,
size_t mmap_size;
char *buf, *mmaps[NUM_MMAPS];
union perf_event *event;
- struct ui_progress prog;
s64 skip;

perf_tool__fill_defaults(tool);
@@ -1841,8 +1842,6 @@ static int __perf_session__process_events(struct perf_session *session,
if (args->data_offset + args->data_size < file_size)
file_size = args->data_offset + args->data_size;

- ui_progress__init_size(&prog, file_size, "Processing events...");
-
mmap_size = MMAP_SIZE;
if (mmap_size > file_size) {
mmap_size = file_size;
@@ -1907,7 +1906,7 @@ static int __perf_session__process_events(struct perf_session *session,
head += size;
file_pos += size;

- ui_progress__update(&prog, size);
+ ui_progress__update(&args->prog, size);

if (session_done())
goto out;
@@ -1936,12 +1935,29 @@ static int __perf_session__process_events(struct perf_session *session,
return err;
}

+static u64 get_index_size(struct perf_session *session)
+{
+ u64 size = 0;
+ int i;
+
+ for (i = 0; i < (int)session->header.nr_index; i++) {
+ struct perf_file_section *idx = &session->header.index[i];
+
+ size += idx->size;
+ }
+
+ return size;
+}
+
static int __perf_session__process_indexed_events(struct perf_session *session)
{
struct process_args args;
struct perf_tool *tool = session->tool;
int err = 0, i;

+ ui_progress__init_size(&args.prog, get_index_size(session),
+ "Processing events");
+
for (i = 0; i < (int)session->header.nr_index; i++) {
struct perf_file_section *idx = &session->header.index[i];

@@ -1982,6 +1998,9 @@ int perf_session__process_events(struct perf_session *session)
args.data_size = session->header.data_size;
args.file_size = perf_data__size(data);

+ ui_progress__init_size(&args.prog, args.file_size,
+ "Processing events");
+
err = __perf_session__process_events(session, &args);

if (!tool->no_warn)
--
2.17.1
\
 
 \ /
  Last update: 2018-09-13 14:58    [W:0.360 / U:15.848 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site