示例#1
0
    # check to see if we are supposed to log the result
    print('benchmark result ===> time=%.2f' + str_mst_weight) % time_sec
    if trial_num < 0 and for_time:
        return

    # extract properties of the graph
    try:
        ti = extract_input_footer(input_graph)
    except ExtractInputFooterError, e:
        raise CheckerError(
            "run test error: unable to extract the input footer for %s: %s" %
            (rel_input_graph, str(e)))

    # log the result
    if for_time:
        data = PerfResult(ti.num_verts, ti.num_edges, ti.seed, rev, trial_num,
                          time_sec, mst_weight)
        try:
            DataSet.add_data_to_log_file(data)
        except DataError, e:
            print >> sys.stderr, "Unable to log result to file %s (was trying to log %s): %s" % (
                data.get_path(), str(data), str(e))
    else:
        data = WeightResult(ti.dims, ti.num_verts, ti.seed, rev, trial_num,
                            mst_weight)
        try:
            DataSet.add_data_to_log_file(data)
        except DataError, e:
            print >> sys.stderr, "Unable to log result to file %s (was trying to log %s): %s" % (
                data.get_path(), str(data), str(e))