Skip to content
Snippets Groups Projects
Commit bd14a580 authored by Andreas Gattringer's avatar Andreas Gattringer
Browse files

debug generation update

parent f459bfa6
Branches
No related tags found
No related merge requests found
......@@ -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;
}
......
......@@ -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
......@@ -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);
......
......@@ -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
};
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment