use CmiSyncSendAndFree to reuse messages
authorGengbin Zheng <gzheng@illinois.edu>
Thu, 4 Aug 2011 19:41:19 +0000 (12:41 -0700)
committerGengbin Zheng <gzheng@illinois.edu>
Thu, 4 Aug 2011 19:41:19 +0000 (12:41 -0700)
tests/converse/commbench/pingpong.c

index f70e323de7aeb23f84fac5b8d75641b2762736fc..7ec90ea70b259686ed57d1f5f7afd36f630b29a1 100644 (file)
@@ -12,9 +12,10 @@ static struct testdata {
 } sizes[] = {
   {16,      256},
   {256,     256},
+  {2048,    64},
   {4096,    64},
-  {65536,   4},
-  {1048576, 1},
+  {65536,   10},
+  {1048576, 10},
   {-1,      -1},
 };
 
@@ -197,18 +198,17 @@ static void startNextIter(Message *msg)
     pva(nextIter) = -1;
     CmiSetHandler(&m, pva(sizeHandler));
     CmiSyncSend(CmiMyPe(), sizeof(EmptyMsg), &m);
+    CmiFree(msg);
   } else {
     CmiSetHandler(msg, pva(bounceHandler));
-    CmiSyncSend(pva(nextNbr), sizeof(Message)+sizes[msg->idx].size, msg);
+    CmiSyncSendAndFree(pva(nextNbr), sizeof(Message)+sizes[msg->idx].size, msg);
   }
-  CmiFree(msg);
 }
 
 static void bounceMessage(Message *msg)
 {
   CmiSetHandler(msg, pva(iterHandler));
-  CmiSyncSend(msg->srcpe, sizeof(Message)+sizes[msg->idx].size, msg);
-  CmiFree(msg);
+  CmiSyncSendAndFree(msg->srcpe, sizeof(Message)+sizes[msg->idx].size, msg);
 }
 
 void pingpong_init(void)