2 Copyright (C) 2014 Tim Mayberry
4 This program is free software; you can redistribute it and/or modify
5 it under the terms of the GNU General Public License as published by
6 the Free Software Foundation; either version 2 of the License, or
7 (at your option) any later version.
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU General Public License for more details.
14 You should have received a copy of the GNU General Public License
15 along with this program; if not, write to the Free Software
16 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
20 #include "pbd/timing.h"
33 get_min_max_avg_total (const std::vector<uint64_t>& values, uint64_t& min, uint64_t& max, uint64_t& avg, uint64_t& total)
40 min = std::numeric_limits<uint64_t>::max();
43 for (std::vector<uint64_t>::const_iterator ci = values.begin(); ci != values.end(); ++ci) {
45 min = std::min (min, *ci);
46 max = std::max (max, *ci);
49 avg = total / values.size();
54 timing_summary (const std::vector<uint64_t>& values)
56 std::ostringstream oss;
58 uint64_t min, max, avg, total;
60 if (get_min_max_avg_total (values, min, max, avg, total)) {
61 oss << "Count: " << values.size()
64 << " Total: " << total
65 << " Avg: " << avg << " (" << avg / 1000 << " msecs)"