Following commits are going to allow 'perf data convert' to collect not
only samples, but also non-sample events like comm and fork. In this
patch we count non-sample events using c.non_sample_count, and prepare
to print number of both type of events like:

 # ~/perf data convert --all --to-ctf ./out.ctf
 [ perf data convert: Converted 'perf.data' into CTF data './out.ctf' ]
 [ perf data convert: Converted and wrote 0.846 MB (6508 samples, 686 
non-samples) ]

Signed-off-by: Wang Nan <wangn...@huawei.com>
Cc: Arnaldo Carvalho de Melo <a...@redhat.com>
Cc: Jiri Olsa <jo...@redhat.com>
---
 tools/perf/util/data-convert-bt.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/tools/perf/util/data-convert-bt.c 
b/tools/perf/util/data-convert-bt.c
index a5e0f68..bf4c15f 100644
--- a/tools/perf/util/data-convert-bt.c
+++ b/tools/perf/util/data-convert-bt.c
@@ -76,6 +76,7 @@ struct convert {
 
        u64                     events_size;
        u64                     events_count;
+       u64                     non_sample_count;
 
        /* Ordered events configured queue size. */
        u64                     queue_size;
@@ -1368,10 +1369,15 @@ int bt_convert__perf2ctf(const char *input, const char 
*path,
                file.path, path);
 
        fprintf(stderr,
-               "[ perf data convert: Converted and wrote %.3f MB (%" PRIu64 " 
samples) ]\n",
+               "[ perf data convert: Converted and wrote %.3f MB (%" PRIu64 " 
samples",
                (double) c.events_size / 1024.0 / 1024.0,
                c.events_count);
 
+       if (!c.non_sample_count)
+               fprintf(stderr, ") ]\n");
+       else
+               fprintf(stderr, ", %" PRIu64 " non-samples) ]\n", 
c.non_sample_count);
+
        cleanup_events(session);
        perf_session__delete(session);
        ctf_writer__cleanup(cw);
-- 
1.8.3.4

Reply via email to