gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[GNUnet-SVN] [gnunet] 01/06: rps profiler: fix logging of statistic valu


From: gnunet
Subject: [GNUnet-SVN] [gnunet] 01/06: rps profiler: fix logging of statistic values
Date: Wed, 04 Apr 2018 08:54:46 +0200

This is an automated email from the git hooks/post-receive script.

julius-buenger pushed a commit to branch master
in repository gnunet.

commit 0d0a91e78153b98f6f7df13731d90e2ee52d22ad
Author: Julius Bünger <address@hidden>
AuthorDate: Wed Apr 4 08:04:40 2018 +0200

    rps profiler: fix logging of statistic values
---
 src/rps/test_rps.c | 84 +++++++++++++++++++++++++++++++++---------------------
 1 file changed, 52 insertions(+), 32 deletions(-)

diff --git a/src/rps/test_rps.c b/src/rps/test_rps.c
index 93a406aaf..22f428e2e 100644
--- a/src/rps/test_rps.c
+++ b/src/rps/test_rps.c
@@ -1968,11 +1968,14 @@ void write_final_stats (void){
   for (i = 0; i < num_peers; i++)
   {
     to_file ("/tmp/rps/final_stats.dat",
-             "%s %" PRIu64
-             " %" PRIu64 " %" PRIu64 " %" PRIu64 " %" PRIu64 " %" PRIu64 " %" 
PRIu64 /* blocking */
-             " %" PRIu64 " %" PRIu64 " %" PRIu64 /* issued */
-             " %" PRIu64 " %" PRIu64 " %" PRIu64 /* sent */
-             " %" PRIu64 " %" PRIu64 " %" PRIu64 /* recv */,
+             "%" PRIu32 " " /* index */
+             "%s %" /* id */
+             PRIu64 " %" /* rounds */
+             PRIu64 " %" PRIu64 " %" PRIu64 " %" PRIu64 " %" PRIu64 " %" 
PRIu64 " %" /* blocking */
+             PRIu64 " %" PRIu64 " %" PRIu64 " %" /* issued */
+             PRIu64 " %" PRIu64 " %" PRIu64 " %" /* sent */
+             PRIu64 " %" PRIu64 " %" PRIu64 /* recv */,
+             i,
              GNUNET_i2s (rps_peers[i].peer_id),
              rps_peers[i].num_rounds,
              rps_peers[i].num_blocks,
@@ -2049,67 +2052,67 @@ post_test_shutdown_ready_cb (void *cls,
  */
 enum STAT_TYPE stat_str_2_type (const char *stat_str)
 {
-  if (GNUNET_YES == strncmp ("# rounds", stat_str, strlen ("# rounds")))
+  if (0 == strncmp ("# rounds blocked - no pull replies", stat_str, strlen ("# 
rounds blocked - no pull replies")))
   {
-    return STAT_TYPE_ROUNDS;
+    return STAT_TYPE_BLOCKS_NO_PULL;
   }
-  if (GNUNET_YES == strncmp ("# rounds blocked", stat_str, strlen ("# rounds 
blocked")))
+  else if (0 == strncmp ("# rounds blocked - too many pushes, no pull 
replies", stat_str, strlen ("# rounds blocked - too many pushes, no pull 
replies")))
   {
-    return STAT_TYPE_BLOCKS;
+    return STAT_TYPE_BLOCKS_MANY_PUSH_NO_PULL;
   }
-  if (0 == strncmp ("# rounds blocked - too many pushes", stat_str, strlen ("# 
rounds blocked - too many pushes")))
+  else if (0 == strncmp ("# rounds blocked - too many pushes", stat_str, 
strlen ("# rounds blocked - too many pushes")))
   {
     return STAT_TYPE_BLOCKS_MANY_PUSH;
   }
-  if (0 == strncmp ("# rounds blocked - no pushes", stat_str, strlen ("# 
rounds blocked - no pushes")))
+  else if (0 == strncmp ("# rounds blocked - no pushes, no pull replies", 
stat_str, strlen ("# rounds blocked - no pushes, no pull replies")))
   {
-    return STAT_TYPE_BLOCKS_NO_PUSH;
+    return STAT_TYPE_BLOCKS_NO_PUSH_NO_PULL;
   }
-  if (0 == strncmp ("# rounds blocked - no pull replies", stat_str, strlen ("# 
rounds blocked - no pull replies")))
+  else if (0 == strncmp ("# rounds blocked - no pushes", stat_str, strlen ("# 
rounds blocked - no pushes")))
   {
-    return STAT_TYPE_BLOCKS_NO_PULL;
+    return STAT_TYPE_BLOCKS_NO_PUSH;
   }
-  if (0 == strncmp ("# rounds blocked - too many pushes, no pull replies", 
stat_str, strlen ("# rounds blocked - too many pushes, no pull replies")))
+  else if (0 == strncmp ("# rounds blocked", stat_str, strlen ("# rounds 
blocked")))
   {
-    return STAT_TYPE_BLOCKS_MANY_PUSH_NO_PULL;
+    return STAT_TYPE_BLOCKS;
   }
-  if (0 == strncmp ("# rounds blocked - no pushes, no pull replies", stat_str, 
strlen ("# rounds blocked - no pushes, no pull replies")))
+  else if (0 == strncmp ("# rounds", stat_str, strlen ("# rounds")))
   {
-    return STAT_TYPE_BLOCKS_NO_PUSH_NO_PULL;
+    return STAT_TYPE_ROUNDS;
   }
-  if (0 == strncmp ("# push send issued", stat_str, strlen ("# push send 
issued")))
+  else if (0 == strncmp ("# push send issued", stat_str, strlen ("# push send 
issued")))
   {
     return STAT_TYPE_ISSUED_PUSH_SEND;
   }
-  if (0 == strncmp ("# pull request send issued", stat_str, strlen ("# pull 
request send issued")))
+  else if (0 == strncmp ("# pull request send issued", stat_str, strlen ("# 
pull request send issued")))
   {
     return STAT_TYPE_ISSUED_PULL_REQ;
   }
-  if (0 == strncmp ("# pull reply send issued", stat_str, strlen ("# pull 
reply send issued")))
+  else if (0 == strncmp ("# pull reply send issued", stat_str, strlen ("# pull 
reply send issued")))
   {
     return STAT_TYPE_ISSUED_PULL_REP;
   }
-  if (0 == strncmp ("# pushes sent", stat_str, strlen ("# pushes sent")))
+  else if (0 == strncmp ("# pushes sent", stat_str, strlen ("# pushes sent")))
   {
     return STAT_TYPE_SENT_PUSH_SEND;
   }
-  if (0 == strncmp ("# pull requests sent", stat_str, strlen ("# pull requests 
sent")))
+  else if (0 == strncmp ("# pull requests sent", stat_str, strlen ("# pull 
requests sent")))
   {
     return STAT_TYPE_SENT_PULL_REQ;
   }
-  if (0 == strncmp ("# pull replys sent", stat_str, strlen ("# pull replys 
sent")))
+  else if (0 == strncmp ("# pull replys sent", stat_str, strlen ("# pull 
replys sent")))
   {
     return STAT_TYPE_SENT_PULL_REP;
   }
-  if (0 == strncmp ("# push message received", stat_str, strlen ("# push 
message received")))
+  else if (0 == strncmp ("# push message received", stat_str, strlen ("# push 
message received")))
   {
     return STAT_TYPE_RECV_PUSH_SEND;
   }
-  if (0 == strncmp ("# pull request message received", stat_str, strlen ("# 
pull request message received")))
+  else if (0 == strncmp ("# pull request message received", stat_str, strlen 
("# pull request message received")))
   {
     return STAT_TYPE_RECV_PULL_REQ;
   }
-  if (0 == strncmp ("# pull reply messages received", stat_str, strlen ("# 
pull reply messages received")))
+  else if (0 == strncmp ("# pull reply messages received", stat_str, strlen 
("# pull reply messages received")))
   {
     return STAT_TYPE_RECV_PULL_REP;
   }
@@ -2191,49 +2194,66 @@ stat_iterator (void *cls,
       //stat_type_2_str (stat_cls->stat_type),
       name,
       value);
-  //to_file (rps_peer->file_name_stats,
-  //        "%s: %" PRIu64 "\n",
-  //        name,
-  //        value);
+  to_file (rps_peer->file_name_stats,
+          "%s: %" PRIu64 "\n",
+          name,
+          value);
   switch (stat_str_2_type (name))
   {
     case STAT_TYPE_ROUNDS:
-      rps_peer->num_blocks = value;
+      rps_peer->num_rounds = value;
+      break;
     case STAT_TYPE_BLOCKS:
       rps_peer->num_blocks = value;
+      break;
     case STAT_TYPE_BLOCKS_MANY_PUSH:
       rps_peer->num_blocks_many_push = value;
+      break;
     case STAT_TYPE_BLOCKS_NO_PUSH:
       rps_peer->num_blocks_no_push = value;
+      break;
     case STAT_TYPE_BLOCKS_NO_PULL:
       rps_peer->num_blocks_no_pull = value;
+      break;
     case STAT_TYPE_BLOCKS_MANY_PUSH_NO_PULL:
       rps_peer->num_blocks_many_push_no_pull = value;
+      break;
     case STAT_TYPE_BLOCKS_NO_PUSH_NO_PULL:
       rps_peer->num_blocks_no_push_no_pull = value;
+      break;
     case STAT_TYPE_ISSUED_PUSH_SEND:
       rps_peer->num_issued_push = value;
+      break;
     case STAT_TYPE_ISSUED_PULL_REQ:
       rps_peer->num_issued_pull_req = value;
+      break;
     case STAT_TYPE_ISSUED_PULL_REP:
       rps_peer->num_issued_pull_rep = value;
+      break;
     case STAT_TYPE_SENT_PUSH_SEND:
       rps_peer->num_sent_push = value;
+      break;
     case STAT_TYPE_SENT_PULL_REQ:
       rps_peer->num_sent_pull_req = value;
+      break;
     case STAT_TYPE_SENT_PULL_REP:
       rps_peer->num_sent_pull_rep = value;
+      break;
     case STAT_TYPE_RECV_PUSH_SEND:
       rps_peer->num_recv_push = value;
+      break;
     case STAT_TYPE_RECV_PULL_REQ:
       rps_peer->num_recv_pull_req = value;
+      break;
     case STAT_TYPE_RECV_PULL_REP:
       rps_peer->num_recv_pull_rep = value;
+      break;
     case STAT_TYPE_MAX:
     default:
       GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
                  "Unknown statistics string: %s\n",
                  name);
+      break;
   }
   return GNUNET_OK;
 }

-- 
To stop receiving notification emails like this one, please contact
address@hidden



reply via email to

[Prev in Thread] Current Thread [Next in Thread]