Revision 32c9a7bc ed.c

View differences:

ed.c
10 10

  
11 11
FILE *resfile;
12 12
FILE *statusfile;
13
extern float convergence_precision;
13 14

  
14 15
struct ed_simulator {
15 16
	struct chunk * chunks;
......
217 218
	struct ed_simulator * eds;
218 219
	struct chunk * chunks;
219 220
	struct action_event * ae;
221
	struct stats * stat = NULL;
220 222

  
221 223
	chunks = malloc(num_chunks * sizeof(struct chunk));
222 224
	if (chunks == NULL) {
......
228 230
	eds = ed_simulator_new(chunks, num_chunks, p, np, server_period);
229 231
	ed_simulator_gen_events(eds);
230 232

  
231
	while(ed_simulator_network_activity(eds))
233
	while(ed_simulator_network_activity(eds) &&
234
			!(convergence_precision && 
235
			 chunk_stats_converge(&stat, chunks, num_chunks, p, np, ed_simulator_time(eds))))
232 236
	{
233 237
		//fprintf(stderr,"[DEBUG] another round, time %f\n", ed_simulator_time(eds));
234 238
		ae = ed_simulator_pick_event(eds);
235 239
		action_event_trigger(ae);
240
		//chunk_stats_print(stat, PLAIN_STATS);
236 241
	}
242
	chunk_stats_converge(&stat, chunks, num_chunks, p, np, ed_simulator_time(eds));
243
	chunk_stats_print(stat, CSV_STATS);
237 244
	ed_simulator_destroy(&eds);
238 245

  
239 246
	return chunks;

Also available in: Unified diff