Merge branch 'master' into benchmark
[lttng-tools.git] / benchmark / benchmark.c
index 8fbe8ad78416bcfdd2843ef6b986fa486e9ab096..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;
@@ -150,6 +214,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.
  */
This page took 0.038618 seconds and 4 git commands to generate.