Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
O
OpenXG-RAN
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
lizhongxiao
OpenXG-RAN
Commits
211b6fea
Commit
211b6fea
authored
Feb 25, 2022
by
Robert Schmidt
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use (portable) rdtsc_oai() in tpool
parent
c6ac88ff
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
35 additions
and
40 deletions
+35
-40
common/utils/telnetsrv/telnetsrv_measurements.c
common/utils/telnetsrv/telnetsrv_measurements.c
+1
-0
common/utils/threadPool/measurement_display.c
common/utils/threadPool/measurement_display.c
+2
-2
common/utils/threadPool/thread-pool.c
common/utils/threadPool/thread-pool.c
+2
-2
common/utils/threadPool/thread-pool.h
common/utils/threadPool/thread-pool.h
+12
-18
common/utils/time_meas.c
common/utils/time_meas.c
+9
-0
common/utils/time_meas.h
common/utils/time_meas.h
+9
-18
No files found.
common/utils/telnetsrv/telnetsrv_measurements.c
View file @
211b6fea
...
...
@@ -51,6 +51,7 @@
static
char
*
grouptypes
[]
=
{
"ltestats"
,
"cpustats"
};
static
double
cpufreq
;
extern
notifiedFIFO_t
measur_fifo
;
#define TELNET_NUM_MEASURTYPES (sizeof(grouptypes)/sizeof(char *))
#define HDR "---------------------------------"
...
...
common/utils/threadPool/measurement_display.c
View file @
211b6fea
...
...
@@ -43,9 +43,9 @@ int main(int argc, char *argv[]) {
exit
(
1
);
}
uint64_t
deb
=
rdtsc
();
uint64_t
deb
=
rdtsc
_oai
();
usleep
(
100000
);
cpuCyclesMicroSec
=
(
rdtsc
()
-
deb
)
/
100000
;
cpuCyclesMicroSec
=
(
rdtsc
_oai
()
-
deb
)
/
100000
;
printf
(
"Cycles per µs: %lu
\n
"
,
cpuCyclesMicroSec
);
printf
(
"Key"
SEP
"delay to process"
SEP
"processing time"
SEP
"delay to be read answer
\n
"
);
notifiedFIFO_elt_t
doneRequest
;
...
...
common/utils/threadPool/thread-pool.c
View file @
211b6fea
...
...
@@ -72,11 +72,11 @@ void *one_thread(void *arg) {
do
{
notifiedFIFO_elt_t
*
elt
=
pullNotifiedFifoRemember
(
&
tp
->
incomingFifo
,
myThread
);
if
(
tp
->
measurePerf
)
elt
->
startProcessingTime
=
rdtsc
();
if
(
tp
->
measurePerf
)
elt
->
startProcessingTime
=
rdtsc
_oai
();
elt
->
processingFunc
(
NotifiedFifoData
(
elt
));
if
(
tp
->
measurePerf
)
elt
->
endProcessingTime
=
rdtsc
();
if
(
tp
->
measurePerf
)
elt
->
endProcessingTime
=
rdtsc
_oai
();
if
(
elt
->
reponseFifo
)
{
// Check if the job is still alive, else it has been aborted
...
...
common/utils/threadPool/thread-pool.h
View file @
211b6fea
...
...
@@ -29,15 +29,9 @@
#include <pthread.h>
#include <unistd.h>
#include <sys/syscall.h>
#include <assertions.h>
#include <common/utils/system.h>
//#include <stdatomic.h>
static
__inline__
uint64_t
rdtsc
(
void
)
{
uint32_t
a
,
d
;
__asm__
volatile
(
"rdtsc"
:
"=a"
(
a
),
"=d"
(
d
));
return
(((
uint64_t
)
d
)
<<
32
)
|
((
uint64_t
)
a
);
}
#include "assertions.h"
#include "common/utils/time_meas.h"
#include "common/utils/system.h"
#ifdef DEBUG
#define THREADINIT PTHREAD_ERRORCHECK_MUTEX_INITIALIZER_NP
...
...
@@ -66,10 +60,10 @@ typedef struct notifiedFIFO_elt_s {
struct
notifiedFIFO_s
*
reponseFifo
;
void
(
*
processingFunc
)(
void
*
);
bool
malloced
;
uint64_t
creationTime
;
uint64_t
startProcessingTime
;
uint64_t
endProcessingTime
;
uint64_t
returnTime
;
OAI_CPUTIME_TYPE
creationTime
;
OAI_CPUTIME_TYPE
startProcessingTime
;
OAI_CPUTIME_TYPE
endProcessingTime
;
OAI_CPUTIME_TYPE
returnTime
;
void
*
msgData
;
}
notifiedFIFO_elt_t
;
...
...
@@ -225,18 +219,18 @@ typedef struct thread_pool {
}
tpool_t
;
static
inline
void
pushTpool
(
tpool_t
*
t
,
notifiedFIFO_elt_t
*
msg
)
{
if
(
t
->
measurePerf
)
msg
->
creationTime
=
rdtsc
();
if
(
t
->
measurePerf
)
msg
->
creationTime
=
rdtsc
_oai
();
if
(
t
->
activated
)
pushNotifiedFIFO
(
&
t
->
incomingFifo
,
msg
);
else
{
if
(
t
->
measurePerf
)
msg
->
startProcessingTime
=
rdtsc
();
msg
->
startProcessingTime
=
rdtsc
_oai
();
msg
->
processingFunc
(
NotifiedFifoData
(
msg
));
if
(
t
->
measurePerf
)
msg
->
endProcessingTime
=
rdtsc
();
msg
->
endProcessingTime
=
rdtsc
_oai
();
if
(
msg
->
reponseFifo
)
pushNotifiedFIFO
(
msg
->
reponseFifo
,
msg
);
...
...
@@ -247,7 +241,7 @@ static inline notifiedFIFO_elt_t *pullTpool(notifiedFIFO_t *responseFifo, tpool_
notifiedFIFO_elt_t
*
msg
=
pullNotifiedFIFO
(
responseFifo
);
AssertFatal
(
t
->
traceFd
,
"Thread pool used while not initialized"
);
if
(
t
->
measurePerf
)
msg
->
returnTime
=
rdtsc
();
msg
->
returnTime
=
rdtsc
_oai
();
if
(
t
->
traceFd
>
0
)
if
(
write
(
t
->
traceFd
,
msg
,
sizeof
(
*
msg
)));
...
...
@@ -262,7 +256,7 @@ static inline notifiedFIFO_elt_t *tryPullTpool(notifiedFIFO_t *responseFifo, tpo
return
NULL
;
if
(
t
->
measurePerf
)
msg
->
returnTime
=
rdtsc
();
msg
->
returnTime
=
rdtsc
_oai
();
if
(
t
->
traceFd
)
if
(
write
(
t
->
traceFd
,
msg
,
sizeof
(
*
msg
)));
...
...
common/utils/time_meas.c
View file @
211b6fea
...
...
@@ -267,6 +267,15 @@ void init_meas(void) {
AssertFatal
(
rt
==
0
,
"couldn't create cpu measurment thread: %s
\n
"
,
strerror
(
errno
));
}
void
send_meas
(
time_stats_t
*
ts
,
int
msgid
)
{
if
(
MEASURE_ENABLED
(
ts
)
)
{
ts
->
tstatptr
->
timestat_id
=
ts
->
meas_index
;
ts
->
tstatptr
->
msgid
=
msgid
;
ts
->
tstatptr
->
ts
=
rdtsc_oai
();
pushNotifiedFIFO
(
&
measur_fifo
,
ts
->
tpoolmsg
);
}
}
void
end_meas
(
void
)
{
notifiedFIFO_elt_t
*
nfe
=
newNotifiedFIFO_elt
(
sizeof
(
time_stats_msg_t
),
0
,
NULL
,
NULL
);
time_stats_msg_t
*
msg
=
(
time_stats_msg_t
*
)
NotifiedFifoData
(
nfe
);
...
...
common/utils/time_meas.h
View file @
211b6fea
...
...
@@ -31,7 +31,6 @@
#include <pthread.h>
#include <linux/kernel.h>
#include <linux/types.h>
#include "common/utils/threadPool/thread-pool.h"
// global var to enable openair performance profiler
extern
int
opp_enabled
;
extern
double
cpu_freq_GHz
__attribute__
((
aligned
(
32
)));;
...
...
@@ -58,8 +57,8 @@ typedef struct {
meas_printfunc_t
displayFunc
;
/*!< \brief function to call when DISPLAY message is received*/
}
time_stats_msg_t
;
typedef
struct
{
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 */
...
...
@@ -70,7 +69,7 @@ typedef struct {
char
*
meas_name
;
/*!< \brief name to use when printing the measure (not used for PHY simulators)*/
int
meas_index
;
/*!< \brief index of this measure in the measure array (not used for PHY simulators)*/
int
meas_enabled
;
/*!< \brief per measure enablement flag. send_meas tests this flag, unused today in start_meas and stop_meas*/
notifiedFIFO_elt_t
*
tpoolmsg
;
/*!< \brief message pushed to the cpu measurment queue to report a measure START or STOP */
struct
notifiedFIFO_elt_s
*
tpoolmsg
;
/*!< \brief message pushed to the cpu measurment queue to report a measure START or STOP */
time_stats_msg_t
*
tstatptr
;
/*!< \brief pointer to the time_stats_msg_t data in the tpoolmsg, stored here for perf considerations*/
}
time_stats_t
;
#define MEASURE_ENABLED(X) (X->meas_enabled)
...
...
@@ -189,25 +188,17 @@ static inline void merge_meas(time_stats_t *dst_ts, time_stats_t *src_ts)
dst_ts
->
max
=
src_ts
->
max
;
}
extern
notifiedFIFO_t
measur_fifo
;
#define CPUMEASUR_SECTION "cpumeasur"
#define CPUMEASUR_PARAMS_DESC { \
{"max_cpumeasur", "Max number of cpu measur entries", 0, uptr:&max_cpumeasur, defintval:100, TYPE_UINT, 0},\
}
void
init_meas
(
void
);
time_stats_t
*
register_meas
(
char
*
name
);
#define START_MEAS(X) send_meas(X, TIMESTAT_MSGID_START)
#define STOP_MEAS(X) send_meas(X, TIMESTAT_MSGID_STOP)
static
inline
void
send_meas
(
time_stats_t
*
ts
,
int
msgid
)
{
if
(
MEASURE_ENABLED
(
ts
)
)
{
ts
->
tstatptr
->
timestat_id
=
ts
->
meas_index
;
ts
->
tstatptr
->
msgid
=
msgid
;
ts
->
tstatptr
->
ts
=
rdtsc_oai
();
pushNotifiedFIFO
(
&
measur_fifo
,
ts
->
tpoolmsg
);
}
}
void
end_meas
(
void
);
void
init_meas
(
void
);
time_stats_t
*
register_meas
(
char
*
name
);
#define START_MEAS(X) send_meas(X, TIMESTAT_MSGID_START)
#define STOP_MEAS(X) send_meas(X, TIMESTAT_MSGID_STOP)
void
send_meas
(
time_stats_t
*
ts
,
int
msgid
);
void
end_meas
(
void
);
#endif
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment