Improving safe aggregator draft default tip
authorSAFE <safe@eg.bucknell.edu>
Thu, 13 Jun 2013 15:19:44 -0400
changeset 7954 33ce72f516b4
parent 7953 4c134bbc0e76
Improving safe aggregator
src/data-collection/examples/mm1-queue-safe.cc
src/data-collection/model/safe-aggregator.cc
src/stats/examples/wscript
--- a/src/data-collection/examples/mm1-queue-safe.cc	Tue Jun 11 17:08:43 2013 -0400
+++ b/src/data-collection/examples/mm1-queue-safe.cc	Thu Jun 13 15:19:44 2013 -0400
@@ -173,7 +173,7 @@
 }
 
 MM1Simulation::~MM1Simulation() {
-
+  printf("Total number of customers: %d\n",customerCount);
 }
 
 void MM1Simulation::start() {
--- a/src/data-collection/model/safe-aggregator.cc	Tue Jun 11 17:08:43 2013 -0400
+++ b/src/data-collection/model/safe-aggregator.cc	Thu Jun 13 15:19:44 2013 -0400
@@ -62,7 +62,7 @@
   m_metricType.push_back(std::string("double"));
   //Send to worker
   std::stringstream ss;
-  ss << "{type:\"newMetric\", name:\""<<name.c_str()<<"\", metric_type:\"double\"}";
+  ss << "{\"type\":\"new_metric\", \"name\":\""<<name.c_str()<<"\", \"metric_type\":\"double\"}";
   std::string msg = ss.str();
   //Worker will receive messages in the same order, so it will know the vector position
   send2SAFE(msg);
@@ -81,7 +81,7 @@
 
   char * base64val = base64_encode((const unsigned char*)&newData, sizeof(double));
   std::stringstream ss;
-  ss << "{type:\"result\", pos:"<<pos<<", value: \""<< base64val <<"\"}";
+  ss << "{\"type\":\"result\", \"pos\":"<<pos<<", \"value\": \""<< base64val <<"\"}";
   
   std::string msg = ss.str();
   send2SAFE(msg);
@@ -90,7 +90,7 @@
 void
 SafeAggregator::send2SAFE(const std::string msg)
 {
-  printf("Sending to SAFE: %s\n",msg.c_str());
+  //printf("Sending to SAFE: %s\n",msg.c_str());
   uint32_t size;
   //string size needs to be in network byte order
   size = htonl(msg.size());
--- a/src/stats/examples/wscript	Tue Jun 11 17:08:43 2013 -0400
+++ b/src/stats/examples/wscript	Thu Jun 13 15:19:44 2013 -0400
@@ -4,5 +4,5 @@
     if not bld.env['ENABLE_EXAMPLES']:
         return;
 
-    obj = bld.create_ns3_program('mm1-queue', ['core', 'network', 'stats', 'tools'])
-    obj.source = 'mm1-queue.cc'
+    #obj = bld.create_ns3_program('mm1-queue', ['core', 'network', 'stats', 'tools'])
+    #obj.source = 'mm1-queue.cc'