diff --git a/common/utils/threadPool/thread-pool.h b/common/utils/threadPool/thread-pool.h index 6df98e2ba4e02fa10b14fbf821d0712c931466d3..dc2655f7413e3951bb9c7d79cc1fd97ebaa5cead 100644 --- a/common/utils/threadPool/thread-pool.h +++ b/common/utils/threadPool/thread-pool.h @@ -60,10 +60,10 @@ typedef struct notifiedFIFO_elt_s { struct notifiedFIFO_s *reponseFifo; void (*processingFunc)(void *); bool malloced; - OAI_CPUTIME_TYPE creationTime; - OAI_CPUTIME_TYPE startProcessingTime; - OAI_CPUTIME_TYPE endProcessingTime; - OAI_CPUTIME_TYPE returnTime; + oai_cputime_t creationTime; + oai_cputime_t startProcessingTime; + oai_cputime_t endProcessingTime; + oai_cputime_t returnTime; void *msgData; } notifiedFIFO_elt_t; @@ -96,9 +96,12 @@ static inline void *NotifiedFifoData(notifiedFIFO_elt_t *elt) { } static inline void delNotifiedFIFO_elt(notifiedFIFO_elt_t *elt) { - AssertFatal(elt->malloced, "delNotifiedFIFO on something not allocated by newNotifiedFIFO\n"); - elt->malloced=false; - free(elt); + if (elt->malloced) { + elt->malloced = false; + free(elt); + } + /* it is allowed to call delNotifiedFIFO_elt when the memory is managed by + * the caller */ } static inline void initNotifiedFIFO_nothreadSafe(notifiedFIFO_t *nf) { diff --git a/common/utils/time_meas.h b/common/utils/time_meas.h index 81a1a893cd5f9aeae5b0f2cc3360456e610adc17..382dd7455a0e4a5d44146b4c6054c971071d7809 100644 --- a/common/utils/time_meas.h +++ b/common/utils/time_meas.h @@ -36,9 +36,9 @@ extern int opp_enabled; extern double cpu_freq_GHz __attribute__ ((aligned(32)));; // structure to store data to compute cpu measurment #if defined(__x86_64__) || defined(__i386__) - #define OAI_CPUTIME_TYPE long long + typedef long long oai_cputime_t; #elif defined(__arm__) - #define OAI_CPUTIME_TYPE uint32_t + typedef uint32_t oai_cputime_t; #else #error "building on unsupported CPU architecture" #endif @@ -53,17 +53,17 @@ typedef void(*meas_printfunc_t)(const char* format, ...); typedef struct { int msgid; /*!< \brief message id, as defined by TIMESTAT_MSGID_X macros */ int timestat_id; /*!< \brief points to the time_stats_t entry in cpumeas table */ - OAI_CPUTIME_TYPE ts; /*!< \brief time stamp */ + oai_cputime_t ts; /*!< \brief time stamp */ meas_printfunc_t displayFunc; /*!< \brief function to call when DISPLAY message is received*/ } time_stats_msg_t; struct notifiedFIFO_elt_s; typedef struct time_stats { - OAI_CPUTIME_TYPE in; /*!< \brief time at measure starting point */ - OAI_CPUTIME_TYPE diff; /*!< \brief average difference between time at starting point and time at endpoint*/ - OAI_CPUTIME_TYPE p_time; /*!< \brief absolute process duration */ - OAI_CPUTIME_TYPE diff_square; /*!< \brief process duration square */ - OAI_CPUTIME_TYPE max; /*!< \brief maximum difference between time at starting point and time at endpoint*/ + oai_cputime_t in; /*!< \brief time at measure starting point */ + oai_cputime_t diff; /*!< \brief average difference between time at starting point and time at endpoint*/ + oai_cputime_t p_time; /*!< \brief absolute process duration */ + oai_cputime_t diff_square; /*!< \brief process duration square */ + oai_cputime_t max; /*!< \brief maximum difference between time at starting point and time at endpoint*/ int trials; /*!< \brief number of start point - end point iterations */ int meas_flag; /*!< \brief 1: stop_meas not called (consecutive calls of start_meas) */ char *meas_name; /*!< \brief name to use when printing the measure (not used for PHY simulators)*/ diff --git a/executables/nr-gnb.c b/executables/nr-gnb.c index 9f3f2e36bf4c91ce481000a10f1211feed83d63b..fa0c3a1f63a15e40fe9b3c0db9fec46fc7faba24 100644 --- a/executables/nr-gnb.c +++ b/executables/nr-gnb.c @@ -423,7 +423,7 @@ void init_gNB_Tpool(int inst) { s_offset += 3; } if (getenv("noThreads")) strcpy(pool, "n"); - initTpool(pool, gNB->threadPool, true); + initTpool(pool, gNB->threadPool, cpumeas(CPUMEAS_GETSTATE)); // ULSCH decoder result FIFO gNB->respDecode = (notifiedFIFO_t*) malloc(sizeof(notifiedFIFO_t)); initNotifiedFIFO(gNB->respDecode);