Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
O
OpenXG UE
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
Michael Black
OpenXG UE
Commits
68eb3bd4
Commit
68eb3bd4
authored
Apr 29, 2021
by
frtabu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
enhance cpu measurments to better support parallelism via using a message queue.
parent
7348fdaa
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
52 additions
and
2 deletions
+52
-2
openair1/PHY/TOOLS/time_meas.c
openair1/PHY/TOOLS/time_meas.c
+38
-1
openair1/PHY/TOOLS/time_meas.h
openair1/PHY/TOOLS/time_meas.h
+14
-1
No files found.
openair1/PHY/TOOLS/time_meas.c
View file @
68eb3bd4
...
@@ -23,12 +23,20 @@
...
@@ -23,12 +23,20 @@
#include "time_meas.h"
#include "time_meas.h"
#include <math.h>
#include <math.h>
#include <unistd.h>
#include <unistd.h>
#include <string.h>
#include "assertions.h"
#ifndef PHYSIM
#include "common/config/config_userapi.h"
#endif
// global var for openair performance profiler
// global var for openair performance profiler
int
opp_enabled
=
0
;
int
opp_enabled
=
0
;
double
cpu_freq_GHz
__attribute__
((
aligned
(
32
)));
double
cpu_freq_GHz
__attribute__
((
aligned
(
32
)));
double
cpu_freq_GHz
__attribute__
((
aligned
(
32
)))
=
0
.
0
;
double
cpu_freq_GHz
__attribute__
((
aligned
(
32
)))
=
0
.
0
;
#ifndef PHYSIM
static
uint32_t
max_cpumeasur
;
time_stats_t
**
measur_table
;
#endif
double
get_cpu_freq_GHz
(
void
)
double
get_cpu_freq_GHz
(
void
)
{
{
if
(
cpu_freq_GHz
<
1
)
{
if
(
cpu_freq_GHz
<
1
)
{
...
@@ -133,3 +141,32 @@ double get_time_meas_us(time_stats_t *ts)
...
@@ -133,3 +141,32 @@ double get_time_meas_us(time_stats_t *ts)
return
0
;
return
0
;
}
}
#ifndef PHYSIM
int
register_meas
(
char
*
name
,
time_stats_t
*
dst_ts
)
{
for
(
int
i
=
0
;
i
<
max_cpumeasur
;
i
++
)
{
if
(
measur_table
[
i
]
==
NULL
)
{
measur_table
[
i
]
=
(
time_stats_t
*
)
malloc
(
sizeof
(
time_stats_t
));
memset
(
measur_table
[
i
]
,
0
,
sizeof
(
time_stats_t
));
measur_table
[
i
]
->
meas_name
=
strdup
(
name
);
measur_table
[
i
]
->
meas_index
=
i
;
return
i
;
}
}
return
-
1
;
}
void
init_meas
(
void
)
{
paramdef_t
cpumeasur_params
[]
=
CPUMEASUR_PARAMS_DESC
;
int
numparams
=
sizeof
(
cpumeasur_params
)
/
sizeof
(
paramdef_t
);
int
ret
=
config_get
(
cpumeasur_params
,
numparams
,
CPUMEASUR_SECTION
);
AssertFatal
(
ret
>=
0
,
"cpumeasur configuration couldn't be performed"
);
measur_table
=
calloc
(
max_cpumeasur
,
sizeof
(
time_stats_t
*
));
AssertFatal
(
measur_table
!=
NULL
,
"couldn't allocate %u cpu measurements entries
\n
"
,
max_cpumeasur
);
}
#endif
openair1/PHY/TOOLS/time_meas.h
View file @
68eb3bd4
...
@@ -34,7 +34,7 @@
...
@@ -34,7 +34,7 @@
// global var to enable openair performance profiler
// global var to enable openair performance profiler
extern
int
opp_enabled
;
extern
int
opp_enabled
;
extern
double
cpu_freq_GHz
__attribute__
((
aligned
(
32
)));;
extern
double
cpu_freq_GHz
__attribute__
((
aligned
(
32
)));;
// structure to store data to compute cpu measurment
#if defined(__x86_64__) || defined(__i386__)
#if defined(__x86_64__) || defined(__i386__)
typedef
struct
{
typedef
struct
{
long
long
in
;
long
long
in
;
...
@@ -44,6 +44,8 @@ typedef struct {
...
@@ -44,6 +44,8 @@ typedef struct {
long
long
max
;
long
long
max
;
int
trials
;
int
trials
;
int
meas_flag
;
int
meas_flag
;
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)*/
}
time_stats_t
;
}
time_stats_t
;
#elif defined(__arm__)
#elif defined(__arm__)
typedef
struct
{
typedef
struct
{
...
@@ -137,4 +139,15 @@ static inline void copy_meas(time_stats_t *dst_ts,time_stats_t *src_ts) {
...
@@ -137,4 +139,15 @@ static inline void copy_meas(time_stats_t *dst_ts,time_stats_t *src_ts) {
dst_ts
->
max
=
src_ts
->
max
;
dst_ts
->
max
=
src_ts
->
max
;
}
}
}
}
#ifndef PHYSIM
#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
);
int
register_meas
(
char
*
name
,
time_stats_t
*
ts
);
#endif //ifndef PHYSIM
#endif
#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