⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 rticore.c

📁 基于linux环境的ns2多机并行仿真补丁
💻 C
📖 第 1 页 / 共 5 页
字号:
  }    switch (CRTI.PendingRequest)  {    case NER:     {      /* if LBTS far enough, we don't need to start an LBTS*/      /* LBTS is far enough if                   1- if LBTS GT PendingTime        2- or if LBTS EQ PendingTime and LBTSQual >= PendingQual        3- or if LBTS GT TSOMin        4- or if LBTS EQ TSOMin and ( LBTSQual = EXCL                                        or TargetLA GT ZERO                                        or (LBTS - Current GT Lookahead ) )                */      if (TM_GT(CRTI.LBTS, CRTI.PendingTime) ||            ( TM_EQ(CRTI.LBTS, CRTI.PendingTime) && (CRTI.LBTSQual >= CRTI.PendingQual) ) ||            ( TM_GT(CRTI.LBTS,RTI_TSOMin()) )  ||            ( TM_EQ(CRTI.LBTS, RTI_TSOMin() ) &&                (   (CRTI.LBTSQual == TM_TIME_QUAL_EXCL)  ||                ( TM_GT(CRTI.TargetLA, TM_ZERO) )  ||                ( TM_GT(TM_Sub(CRTI.LBTS,CRTI.CurrentTime), CRTI.LookAhead)) )            )          )         {             /* requested time is easily satisfiable, since it is <= LBTS */        }        else         {            status = core_StartLBTS();        }    }    break;    case TAR:     {      /* if LBTS far enough, we don't need to start an LBTS*/      /* LBTS is not far enough if                   1- if LBTS GT PendingTime        2- else if LBTS EQ PendingTime and LBTSQual >= PendingQual                */              if (TM_GT(CRTI.LBTS, CRTI.PendingTime) ||            ( TM_EQ(CRTI.LBTS, CRTI.PendingTime) && (CRTI.LBTSQual >= CRTI.PendingQual) ) )      {             /* requested time is easily satisfiable  */      }      else       {              status = core_StartLBTS();      }            }    break;    case FQR:     {        /* if LBTS far enough, we don't need to start an LBTS*/        /* LBTS is not far enough if                1- if LBTS GT PendingTime            2- else if LBTS EQ PendingTime and LBTSQual >= PendingQual                  */          if (TM_GE(CRTI.LBTS, CRTI.PendingTime) )        {            /* requested time is easily satisfiable  */        }        else        {            status = core_StartLBTS();         }              }    break;    case NERA:     {        if (1 || CRTI.debug > 0)        {            fprintf(cd,"Core_Request: Fatal Error! Invalid RequestType\n");            fflush(cd);        }        exit(1);            }    break;    case TARA:     {        if (1 || CRTI.debug > 0)        {            fprintf(cd,"Core_Request: Fatal Error! Invalid RequestType\n");            fflush(cd);        }        exit(1);            }    break;    default:     {        if (1 || CRTI.debug > 0)        {            fprintf(cd,"Core_Request: Fatal Error! Invalid RequestType\n");            fflush(cd);        }        exit(1);      }    break;  }      if (needToStartLBTS)               status = core_StartLBTS();      return(status); }/*----------------------------------------------------------------------------*/fdkErrorCode Core_NextEventRequest (TM_Time RequestTime){  fdkErrorCode status = fdkSUCCEEDED;  TM_Time candidateTime;  /*KALYAN: See note in Core_tick() about this optimization*/  if( CRTI.optimize.ner_fastpath &&      TM_LT( RequestTime, RTI_TSOMin() ) &&      TM_LT( RequestTime, CRTI.LBTS ) )  {     CRTI.PendingRequest = NER;     CRTI.PendingTime = RequestTime;     CRTI.PendingQual = TM_TIME_QUAL_INCL;     return fdkSUCCEEDED;  }   if (CRTI.debug > 1)  {     fprintf(cd,"\nRTICore: NER RequestTime = %12.6f\n", RequestTime);     fflush(cd);  }    /* error if request is already pending */  status = Core_EnsureRequestNotPending();  if ( status != fdkSUCCEEDED) return (status);  /* error if time has already passed*/  status = Core_EnsureRequestTimeNotPast(RequestTime);  if( status != fdkSUCCEEDED ) return (status);     CRTI.PendingRequest = NER;    CRTI.PendingTime = RequestTime;    status = Core_SetPendingQual();  if (status != fdkSUCCEEDED )  {      CRTI.PendingRequest = NO_REQ;       return (status);  }  /* if LBTS not far enough, we need to start an LBTS*/  /* LBTS is far enough if           1- if LBTS GT min(PendingTime, TSOMin)    2- or if LBTS EQ PendingTime and LBTSQual >= PendingQual    3- or if LBTS GT TSOMin    4- or if LBTS EQ TSOMin and ( LBTSQual = EXCL                                    or TargetLA GT ZERO                                    or (LBTS - Current GT Lookahead ) )            */  candidateTime = TM_Min(CRTI.PendingTime,RTI_TSOMin());  if (TM_LT(CRTI.LBTS, candidateTime))    /* LBTS is clearly not far enough */  {      status = core_StartLBTS();  }  else if (TM_EQ(CRTI.LBTS,candidateTime) && (CRTI.LBTSQual == TM_TIME_QUAL_INCL) )  {    if (TM_isZero(CRTI.LookAhead) ||    /*if my lookahead is already zero */        ( TM_isZero(CRTI.TargetLA)           && TM_GE(candidateTime,TM_Add(CRTI.CurrentTime,CRTI.LookAhead))))    {      status = core_StartLBTS();    }  }  else   {    /*  LBTS is definitely far enough to permit a TAG*/  }  if (status != fdkSUCCEEDED)  {    CRTI.PendingRequest = NO_REQ;  }  return(status); }/*----------------------------------------------------------------------------*/fdkErrorCode Core_NextEventRequestAvailable (TM_Time RequestTime){  fdkErrorCode status = fdkSUCCEEDED;  TM_Time candidateTime;   if (CRTI.debug > 1)  {     fprintf(cd,"\nRTICore: NERA RequestTime = %12.6f\n", RequestTime);     fflush(cd);  }    /* error if request is already pending */  status = Core_EnsureRequestNotPending();  if ( status != fdkSUCCEEDED) return (status);  /* error if time has already passed*/  status = Core_EnsureRequestTimeNotPast(RequestTime);  if( status != fdkSUCCEEDED ) return (status);     CRTI.PendingRequest = NERA;    CRTI.PendingTime = RequestTime;    status = Core_SetPendingQual();  if (status != fdkSUCCEEDED )  {      CRTI.PendingRequest = NO_REQ;       return (status);  }  /* if LBTS not far enough, we need to start an LBTS*/  /* LBTS is far enough if           1- if LBTS GT min(PendingTime, TSOMin)    2- or if LBTS EQ PendingTime and LBTSQual >= PendingQual    3- or if LBTS GT TSOMin    4- or if LBTS EQ TSOMin and ( LBTSQual = EXCL                                    or TargetLA GT ZERO                                    or (LBTS - Current GT Lookahead ) )            */  candidateTime = TM_Min(CRTI.PendingTime,RTI_TSOMin());  if (TM_LT(CRTI.LBTS, candidateTime))    /* LBTS is clearly not far enough */  {      status = core_StartLBTS();  }  if (status != fdkSUCCEEDED)  {    CRTI.PendingRequest = NO_REQ;  }  return(status); }/*----------------------------------------------------------------------------*/fdkErrorCode Core_TimeAdvanceRequest (TM_Time RequestTime){  fdkErrorCode status = fdkSUCCEEDED;  if (CRTI.debug > 1)  {     fprintf(cd,"\nRTICore: TAR AdvanceTime = %12.6f\n",RequestTime);     fflush(cd);  }  /* error if request is already pending */  status = Core_EnsureRequestNotPending();  if ( status != fdkSUCCEEDED) return (status);  /* error if time has already passed*/  status = Core_EnsureRequestTimeNotPast(RequestTime);  if( status != fdkSUCCEEDED ) return (status);    CRTI.PendingRequest = TAR;    CRTI.PendingTime = RequestTime;    status = Core_SetPendingQual();  if (status != fdkSUCCEEDED )  {      CRTI.PendingRequest = NO_REQ;      return (status);  }  /* if LBTS far enough, we don't need to start an LBTS*/  /* LBTS is not far enough if           1- if LBTS GT PendingTime    2- else if LBTS EQ PendingTime and LBTSQual >= PendingQual            */      if (TM_LT(CRTI.LBTS, CRTI.PendingTime) ||        ( TM_EQ(CRTI.LBTS, CRTI.PendingTime) && (CRTI.LBTSQual < CRTI.PendingQual) ) )  {          status = core_StartLBTS();  }  else   {         /* requested time is easily satisfiable  */  }  if (status != fdkSUCCEEDED)  {    CRTI.PendingRequest = NO_REQ;  }  return(status); }/*----------------------------------------------------------------------------*/fdkErrorCode Core_TimeAdvanceRequestAvailable (TM_Time RequestTime){  fdkErrorCode status = fdkSUCCEEDED;  if (CRTI.debug > 1)  {     fprintf(cd,"\nRTICore: TARA AdvanceTime = %12.6f\n",RequestTime);     fflush(cd);  }  /* error if request is already pending */  status = Core_EnsureRequestNotPending();  if ( status != fdkSUCCEEDED) return (status);  /* error if time has already passed*/  status = Core_EnsureRequestTimeNotPast(RequestTime);  if( status != fdkSUCCEEDED ) return (status);    CRTI.PendingRequest = TARA;    CRTI.PendingTime = RequestTime;    status = Core_SetPendingQual();  if (status != fdkSUCCEEDED )  {      CRTI.PendingRequest = NO_REQ;      return (status);  }  /* if LBTS far enough, we don't need to start an LBTS*/  /* LBTS is not far enough if           1- if LBTS GT PendingTime    2- else if LBTS EQ PendingTime and LBTSQual >= PendingQual            */      if (TM_LT(CRTI.LBTS, CRTI.PendingTime) )  {          status = core_StartLBTS();  }  else   {         /* requested time is easily satisfiable  */  }  if (status != fdkSUCCEEDED)  {    CRTI.PendingRequest = NO_REQ;  }  return(status); }/*----------------------------------------------------------------------------*/fdkErrorCode Core_FlushQueueRequest(TM_Time RequestTime){    fdkErrorCode status = fdkSUCCEEDED;    TM_Time Candidate_Time, Candidate_LA;    if (CRTI.debug > 1)    {        fprintf(cd,"Core_FlushQueueRequest: ");        fprintf(cd,"setting FlushQueueTime to %16.10f\n",RequestTime);        fflush(cd);    }        /* error if request is already pending */    if (Core_EnsureRequestNotPending() == fdkTMPENDING)        return(fdkTMPENDING);    /* error if time has already passed*/    if( Core_EnsureRequestTimeNotPast(RequestTime) == fdkTIMEPASSED )        return(fdkTIMEPASSED);    CRTI.PendingRequest = FQR;    CRTI.PendingTime = RequestTime;    CRTI.MinDelivered = RequestTime;        status = Core_SetPendingQual();    if (status != fdkSUCCEEDED )    {        CRTI.PendingRequest = NO_REQ;         return (status);    }    /*    * Not certain that this is according to the spec.     *     * here we are determining if we need to start an LBTS in order    * to make progress.  We only start one when we need to.    *      */    Candidate_Time = TM_Min(CRTI.PendingTime,                    TM_Min(RTI_TSOMin(), core_MinRetract()));    Candidate_LA = TM_Max(CRTI.TargetLA,         TM_Sub(CRTI.LookAhead, TM_Sub(Candidate_Time, CRTI.CurrentTime)));    if ( TM_LT(CRTI.LBTS,Candidate_Time) ||       ( TM_EQ(Candidate_Time,CRTI.CurrentTime ) && (CRTI.CurrentQual == TM_TIME_QUAL_INCL) ) )      {        status = core_StartLBTS();    }    if (status != fdkSUCCEEDED)    {        if (1 || CRTI.debug > 1)        {            fprintf(cd,"Core_FlushQueueRequest: core_StartLBTS() did not succeed!\n");            fflush(cd);        }    }        return(status);   }

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -