benchmark

This commit is contained in:
Carl-Benedikt Krüger 2011-07-05 14:16:40 +02:00
parent 820b4e3a18
commit 8e51493181

View file

@ -48,6 +48,7 @@ extern HANDLE hProc;
#define DEBUGPRINTF(x,...) kprintf(x,##__VA_ARGS__)
#include <metalsvm/semaphore.h>
#include <metalsvm/spinlock.h>
#include <asm/RCCE_lib.h>
#include <asm/RCCE.h>
@ -186,7 +187,8 @@ typedef struct mm_rx_buffer
uint8_t iv_intr;
sem_t lock;
// sem_t lock;
spinlock_t lock;
// uint32_t timestamp[MMNIF_RX_QUEUELEN];
// uint32_t bitmap[MMNIF_RX_QUEUELEN];
@ -543,7 +545,8 @@ __inline void mmnif_lock_rx_hdr(int dest_ip)
#else
if(disable_locking) return;
mm_rx_buffer_t* hdr = (char*)mpb_start_address + ( dest_ip -1 ) * mpb_size;
sem_wait(&hdr->lock);
// sem_wait(&hdr->lock);
spinlock_lock(&hdr->lock);
#endif
}
/* mmnif_unlock_rx_hdr(): unlock the header
@ -559,7 +562,7 @@ __inline void mmnif_unlock_rx_hdr(int dest_ip)
#else
if(disable_locking) return;
mm_rx_buffer_t* hdr = (char*)mpb_start_address + ( dest_ip -1 ) * mpb_size;
sem_post(&hdr->lock);
spinlock_unlock(&hdr->lock);
#endif
}
@ -874,7 +877,8 @@ err_t mmnif_init(struct netif* netif)
/* init the lock for the hdr
*/
sem_init(&mmnif->rx_buff->lock,1);
// sem_init(&mmnif->rx_buff->lock,1);
spinlock_init(&mmnif->rx_buff->lock);
/* init the sems for communication art
*/
@ -1188,6 +1192,7 @@ int mmnif_poll(void* e)
{
while (!mmnif->rx_buff->queued)
{
mmnif->stats.pll_empty++;
if (mmnif->stats.pll_empty >= MMNIF_POLL_BUDGET)
{
/* enable interrupts and suspend polling
@ -1200,11 +1205,9 @@ int mmnif_poll(void* e)
DEBUGPRINTF("mmnif_poll(): heuristical interrupts enabled\n");
#endif
sem_wait(&mmnif->com_poll);
mmnif->stats.pll_empty = 1;
}
mmnif->stats.pll_empty++;
}
}
mmnif->stats.pll_empty--;
mmnif->stats.pll_empty=0;
mmnif_rx(mmnif_dev);
if (instant_process)