Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
SWIFT
SWIFTsim
Commits
ff45a6ac
Commit
ff45a6ac
authored
Feb 26, 2017
by
Matthieu Schaller
Browse files
Drift before dumping statistics.
parent
a1f2133c
Changes
2
Hide whitespace changes
Inline
Side-by-side
src/engine.c
View file @
ff45a6ac
...
...
@@ -2827,6 +2827,8 @@ void engine_print_stats(struct engine *e) {
const
ticks
tic
=
getticks
();
e
->
save_stats
=
0
;
struct
statistics
stats
;
stats_init
(
&
stats
);
...
...
@@ -3065,12 +3067,6 @@ void engine_step(struct engine *e) {
/* Print the number of active tasks ? */
if
(
e
->
verbose
)
engine_print_task_counts
(
e
);
/* Save some statistics ? */
if
(
e
->
time
-
e
->
timeLastStatistics
>=
e
->
deltaTimeStatistics
)
{
engine_print_stats
(
e
);
e
->
timeLastStatistics
+=
e
->
deltaTimeStatistics
;
}
/* Start all the tasks. */
TIMER_TIC
;
engine_launch
(
e
,
e
->
nr_threads
);
...
...
@@ -3085,13 +3081,18 @@ void engine_step(struct engine *e) {
e
->
forcerebuild
=
buff
;
#endif
/* Save some statistics ? */
if
(
e
->
time
-
e
->
timeLastStatistics
>=
e
->
deltaTimeStatistics
)
{
e
->
save_stats
=
1
;
}
/* Do we want a snapshot? */
if
(
e
->
ti_end_min
>=
e
->
ti_nextSnapshot
&&
e
->
ti_nextSnapshot
>
0
)
e
->
dump_snapshot
=
1
;
/* Drift everybody (i.e. what has not yet been drifted) */
/* to the current time */
if
(
e
->
dump_snapshot
||
e
->
forcerebuild
||
e
->
forcerepart
)
if
(
e
->
dump_snapshot
||
e
->
forcerebuild
||
e
->
forcerepart
||
e
->
save_stats
)
engine_drift_all
(
e
);
/* Write a snapshot ? */
...
...
@@ -3104,6 +3105,16 @@ void engine_step(struct engine *e) {
engine_compute_next_snapshot_time
(
e
);
}
/* Save some statistics */
if
(
e
->
save_stats
)
{
/* Dump */
engine_print_stats
(
e
);
/* and move on */
e
->
timeLastStatistics
+=
e
->
deltaTimeStatistics
;
}
/* Recover the (integer) end of the next time-step */
engine_collect_timestep
(
e
);
...
...
@@ -3530,6 +3541,7 @@ void engine_init(struct engine *e, struct space *s,
e
->
forcerepart
=
0
;
e
->
reparttype
=
reparttype
;
e
->
dump_snapshot
=
0
;
e
->
save_stats
=
0
;
e
->
links
=
NULL
;
e
->
nr_links
=
0
;
e
->
timeBegin
=
parser_get_param_double
(
params
,
"TimeIntegration:time_begin"
);
...
...
src/engine.h
View file @
ff45a6ac
...
...
@@ -191,6 +191,9 @@ struct engine {
int
forcerepart
;
enum
repartition_type
reparttype
;
/* Need to dump some statistics ? */
int
save_stats
;
/* Need to dump a snapshot ? */
int
dump_snapshot
;
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new 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