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
02829888
Commit
02829888
authored
Apr 30, 2020
by
Joanne Hugé
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Making tracing optional
parent
a7d3c837
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
21 additions
and
6 deletions
+21
-6
clock-res/src/clockres.c
clock-res/src/clockres.c
+21
-6
No files found.
clock-res/src/clockres.c
View file @
02829888
...
...
@@ -24,6 +24,7 @@ typedef struct thread_stat {
typedef
struct
thread_param
{
int
priority
;
int
max_cycles
;
int
enable_tracing
;
uint64_t
interval
;
uint64_t
latency_threshold
;
thread_stat_t
stat
;
...
...
@@ -31,6 +32,7 @@ typedef struct thread_param {
typedef
struct
main_param
{
int
refresh_rate
;
int
enable_tracing
;
}
main_param_t
;
static
void
process_options
(
int
argc
,
char
*
argv
[],
thread_param_t
*
param
,
...
...
@@ -60,17 +62,21 @@ static void *timerthread(void *p) {
for
(
stat
->
nb_cycles
=
0
;;
stat
->
nb_cycles
++
)
{
if
(
param
->
max_cycles
&&
(
stat
->
nb_cycles
>=
param
->
max_cycles
))
break
;
tracing
(
1
);
if
(
param
->
enable_tracing
)
tracing
(
1
);
clock_gettime
(
CLOCK_ID
,
&
previous
);
clock_gettime
(
CLOCK_ID
,
&
current
);
tracing
(
0
);
if
(
param
->
enable_tracing
)
tracing
(
0
);
diff
=
calcdiff_ns
(
current
,
previous
);
stat
->
max_res
=
max
(
stat
->
max_res
,
diff
);
stat
->
min_res
=
min
(
stat
->
min_res
,
diff
);
if
(
diff
>
param
->
latency_threshold
)
break
;
if
(
param
->
enable_tracing
&&
(
diff
>
param
->
latency_threshold
)
)
break
;
usleep
(
param
->
interval
);
}
...
...
@@ -89,10 +95,16 @@ int main(int argc, char *argv[]) {
param
.
interval
=
1000
;
param
.
max_cycles
=
100000
;
param
.
priority
=
99
;
param
.
enable_tracing
=
0
;
main_param
.
enable_tracing
=
0
;
main_param
.
refresh_rate
=
10000
;
process_options
(
argc
,
argv
,
&
param
,
&
main_param
);
setup_tracer
();
if
(
main_param
.
enable_tracing
)
{
param
.
enable_tracing
=
1
;
setup_tracer
();
}
usleep
(
10000
);
...
...
@@ -108,7 +120,7 @@ int main(int argc, char *argv[]) {
param
.
stat
.
nb_cycles
);
if
(
param
.
max_cycles
==
param
.
stat
.
nb_cycles
)
break
;
if
(
param
.
stat
.
max_res
>=
param
.
latency_threshold
)
break
;
if
(
main_param
.
enable_tracing
&&
(
param
.
stat
.
max_res
>=
param
.
latency_threshold
)
)
break
;
}
tracing
(
0
);
...
...
@@ -119,7 +131,7 @@ int main(int argc, char *argv[]) {
static
void
process_options
(
int
argc
,
char
*
argv
[],
thread_param_t
*
param
,
main_param_t
*
main_param
)
{
for
(;;)
{
int
c
=
getopt
(
argc
,
argv
,
"l:p:i:r:b:"
);
int
c
=
getopt
(
argc
,
argv
,
"l:p:i:r:b:
f:
"
);
if
(
c
==
-
1
)
break
;
...
...
@@ -139,6 +151,9 @@ static void process_options(int argc, char *argv[], thread_param_t *param,
case
'r'
:
main_param
->
refresh_rate
=
atoi
(
optarg
);
break
;
case
'f'
:
main_param
->
enable_tracing
=
1
;
break
;
default:
exit
(
EXIT_FAILURE
);
break
;
...
...
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