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
c7d63de1
Commit
c7d63de1
authored
May 01, 2020
by
Joanne Hugé
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add CPU affinity
parent
059bcc69
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
2 deletions
+8
-2
clock-res/src/clockres.c
clock-res/src/clockres.c
+8
-2
No files found.
clock-res/src/clockres.c
View file @
c7d63de1
...
@@ -46,17 +46,24 @@ static inline uint64_t min(uint64_t a, uint64_t b);
...
@@ -46,17 +46,24 @@ static inline uint64_t min(uint64_t a, uint64_t b);
static
void
*
timerthread
(
void
*
p
)
{
static
void
*
timerthread
(
void
*
p
)
{
struct
timespec
previous
,
current
;
struct
timespec
previous
,
current
;
struct
sched_param
priority
;
struct
sched_param
priority
;
cpu_set_t
mask
;
uint64_t
diff
;
uint64_t
diff
;
char
time_measured_string
[
255
];
char
time_measured_string
[
255
];
thread_param_t
*
param
=
(
thread_param_t
*
)
p
;
thread_param_t
*
param
=
(
thread_param_t
*
)
p
;
thread_stat_t
*
stat
=
&
param
->
stat
;
thread_stat_t
*
stat
=
&
param
->
stat
;
// Set thread priority
priority
.
sched_priority
=
param
->
priority
;
priority
.
sched_priority
=
param
->
priority
;
if
(
sched_setscheduler
(
0
,
SCHED_FIFO
,
&
priority
))
if
(
sched_setscheduler
(
0
,
SCHED_FIFO
,
&
priority
))
error
(
EXIT_FAILURE
,
errno
,
"Couldn't set priority"
);
error
(
EXIT_FAILURE
,
errno
,
"Couldn't set priority"
);
// Set thread CPU affinity
CPU_ZERO
(
&
mask
);
CPU_SET
(
1
,
&
mask
);
if
(
pthread_setaffinity_np
(
0
,
sizeof
(
mask
),
&
mask
)
==
-
1
)
printf
(
"Could not set CPU affinity to CPU #1
\n
"
);
stat
->
max_res
=
0
;
stat
->
max_res
=
0
;
stat
->
min_res
=
UINT64_MAX
;
stat
->
min_res
=
UINT64_MAX
;
...
@@ -71,7 +78,6 @@ static void *timerthread(void *p) {
...
@@ -71,7 +78,6 @@ static void *timerthread(void *p) {
diff
=
calcdiff_ns
(
current
,
previous
);
diff
=
calcdiff_ns
(
current
,
previous
);
if
(
param
->
enable_tracing
&&
(
diff
>
param
->
latency_threshold
))
{
if
(
param
->
enable_tracing
&&
(
diff
>
param
->
latency_threshold
))
{
sprintf
(
time_measured_string
,
"Diff measured: %"
PRIu64
"
\n
"
,
diff
);
sprintf
(
time_measured_string
,
"Diff measured: %"
PRIu64
"
\n
"
,
diff
);
tracemark
(
time_measured_string
);
tracemark
(
time_measured_string
);
tracing
(
0
);
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