gnunet-svn
[Top][All Lists]
Advanced

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

[GNUnet-SVN] r29463 - gnunet/src/ats-tests


From: gnunet
Subject: [GNUnet-SVN] r29463 - gnunet/src/ats-tests
Date: Sat, 21 Sep 2013 23:08:52 +0200

Author: wachs
Date: 2013-09-21 23:08:52 +0200 (Sat, 21 Sep 2013)
New Revision: 29463

Modified:
   gnunet/src/ats-tests/perf_ats.c
   gnunet/src/ats-tests/perf_ats_logging.c
Log:
logging on demand + log bandwidth


Modified: gnunet/src/ats-tests/perf_ats.c
===================================================================
--- gnunet/src/ats-tests/perf_ats.c     2013-09-21 20:55:20 UTC (rev 29462)
+++ gnunet/src/ats-tests/perf_ats.c     2013-09-21 21:08:52 UTC (rev 29463)
@@ -750,27 +750,15 @@
 comm_handle_pong (void *cls, const struct GNUNET_PeerIdentity *other,
     const struct GNUNET_MessageHeader *message)
 {
-  int c_s;
   struct BenchmarkPeer *me = cls;
   struct BenchmarkPartner *p = NULL;
 
-  for (c_s = 0; c_s < num_slaves; c_s++)
+  if (NULL == (p = find_partner (me, other)))
   {
-    if (0
-        == memcmp (other, &me->partners[c_s].dest->id,
-            sizeof(struct GNUNET_PeerIdentity)))
-    {
-      p = &me->partners[c_s];
-      break;
-    }
-  }
-  if (NULL == p)
-  {
     GNUNET_break(0);
     return GNUNET_SYSERR;
   }
 
-
   GNUNET_log(GNUNET_ERROR_TYPE_DEBUG,
       "Master [%u]: Received PONG from [%u], next message\n", me->no,
       p->dest->no);
@@ -920,23 +908,11 @@
 {
   struct BenchmarkPeer *me = cls;
   struct BenchmarkPartner *p;
-  int c_s;
   int c_a;
+  int log;
   char *peer_id;
 
-  p = NULL;
-  for (c_s = 0; c_s < me->num_partners; c_s++)
-  {
-
-    if (0 == memcmp (&address->peer, &me->partners[c_s].dest->id,
-        sizeof (struct GNUNET_PeerIdentity)))
-    {
-      p = &me->partners[c_s];
-      break;
-    }
-
-  }
-
+  p = find_partner (me, &address->peer);
   if (NULL == p)
   {
     /* This is not one of my partners
@@ -944,9 +920,15 @@
      */
     return;
   }
-
   peer_id = GNUNET_strdup (GNUNET_i2s (&me->id));
 
+  log = GNUNET_NO;
+  if ((p->bandwidth_in != ntohl (bandwidth_in.value__)) ||
+      (p->bandwidth_out != ntohl (bandwidth_out.value__)))
+      log = GNUNET_YES;
+  p->bandwidth_in = ntohl (bandwidth_in.value__);
+  p->bandwidth_out = ntohl (bandwidth_out.value__);
+
   for (c_a = 0; c_a < ats_count; c_a++)
   {
     GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "%s [%u] received ATS information: %s 
%s %u\n",
@@ -960,36 +942,52 @@
       case GNUNET_ATS_ARRAY_TERMINATOR:
         break;
       case GNUNET_ATS_UTILIZATION_UP:
+        if (p->ats_utilization_up != ntohl (ats[c_a].value))
+            log = GNUNET_YES;
         p->ats_utilization_up = ntohl (ats[c_a].value);
+
         break;
       case GNUNET_ATS_UTILIZATION_DOWN:
+        if (p->ats_utilization_down != ntohl (ats[c_a].value))
+            log = GNUNET_YES;
         p->ats_utilization_down = ntohl (ats[c_a].value);
         break;
       case GNUNET_ATS_NETWORK_TYPE:
+        if (p->ats_network_type != ntohl (ats[c_a].value))
+            log = GNUNET_YES;
         p->ats_network_type = ntohl (ats[c_a].value);
         break;
       case GNUNET_ATS_QUALITY_NET_DELAY:
+        if (p->ats_delay != ntohl (ats[c_a].value))
+            log = GNUNET_YES;
         p->ats_delay = ntohl (ats[c_a].value);
         break;
       case GNUNET_ATS_QUALITY_NET_DISTANCE:
+        if (p->ats_distance != ntohl (ats[c_a].value))
+            log = GNUNET_YES;
         p->ats_distance = ntohl (ats[c_a].value);
         GNUNET_break (0);
         break;
       case GNUNET_ATS_COST_WAN:
+        if (p->ats_cost_wan != ntohl (ats[c_a].value))
+            log = GNUNET_YES;
         p->ats_cost_wan = ntohl (ats[c_a].value);
         break;
       case GNUNET_ATS_COST_LAN:
+        if (p->ats_cost_lan != ntohl (ats[c_a].value))
+            log = GNUNET_YES;
         p->ats_cost_lan = ntohl (ats[c_a].value);
         break;
       case GNUNET_ATS_COST_WLAN:
+        if (p->ats_cost_wlan != ntohl (ats[c_a].value))
+            log = GNUNET_YES;
         p->ats_cost_wlan = ntohl (ats[c_a].value);
         break;
-        break;
       default:
         break;
     }
   }
-  if (GNUNET_YES == logging)
+  if ((GNUNET_YES == logging) && (GNUNET_YES == log))
     collect_log_now();
   GNUNET_free(peer_id);
 }

Modified: gnunet/src/ats-tests/perf_ats_logging.c
===================================================================
--- gnunet/src/ats-tests/perf_ats_logging.c     2013-09-21 20:55:20 UTC (rev 
29462)
+++ gnunet/src/ats-tests/perf_ats_logging.c     2013-09-21 21:08:52 UTC (rev 
29463)
@@ -521,7 +521,6 @@
       slt->ats_utilization_down = p->ats_utilization_down;
       slt->ats_utilization_up = p->ats_utilization_up;
 
-
       /* Total application level rtt  */
       if (NULL == mlt->prev)
       {




reply via email to

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