ROSS
st-instrumentation.c
Go to the documentation of this file.
1 #include <ross.h>
2 #include <sys/stat.h>
3 
5 char g_st_stats_path[4096] = {0};
6 int g_st_pe_data = 1;
7 int g_st_kp_data = 0;
8 int g_st_lp_data = 0;
10 
13 
15 int g_st_num_gvt = 10;
16 
20 
21 double g_st_vt_interval = 1000000;
22 double g_st_sampling_end = 0;
23 
24 
25 
26 static const tw_optdef inst_options[] = {
27  TWOPT_GROUP("ROSS Instrumentation"),
28  TWOPT_UINT("engine-stats", g_st_engine_stats, "Collect sim engine level stats; 0 don't collect, 1 GVT-sampling, 2 RT sampling, 3 VT sampling, 4 All sampling modes"),
29  TWOPT_UINT("model-stats", g_st_model_stats, "Collect model level stats (requires model-level implementation); 0 don't collect, 1 GVT-sampling, 2 RT sampling, 3 VT sampling, 4 all sampling modes"),
30  TWOPT_UINT("num-gvt", g_st_num_gvt, "number of GVT computations between GVT-based sampling points"),
31  TWOPT_ULONGLONG("rt-interval", g_st_rt_interval, "real time sampling interval in ms"),
32  TWOPT_DOUBLE("vt-interval", g_st_vt_interval, "Virtual time sampling interval"),
33  TWOPT_DOUBLE("vt-samp-end", g_st_sampling_end, "End time for virtual time sampling (if different from g_tw_ts_end)"),
34  TWOPT_UINT("pe-data", g_st_pe_data, "Turn on/off collection of sim engine data at PE level"),
35  TWOPT_UINT("kp-data", g_st_kp_data, "Turn on/off collection of sim engine data at KP level"),
36  TWOPT_UINT("lp-data", g_st_lp_data, "Turn on/off collection of sim engine data at LP level"),
37  TWOPT_UINT("event-trace", g_st_ev_trace, "collect detailed data on all events for specified LPs; 0, no trace, 1 full trace, 2 only events causing rollbacks, 3 only committed events"),
38  TWOPT_CHAR("stats-prefix", g_st_stats_out, "prefix for filename(s) for stats output"),
39  TWOPT_CHAR("stats-path", g_st_stats_path, "path to directory to save instrumentation output"),
40  TWOPT_UINT("buffer-size", g_st_buffer_size, "size of buffer in bytes for stats collection"),
41  TWOPT_UINT("buffer-free", g_st_buffer_free_percent, "percentage of free space left in buffer before writing out at GVT"),
42  TWOPT_UINT("disable-output", g_st_disable_out, "used for perturbation analysis; buffer never dumped to file when 1"),
43  TWOPT_END()
44 };
45 
46 const tw_optdef *st_inst_opts(void)
47 {
48  return inst_options;
49 }
50 
51 void st_inst_init(void)
52 {
54 
56  return;
57 
58  // setup appropriate flags for various instrumentation modes
59  // set up files and buffers for necessary instrumentation modes
61  {
64  }
66  {
67  g_st_rt_sampling = 1;
69  }
70 
74  g_st_rt_sampling = 1;
75 
76  if (g_st_rt_sampling)
77  {
80  }
81 
82  if (g_st_ev_trace)
84  if (g_st_model_stats)
86 }
87 
89 {
90  if (g_st_disable_out)
91  return;
92 
97  if (g_st_ev_trace)
99  if (g_st_model_stats)
103 }
104 
106 {
110  {
111  // collect data one final time to account for time between last sample and sim end time
114  }
115  if (g_st_ev_trace)
117  if (g_st_model_stats)
121 
122 }
tw_clock g_st_rt_interval
unsigned long long g_tw_clock_rate
Definition: ross-global.c:98
const tw_optdef * st_inst_opts(void)
char g_st_stats_path[4096]
int g_st_lp_data
#define TWOPT_CHAR(n, v, h)
Definition: tw-opts.h:33
static const tw_optdef inst_options[]
int g_st_pe_data
tw_clock g_st_rt_samp_start_cycles
#define TWOPT_DOUBLE(n, v, h)
Definition: tw-opts.h:32
static tw_clock tw_clock_read(void)
Definition: aarch64.h:6
int g_st_engine_stats
Holds the entire PE state.
Definition: ross-types.h:375
int g_st_buffer_free_percent
#define TWOPT_ULONGLONG(n, v, h)
Definition: tw-opts.h:29
#define INST_MAX_LENGTH
int g_st_buffer_size
int g_st_use_analysis_lps
int g_st_gvt_sampling
void st_buffer_write(int end_of_sim, int type)
void st_inst_dump()
void st_inst_init(void)
int g_st_rt_sampling
void specialized_lp_run()
double g_st_sampling_end
#define TWOPT_UINT(n, v, h)
Definition: tw-opts.h:30
#define TWOPT_END()
Definition: tw-opts.h:35
void st_collect_engine_data(tw_pe *me, int col_type)
Definition: st-sim-engine.c:10
int g_st_model_stats
double g_st_vt_interval
void st_inst_finalize(tw_pe *me)
uint64_t tw_clock
Definition: aarch64.h:4
#define TWOPT_GROUP(h)
Definition: tw-opts.h:27
int g_st_ev_trace
Definition: st-event-trace.c:3
int g_st_kp_data
int g_st_disable_out
char g_st_stats_out[INST_MAX_LENGTH]
int g_st_num_gvt
void st_buffer_init(int type)
void st_buffer_finalize(int type)