Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
T
tsn-measures
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
nexedi
tsn-measures
Commits
2a0883a3
Commit
2a0883a3
authored
May 04, 2020
by
Joanne Hugé
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use absolute time to wake up the real time thread at a regular interval
parent
37b601b6
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
2 deletions
+11
-2
clock-res/src/clockres.c
clock-res/src/clockres.c
+11
-2
No files found.
clock-res/src/clockres.c
View file @
2a0883a3
...
@@ -46,7 +46,7 @@ static inline uint64_t min(uint64_t a, uint64_t b);
...
@@ -46,7 +46,7 @@ static inline uint64_t min(uint64_t a, uint64_t b);
// Real-time thread
// Real-time thread
static
void
*
timerthread
(
void
*
p
)
{
static
void
*
timerthread
(
void
*
p
)
{
struct
timespec
previous
,
current
;
struct
timespec
previous
,
current
,
next
;
struct
sched_param
priority
;
struct
sched_param
priority
;
cpu_set_t
mask
;
cpu_set_t
mask
;
uint64_t
diff
;
uint64_t
diff
;
...
@@ -74,6 +74,8 @@ static void *timerthread(void *p) {
...
@@ -74,6 +74,8 @@ static void *timerthread(void *p) {
// Start tracing
// Start tracing
if
(
param
->
enable_tracing
)
tracing
(
1
);
if
(
param
->
enable_tracing
)
tracing
(
1
);
clock_gettime
(
CLOCK_ID
,
&
next
);
// Measurement loop
// Measurement loop
for
(
stat
->
nb_cycles
=
0
;;
stat
->
nb_cycles
++
)
{
for
(
stat
->
nb_cycles
=
0
;;
stat
->
nb_cycles
++
)
{
if
(
param
->
max_cycles
&&
(
stat
->
nb_cycles
>=
param
->
max_cycles
))
break
;
if
(
param
->
max_cycles
&&
(
stat
->
nb_cycles
>=
param
->
max_cycles
))
break
;
...
@@ -101,7 +103,14 @@ static void *timerthread(void *p) {
...
@@ -101,7 +103,14 @@ static void *timerthread(void *p) {
stat
->
max_res
=
max
(
stat
->
max_res
,
diff
);
stat
->
max_res
=
max
(
stat
->
max_res
,
diff
);
stat
->
min_res
=
min
(
stat
->
min_res
,
diff
);
stat
->
min_res
=
min
(
stat
->
min_res
,
diff
);
usleep
(
param
->
interval
);
next
.
tv_nsec
+=
10000000
;
if
(
next
.
tv_nsec
>=
NSEC_PER_SEC
)
{
next
.
tv_sec
+=
1
;
next
.
tv_nsec
-=
NSEC_PER_SEC
;
}
clock_nanosleep
(
CLOCK_ID
,
TIMER_ABSTIME
,
&
next
,
NULL
);
}
}
if
(
param
->
enable_tracing
)
tracing
(
0
);
if
(
param
->
enable_tracing
)
tracing
(
0
);
...
...
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