diff options
| author | Alan Conway <aconway@apache.org> | 2010-04-13 17:43:02 +0000 |
|---|---|---|
| committer | Alan Conway <aconway@apache.org> | 2010-04-13 17:43:02 +0000 |
| commit | b8a284439c00e81c21307f651c71f8256ae725f9 (patch) | |
| tree | dcd1a247483fb99df4c72dc78ae5a29e5e74e454 /cpp/src/tests/Statistics.cpp | |
| parent | a41bff40eb9080aa99a06b5325d47d995079d5a0 (diff) | |
| download | qpid-python-b8a284439c00e81c21307f651c71f8256ae725f9.tar.gz | |
Make qpid_send/qpid_receive output more spreadsheet-friendly.
- output is tab separated
- --report-header=no suppresses headers
git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk/qpid@933718 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'cpp/src/tests/Statistics.cpp')
| -rw-r--r-- | cpp/src/tests/Statistics.cpp | 23 |
1 files changed, 10 insertions, 13 deletions
diff --git a/cpp/src/tests/Statistics.cpp b/cpp/src/tests/Statistics.cpp index bcc646ce46..87cab2926c 100644 --- a/cpp/src/tests/Statistics.cpp +++ b/cpp/src/tests/Statistics.cpp @@ -27,7 +27,6 @@ namespace qpid { namespace tests { using namespace std; -const int WIDTH=10; Statistic::~Statistic() {} @@ -42,12 +41,12 @@ void Throughput::message(const messaging::Message&) { } void Throughput::header(ostream& o) const { - o << setw(WIDTH) << "msg/sec"; + o << "tp(m/s)"; } void Throughput::report(ostream& o) const { double elapsed(int64_t(sys::Duration(start, sys::now()))/double(sys::TIME_SEC)); - o << setw(WIDTH) << messages/elapsed; + o << fixed << setprecision(0) << messages/elapsed; } ThroughputAndLatency::ThroughputAndLatency() : @@ -73,23 +72,21 @@ void ThroughputAndLatency::message(const messaging::Message& m) { void ThroughputAndLatency::header(ostream& o) const { Throughput::header(o); - o << setw(3*WIDTH) << "latency(ms): min max avg"; + o << '\t' << "l-min" << '\t' << "l-max" << '\t' << "l-avg"; } void ThroughputAndLatency::report(ostream& o) const { Throughput::report(o); if (messages) - o << setw(WIDTH) << min << setw(WIDTH) << max << setw(WIDTH) << total/messages; + o << fixed << setprecision(2) + << '\t' << min << '\t' << max << '\t' << total/messages; else o << "Can't compute latency for 0 messages."; } -ReporterBase::ReporterBase(ostream& o, int batch) - : wantBatch(batch), batchCount(0), headerPrinted(false), out(o) -{ - o.precision(2); - o << fixed; -} +ReporterBase::ReporterBase(ostream& o, int batch, bool wantHeader) + : batchSize(batch), batchCount(0), headerPrinted(!wantHeader), out(o) +{} ReporterBase::~ReporterBase() {} @@ -97,10 +94,10 @@ ReporterBase::~ReporterBase() {} void ReporterBase::message(const messaging::Message& m) { if (!overall.get()) overall = create(); overall->message(m); - if (wantBatch) { + if (batchSize) { if (!batch.get()) batch = create(); batch->message(m); - if (++batchCount == wantBatch) { + if (++batchCount == batchSize) { header(); batch->report(out); out << endl; |
