+ unsigned int cursor;
+
+ double elapsed = 0;
+ double tmax = 0;
+ unsigned long num_proc = xbt_dynar_length(processes);
+ unsigned int t=0;
+ unsigned int data_size = (num_proc / NUM_THREADS) + ((num_proc % NUM_THREADS) ? 1 : 0);
+
+ ssr_count++;
+ time_thread_ssr[0] = 0;
+ xbt_dynar_foreach(processes, cursor, process) {
+ XBT_DEBUG("Schedule item %u of %lu",cursor,xbt_dynar_length(processes));
+ if(cursor >= t * data_size + data_size){
+ if(time_thread_ssr[t] > tmax)
+ tmax = time_thread_ssr[t];
+ t++;
+ time_thread_ssr[t] = 0;
+ }
+
+ if(new_sr){
+ ((smx_ctx_raw_t)process->context)->thread = t;
+ time_thread_sr[t] = 0;
+ }
+
+ xbt_os_timer_start(timer);
+ smx_ctx_raw_resume(process);
+ xbt_os_timer_stop(timer);
+ elapsed = xbt_os_timer_elapsed(timer);
+ time_thread_ssr[t] += elapsed;
+ time_thread_sr[((smx_ctx_raw_t)process->context)->thread] += elapsed;
+ }
+
+ if(new_sr)
+ new_sr = FALSE;
+
+ if(time_thread_ssr[t] > tmax)
+ tmax = time_thread_ssr[t];