From cbdfc1c9332f2aae05bb1cfdc83084d28a2b028f Mon Sep 17 00:00:00 2001 From: frtabu Date: Fri, 8 Jan 2021 01:22:23 +0100 Subject: [PATCH] add tpool thread name parameter, fi init --- common/utils/threadPool/thread-pool.c | 7 ++++--- common/utils/threadPool/thread-pool.h | 4 ++-- executables/nr-uesoftmodem.c | 4 ++-- openair1/PHY/NR_UE_TRANSPORT/nr_dlsch_decoding.c | 12 ++++++------ 4 files changed, 14 insertions(+), 13 deletions(-) diff --git a/common/utils/threadPool/thread-pool.c b/common/utils/threadPool/thread-pool.c index e1446f15d7..77729ae7a7 100644 --- a/common/utils/threadPool/thread-pool.c +++ b/common/utils/threadPool/thread-pool.c @@ -92,7 +92,7 @@ void *one_thread(void *arg) { } while (true); } -void initTpool(char *params,tpool_t *pool, bool performanceMeas) { +void initNamedTpool(char *params,tpool_t *pool, bool performanceMeas, char *name) { memset(pool,0,sizeof(*pool)); char *measr=getenv("threadPoolMeasurements"); pool->measurePerf=performanceMeas; @@ -116,6 +116,7 @@ void initTpool(char *params,tpool_t *pool, bool performanceMeas) { pool->restrictRNTI=false; curptr=strtok_r(parms_cpy,",",&saveptr); struct one_thread * ptr; + char *tname = (name == NULL ? "Tpool" : name); while ( curptr!=NULL ) { int c=toupper(curptr[0]); @@ -129,7 +130,7 @@ void initTpool(char *params,tpool_t *pool, bool performanceMeas) { break; default: - ptr=pool->allthreads; + ptr=pool->allthreads; pool->allthreads=(struct one_thread *)malloc(sizeof(struct one_thread)); pool->allthreads->next=ptr; printf("create a thread for core %d\n", atoi(curptr)); @@ -138,7 +139,7 @@ void initTpool(char *params,tpool_t *pool, bool performanceMeas) { pool->allthreads->pool=pool; //Configure the thread scheduler policy for Linux // set the thread name for debugging - sprintf(pool->allthreads->name,"Tpool_%d",pool->allthreads->coreID); + sprintf(pool->allthreads->name,"%s%d_%d",tname,pool->nbThreads,pool->allthreads->coreID); threadCreate(&pool->allthreads->threadID, one_thread, (void *)pool->allthreads, pool->allthreads->name, pool->allthreads->coreID, OAI_PRIORITY_RT); pool->nbThreads++; diff --git a/common/utils/threadPool/thread-pool.h b/common/utils/threadPool/thread-pool.h index bd55203c7f..5db1a5e34e 100644 --- a/common/utils/threadPool/thread-pool.h +++ b/common/utils/threadPool/thread-pool.h @@ -294,6 +294,6 @@ static inline int abortTpool(tpool_t *t, uint64_t key) { mutexunlock(nf->lockF); return nbRemoved; } -void initTpool(char *params,tpool_t *pool, bool performanceMeas); - +void initNamedTpool(char *params,tpool_t *pool, bool performanceMeas, char *name); +#define initTpool(PARAMPTR,TPOOLPTR, MEASURFLAG) initNamedTpool(PARAMPTR,TPOOLPTR, MEASURFLAG, NULL) #endif diff --git a/executables/nr-uesoftmodem.c b/executables/nr-uesoftmodem.c index 9a8c4cb296..43793fc1ee 100644 --- a/executables/nr-uesoftmodem.c +++ b/executables/nr-uesoftmodem.c @@ -214,9 +214,9 @@ nrUE_params_t *get_nrUE_params(void) { } /* initialie thread pools used for NRUE processing paralleliation */ void init_tpools(uint8_t nun_dlsch_threads) { - char *params=calloc(1,(RX_NB_TH*2)+1); + char *params=calloc(1,(RX_NB_TH*3)+1); for (int i=0; i