Palacios Public Git Repository

To checkout Palacios execute

  git clone http://v3vee.org/palacios/palacios.web/palacios.git
This will give you the master branch. You probably want the devel branch or one of the release branches. To switch to the devel branch, simply execute
  cd palacios
  git checkout --track -b devel origin/devel
The other branches are similar.


reformatting of the source files
[palacios.git] / palacios / src / palacios / vmm_instrument.c
index a207455..f7478f7 100644 (file)
@@ -32,10 +32,10 @@ static ullong_t last = 0;
 static struct v3_ringbuf * func_ring = NULL;
 
 struct instrumented_func {
-  ullong_t time; 
-  uint_t exiting;
-  void * called_fn;
-  void * calling_fn;
+    ullong_t time; 
+    uint_t exiting;
+    void * called_fn;
+    void * calling_fn;
 } __attribute__((packed));
 
 
@@ -46,89 +46,89 @@ void __cyg_profile_func_enter(void * this, void * callsite)   __attribute__((__n
 void __cyg_profile_func_exit(void * this, void * callsite)   __attribute__((__no_instrument_function__));
 
 void v3_init_instrumentation() {
-  PrintDebug("Creating Ring Buffer (unit size = %d)\n", (uint_t)sizeof(struct instrumented_func));
-  // initialize
-  func_ring = v3_create_ringbuf(sizeof(struct instrumented_func) * RING_SIZE); //dequeue at every 4095  
+    PrintDebug("Creating Ring Buffer (unit size = %d)\n", (uint_t)sizeof(struct instrumented_func));
+    // initialize
+    func_ring = v3_create_ringbuf(sizeof(struct instrumented_func) * RING_SIZE); //dequeue at every 4095  
 }
 
 
 
- __attribute__((__no_instrument_function__))
-void __cyg_profile_func_enter(void * this, void * callsite) {
+__attribute__((__no_instrument_function__))
+    void __cyg_profile_func_enter(void * this, void * callsite) {
 
-  if (func_ring != NULL) {
+    if (func_ring != NULL) {
 
-    struct instrumented_func tmp_fn;
-    ullong_t now = 0; 
+       struct instrumented_func tmp_fn;
+       ullong_t now = 0; 
 
-    rdtscll(now);
+       rdtscll(now);
 
-    //PrintDebug("Entering Function\n");
+       //PrintDebug("Entering Function\n");
 
-    if (v3_ringbuf_avail_space(func_ring) < sizeof(struct instrumented_func)) {
-      print_instrumentation();
-    }
+       if (v3_ringbuf_avail_space(func_ring) < sizeof(struct instrumented_func)) {
+           print_instrumentation();
+       }
     
-    tmp_fn.time = now - last; // current tsc
-    tmp_fn.exiting = 0; //enter to be 0
-    tmp_fn.called_fn = this; //this
-    tmp_fn.calling_fn = callsite; //callsite
+       tmp_fn.time = now - last; // current tsc
+       tmp_fn.exiting = 0; //enter to be 0
+       tmp_fn.called_fn = this; //this
+       tmp_fn.calling_fn = callsite; //callsite
     
-    //    PrintDebug("Writing Function: fn_data=%p, size=%d\n", 
-    //       (void *)&tmp_fn, (uint_t)sizeof(struct instrumented_func));
-    v3_ringbuf_write(func_ring, (uchar_t *)&tmp_fn, sizeof(struct instrumented_func));  
+       //    PrintDebug("Writing Function: fn_data=%p, size=%d\n", 
+       //       (void *)&tmp_fn, (uint_t)sizeof(struct instrumented_func));
+       v3_ringbuf_write(func_ring, (uchar_t *)&tmp_fn, sizeof(struct instrumented_func));  
 
-    rdtscll(last);
-  }
+       rdtscll(last);
+    }
 }
 
 
- __attribute__((__no_instrument_function__))
-void __cyg_profile_func_exit(void * this, void * callsite){
+__attribute__((__no_instrument_function__))
+    void __cyg_profile_func_exit(void * this, void * callsite){
 
-  if (func_ring != NULL) {
+    if (func_ring != NULL) {
 
-    struct instrumented_func tmp_fn;
-    ullong_t now = 0;
+       struct instrumented_func tmp_fn;
+       ullong_t now = 0;
 
-    rdtscll(now);
+       rdtscll(now);
     
-    //    PrintDebug("Exiting Function\n");
+       //    PrintDebug("Exiting Function\n");
 
-    if (v3_ringbuf_avail_space(func_ring) < sizeof(struct instrumented_func)) {
-      print_instrumentation();
-    }
+       if (v3_ringbuf_avail_space(func_ring) < sizeof(struct instrumented_func)) {
+           print_instrumentation();
+       }
     
-    tmp_fn.time = now - last; // current tsc
-    tmp_fn.exiting = 1; //exit to be 0
-    tmp_fn.called_fn = this; //this
-    tmp_fn.calling_fn = callsite; //callsite
-
-    //    PrintDebug("Writing Function: fn_data=%p, size=%d\n", 
-    //       (void *)&tmp_fn, (uint_t)sizeof(struct instrumented_func));    
-    v3_ringbuf_write(func_ring, (uchar_t *)&tmp_fn, sizeof(struct instrumented_func));
+       tmp_fn.time = now - last; // current tsc
+       tmp_fn.exiting = 1; //exit to be 0
+       tmp_fn.called_fn = this; //this
+       tmp_fn.calling_fn = callsite; //callsite
+
+       //    PrintDebug("Writing Function: fn_data=%p, size=%d\n", 
+       //       (void *)&tmp_fn, (uint_t)sizeof(struct instrumented_func));    
+       v3_ringbuf_write(func_ring, (uchar_t *)&tmp_fn, sizeof(struct instrumented_func));
     
-    rdtscll(last);
-  }
+       rdtscll(last);
+    }
 }
 
 
 
 static void print_instrumentation() {
 
-  struct instrumented_func tmp_fn;
+    struct instrumented_func tmp_fn;
 
-  //  PrintDebug("Printing Instrumentation\n");
-  while (v3_ringbuf_data_len(func_ring) >= sizeof(struct instrumented_func)) {
+    //  PrintDebug("Printing Instrumentation\n");
+    while (v3_ringbuf_data_len(func_ring) >= sizeof(struct instrumented_func)) {
     
-    v3_ringbuf_read(func_ring, (uchar_t *)&tmp_fn, sizeof(struct instrumented_func)); 
+       v3_ringbuf_read(func_ring, (uchar_t *)&tmp_fn, sizeof(struct instrumented_func)); 
     
-    PrintDebug("CYG_PROF: %d %p %p %p\n", 
-              tmp_fn.exiting, 
-              (void *)(addr_t)(tmp_fn.time), 
-              tmp_fn.called_fn, 
-              tmp_fn.calling_fn);
-  }
+       PrintDebug("CYG_PROF: %d %p %p %p\n", 
+                  tmp_fn.exiting, 
+                  (void *)(addr_t)(tmp_fn.time), 
+                  tmp_fn.called_fn, 
+                  tmp_fn.calling_fn);
+    }
 }