benchmark improved
authorLukas Humbel <none@none>
Thu, 16 Aug 2012 15:42:27 +0000 (17:42 +0200)
committerLukas Humbel <none@none>
Thu, 16 Aug 2012 15:42:27 +0000 (17:42 +0200)
usr/tests/net_tests/nfs_throughput/nfs_cat.c
usr/vmkitmon/pci_vmkitmon_eth.c

index 628b0a8..01c484b 100644 (file)
@@ -29,9 +29,6 @@
 
 #define MOUNT_DIR   "/nfs"
 
-//uint8_t buf[1024 * 1024];
-uint8_t buf[1024 * 128];
-
 // reads the file over nfs
 static int cat(char *path)
 {
@@ -46,23 +43,30 @@ static int cat(char *path)
         return 0;
     }
 
+    struct vfs_fileinfo info;
+    err = vfs_stat(vh, &info);
+    if(err_is_fail(err)){
+       printf("Could not stat file %s\n", path);
+    }
+    printf("Reading %d bytes from %s.\n", (int)info.size, path);
+    void *buf = malloc(info.size);
+    assert(buf);
+
     uint64_t start = rdtsc();
     lwip_benchmark_control(1, BMS_START_REQUEST, 0, 0);
-    do {
-        err = vfs_read(vh, buf, sizeof(buf), &size);
-        if (err_is_fail(err)) {
-            // XXX: Close any files that might be open
-            DEBUG_ERR(err, "error reading file");
-            return 0;
-        }
 
-        filesize += size;
-//      fwrite(buf, 1, size, stdout);
-    } while(size > 0);
+       err = vfs_read(vh, buf, info.size, &size);
+       if (err_is_fail(err)) {
+               // XXX: Close any files that might be open
+               DEBUG_ERR(err, "error reading file");
+               return 0;
+       }
+       assert(info.size == size);
+       filesize += size;
 
     // record stop time
     uint64_t stop = rdtsc();
-    printf("Everythin done\n");
+    printf("Everything done\n");
     lwip_print_interesting_stats();
     double speed = ((filesize/in_seconds(stop - start))/(1024 * 1024));
     if (speed < 50) {
index 2b4ab85..d5ac8cb 100644 (file)
@@ -203,7 +203,7 @@ static void transmit_pending_packets(struct pci_vmkitmon_eth * h){
                 process_received_packet(rx_buffer_ring[receive_bufptr].opaque, cur_tx->len, true);
                 if(*(unsigned char *)hv_addr == 0xaa) {
                     printf("packet %d delivered to barrelfish\n", ++global_packet_in_count);
-                    dumpRegion(hv_addr);
+                    if(0) dumpRegion(hv_addr);
                 }
                 receive_bufptr = (receive_bufptr + 1) % DRIVER_RECEIVE_BUFFERS;
                 --receive_free;