added benchmark
authorLukas Humbel <none@none>
Fri, 31 Aug 2012 14:42:17 +0000 (16:42 +0200)
committerLukas Humbel <none@none>
Fri, 31 Aug 2012 14:42:17 +0000 (16:42 +0200)
include/arch/x86/bench/bench_arch.h
include/barrelfish/net_constants.h
lib/bench/arch/x86/bench_arch.c
lib/lwip/src/core/pbuf.c
usr/tests/net_tests/nfs_throughput/nfs_cat.c
usr/vmkitmon/Hakefile
usr/vmkitmon/pci_ethernet.c
usr/vmkitmon/pci_vmkitmon_eth.c
usr/vmkitmon/vmkitmon.c

index 0e2a429..6721fe7 100644 (file)
@@ -36,5 +36,6 @@ static inline cycles_t bench_tsc(void)
 }
 
 uint64_t bench_tsc_to_ms(cycles_t tsc);
+uint64_t bench_tsc_to_us(cycles_t tsc);
 
 #endif // ARCH_X86_64_BARRELFISH_BENCH_H
index 28dbb9a..9e81256 100644 (file)
@@ -129,13 +129,13 @@ enum buffer_memory_types {
 
 /// Number of PBUF structs available
 #ifndef MEMP_NUM_PBUF
-#define MEMP_NUM_PBUF         (4*16384)
+#define MEMP_NUM_PBUF         (16384)
 //#define MEMP_NUM_PBUF           4096
 #endif // MEMP_NUM_PBUF
 
 /// Number of PBUF buffers available
 #ifndef PBUF_POOL_SIZE
-#define PBUF_POOL_SIZE         (4*16384)
+#define PBUF_POOL_SIZE         (16384)
 //#define PBUF_POOL_SIZE          4096
 #endif // PBUF_POOL_SIZE
 
index 30a35e7..fe0d77a 100644 (file)
@@ -42,3 +42,7 @@ uint64_t bench_tsc_to_ms(cycles_t tsc)
 {
     return tsc / tscperms;
 }
+
+uint64_t bench_tsc_to_us(cycles_t tsc){
+       return tsc / (tscperms/1000);
+}
index 0725fc2..b1bf0a3 100644 (file)
@@ -145,7 +145,6 @@ static struct pbuf *alloc_pool_pbuf(void)
         if (payload != NULL) {
             memp_free(MEMP_PBUF_POOL, payload);
         }
-        //*((uint32_t *)0) = 1;
         USER_PANIC("alloc_pool_pbuf: failed!");
         return NULL;
     }
index 01c484b..ea3fe6c 100644 (file)
@@ -80,7 +80,7 @@ static int cat(char *path)
     if (err_is_fail(err)) {
             DEBUG_ERR(err, "in vfs_close");
     }
-
+    free(buf);
     return filesize;
 }
 
@@ -107,9 +107,15 @@ int main(int argc, char**argv)
     assert(err_is_ok(err));
     printf("mount done\n");
 
-    printf("reading file [%s]\n", argv[2]);
+    printf("reading file 1. time [%s]\n", argv[2]);
     cat(argv[2]);
-    printf("Benchmark done.\n");
+    printf("receive 1 done.\n");
+
+    /*
+    printf("reading file 2. time [%s]\n", argv[2]);
+       cat(argv[2]);
+       printf("receive 2 done.\n"); */
+       printf("All done.\n");
 
     struct waitset *ws = get_default_waitset();
     while (1) {
index 7f3742f..fdfab1b 100644 (file)
                       cFiles = [ "vmkitmon.c", "guest.c", "realmode.c",
                                  "hdd.c", "keyboard.c", "console.c",
                                  "apic.c", "lpc.c", "pc16550d.c", "pci.c",
-                                                                "pci_host.c", "pci_hostbridge.c", "pci_ethernet.c", "pci_vmkitmon_eth.c" ],
+                                                                "pci_host.c", "pci_hostbridge.c", "pci_ethernet.c", "pci_vmkitmon_eth.c", "benchmark.c" ],
                                         flounderBindings = [ "net_queue_manager",
                                 "net_soft_filters" ],
                       mackerelDevices = [ "amd_vmcb", "lpc_timer", "e1000",
                                           "pc16550d_mem", "pci_hdr0_mem" ],
