Add dedicated trace events for benchmarking.
authorGerd Zellweger <mail@gerdzellweger.com>
Sat, 5 Apr 2014 16:39:37 +0000 (18:39 +0200)
committerGerd Zellweger <mail@gerdzellweger.com>
Tue, 14 Oct 2014 06:51:24 +0000 (08:51 +0200)
trace_definitions/trace_defs.pleco
usr/bench/mem_bench/memeasy.c

index 8e7ec54..bb57310 100644 (file)
@@ -38,6 +38,7 @@
 
 subsystem kernel {
 
+    // Do not change CSWITCH name without changing Aquarium EventFactory.java!
        event CSWITCH                           "Context Switch",
        event BZERO                             "Buffer zeroing",
        event TIMER                             "",
@@ -52,6 +53,32 @@ subsystem kernel {
     event CORE_START_REQUEST      "Requested start of a new core.",
     event CORE_START_REQUEST_DONE "Request is sent, waiting for core to come up.",
     event CORE_START_REQUEST_ACK  "Core is online.",
+
+    /* Syscalls */
+    event SC_PRINT            "Syscall PRINT",
+    event SC_DISP_SETUP       "Syscall DISPATCHER ",
+    event SC_DISP_PROPS       "Syscall DISPATCHER_PROPS",
+    event SC_RETYPE           "Syscall RETYPE",
+    event SC_CREATE           "Syscall CREATE",
+    event SC_COPY_OR_MINT     "Syscall COPY_OR_MINT",
+    event SC_CTE_FOR_CAP      "Syscall CTE_FOR_CAP",
+    event SC_MAP              "Syscall MAP",
+    event SC_DELETE           "Syscall DELETE",
+    event SC_REVOKE           "Syscall REVOKE",
+    event SC_MONITOR_REGISTER "Syscall MONITOR_REGISTER",
+    event SC_IDENTIFY_CAP     "Syscall IDENTIFY_CAP",
+    event SC_NULLIFY_CAP      "Syscall NULLIFY_CAP",
+    event SC_DOMAIN_ID        "Syscall DOMAIN_ID",
+    event SC_YIELD            "Syscall YIELD",
+    event SC_SUSPEND          "Syscall SUSPEND",
+    event SC_IDCAP_IDENTIFY   "Syscall IDCAP_IDENTIFY",
+    event SC_SPAWN_CORE       "Syscall SPAWN_CORE",
+
+    event CAP_LOOKUP_SLOT          "Cap Slot lookup",
+    event CAP_LOOKUP_CAP           "Cap Lookup",
+    event CAP_CREATE_FROM_EXISTING "Cap Create from existing",
+    event CAP_CREATE_NEW           "Cap Create new",
+    event CAP_RETYPE               "Cap Retype",
 };
 
 subsystem threads {
@@ -166,12 +193,20 @@ subsystem route {
 
 };
 
+// Generic Benchmarking events
 subsystem bench {
 
+ event START                "Start the benchmark/tracing",
+ event STOP                 "End of the benchmark/tracing",
+
+ event ROUND_START          "",
+ event ROUND_END            "",
+
  event PCBENCH                         "",
  event RXPING                          "",
  event RXPONG                          "",
 
+
 };
 
 subsystem bomp {
index 3629ad8..69843c4 100644 (file)
@@ -22,6 +22,8 @@
 #include <trace/trace.h>
 
 #define MAX_ITERATION 1000
+#define TRACE(s, e, a) trace_event(TRACE_SUBSYS_##s, TRACE_EVENT_##s##_##e, a)
+
 static volatile bool finished;
 
 static void set_true(void* arg) {
@@ -60,28 +62,27 @@ static void after_prepare(void *arg)
 static errval_t init_tracing(void)
 {
     trace_reset_all();
-
     debug_printf("after trace reset\n");
 
     // Tell the trace system when to start and stop.  We can also
     // provide an overriding maximum duration (in cycles) as the last parameter.
-    return trace_control(TRACE_EVENT(TRACE_SUBSYS_XMPL,
-                                    TRACE_EVENT_XMPL_START, 0),
-                        TRACE_EVENT(TRACE_SUBSYS_XMPL,
-                                    TRACE_EVENT_XMPL_STOP, 0),
+    return trace_control(TRACE_EVENT(TRACE_SUBSYS_BENCH,
+                                    TRACE_EVENT_BENCH_START, 0),
+                        TRACE_EVENT(TRACE_SUBSYS_BENCH,
+                                    TRACE_EVENT_BENCH_STOP, 0),
                         0);
 }
 
 static void start_tracing(void)
 {
     // start the trace going by providing the start event
-    trace_event(TRACE_SUBSYS_XMPL, TRACE_EVENT_XMPL_START, 0);
+    TRACE(BENCH, START, 0);
 }
 
 static void stop_tracing(void)
 {
     // stop the trace by providing the stop event
-    trace_event(TRACE_SUBSYS_XMPL, TRACE_EVENT_XMPL_STOP, 0);
+    TRACE(BENCH, STOP, 0);
 }
 
 static void callback(void *arg)
@@ -172,6 +173,7 @@ int main(int argc, char** argv)
     }
 
     for (size_t i=0; i<MAX_ITERATION; i++) {
+        TRACE(BENCH, ROUND_START, 0);
         //printf("%s:%s:%d: i=%"PRIu64"\n",
         //       __FILE__, __FUNCTION__, __LINE__, i);
         start = bench_tsc();
@@ -190,6 +192,7 @@ int main(int argc, char** argv)
         if (sleep > 0) {
             sleep_until(sleep);
         }
+        TRACE(BENCH, ROUND_END, 0);
 
         runs[i] = end - start;
     }