diff --git a/src/modules/butterflies/butterflies_actions.c b/src/modules/butterflies/butterflies_actions.c index cd3b954c5e7839930e9bc6609df8f961877fa080..2dc79f57ab1a70ca957990e69d448aecaf19fe12 100644 --- a/src/modules/butterflies/butterflies_actions.c +++ b/src/modules/butterflies/butterflies_actions.c @@ -328,6 +328,10 @@ enum action_status bf_action_generation_update(struct cats_grid *grid, struct ca int module_id = CATS_MODULE_ID; struct grid_data_butterflies *data = grid->grid_modules[module_id].module_data; struct conf_data_butterflies *module_conf = CATS_MODULE_DATA; + const int64_t egg_cells_id = module_conf->stat_ids[BF_CELLS_WITH_EGGS]; + const int64_t egg_cells_removed_id = module_conf->stat_ids[BF_CELLS_WITH_EGGS]; + grid->stats.custom_stats[egg_cells_id] = 0; + grid->stats.custom_stats[egg_cells_removed_id] = 0; data->generation_current = module_conf->generations_max; log_message(LOG_IMPORTANT, "resetting generation to %d", module_conf->generations_max); @@ -338,6 +342,12 @@ enum action_status bf_action_generation_update(struct cats_grid *grid, struct ca } threaded_action(&bf_area_generation_update, grid, conf, TS_DEFAULT); + + int64_t cells_with_eggs = grid->stats.custom_stats[egg_cells_id]; + int64_t cells_with_eggs_removed = grid->stats.custom_stats[egg_cells_removed_id]; + log_message(LOG_INFO, "%ld cells with eggs left, %ld cells with eggs removed", cells_with_eggs, cells_with_eggs_removed); + grid->stats.custom_stats[egg_cells_id] = 0; + grid->stats.custom_stats[egg_cells_removed_id] = 0; return ACTION_RUN; } diff --git a/src/modules/butterflies/butterflies_generations.c b/src/modules/butterflies/butterflies_generations.c index f2343180a9380917455d24c3e08103688b4a1f28..b046bceae97003bf978fbbb420c023e1917ac1e4 100644 --- a/src/modules/butterflies/butterflies_generations.c +++ b/src/modules/butterflies/butterflies_generations.c @@ -21,9 +21,11 @@ void bf_area_generation_update(struct cats_grid *grid, struct cats_thread_info * const cats_dt_coord start_col = ts->area.start_col; const cats_dt_coord end_col = ts->area.end_col; + struct statistics *stats = &ts->stats[grid->id]; const cats_dt_rates ot = grid->param.OT; - + const int64_t egg_cells_id = module_conf->stat_ids[BF_CELLS_WITH_EGGS]; + const int64_t egg_cells_removed_id = module_conf->stat_ids[BF_CELLS_WITH_EGGS]; int64_t cells_with_eggs = 0; int64_t cells_with_eggs_removed = 0; @@ -64,5 +66,7 @@ void bf_area_generation_update(struct cats_grid *grid, struct cats_thread_info * } } - log_message(LOG_INFO, "thread %d: %ld cells with eggs removed, %ld cells with eggs left", ts->id, cells_with_eggs_removed, cells_with_eggs); + stats->custom_stats[egg_cells_id] += cells_with_eggs; + stats->custom_stats[egg_cells_removed_id] += cells_with_eggs_removed; + } \ No newline at end of file diff --git a/src/modules/butterflies/butterflies_stats.c b/src/modules/butterflies/butterflies_stats.c index 030633ffb66e07f007c1ef7cb8c01c1035b6fd73..ce77d1b323e528ab4be50762f728ead21d26d4b1 100644 --- a/src/modules/butterflies/butterflies_stats.c +++ b/src/modules/butterflies/butterflies_stats.c @@ -40,6 +40,11 @@ const char *bf_get_stats_field_name(enum butterfly_stats which) case BF_STAT_MAX: break; + case BF_CELLS_WITH_EGGS: + return "cells with eggs"; + case BF_CELLS_WITH_EGGS_REMOVED: + return "removed cells with eggs"; + } log_message(LOG_ERROR, "unknown butterfly stats name with id %d", which); diff --git a/src/modules/butterflies/butterflies_stats.h b/src/modules/butterflies/butterflies_stats.h index 2a198419603c92e8b090e793a83cba3b1e4e0366..09223497053184c8829e09838263aa2431d1a5f8 100644 --- a/src/modules/butterflies/butterflies_stats.h +++ b/src/modules/butterflies/butterflies_stats.h @@ -18,6 +18,8 @@ enum butterfly_stats { BF_POPULATED_AT_DISPERSAL, BF_RANDOM_WALK_COUNT, BF_RANDOM_WALK_STEP_COUNT, + BF_CELLS_WITH_EGGS, + BF_CELLS_WITH_EGGS_REMOVED, BF_STAT_MAX };