From 735e2ef3949fde4fc5e45d6ed140013ec3de69cf Mon Sep 17 00:00:00 2001 From: David Anderson Date: Fri, 3 May 2013 15:08:06 -0700 Subject: [PATCH] - client emulator: show jobs in summary file --- client/sim.cpp | 19 ++++++++++++++----- lib/str_util.cpp | 16 +++++----------- 2 files changed, 19 insertions(+), 16 deletions(-) diff --git a/client/sim.cpp b/client/sim.cpp index ba5daf3211..3ced39009e 100644 --- a/client/sim.cpp +++ b/client/sim.cpp @@ -1078,15 +1078,24 @@ void simulate() { " Scheduling period %f\n" "Scheduling policies\n" " Round-robin only: %s\n" - " Scheduler EDF simulation: %s\n", + " Scheduler EDF simulation: %s\n" + " REC half-life: %f\n", gstate.work_buf_min(), gstate.work_buf_total(), gstate.global_prefs.cpu_scheduling_period(), cpu_sched_rr_only?"yes":"no", - server_uses_workload?"yes":"no" - ); - fprintf(summary_file, - " REC half-life: %f\n", config.rec_half_life + server_uses_workload?"yes":"no", + config.rec_half_life ); + fprintf(summary_file, "Jobs\n"); + for (int i=0; iname, + timediff_format(rp->sim_flops_left/rp->avp->flops).c_str(), + timediff_format(rp->report_deadline - START_TIME).c_str() + ); + } fprintf(summary_file, "Simulation parameters\n" " time step %f, duration %f\n" diff --git a/lib/str_util.cpp b/lib/str_util.cpp index 06b786150e..ba6a9ae31d 100644 --- a/lib/str_util.cpp +++ b/lib/str_util.cpp @@ -362,33 +362,27 @@ string timediff_format(double diff) { int sex = tdiff % 60; tdiff /= 60; if (!tdiff) { - sprintf(buf, "%d sec", sex); + sprintf(buf, "00:00:%02d", sex); return buf; } int min = tdiff % 60; tdiff /= 60; if (!tdiff) { - sprintf(buf, "%d min %d sec", min, sex); + sprintf(buf, "00:%02d:%02d", min, sex); return buf; } int hours = tdiff % 24; tdiff /= 24; if (!tdiff) { - sprintf(buf, "%d hr %d min %d sec", hours, min, sex); + sprintf(buf, "%02d:%02d:%02d", hours, min, sex); return buf; } - int days = tdiff % 7; - tdiff /= 7; - if (!tdiff) { - sprintf(buf, "%d days %d hr %d min %d sec", days, hours, min, sex); - return buf; - } - - sprintf(buf, "%d weeks %d days %d hrs %d min %d sec", (int)tdiff, days, hours, min, sex); + sprintf(buf, "%d days %02d:%02d:%02d", tdiff, hours, min, sex); return buf; + } void mysql_timestamp(double dt, char* p) {