Merge branch 'master' into benchmark
[lttng-tools.git] / benchmark / benchmark.c
index 9100fae5735c64bdc3cc41001908afdfa3597a4a..fea90afd5a3f0eeb5615dd76e539844ceb83c5e9 100644 (file)
@@ -29,7 +29,7 @@ static double g_freq;
 static double calibrate_cpu_freq(void)
 {
        int i, nb_calib = 10;
-       double freq;
+       double freq = 0;
 
        printf("CPU frequency calibration, this should take 10 seconds\n");
 
@@ -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);
 }
 
@@ -99,6 +100,58 @@ double bench_get_destroy_session(void)
        return get_bench_time(time_destroy_session_start, time_destroy_session_end);
 }
 
+void bench_print_create_session(void)
+{
+       fprintf(fp, "Create session time:\n");
+       fprintf(fp, "  %.20f sec.\n", bench_get_create_session());
+}
+
+void bench_print_enable_ust_channel(void)
+{
+       double res;
+
+       if ((time_enable_ust_channel_start == 0) &&
+                       (time_enable_ust_channel_end == 0)) {
+               fprintf(fp, "NO DATA\n");
+               return;
+       }
+
+       res = get_bench_time(time_enable_ust_channel_start,
+                       time_enable_ust_channel_end);
+       fprintf(fp, "Enable lttng-ust channel time:\n");
+       fprintf(fp, "  %.20f sec.\n", res);
+}
+
+void bench_print_enable_ust_event(void)
+{
+       double res;
+
+       if ((time_enable_ust_event_start== 0) &&
+                       (time_enable_ust_event_end == 0)) {
+               fprintf(fp, "NO DATA\n");
+               return;
+       }
+
+       res = get_bench_time(time_enable_ust_event_start,
+                       time_enable_ust_event_end);
+       fprintf(fp, "Enable lttng-ust event time:\n");
+       fprintf(fp, "  %.20f sec.\n", res);
+}
+
+void bench_print_start_ust(void)
+{
+       double res;
+
+       if ((time_start_ust_start== 0) && (time_start_ust_end == 0)) {
+               fprintf(fp, "NO DATA\n");
+               return;
+       }
+
+       res = get_bench_time(time_start_ust_start, time_start_ust_end);
+       fprintf(fp, "Start lttng-ust tracing time:\n");
+       fprintf(fp, "  %.20f sec.\n", res);
+}
+
 /*
  * Complete UST notification process time break down in different actions.
  */
@@ -141,6 +194,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;
This page took 0.043589 seconds and 4 git commands to generate.