From 16c28db384adbe61034eb8a2267cd6a886ffd72f Mon Sep 17 00:00:00 2001 From: Dennis Brentjes Date: Thu, 1 Dec 2016 21:42:51 +0100 Subject: Added the client side code for the statsd in the nodes. --- node/node_node.cpp | 83 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 83 insertions(+) (limited to 'node/node_node.cpp') diff --git a/node/node_node.cpp b/node/node_node.cpp index 27e8042..27104b5 100644 --- a/node/node_node.cpp +++ b/node/node_node.cpp @@ -3,6 +3,7 @@ template void fill_precomputation_pre_message(CMixContext& ctx, cmix_proto::PrePre& prepre, T const& rs, T const& ms) { + if(start_mix(&ctx, rs.size()) != no_error) { exit(-1); } @@ -190,29 +191,62 @@ void Node::handle_node_secretkey(cmix_proto::SecretKey const& secret) void Node::handle_node_prepre(cmix_proto::PrePre const& pre) { if(network_settings.is_first) { + if(performance) { + performance->send("pre_mix_start"); + } + ArenaMessage arena; auto& premix = arena.get(); fill_precomputation_mix_message(cmix_ctx, premix, pre.r_er(), pre.m_er()); next_node.async_send(premix); + + if(performance) { + performance->send("pre_mix_end"); + } } else { + if(performance) { + performance->send("pre_pre_start"); + } + ArenaMessage arena; auto& prepre = arena.get(); fill_precomputation_pre_message(cmix_ctx, prepre, pre.r_er(), pre.m_er()); next_node.async_send(prepre); + + if(performance) { + performance->send("pre_pre_end"); + } } } void Node::handle_node_premix(cmix_proto::PreMix const& premix) { if(network_settings.is_first) { + if(performance) { + performance->send("pre_post_start"); + } + ArenaMessage arena; auto& prepost = arena.get(); fill_precomputation_post_message(cmix_ctx, prepost, premix.r_epirs(), premix.m_epirs()); next_node.async_send(prepost); + + if(performance) { + performance->send("pre_post_end"); + } + } else { + if(performance) { + performance->send("pre_mix_start"); + } + ArenaMessage arena; auto& n_premix = arena.get(); fill_precomputation_mix_message(cmix_ctx, n_premix, premix.r_epirs(), premix.m_epirs()); next_node.async_send(n_premix); + + if(performance) { + performance->send("pre_mix_end"); + } } } @@ -220,24 +254,48 @@ void Node::handle_node_prepost(cmix_proto::PrePost const& prepost) { if(network_settings.is_first) { start_realtime_phase(); } else { + if(performance) { + performance->send("pre_post_start"); + } + ArenaMessage arena; auto& n_prepost = arena.get(); fill_precomputation_post_message(cmix_ctx, n_prepost, prepost.r_epirs(), prepost.m_epirs()); next_node.async_send(n_prepost); + + if(performance) { + performance->send("pre_post_end"); + } } } void Node::handle_node_realpre(cmix_proto::RealPre const& realpre) { if(network_settings.is_first) { + if(performance) { + performance->send("real_mix_start"); + } + ArenaMessage arena; auto& realmix = arena.get(); fill_realtime_mix_message(cmix_ctx, realmix, realpre.m()); next_node.async_send(realmix); + + if(performance) { + performance->send("real_mix_end"); + } } else { + if(performance) { + performance->send("real_pre_start"); + } + ArenaMessage arena; auto& n_realpre = arena.get(); fill_realtime_pre_message(cmix_ctx, n_realpre, realpre.h(), realpre.m(), data); next_node.async_send(n_realpre); + + if(performance) { + performance->send("real_pre_end"); + } } } @@ -245,10 +303,22 @@ void Node::handle_node_realmix(cmix_proto::RealMix const& realmix) { if(network_settings.is_last) { BOOST_LOG_TRIVIAL(trace) << "Doing the last step:"; + if(performance) { + performance->send("real_mix_start"); + } + ArenaMessage arena; auto& n_realmix = arena.get(); fill_realtime_mix_message(cmix_ctx, n_realmix, realmix.m()); + if(performance) { + performance->send("real_mix_end"); + } + + if(performance) { + performance->send("real_post_start"); + } + size_t len = get_group_element_array_size(&cmix_ctx); std::string str; str.resize(len); @@ -280,11 +350,24 @@ void Node::handle_node_realmix(cmix_proto::RealMix const& realmix) { free(dest); free(payload); } + + if(performance) { + performance->send("real_post_end"); + } + } else { + if(performance) { + performance->send("real_mix_start"); + } + ArenaMessage arena; auto& n_realmix = arena.get(); fill_realtime_mix_message(cmix_ctx, n_realmix, realmix.m()); next_node.async_send(n_realmix); + + if(performance) { + performance->send("real_mix_end"); + } } } -- cgit v1.2.3-70-g09d2