Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
F
FMC DIO 5ch TTL a
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
6
Issues
6
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Wiki
Wiki
image/svg+xml
Discourse
Discourse
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Projects
FMC DIO 5ch TTL a
Commits
31866040
Commit
31866040
authored
Nov 19, 2020
by
Jorge Machado
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Compute peak to peak statistics
parent
572a47a7
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
12 additions
and
2 deletions
+12
-2
stats-engine-private.h
sw/irq-demo/dep/stats-engine-private.h
+3
-0
stats-engine.c
sw/irq-demo/dep/stats-engine.c
+9
-2
No files found.
sw/irq-demo/dep/stats-engine-private.h
View file @
31866040
...
...
@@ -24,6 +24,7 @@ struct ts_stats {
double
std
;
double
min
;
double
max
;
double
peak_to_peak
;
unsigned
int
ts_per_second
;
unsigned
int
ts_total
;
};
...
...
@@ -62,6 +63,8 @@ static double compute_min(const double *values,
const
unsigned
int
n_values
);
static
double
compute_max
(
const
double
*
values
,
const
unsigned
int
n_values
);
static
double
compute_peak_to_peak
(
const
double
min
,
const
double
max
);
static
double
compute_mean
(
const
double
*
values
,
const
unsigned
int
n_values
);
static
double
compute_stdev
(
const
double
*
values
,
...
...
sw/irq-demo/dep/stats-engine.c
View file @
31866040
...
...
@@ -96,6 +96,7 @@ int run_stats_engine(stats_engine engine, int verbose)
engine
->
stats
.
max
=
compute_max
(
engine
->
diff_ts
,
engine
->
n_ts
);
engine
->
stats
.
mean
=
compute_mean
(
engine
->
diff_ts
,
engine
->
n_ts
);
engine
->
stats
.
std
=
compute_stdev
(
engine
->
diff_ts
,
engine
->
n_ts
,
engine
->
stats
.
mean
);
engine
->
stats
.
peak_to_peak
=
compute_peak_to_peak
(
engine
->
stats
.
min
,
engine
->
stats
.
max
);
count_ts
=
compute_ts_per_second
(
engine
->
usr_ts
[
engine
->
current_ts
].
t
.
tv_sec
,
engine
->
usr_ts
,
engine
->
n_ts
);
if
(
count_ts
!=
-
1
)
...
...
@@ -160,10 +161,11 @@ static void log_stats_engine(stats_engine engine, int verbose)
LOG
(
engine
,
"Iterations: %d"
,
engine
->
n_iter
);
LOG
(
engine
,
"Metrics => Total timestamps: %d, Timestamps per second: %d
\n
"
"max: %f %s, min %f %s
\n
"
"max: %f %s, min %f %s
, peak to peak %f %s
\n
"
"mean: %f %s, stdev: %f %s"
,
engine
->
stats
.
ts_total
,
engine
->
stats
.
ts_per_second
,
engine
->
stats
.
max
,
METRICS_UNIT
,
engine
->
stats
.
min
,
METRICS_UNIT
,
engine
->
stats
.
max
,
METRICS_UNIT
,
engine
->
stats
.
min
,
METRICS_UNIT
,
engine
->
stats
.
peak_to_peak
,
METRICS_UNIT
,
engine
->
stats
.
mean
,
METRICS_UNIT
,
engine
->
stats
.
std
,
METRICS_UNIT
);
LOG
(
engine
,
"
\n
============================================================
\n
"
);
log_clear
(
engine
);
...
...
@@ -265,6 +267,11 @@ static double compute_min(const double *values,
return
min
;
}
static
double
compute_peak_to_peak
(
const
double
min
,
const
double
max
)
{
return
max
-
min
;
}
static
double
compute_max
(
const
double
*
values
,
const
unsigned
int
n_values
)
{
...
...
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