def aggregate_publish_stats(stats_set):
    """
    For a set of per process _publish_ stats, make some basic aggregated stats
    timings are a simple mean of the input timings. ie the aggregate
    "minimum" is the average of the minimum of each process, not the
    absolute minimum of any process.
    Likewise, aggregate "stddev" is a simple mean of the stddev from each
    process, not an entire population stddev.
    """
    def naive_average(the_set):
        return sum(the_set) / len(the_set)
    count_ok = sum([x["count_ok"] for x in stats_set])
    count_total = sum([x["count_total"] for x in stats_set])
    cid = "Aggregate stats (simple avg) for %d processes" % len(stats_set)
    avg_msgs_per_sec = naive_average([x["msgs_per_sec"] for x in stats_set])
    return {
        "clientid": cid,
        "count_ok": count_ok,
        "count_total": count_total,
        "rate_ok": count_ok / count_total,
        "time_min": naive_average([x["time_min"] for x in stats_set]),
        "time_max": naive_average([x["time_max"] for x in stats_set]),
        "time_mean": naive_average([x["time_mean"] for x in stats_set]),
        "time_stddev": naive_average([x["time_stddev"] for x in stats_set]),
        "msgs_per_sec": avg_msgs_per_sec * len(stats_set)
    }