diff options
| author | Dennis Brentjes <d.brentjes@gmail.com> | 2017-05-21 14:27:55 +0200 |
|---|---|---|
| committer | Dennis Brentjes <d.brentjes@gmail.com> | 2017-05-21 14:27:55 +0200 |
| commit | e1e1e9ac34ab70c3a1f2344361c7e04e5f15c3bd (patch) | |
| tree | bf9c27edae6fb6c6f0c186cc06db92378e53055b /statsd/stats.cpp | |
| parent | ce2d83a434cea8a6317690aadbb478a58858ad5b (diff) | |
| download | cmix-e1e1e9ac34ab70c3a1f2344361c7e04e5f15c3bd.tar.gz cmix-e1e1e9ac34ab70c3a1f2344361c7e04e5f15c3bd.tar.bz2 cmix-e1e1e9ac34ab70c3a1f2344361c7e04e5f15c3bd.zip | |
Removes bias from generating random curve points.
Diffstat (limited to 'statsd/stats.cpp')
| -rw-r--r-- | statsd/stats.cpp | 37 |
1 files changed, 21 insertions, 16 deletions
diff --git a/statsd/stats.cpp b/statsd/stats.cpp index a448449..2202f32 100644 --- a/statsd/stats.cpp +++ b/statsd/stats.cpp @@ -12,7 +12,7 @@ void Stats::accept_connection(std::unique_ptr<boost::asio::ip::tcp::socket>&& so }); } -void Stats::handle_performance(std::list<Receiver>::iterator it, const cmix_proto::Performance& perf) { +void Stats::handle_performance(std::list<Receiver>::iterator it, cmix_proto::Performance perf) { data[perf.node()][perf.column() + "wall_time"].push_back(std::stol(perf.wall_time())); data[perf.node()][perf.column() + "system_time"].push_back(std::stol(perf.system_time())); data[perf.node()][perf.column() + "user_time"].push_back(std::stol(perf.user_time())); @@ -24,20 +24,20 @@ void Stats::handle_performance(std::list<Receiver>::iterator it, const cmix_prot void Stats::handle_message(std::list<Receiver>::iterator it, cmix_proto::CMixMessage message) { switch(message.contents_case()) { - case cmix_proto::CMixMessage::ContentsCase::kPerformance: { - BOOST_LOG_TRIVIAL(trace) << "Handling performance"; - handle_performance(it, message.performance()); - break; - } - case cmix_proto::CMixMessage::ContentsCase::kBye: { - BOOST_LOG_TRIVIAL(trace) << "Handling Bye"; - - break; - } - default: { - BOOST_LOG_TRIVIAL(error) << "handle_message: CMixMessage contains unknown contents."; - connections.erase(it); - } + case cmix_proto::CMixMessage::ContentsCase::kPerformance: { + BOOST_LOG_TRIVIAL(trace) << "Handling performance"; + handle_performance(it, message.performance()); + break; + } + case cmix_proto::CMixMessage::ContentsCase::kBye: { + BOOST_LOG_TRIVIAL(trace) << "Handling Bye"; + + break; + } + default: { + BOOST_LOG_TRIVIAL(error) << "handle_message: CMixMessage contains unknown contents."; + connections.erase(it); + } } } @@ -67,7 +67,12 @@ void Stats::output(std::string file) if(it != table.second.begin()) { ofs << ", "; } - ofs << it->second[i]; + if(table.second.begin()->second.size() != it->second.size()) { + ofs << it->second[i*2]; + } else { + ofs << it->second[i]; + } + } ofs << std::endl; } |
