![]() |
The ROme OpTimistic Simulator
2.0.0
A General-Purpose Multithreaded Parallel/Distributed Simulation Platform
|
Statistics module. More...
#include <unistd.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <errno.h>
#include <time.h>
#include <math.h>
#include <sys/stat.h>
#include <sys/types.h>
#include <dirent.h>
#include <arch/thread.h>
#include <arch/memusage.h>
#include <scheduler/process.h>
#include <scheduler/scheduler.h>
#include <gvt/gvt.h>
#include <statistics/statistics.h>
#include <queues/queues.h>
#include <mm/state.h>
#include <mm/mm.h>
#include <core/core.h>
#include <core/init.h>
#include <core/timer.h>
#include <communication/mpi.h>
Go to the source code of this file.
Data Structures | |
struct | _gvt_buffer |
struct | _gvt_buffer::_gvt_buffer_row_t |
Macros | |
#define | GVT_BUFF_ROWS 50 |
#define | safe_asprintf(ret_addr, format, ...) |
#define | HEADER_STR "------------------------------------------------------------" |
#define | assign_new_file(destination, format, ...) |
Functions | |
static void | _rmdir (const char *path) |
void | _mkdir (const char *path) |
static void | print_config_to_file (FILE *f) |
void | print_config (void) |
void | statistics_start (void) |
static char * | format_size (double size) |
static void | print_header (FILE *f, const char *title) |
static void | print_timer_stats (FILE *f, timer *start_timer, timer *stop_timer, double total_time) |
static void | print_common_stats (FILE *f, struct stat_t *stats_p, bool want_thread_stats, bool want_local_stats) |
static void | print_termination_status (FILE *f, int exit_code) |
void | print_gvt_stats_file (void) |
void | statistics_stop (int exit_code) |
void | statistics_on_gvt (double gvt) |
void | statistics_on_gvt_serial (double gvt) |
void | statistics_init (void) |
void | statistics_fini (void) |
void | statistics_post_data_serial (enum stat_msg_t type, double data) |
void | statistics_post_data (struct lp_struct *lp, enum stat_msg_t type, double data) |
double | statistics_get_lp_data (struct lp_struct *lp, unsigned int type) |
Variables | |
static __thread struct _gvt_buffer | gvt_buf = {0} |
This structure is used to buffer statistics gathered on GVT computation. | |
static FILE ** | thread_blob_files = {0} |
Pointers to the files used as binary buffer for the GVT statistics. | |
static FILE * | unique_files [NUM_STAT_FILE_U] = {0} |
Pointers to unique files. | |
static FILE ** | thread_files [NUM_STAT_FILE_T] = {0} |
Pointers to per-thread files. | |
static timer | simulation_timer |
This is a timer that start during the initialization of statistics subsystem and can be used to know the total simulation time. | |
static struct stat_t * | lp_stats |
Keeps statistics on a per-LP basis. | |
static struct stat_t * | lp_stats_gvt |
Keeps statistics on a per-LP basis in a GVT phase. | |
static struct stat_t * | thread_stats |
Keeps statistics on a per-thread basis. | |
static struct stat_t | system_wide_stats = {.gvt_round_time_min = INFTY} |
Keeps global statistics. | |
struct stat_t | global_stats = {.gvt_round_time_min = INFTY} |
Keep statistics reduced globally across MPI ranks. | |
Statistics module.
All facitilies to collect, gather, and dump statistics are implemented in this module. The statistics subsystem relies on the struct stat_t type to keep the relevant fields. Every statistic variable must be a double
, because the aggregation functions are type-agnostic and consider every value to be a double
. This allows to speedup some aggregations by relying on vectorized instructions.
There are two main entry points in this module:
At the end of the simulation (or if the simulation is stopped), this module implements a coordination protocol to reduce all values, both at a machine level, and among distributed processes (using MPI).
This file is part of ROOT-Sim (ROme OpTimistic Simulator).
ROOT-Sim is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; only version 3 of the License applies.
ROOT-Sim is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with ROOT-Sim; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Definition in file statistics.c.
#define assign_new_file | ( | destination, | |
format, | |||
... | |||
) |
Definition at line 647 of file statistics.c.
#define safe_asprintf | ( | ret_addr, | |
format, | |||
... | |||
) |
This is a pseudo asprintf() implementation needed in order to stop GCC 8 from complaining
ret_addr | A char ** pointer where the function stores the address of a large-enough string to hold the output |
format | The format string as in the real asprintf() |
... | The arguments list as in the real asprintf() |
Definition at line 136 of file statistics.c.
void _mkdir | ( | const char * | path | ) |
This is an helper-function to allow the statistics subsystem create a new directory
path | The path of the new directory to create |
Definition at line 198 of file statistics.c.
|
static |
This is an helper-function to recursively delete the whole content of a folder
path | The path of the directory to purge |
Definition at line 154 of file statistics.c.
|
static |
Nicely print a size
size | The size in byte |
Definition at line 298 of file statistics.c.
void statistics_fini | ( | void | ) |
This function finalize the Statistics subsystem
Definition at line 736 of file statistics.c.
void statistics_init | ( | void | ) |
This function initializes the Statistics subsystem
Definition at line 660 of file statistics.c.
void statistics_start | ( | void | ) |
This function registers when the actual simulation is starting.
Definition at line 286 of file statistics.c.
void statistics_stop | ( | int | exit_code | ) |
This function print in the output file all the statistics associated with the simulation
exit_code | The exit code of the simulator, used to display a happy or sad termination message |
Definition at line 442 of file statistics.c.