aboutsummaryrefslogtreecommitdiff
path: root/statsd
diff options
context:
space:
mode:
Diffstat (limited to 'statsd')
-rw-r--r--statsd/stats.cpp37
-rw-r--r--statsd/stats.hpp2
2 files changed, 22 insertions, 17 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;
}
diff --git a/statsd/stats.hpp b/statsd/stats.hpp
index 4e1c18f..b23da40 100644
--- a/statsd/stats.hpp
+++ b/statsd/stats.hpp
@@ -29,7 +29,7 @@ class Stats {
void accept_connection(std::unique_ptr<boost::asio::ip::tcp::socket>&& socket);
- void handle_performance(std::list<Receiver>::iterator it, cmix_proto::Performance const& perf);
+ void handle_performance(std::list<Receiver>::iterator it, cmix_proto::Performance perf);
void handle_message(std::list<Receiver>::iterator it, cmix_proto::CMixMessage message);