From cb67f269f8a6dfad6c92deeca348e9da42146479 Mon Sep 17 00:00:00 2001 From: jzhou Date: Wed, 10 Mar 2010 18:49:38 +0000 Subject: [PATCH] mark before adding zero-overhead linux mode --- Robust/src/Runtime/multicoreruntime.h | 10 ++++++++-- Robust/src/Runtime/multicoretask.c | 6 ++++-- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/Robust/src/Runtime/multicoreruntime.h b/Robust/src/Runtime/multicoreruntime.h index ccfd0624..63b324a9 100644 --- a/Robust/src/Runtime/multicoreruntime.h +++ b/Robust/src/Runtime/multicoreruntime.h @@ -9,6 +9,9 @@ // global variables // /////////////////////////////////////////////////////////////// +// record the starting time +unsigned long long bamboo_start_time; + // data structures for msgs #define BAMBOO_OUT_BUF_LENGTH 3000 #define BAMBOO_MSG_BUF_LENGTH 3000 @@ -16,11 +19,12 @@ int msgdata[BAMBOO_MSG_BUF_LENGTH]; int msgdataindex; int msgdatalast; int msglength; +volatile bool msgdatafull; int outmsgdata[BAMBOO_OUT_BUF_LENGTH]; int outmsgindex; int outmsglast; int outmsgleft; -bool isMsgHanging; +volatile bool isMsgHanging; volatile bool isMsgSending; #define MSG_INDEXINC_I() \ @@ -39,7 +43,9 @@ volatile bool isMsgSending; #define MSG_REMAINSIZE_I(s) \ if(msgdataindex < msgdatalast) { \ (*(int*)s) = msgdatalast - msgdataindex; \ - } else { \ + } else if((msgdataindex == msgdatalast) && (!msgdatafull)) {\ + (*(int*)s) = 0; \ + } else { \ (*(int*)s) = (BAMBOO_MSG_BUF_LENGTH) - msgdataindex + msgdatalast; \ } diff --git a/Robust/src/Runtime/multicoretask.c b/Robust/src/Runtime/multicoretask.c index c43766b2..f1af2a03 100644 --- a/Robust/src/Runtime/multicoretask.c +++ b/Robust/src/Runtime/multicoretask.c @@ -92,6 +92,7 @@ void initruntimedata() { msgdataindex = 0; msgdatalast = 0; msglength = BAMBOO_MSG_BUF_LENGTH; + msgdatafull = false; for(i = 0; i < BAMBOO_OUT_BUF_LENGTH; ++i) { outmsgdata[i] = -1; } @@ -403,9 +404,9 @@ void checkCoreStatus() { #endif #ifdef USEIO - totalexetime = BAMBOO_GET_EXE_TIME(); + totalexetime = BAMBOO_GET_EXE_TIME() - bamboo_start_time; #else - BAMBOO_DEBUGPRINT(BAMBOO_GET_EXE_TIME()); + BAMBOO_DEBUGPRINT(BAMBOO_GET_EXE_TIME() - bamboo_start_time); BAMBOO_DEBUGPRINT_REG(total_num_t6); // TODO for test BAMBOO_DEBUGPRINT(0xbbbbbbbb); #endif @@ -2393,6 +2394,7 @@ processmsg: MSGTYPE type; type = msgdata[msgdataindex]; //[0] MSG_INDEXINC_I(); + msgdatafull = false; // TODO //tprintf("msg type: %x\n", type); switch(type) { -- 2.34.1