The ROme OpTimistic Simulator  3.0.0
A General-Purpose Multithreaded Parallel/Distributed Simulation Platform
stats.c File Reference

Statistics module. More...

#include <log/stats.h>
#include <arch/io.h>
#include <arch/mem.h>
#include <arch/timer.h>
#include <core/arg_parse.h>
#include <core/core.h>
#include <assert.h>
#include <inttypes.h>
#include <memory.h>
#include <stdarg.h>
#include <stdatomic.h>
#include <stdint.h>
#include <stdio.h>
+ Include dependency graph for stats.c:

Go to the source code of this file.

Data Structures

struct  stats_measure
 A set of statistical values of a single metric. More...
 
struct  stats_thread
 A container for statistics in a logical time period. More...
 
struct  stats_node
 
struct  stats_glob
 

Macros

#define STATS_BUFFER_ENTRIES   (1024)
 
#define STD_DEV_POWER_2_EXP   5
 
#define STATS_MAX_STRLEN   32U
 

Functions

static void file_write_chunk (FILE *f, const void *data, size_t data_size)
 
static void * file_memory_load (FILE *f, int64_t *f_size_p)
 
static FILE * file_open (const char *open_type, const char *fmt,...)
 A version of fopen() which accepts a printf style format string. More...
 
void stats_global_time_start (void)
 Initializes the internal timer used to take accurate measurements.
 
void stats_global_time_take (enum stats_global_time this_stat)
 Initializes the internal timer used to take accurate measurements.
 
void stats_global_init (void)
 Initializes the stats subsystem in the node.
 
void stats_init (void)
 Initializes the stats subsystem in the current thread.
 
static void stats_files_receive (FILE *o)
 
static void stats_files_send (void)
 
static void stats_file_final_write (FILE *o)
 
void stats_global_fini (void)
 Finalizes the stats subsystem in the node. More...
 
void stats_time_start (enum stats_time this_stat)
 
void stats_time_take (enum stats_time this_stat)
 
void stats_on_gvt (simtime_t gvt)
 
void stats_dump (void)
 

Variables

const char *const s_names []
 The statistics names, used to fill in the header of the final csv. More...
 
static timer_uint sim_start_ts
 
static struct stats_glob stats_glob_cur
 
static FILE * stats_node_tmp
 
static FILE ** stats_tmps
 
static __thread struct stats_thread stats_cur
 
static __thread timer_uint last_ts [STATS_COUNT]
 

Detailed Description

Statistics module.

All facilities to collect, gather, and dump statistics are implemented in this module.

Definition in file stats.c.

Function Documentation

◆ file_open()

static FILE* file_open ( const char *  open_type,
const char *  fmt,
  ... 
)
static

A version of fopen() which accepts a printf style format string.

Parameters
open_typea string which controls how the file is opened (see fopen())
fmtthe file name expressed as a printf style format string
...the list of additional arguments used in fmt (see printf())

Definition at line 121 of file stats.c.

+ Here is the call graph for this function:

◆ stats_global_fini()

void stats_global_fini ( void  )

Finalizes the stats subsystem in the node.

When finalizing this subsystem the master node formats and dumps his statistics from his temporary files onto the final csv. Then, in a distributed setting, he receives the slaves temporary files, formatting and dumping their statistics as well.

Definition at line 273 of file stats.c.

+ Here is the call graph for this function:

Variable Documentation

◆ s_names

const char* const s_names[]
Initial value:
= {
[STATS_ROLLBACK] = "rollbacks",
[STATS_GVT] = "gvt",
[STATS_MSG_SILENT] = "silent messages",
[STATS_MSG_PROCESSED] = "processed messages"
}

The statistics names, used to fill in the header of the final csv.

Definition at line 78 of file stats.c.