Exemple #1
0
def main(argv):
    Conf.ParseArgs()

    SimTime.Init(Conf.Get("simulation_time_begin"))
    Util.MkDirs(Conf.dn_result)

    Plot.Plot()
Exemple #2
0
def GenDataFileForGnuplot(dt):
    SimTime.Init(dt)

    dn = "%s/%s" % (Conf.GetDir("output_dir"), dt)
    Util.MkDirs(dn)
    fn = "%s/dstat-data" % dn
    if os.path.isfile(fn):
        return fn

    with Cons.MT("Generating data file for plot ..."):
        global _header_idx
        global _body_rows
        _header_idx = None
        _body_rows = None

        _Parse(dt)

        fmt = "%9.0f %9.0f %9.0f %9.0f %9.0f %9.0f %9.0f %9.0f" \
          " %6.1f %6.1f %6.1f %6.1f %6.1f %6.1f %6.1f %6.1f" \
          " %8.0f %8.0f %8.0f %8.0f" \
          " %3.0f %3.0f" \
          " %3.0f %3.0f %11s" \
          " %3.1f %6.2f %3.1f %6.2f %6.2f %6.3f"
        header = Util.BuildHeader(
            fmt, " ".join(k for k, v in sorted(_header_idx.iteritems())))
        with open(fn, "w") as fo:
            i = 0
            for r in _body_rows:
                if i % 50 == 0:
                    fo.write("%s\n" % header)
                i += 1
                #Cons.P(fmt % tuple(r.Prepared()))
                fo.write((fmt + "\n") % tuple(r.Prepared()))
        Cons.P("Created %s %d" % (fn, os.path.getsize(fn)))
        return fn
Exemple #3
0
def main(argv):
    Conf.ParseArgs()
    dn_out = Conf.Get("dn_result")
    Util.MkDirs(dn_out)

    SimTime.Init(Conf.Get("simulation_time_begin"))
    Plot.Plot()
Exemple #4
0
def main(argv):
	Conf.ParseArgs()

	# Get the simulation/simulated time begin/end by parsing a client log file
	# with the the same simulation time begin
	SimTime.Init()

	Plot.Plot()
Exemple #5
0
def Plot(param):
    job_id = param[0]
    exp_dt = param[1]
    dn_log_job = "%s/work/mutant/log/quizup/sla-admin/%s" % (
        os.path.expanduser("~"), job_id)

    fn_log_quizup = "%s/quizup/%s" % (dn_log_job, exp_dt)
    fn_log_rocksdb = "%s/rocksdb/%s" % (dn_log_job, exp_dt)
    fn_log_dstat = "%s/dstat/%s.csv" % (dn_log_job, exp_dt)

    log_q = QuizupLog(fn_log_quizup)
    SimTime.Init(log_q.SimTime("simulated_time_begin"),
                 log_q.SimTime("simulated_time_end"),
                 log_q.SimTime("simulation_time_begin"),
                 log_q.SimTime("simulation_time_end"))

    qz_std_max = _QzSimTimeDur(
        log_q.quizup_options["simulation_time_dur_in_sec"])
    qz_opt_str = _QuizupOptionsFormattedStr(log_q.quizup_options)
    error_adj_ranges = log_q.quizup_options["error_adj_ranges"].replace(
        ",", " ")

    (fn_rocksdb_sla_admin_log, pid_params,
     num_sla_adj) = RocksdbLog.ParseLog(fn_log_rocksdb, exp_dt)

    fn_dstat = DstatLog.GenDataFileForGnuplot(fn_log_dstat, exp_dt)

    fn_out = "%s/sla-admin-by-time-%s.pdf" % (Conf.GetDir("output_dir"),
                                              exp_dt)

    with Cons.MT("Plotting ..."):
        env = os.environ.copy()
        env["STD_MAX"] = qz_std_max
        env["ERROR_ADJ_RANGES"] = error_adj_ranges
        env["IN_FN_QZ"] = fn_log_quizup
        env["IN_FN_SLA_ADMIN"] = "" if num_sla_adj == 0 else fn_rocksdb_sla_admin_log
        env["QUIZUP_OPTIONS"] = qz_opt_str
        env["PID_PARAMS"] = "%s %s %s %s" % (pid_params["target_value"],
                                             pid_params["p"], pid_params["i"],
                                             pid_params["d"])
        env["WORKLOAD_EVENTS"] = " ".join(
            str(t) for t in log_q.simulation_time_events)
        env["IN_FN_DS"] = fn_dstat
        env["OUT_FN"] = fn_out
        Util.RunSubp("gnuplot %s/sla-admin-by-time.gnuplot" %
                     os.path.dirname(__file__),
                     env=env)
        Cons.P("Created %s %d" % (fn_out, os.path.getsize(fn_out)))
Exemple #6
0
def main(argv):
    Conf.ParseArgs()

    SimTime.Init(Conf.Get("simulation_time_begin"))
Exemple #7
0
def main(argv):
    Conf.ParseArgs()

    SimTime.Init(Conf.Get("simulation_time_begin"))

    RocksDbLogReader.CalcStorageCost()