integrate the timer values of the icc ping example in the payload of the mailbox header

=> remove some static variables
This commit is contained in:
Stefan Lankes 2011-07-02 03:40:08 -07:00
parent 5cd3d7557a
commit e5c0e2b037
2 changed files with 9 additions and 9 deletions

View file

@ -212,13 +212,12 @@ int icc_halt(void)
return 0;
}
#define MAIL_MSG_SIZE 20
uint64_t timer;
int icc_mail_ping( void )
{
uint32_t flags;
int remote_rank = (my_ue+1)%2;
uint8_t payload[iRCCE_MAIL_HEADER_PAYLOAD];
uint64_t* timer = (uint64_t*) payload;
if (my_ue)
return -1;
@ -229,10 +228,10 @@ int icc_mail_ping( void )
flags = irq_nested_disable();
// start timer
timer = rdtsc();
*timer = rdtsc();
/* send ping request */
iRCCE_mail_send(0, ICC_TAG_PINGREQUEST, 0, NULL, remote_rank);
iRCCE_mail_send(sizeof(uint64_t), ICC_TAG_PINGREQUEST, 0, payload, remote_rank);
NOP8;
icc_send_irq(remote_rank);
@ -250,6 +249,7 @@ void icc_mail_check(void)
{
iRCCE_MAIL_HEADER* header = NULL;
int res;
uint64_t timer;
//char* recv_buffer;
// empty mailbox and interpret headers
@ -257,12 +257,12 @@ void icc_mail_check(void)
switch(header->tag)
{
case ICC_TAG_PINGREQUEST:
iRCCE_mail_send( 0, ICC_TAG_PINGRESPONSE, 0, NULL, header->source );
iRCCE_mail_send( header->size, ICC_TAG_PINGRESPONSE, 0, header->payload, header->source );
NOP8;
icc_send_irq( header->source );
break;
case ICC_TAG_PINGRESPONSE:
timer = rdtsc() - timer;
timer = rdtsc() - *((uint64_t*) header->payload);
kprintf( "Response received in %d ticks!\n", timer );
break;
default:

View file

@ -91,8 +91,8 @@ int STDCALL mail_ping(void* arg) {
int i;
for(i=0; i<20; i++) {
icc_mail_ping();
//icc_halt();
if (BUILTIN_EXPECT(icc_mail_ping(), 0))
return -1;
udelay(500000);
}