ROSS
tw-stats.c
Go to the documentation of this file.
1 #include <ross.h>
2 
3 #ifndef ROSS_DO_NOT_PRINT
4 static void
5 show_lld(const char *name, tw_stat v)
6 {
7  printf("\t%-50s %11lld\n", name, v);
8  fprintf(g_tw_csv, ",%lld", v);
9 }
10 
11 static void
12 show_2f(const char *name, double v)
13 {
14  printf("\t%-50s %11.2f %%\n", name, v);
15  fprintf(g_tw_csv, ",%.2f", v);
16 }
17 
18 static void
19 show_1f(const char *name, double v)
20 {
21  printf("\t%-50s %11.1f\n", name, v);
22  fprintf(g_tw_csv, ",%.2f", v);
23 }
24 
25 static void
26 show_4f(const char *name, double v)
27 {
28  printf("\t%-50s %11.4lf\n", name, v);
29  fprintf(g_tw_csv, ",%.4lf", v);
30 }
31 
32 #endif
33 
34 void
36 {
37  tw_kp *kp;
38 
39  unsigned int i;
40 
41  if (pe != g_tw_pe)
42  return;
43 
44  if (0 == g_tw_sim_started)
45  return;
46 
47  tw_wtime rt;
48 
49  tw_wall_sub(&rt, &pe->end_time, &pe->start_time);
50 
53  s->s_pq_qsize += tw_pq_get_size(pe->pq);
54 
57 
61 
62  s->s_total += pe->stats.s_total;
63  s->s_init += pe->stats.s_init;
64  s->s_net_read += pe->stats.s_net_read;
65  s->s_net_other += pe->stats.s_net_other;
66  s->s_gvt += pe->stats.s_gvt;
70  s->s_pq += pe->stats.s_pq;
71  s->s_rollback += pe->stats.s_rollback;
72  s->s_cancel_q += pe->stats.s_cancel_q;
75  s->s_avl += pe->stats.s_avl;
76  s->s_buddy += pe->stats.s_buddy;
77  s->s_lz4 += pe->stats.s_lz4;
78  s->s_stat_comp += pe->stats.s_stat_comp;
81 #ifdef USE_RIO
82  s->s_rio_load += pe->stats.s_rio_load;
83  s->s_rio_lp_init += pe->stats.s_rio_lp_init;
84 #endif
86  s->s_alp_e_rbs = pe->stats.s_alp_e_rbs;
87 
88  for(i = 0; i < g_tw_nkp; i++)
89  {
90  kp = tw_getkp(i);
92  s->s_e_rbs += kp->s_e_rbs;
93  s->s_rb_total += kp->s_rb_total;
95  }
96 
97 
101 }
102 
104 {
105  tw_stat model_nevent = s->s_nevent_processed - s->s_alp_nevent_processed;
106  tw_stat model_e_rbs = s->s_e_rbs - s->s_alp_e_rbs;
107  tw_stat model_net = model_nevent - model_e_rbs;
108  tw_stat analysis_net = s->s_alp_nevent_processed - s->s_alp_e_rbs;
109 
110  printf("\nSeparate Statistics for Model and Analysis LPs\n");
111  printf("Model LPs:\n");
112  show_lld("Total Events Processed", model_nevent);
113  show_lld("Events Rolled Back", model_e_rbs);
114  show_lld("Net Events Processed", model_net);
115  show_2f("Efficiency", 100.0 * (1.0 - ((double) model_e_rbs / (double) model_net)));
116 
117  printf("\nAnalysis LPs:\n");
118  show_lld("Total Events Processed", s->s_alp_nevent_processed);
119  show_lld("Events Rolled Back", s->s_alp_e_rbs);
120  show_lld("Net Events Processed", analysis_net);
121  show_2f("Efficiency", 100.0 * (1.0 - ((double) s->s_alp_e_rbs / (double) analysis_net)));
122 }
123 
124 void
126 {
127  tw_statistics s;
128  bzero(&s, sizeof(s));
129  size_t m_alloc, m_waste;
130  tw_calloc_stats(&m_alloc, &m_waste);
131  tw_lp *lp = NULL;
132  unsigned int i;
133  for(i = 0; i < g_tw_nlp + g_st_analysis_nlp; i++)
134  {
135  lp = tw_getlp(i);
136  if (lp->type->final)
137  (*lp->type->final) (lp->cur_state, lp);
138  }
139  tw_get_stats(me, &s);
140  s = *(tw_net_statistics(me, &s));
141 
142  if (!tw_ismaster())
143  return;
144 
145 #ifndef ROSS_DO_NOT_PRINT
146  printf("\n\t: Running Time = %.4f seconds\n", s.s_max_run_time);
147  fprintf(g_tw_csv, "%.4f", s.s_max_run_time);
148 
149  printf("\nTW Library Statistics:\n");
150  show_lld("Total Events Processed", s.s_nevent_processed);
151  show_lld("Events Aborted (part of RBs)", s.s_nevent_abort);
152  show_lld("Events Rolled Back", s.s_e_rbs);
153  show_lld("Event Ties Detected in PE Queues", s.s_pe_event_ties);
155  printf("\t%-50s %11.9lf\n",
156  "Minimum TS Offset Detected in Conservative Mode",
157  (double) s.s_min_detected_offset);
158  show_2f("Efficiency", 100.0 * (1.0 - ((double) s.s_e_rbs / (double) s.s_net_events)));
159  show_lld("Total Remote (shared mem) Events Processed", s.s_nsend_loc_remote);
160 
161  show_2f(
162  "Percent Remote Events",
163  ( (double)s.s_nsend_loc_remote
164  / (double)s.s_net_events)
165  * 100.0
166  );
167 
168  show_lld("Total Remote (network) Events Processed", s.s_nsend_net_remote);
169  show_2f(
170  "Percent Remote Events",
171  ( (double)s.s_nsend_net_remote
172  / (double)s.s_net_events)
173  * 100.0
174  );
175 
176  printf("\n");
177  show_lld("Total Roll Backs ", s.s_rb_total);
178  show_lld("Primary Roll Backs ", s.s_rb_primary);
179  show_lld("Secondary Roll Backs ", s.s_rb_secondary);
180  show_lld("Fossil Collect Attempts", s.s_fc_attempts);
181  show_lld("Total GVT Computations", g_tw_gvt_done);
182 
183  printf("\n");
184  show_lld("Net Events Processed", s.s_net_events);
185  show_1f(
186  "Event Rate (events/sec)",
187  ((double)s.s_net_events / s.s_max_run_time)
188  );
189 
190  show_lld("Total Events Scheduled Past End Time", s.s_events_past_end);
191 
192  printf("\nTW Memory Statistics:\n");
193  show_lld("Events Allocated", 1 + g_tw_events_per_pe + g_tw_events_per_pe_extra);
194  show_lld("Memory Allocated", m_alloc / 1024);
195  show_lld("Memory Wasted", m_waste / 1024);
196 
197  if (tw_nnodes() > 1) {
198  printf("\n");
199  printf("TW Network Statistics:\n");
200  show_lld("Remote sends", s.s_nsend_network);
201  show_lld("Remote recvs", s.s_nread_network);
202  }
203 
204  printf("\nTW Data Structure sizes in bytes (sizeof):\n");
205  show_lld("PE struct", sizeof(tw_pe));
206  show_lld("KP struct", sizeof(tw_kp));
207  show_lld("LP struct", sizeof(tw_lp));
208  show_lld("LP Model struct", lp->type->state_sz);
209  show_lld("LP RNGs", sizeof(*lp->rng));
210  show_lld("Total LP", sizeof(tw_lp) + lp->type->state_sz + sizeof(*lp->rng));
211  show_lld("Event struct", sizeof(tw_event));
212  show_lld("Event struct with Model", sizeof(tw_event) + g_tw_msg_sz);
213 
214 #ifdef ROSS_timing
215  printf("\nTW Clock Cycle Statistics (MAX values in secs at %1.4lf GHz):\n", g_tw_clock_rate / 1000000000.0);
216  show_4f("Initialization", (double) s.s_init / g_tw_clock_rate);
217  show_4f("Priority Queue (enq/deq)", (double) s.s_pq / g_tw_clock_rate);
218  show_4f("AVL Tree (insert/delete)", (double) s.s_avl / g_tw_clock_rate);
219  show_4f("LZ4 (de)compression", (double) s.s_lz4 / g_tw_clock_rate);
220  show_4f("Buddy system", (double) s.s_buddy / g_tw_clock_rate);
221 #ifdef USE_RIO
222  show_4f("RIO Loading", (double) s.s_rio_load / g_tw_clock_rate);
223  show_4f("RIO LP Init", (double) s.s_rio_lp_init / g_tw_clock_rate);
224 #endif
225  show_4f("Event Processing", (double) s.s_event_process / g_tw_clock_rate);
226  show_4f("Event Cancel", (double) s.s_cancel_q / g_tw_clock_rate);
227  show_4f("Event Abort", (double) s.s_event_abort / g_tw_clock_rate);
228  printf("\n");
229  show_4f("GVT", (double) s.s_gvt / g_tw_clock_rate);
230  show_4f("Fossil Collect", (double) s.s_fossil_collect / g_tw_clock_rate);
231  show_4f("Primary Rollbacks", (double) s.s_rollback / g_tw_clock_rate);
232  show_4f("Network Read", (double) s.s_net_read / g_tw_clock_rate);
233  show_4f("Other Network", (double) s.s_net_other / g_tw_clock_rate);
234  show_4f("Instrumentation (computation)", (double) s.s_stat_comp / g_tw_clock_rate);
235  show_4f("Instrumentation (write)", (double) s.s_stat_write / g_tw_clock_rate);
236  show_4f("Total Time (Note: Using Running Time above for Speedup)", (double) s.s_total / g_tw_clock_rate);
237 #endif
238 
239  tw_gvt_stats(stdout);
240 
243 #endif
244 }
tw_synch g_tw_synchronization_protocol
Definition: ross-global.c:18
unsigned int g_tw_gvt_done
Definition: ross-global.c:81
tw_clock s_net_other
Definition: ross-types.h:137
tw_clock s_event_process
Definition: ross-types.h:142
double g_tw_min_detected_offset
Definition: ross-global.c:55
unsigned long long g_tw_clock_rate
Definition: ross-global.c:98
final_f final
Final handler routine.
Definition: ross-types.h:93
tw_clock s_pq
Definition: ross-types.h:143
size_t g_tw_msg_sz
Definition: ross-global.c:33
tw_lptype * type
Type of this LP, including service callbacks.
Definition: ross-types.h:316
tw_stat s_rb_primary
Definition: ross-types.h:116
tw_stat s_nevent_abort
Definition: ross-types.h:112
static void show_1f(const char *name, double v)
Definition: tw-stats.c:19
tw_statistics stats
per PE counters
Definition: ross-types.h:415
unsigned int g_tw_sim_started
Definition: ross-global.c:32
static int tw_ismaster(void)
tw_stat s_rb_total
Definition: ross-types.h:115
long s_rb_secondary
Number of secondary rollbacks by this LP.
Definition: ross-types.h:365
void st_print_analysis_LP_stats(tw_statistics *s)
Definition: tw-stats.c:103
tw_clock s_lz4
Definition: ross-types.h:150
Holds the entire PE state.
Definition: ross-types.h:375
tw_clock s_init
Definition: ross-types.h:135
tw_lpid g_tw_nlp
Definition: ross-global.c:23
static void show_4f(const char *name, double v)
Definition: tw-stats.c:26
tw_clock s_stat_comp
Definition: ross-types.h:151
unsigned int tw_nnodes(void)
Definition: network-mpi.c:103
tw_stat s_nsend_network
Definition: ross-types.h:121
tw_stat s_nsend_remote_rb
Definition: ross-types.h:123
unsigned int tw_pq_get_size(splay_tree *st)
Definition: splay.c:351
static tw_kp * tw_getkp(tw_kpid id)
tw_stat s_net_events
Definition: ross-types.h:110
tw_stat s_pq_qsize
Definition: ross-types.h:120
struct timeval tw_wtime
Definition: tw-timing.h:4
Statistics tallied over the duration of the simulation.
Definition: ross-types.h:107
tw_stat s_nsend_net_remote
Definition: ross-types.h:126
Event Stucture.
Definition: ross-types.h:250
void tw_stats(tw_pe *me)
Definition: tw-stats.c:125
tw_lpid g_st_analysis_nlp
tw_clock s_stat_write
Definition: ross-types.h:152
tw_stat s_nread_network
Definition: ross-types.h:122
int g_st_use_analysis_lps
unsigned int g_tw_events_per_pe_extra
Definition: ross-global.c:78
tw_clock s_buddy
Definition: ross-types.h:149
double s_max_run_time
Definition: ross-types.h:108
FILE * g_tw_csv
Definition: ross-global.c:91
tw_stat s_alp_e_rbs
Definition: ross-types.h:157
tw_stat s_e_rbs
Definition: ross-types.h:113
tw_wtime start_time
When this PE first started execution.
Definition: ross-types.h:412
long s_e_rbs
Number of events rolled back by this LP.
Definition: ross-types.h:363
tw_pq * pq
Priority queue used to sort events.
Definition: ross-types.h:381
void tw_wall_sub(tw_wtime *r, tw_wtime *a, tw_wtime *b)
Definition: tw-timing.c:11
tw_statistics * tw_net_statistics(tw_pe *me, tw_statistics *s)
Function to output the statistics.
Definition: network-mpi.c:656
tw_clock s_net_read
Definition: ross-types.h:136
size_t state_sz
Number of bytes that SV is for the LP.
Definition: ross-types.h:95
long s_rb_total
Number of total rollbacks by this LP.
Definition: ross-types.h:364
double s_min_detected_offset
Definition: ross-types.h:132
tw_clock s_avl
Definition: ross-types.h:148
static tw_lp * tw_getlp(tw_lpid id)
tw_stat s_fc_attempts
Definition: ross-types.h:118
int g_tw_fossil_attempts
Definition: ross-global.c:28
tw_stat s_pe_event_ties
Definition: ross-types.h:130
tw_stat s_nsend_loc_remote
Definition: ross-types.h:125
tw_clock s_fossil_collect
Definition: ross-types.h:139
tw_pe * g_tw_pe
Definition: ross-global.c:75
tw_wtime end_time
When this PE finished its execution.
Definition: ross-types.h:413
unsigned long long tw_stat
Definition: ross-types.h:48
static void show_lld(const char *name, tw_stat v)
Definition: tw-stats.c:5
tw_clock s_gvt
Definition: ross-types.h:138
tw_pe * pe
Definition: avl_tree.c:11
#define ROSS_MAX(a, b)
void * cur_state
Current application LP data.
Definition: ross-types.h:315
double tw_wall_to_double(tw_wtime *t)
Definition: tw-timing.c:24
tw_stat s_alp_nevent_processed
Definition: ross-types.h:156
tw_kpid g_tw_nkp
Definition: ross-global.c:25
tw_stat s_nevent_processed
Definition: ross-types.h:111
tw_rng_stream * rng
RNG stream array for this LP.
Definition: ross-types.h:317
void tw_get_stats(tw_pe *pe, tw_statistics *s)
Definition: tw-stats.c:35
tw_stat s_events_past_end
Definition: ross-types.h:154
static void show_2f(const char *name, double v)
Definition: tw-stats.c:12
tw_clock s_total
Definition: ross-types.h:134
tw_clock s_event_abort
Definition: ross-types.h:141
tw_clock s_rollback
Definition: ross-types.h:144
void tw_gvt_stats(FILE *f)
Definition: mpi_allreduce.c:53
tw_stat s_rb_secondary
Definition: ross-types.h:117
tw_clock s_cancel_q
Definition: ross-types.h:146
tw_stat s_nevent_processed
Number of events processed.
Definition: ross-types.h:361
unsigned int g_tw_events_per_pe
Definition: ross-global.c:76
void tw_calloc_stats(size_t *alloc, size_t *waste)
Definition: tw-util.c:120
LP State Structure.
Definition: ross-types.h:304