misc: tegra-profiler: remove excess callchains
Igor Nabirushkin [Sun, 8 Sep 2013 06:43:36 +0000 (10:43 +0400)]
Tegra Profiler: improve performance by removing
unnecessary callchains

Bug 1364258

Change-Id: I664fbabb576b98b1609db6fd904d9449727e2523
Signed-off-by: Igor Nabirushkin <inabirushkin@nvidia.com>
Reviewed-on: http://git-master/r/277090
(cherry picked from commit 65da0a2e6e2b984326c4f75775ba58cb38949956)
Reviewed-on: http://git-master/r/340002
Reviewed-by: Harry Hong <hhong@nvidia.com>
Tested-by: Harry Hong <hhong@nvidia.com>

drivers/misc/tegra-profiler/hrt.c
drivers/misc/tegra-profiler/version.h

index 6a9c39f..fdfbb96 100644 (file)
@@ -253,6 +253,9 @@ static void read_source(struct quadd_event_source_interface *source,
                return;
        }
 
+       if (atomic_read(&cpu_ctx->nr_active) == 0)
+               return;
+
        if (user_mode(regs) && hrt.quadd_ctx->param.backtrace) {
                callchain_nr = quadd_get_user_callchain(regs, callchain_data);
                if (callchain_nr > 0) {
@@ -275,20 +278,20 @@ static void read_source(struct quadd_event_source_interface *source,
                    !quadd_ctx->collect_kernel_ips)
                        record_data.sample.ip = 0;
 
-               record_data.sample.callchain_nr = callchain_nr;
-
                if (pid > 0) {
                        record_data.sample.pid = pid;
-                       quadd_put_sample(&record_data, extra_data,
-                                        extra_length);
                } else {
                        t_data = &cpu_ctx->active_thread;
+                       record_data.sample.pid = t_data->pid;
+               }
 
-                       if (atomic_read(&cpu_ctx->nr_active) > 0) {
-                               record_data.sample.pid = t_data->pid;
-                               quadd_put_sample(&record_data, extra_data,
-                                                extra_length);
-                       }
+               if (i == 0) {
+                       record_data.sample.callchain_nr = callchain_nr;
+                       quadd_put_sample(&record_data, extra_data,
+                                        extra_length);
+               } else {
+                       record_data.sample.callchain_nr = 0;
+                       quadd_put_sample(&record_data, NULL, 0);
                }
        }
 }
index 838c1f4..3c03b29 100644 (file)
@@ -18,7 +18,7 @@
 #ifndef __QUADD_VERSION_H
 #define __QUADD_VERSION_H
 
-#define QUADD_MODULE_VERSION           "1.29"
+#define QUADD_MODULE_VERSION           "1.30"
 #define QUADD_MODULE_BRANCH            "Dev"
 
 #endif /* __QUADD_VERSION_H */