-                      addLibraries = libDeps [ "spawndomain", "netQmng", "x86emu", "vfs", "pci"],
+                      addLibraries = libDeps [ "spawndomain", "netQmng", "x86emu", "vfs", "pci", "bench"],
                       -- addLibraries = libDeps [ "spawndomain", "netQmng"],
                       architectures = ["x86_64"]
                     }
index ecba527..778ee9c 100644 (file)
@@ -17,6 +17,7 @@
 #include "pci.h"
 #include "pci_devices.h"
 #include "pci_ethernet.h"
+#include "benchmark.h"
 #include <pci/pci.h>
 #include <arch/x86/barrelfish/iocap_arch.h>
 #include <dev/e10k_dev.h>
@@ -199,6 +200,7 @@ static void mem_write(struct pci_device *dev, uint32_t addr, int bar, uint32_t v
                                *ptr =  1;
                        }
                }
+               record_packet_transmit_to_net();
        }
        if(addr == RDT0_OFFSET){
                //Inspect the contents of the RECEIVE descriptors
@@ -268,6 +270,7 @@ static void mem_read(struct pci_device *dev, uint32_t addr, int bar, uint32_t *v
 // static uint32_t last_rdh = 600;
 static void pci_ethernet_interrupt_handler(void *arg)
 {
+       record_packet_receive_from_net();
     struct pci_device *dev = (struct pci_device *)arg;
     lpc_pic_assert_irq(dev->lpc, dev->irq);
 }
index 2f48da4..b71c824 100644 (file)
@@ -4,6 +4,7 @@
 #include "pci_vmkitmon_eth.h"
 #include "guest.h"
 #include "string.h"
+#include "benchmark.h"
 #include <pci/devids.h>
 #include <net_queue_manager/net_queue_manager.h>
 #include <if/net_queue_manager_defs.h>
@@ -108,12 +109,13 @@ static void dumpRegion(uint8_t *start){
 }
 #endif
 
-//TODO
 static errval_t transmit_pbuf_list_fn(struct driver_buffer *buffers, size_t size, void *opaque) {
        struct pci_vmkitmon_eth *h = the_pci_vmkitmon_eth->state;
        int i;
        uint64_t paddr;
 
+       record_packet_receive_from_bf();
+
     VMKITMON_ETH_DEBUG("transmit_pbuf_list_fn, no_pbufs: 0x%lx\n", size);
 
        struct pci_vmkitmon_eth_rxdesc * first_rx = (struct pci_vmkitmon_eth_rxdesc *) guest_to_host( h->mmio_register[PCI_VMKITMON_ETH_RXDESC_ADR] );
@@ -191,13 +193,15 @@ static void transmit_pending_packets(struct pci_vmkitmon_eth * h){
                struct pci_vmkitmon_eth_txdesc * cur_tx =first_tx + i;
                if(cur_tx->len != 0 && cur_tx->addr != 0){
                        void *hv_addr = (void *)guest_to_host(cur_tx->addr);
-                       VMKITMON_ETH_DEBUG("Sending packet at txdesc %d, addr: 0x%x, len: 0x%x\n", i, cur_tx->addr, cur_tx->len);
+                       //VMKITMON_ETH_DEBUG("Sending packet at txdesc %d, addr: 0x%x, len: 0x%x\n", i, cur_tx->addr, cur_tx->len);
+                       //printf("Sending packet at txdesc %d, addr: 0x%x, len: 0x%x\n", i, cur_tx->addr, cur_tx->len);
             
             if(receive_free == 0) {
                 VMKITMON_ETH_DEBUG("Could not deliver packet, no receive buffer available. Drop packet.\n");
                 printf("Could not deliver packet, no receive buffer available. Drop packet.\n");
             } else {
                 memcpy(rx_buffer_ring[receive_bufptr].vaddr, hv_addr, cur_tx->len);
+                record_packet_transmit_to_bf();
                 process_received_packet(rx_buffer_ring[receive_bufptr].opaque, cur_tx->len, true);
                 /*
                 if(*(unsigned char *)hv_addr == 0xaa) {
index 67e3d7b..9843941 100644 (file)
@@ -21,6 +21,7 @@
 #include <vfs/vfs.h>
 #include <timer/timer.h>
 #include "realmode.h"
+#include <bench/bench.h>
 #include "pci/devids.h"
 #include <pci/pci.h>
 
@@ -70,6 +71,7 @@ int main (int argc, char *argv[])
     const char *imagefile = IMAGEFILE;
 
     vfs_init();
+    bench_init();
     
     err = timer_init();
     if (err_is_fail(err)) {