Fix benchmark and missing tracepoint
[lttng-tools.git] / benchmark / benchmark.c
index 7e12c98946a9df40b2241c067cc58795e15e14a7..b8f8516ef9447d64fbd6b6086884201272944f3e 100644 (file)
@@ -37,6 +37,7 @@ static double calibrate_cpu_freq(void)
        for (i = 0; i < nb_calib; i++) {
                freq += (double) get_cpu_freq();
        }
+
        return (freq / (double)nb_calib);
 }
 
@@ -141,6 +142,17 @@ void bench_print_ust_notification(void)
 
        total += res;
 
+       if (time_ust_notify_apps_start == 0 || time_ust_notify_apps_stop == 0) {
+               goto no_data;
+       }
+
+       res = get_bench_time(time_ust_notify_apps_start,
+                       time_ust_notify_apps_stop);
+       fprintf(fp, "futex wake\n");
+       fprintf(fp, "Time: %.20f sec.\n", res);
+
+       total += res;
+
        fprintf(fp, "Global UST nonification time\n");
        fprintf(fp, "Time: %.20f sec.\n", total);
        return;
@@ -150,6 +162,29 @@ no_data:
        return;
 }
 
+/*
+ * Time taken by an UST apps to unregister.
+ */
+void bench_print_ust_unregister(void)
+{
+    double res;
+
+    fprintf(fp, "--- UST unregister time ---\n");
+
+    if (time_ust_unregister_start == 0 || time_ust_unregister_stop == 0) {
+        goto no_data;
+    }
+
+    res = get_bench_time(time_ust_unregister_start, time_ust_unregister_stop);
+    fprintf(fp, "UST unregister time\n");
+    fprintf(fp, "Time: %.20f sec.\n", res);
+    return;
+
+no_data:
+    fprintf(fp, "NO DATA\n");
+    return;
+}
+
 /*
  * This time value is only coherent is an UST application registered.
  */
@@ -181,14 +216,25 @@ void bench_print_ust_register(void)
 
        total += res;
 
-       if (time_ust_manage_register_start == 0 ||
-                       time_ust_manage_register_stop == 0) {
-               goto no_data;
-       }
+       fprintf(fp, "--> Manage registration breakdown\n");
+
+       res = get_bench_time(time_ust_register_read_start,
+                       time_ust_register_read_stop);
+       fprintf(fp, "read() from pipe time\n");
+       fprintf(fp, "Time: %.20f sec.\n", res);
+
+       total += res;
+
+       res = get_bench_time(time_ust_register_add_start,
+                       time_ust_register_add_stop);
+       fprintf(fp, "register_traceable_app time\n");
+       fprintf(fp, "Time: %.20f sec.\n", res);
+
+       total += res;
 
-       res = get_bench_time(time_ust_manage_register_start,
-                       time_ust_manage_register_stop);
-       fprintf(fp, "Manage UST registration time\n");
+       res = get_bench_time(time_ust_register_done_start,
+                       time_ust_register_done_stop);
+       fprintf(fp, "send register done command time\n");
        fprintf(fp, "Time: %.20f sec.\n", res);
 
        total += res;
@@ -217,31 +263,45 @@ void bench_print_boot_process(void)
 
        res = get_bench_time(time_sessiond_boot_start, time_sessiond_boot_end);
 
-       fprintf(fp, "Boot time inside main() from start to first pthread_join (blocking state)\n");
+       fprintf(fp, "Inside main() from start to first pthread_join"
+                       "(blocking state)\n");
+       fprintf(fp, "Time: %.20f sec.\n", res);
+
+       global_boot_time += res;
+
+       res = get_bench_time(time_sessiond_th_kern_start,
+                       time_sessiond_th_kern_poll);
+
+       fprintf(fp, "Kernel thread from start to poll() (ready state)\n");
        fprintf(fp, "Time: %.20f sec.\n", res);
 
        global_boot_time += res;
 
-       res = get_bench_time(time_sessiond_th_kern_start, time_sessiond_th_kern_poll);
+       res = get_bench_time(time_sessiond_th_apps_start,
+                       time_sessiond_th_apps_poll);
 
-       fprintf(fp, "Boot time of the kernel thread from start to poll() (ready state)\n");
+       fprintf(fp, "Application thread from start to poll() (ready state)\n");
        fprintf(fp, "Time: %.20f sec.\n", res);
 
        global_boot_time += res;
 
-       res = get_bench_time(time_sessiond_th_apps_start, time_sessiond_th_apps_poll);
+       res = get_bench_time(time_sessiond_th_cli_start,
+                       time_sessiond_th_cli_poll);
 
-       fprintf(fp, "Boot time of the application thread from start to poll() (ready state)\n");
+       fprintf(fp, "Client thread from start to poll() (ready state)\n");
        fprintf(fp, "Time: %.20f sec.\n", res);
 
        global_boot_time += res;
 
-       res = get_bench_time(time_sessiond_th_cli_start, time_sessiond_th_cli_poll);
+       res = get_bench_time(time_sessiond_th_dispatch_start,
+                       time_sessiond_th_dispatch_block);
 
-       fprintf(fp, "Boot time of the client thread from start to poll() (ready state)\n");
+       fprintf(fp, "Dispatch registration thread from start to poll()"
+                       "(ready state)\n");
        fprintf(fp, "Time: %.20f sec.\n", res);
 
        global_boot_time += res;
 
-       fprintf(fp, "Global Boot Time of ltt-sessiond: %0.20f sec.\n", global_boot_time);
+       fprintf(fp, "Global Boot Time\n");
+       fprintf(fp, "Time: %0.20f sec.\n", global_boot_time);
 }
This page took 0.041736 seconds and 4 git commands to generate.