new mail_pingpong test
This commit is contained in:
parent
bc28b300e0
commit
f4443e6761
3 changed files with 48 additions and 35 deletions
|
@ -39,6 +39,11 @@ typedef struct {
|
|||
|
||||
extern bootinfo_t* bootinfo;
|
||||
|
||||
enum icc_mail_requests {
|
||||
PING_REQ=1,
|
||||
PING_RESP,
|
||||
};
|
||||
|
||||
/*
|
||||
#define ICC_TYPE_IP (1 << 0)
|
||||
#define ICC_TYPE_SVM (1 << 1)
|
||||
|
|
|
@ -210,46 +210,59 @@ int icc_halt(void)
|
|||
return 0;
|
||||
}
|
||||
|
||||
#define MAIL_MSG_SIZE 20
|
||||
#define ROUNDS 1000
|
||||
|
||||
int icc_mail_ping( void )
|
||||
{
|
||||
uint32_t flags;
|
||||
uint64_t timer;
|
||||
int remote_rank = (my_ue+1)%2;
|
||||
int rem_rank = (my_ue+1)%2;
|
||||
int i;
|
||||
iRCCE_MAIL_HEADER* recv_header = NULL;
|
||||
|
||||
char send_buffer[MAIL_MSG_SIZE];
|
||||
int length = MAIL_MSG_SIZE;
|
||||
|
||||
if( my_ue ) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
kprintf( "Hello from mail_ping ... \n" );
|
||||
|
||||
// disable interrupts
|
||||
flags = irq_nested_disable();
|
||||
|
||||
// start timer
|
||||
timer = rdtsc();
|
||||
|
||||
// start anylength send
|
||||
iRCCE_isend( send_buffer, -length, remote_rank, NULL );
|
||||
|
||||
// wait for response
|
||||
iRCCE_MAIL_HEADER* mail;
|
||||
do {
|
||||
iRCCE_mail_recv( &mail );
|
||||
} while( !mail );
|
||||
|
||||
// stop timer
|
||||
for( i=0; i<ROUNDS+1; ++i ) {
|
||||
if( my_rank == 0 ) {
|
||||
/* send ping request */
|
||||
iRCCE_mail_send(0, PING_REQ, 0, NULL, rem_rank);
|
||||
|
||||
/* wait for response */
|
||||
do {
|
||||
iRCCE_mail_recv(&recv_header);
|
||||
} while( !recv_header );
|
||||
|
||||
/* release mail */
|
||||
iRCCE_mail_release(&recv_header);
|
||||
}
|
||||
else {
|
||||
/* wait for request */
|
||||
do {
|
||||
iRCCE_mail_recv(&recv_header);
|
||||
} while( (!recv_header));
|
||||
|
||||
/* send response */
|
||||
iRCCE_mail_send(0, PING_RESP, 0, NULL, rem_rank);
|
||||
|
||||
/* release mail */
|
||||
iRCCE_mail_release(&recv_header);
|
||||
}
|
||||
|
||||
/* start timer in first round */
|
||||
if( i == 0 ) timer = rdtsc();
|
||||
|
||||
|
||||
}
|
||||
|
||||
/* stop timer */
|
||||
timer = rdtsc() - timer;
|
||||
|
||||
if( mail->tag == 2 ) {
|
||||
kprintf( "Response received in %d ticks!\n", timer );
|
||||
}
|
||||
else {
|
||||
kprintf( "Response didn't arrive!\n" );
|
||||
if( my_rank == 0 ) {
|
||||
printf( "mail_pingpong needs in average %.3f µsec (%d ticks)!\n",
|
||||
timer/(2.0*ROUNDS*533), timer/(2*ROUNDS) );
|
||||
}
|
||||
|
||||
irq_nested_enable(flags);
|
||||
|
|
|
@ -88,13 +88,8 @@ static int STDCALL foo(void* arg)
|
|||
|
||||
#ifdef CONFIG_ROCKCREEK
|
||||
int STDCALL mail_ping(void* arg) {
|
||||
int i;
|
||||
|
||||
for(i=0; i<20; i++) {
|
||||
icc_mail_ping();
|
||||
//icc_halt();
|
||||
udelay(500000);
|
||||
}
|
||||
icc_halt();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -135,9 +130,9 @@ int test_init(void)
|
|||
//create_kernel_task(NULL, join_test, NULL);
|
||||
//create_kernel_task(NULL, producer, NULL);
|
||||
//create_kernel_task(NULL, consumer, NULL);
|
||||
//create_kernel_task(NULL, mail_ping, NULL);
|
||||
create_kernel_task(NULL, mail_ping, NULL);
|
||||
//create_user_task(NULL, "/bin/hello", argv);
|
||||
create_user_task(NULL, "/bin/tests", argv);
|
||||
//create_user_task(NULL, "/bin/tests", argv);
|
||||
//create_user_task(NULL, "/bin/jacobi", argv);
|
||||
//create_user_task(NULL, "/bin/jacobi", argv);
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue