gnunet-svn
[Top][All Lists]
Advanced

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

[GNUnet-SVN] r9355 - GNUnet/src/applications/fs/gap


From: gnunet
Subject: [GNUnet-SVN] r9355 - GNUnet/src/applications/fs/gap
Date: Fri, 30 Oct 2009 17:26:17 -0600

Author: nevans
Date: 2009-10-30 17:26:17 -0600 (Fri, 30 Oct 2009)
New Revision: 9355

Modified:
   GNUnet/src/applications/fs/gap/dv_fs.c
   GNUnet/src/applications/fs/gap/dv_querymanager.c
   GNUnet/src/applications/fs/gap/plan.c
   GNUnet/src/applications/fs/gap/test_gap_dv.c
Log:
stat tracking changes

Modified: GNUnet/src/applications/fs/gap/dv_fs.c
===================================================================
--- GNUnet/src/applications/fs/gap/dv_fs.c      2009-10-30 19:34:26 UTC (rev 
9354)
+++ GNUnet/src/applications/fs/gap/dv_fs.c      2009-10-30 23:26:17 UTC (rev 
9355)
@@ -85,6 +85,8 @@
 
 static int stat_gap_trust_awarded;
 
+static int stat_dv_replies_sent;
+
 /**
  * Hard CPU limit
  */
@@ -635,7 +637,7 @@
                      htonl (original_msg->priority) * 2, et);
   if (stats != NULL)
     {
-      //stats->change (stat_trust_earned, req->value_offered);
+      stats->change (stat_dv_replies_sent, 1);
     }
 
   GNUNET_free_non_null (enc);
@@ -982,6 +984,8 @@
         stats->create (gettext_noop ("# gap content total received"));
       stat_gap_trust_awarded =
         stats->create (gettext_noop ("# gap total trust awarded"));
+      stat_dv_replies_sent =
+       stats->create (gettext_noop ("# gap replies sent via dv"));
     }
   identity = coreAPI->service_request ("identity");
   if (identity == NULL)

Modified: GNUnet/src/applications/fs/gap/dv_querymanager.c
===================================================================
--- GNUnet/src/applications/fs/gap/dv_querymanager.c    2009-10-30 19:34:26 UTC 
(rev 9354)
+++ GNUnet/src/applications/fs/gap/dv_querymanager.c    2009-10-30 23:26:17 UTC 
(rev 9355)
@@ -21,7 +21,8 @@
 /**
  * @file fs/gap/dv_querymanager.c
  * @brief management of queries from our clients
- * @author Christian Grothoff, Nathan Evans
+ * @author Christian Grothoff
+ * @author Nathan Evans
  *
  * This code forwards queries (using GAP and DHT) to other peers and
  * passes replies (from GAP or DHT) back to clients.

Modified: GNUnet/src/applications/fs/gap/plan.c
===================================================================
--- GNUnet/src/applications/fs/gap/plan.c       2009-10-30 19:34:26 UTC (rev 
9354)
+++ GNUnet/src/applications/fs/gap/plan.c       2009-10-30 23:26:17 UTC (rev 
9355)
@@ -529,6 +529,14 @@
   info = clients;
   while ((info != NULL) && ((info->client != client) || (info->peer != peer)))
     info = info->next;
+  /* We have a specific peer targeted for this request,
+   * abandon normal processing if we have DV available and
+   * try to send direct to this peer (provided we are using
+   * non-anonymous download) */
+  if ((request->primary_target != 0) && (request->anonymityLevel == 0))
+  {
+       fprintf(stdout, "In plan.c, received non-anonymous request for data and 
we have a specific peer in mind to download from!\n");
+  }
 
   /* for all connected peers compute ranking */
   rpc.info = info;

Modified: GNUnet/src/applications/fs/gap/test_gap_dv.c
===================================================================
--- GNUnet/src/applications/fs/gap/test_gap_dv.c        2009-10-30 19:34:26 UTC 
(rev 9354)
+++ GNUnet/src/applications/fs/gap/test_gap_dv.c        2009-10-30 23:26:17 UTC 
(rev 9355)
@@ -72,6 +72,14 @@
 static int have_uri;
 static unsigned int downloads_running;
 
+static unsigned long long total_gap_queries_sent;
+static unsigned long long total_gap_requests_started;
+static unsigned long long total_gap_replies_to_client;
+static unsigned long long total_gap_dv_requests_sent;
+static unsigned long long total_gap_requests_dropped;
+static unsigned long long total_gap_requests_received;
+static unsigned long long total_gap_dv_replies;
+
 /* Main URI to be assigned for each file */
 static struct GNUNET_ECRS_URI *file_uri;
 
@@ -95,6 +103,26 @@
 
 #define CHECK(a) do { if (!(a)) { ret = 1; GNUNET_GE_BREAK(ectx, 0); goto 
FAILURE; } } while(0)
 
+static int
+getGAPStats (const char *name, unsigned long long value, void *cls)
+{
+  if ((value > 0) && (strstr (name, _("# gap client requests injected")) != 
NULL))
+               total_gap_requests_started += value;
+  else if ((value > 0) && (strstr (name, _("# gap requests total sent")) != 
NULL))
+       total_gap_queries_sent += value;
+       else if ((value > 0) && (strstr (name, _("# dv gap requests sent")) != 
NULL))
+               total_gap_dv_requests_sent += value;
+       else if ((value > 0) && (strstr (name, _("# gap replies sent to 
client")) != NULL))
+               total_gap_replies_to_client += value;
+       else if ((value > 0) && (strstr (name, _("# gap requests dropped due to 
load")) != NULL))
+               total_gap_requests_dropped += value;
+       else if ((value > 0) && (strstr (name, _("# gap requests total 
received")) != NULL))
+               total_gap_requests_received += value;
+       else if ((value > 0) && (strstr (name, _("# gap replies sent via dv")) 
!= NULL))
+               total_gap_dv_replies += value;
+  return GNUNET_OK;
+}
+
 static char *
 makeName (unsigned int i)
 {
@@ -261,7 +289,6 @@
   ctx = GNUNET_FSUI_start (ectx, cfg, "gnunet-insert", GNUNET_NO, 32,   /* 
make configurable */
                                                                                
                         &printstatus, &verbose);
 
-       /* first insert all of the top-level files or directories */
        GNUNET_meta_data_add_publication_date (meta);
        start_time = GNUNET_get_time ();
        ul = GNUNET_FSUI_upload_start (ctx,
@@ -464,6 +491,15 @@
   int j;
   int len;
 
+  unsigned long long old_total_gap_queries_sent;
+  unsigned long long old_total_gap_requests_started;
+  unsigned long long old_total_gap_replies_to_client;
+  unsigned long long old_total_gap_dv_requests_sent;
+  unsigned long long new_total_gap_queries_sent;
+  unsigned long long new_total_gap_requests_started;
+  unsigned long long new_total_gap_replies_to_client;
+  unsigned long long new_total_gap_dv_requests_sent;
+
   unsigned int rand_peer;
   unsigned int temp_rand_peer;
 
@@ -474,6 +510,14 @@
 
   const char *filename;
 
+  GNUNET_CronTime startTime;
+  GNUNET_CronTime endTime;
+
+  struct GNUNET_ClientServerConnection *sock;
+#ifdef WAIT
+       int r;
+#endif
+
   fd = -1;
        if ((argc == 3) && (strcmp(argv[1], "-o") == 0))
        {
@@ -483,13 +527,6 @@
                        return fd;
        }
 
-  GNUNET_CronTime startTime;
-  GNUNET_CronTime endTime;
-#ifdef WAIT
-  struct GNUNET_ClientServerConnection *sock;
-       int r;
-#endif
-
   ectx = NULL;
   cfg = GNUNET_GC_create ();
   if (-1 == GNUNET_GC_parse_configuration (cfg, "gap_test.conf"))
@@ -513,7 +550,8 @@
       peer_array[i] = pos;
       pos = pos->next;
     }
-  sleep (30);
+  fprintf(stdout, "Sleeping for ten minutes\n");
+  GNUNET_thread_sleep (600 * GNUNET_CRON_SECONDS);
 
   /* Insert at random peer, search for data (to get proper uri), then try to 
download
    * from peers 0, 1, 2, and 3 hops away from upload peer to get speed 
results. */
@@ -573,6 +611,36 @@
                                ret = WRITE (fd, buf, len - 1);
                                GNUNET_free(buf);
                        }
+
+                       old_total_gap_queries_sent = total_gap_queries_sent;
+                       old_total_gap_requests_started = 
total_gap_requests_started;
+                       old_total_gap_replies_to_client = 
total_gap_replies_to_client;
+                       old_total_gap_dv_requests_sent = 
total_gap_dv_requests_sent;
+
+
+                       total_gap_queries_sent = 0;
+                       total_gap_requests_started = 0;
+                       total_gap_replies_to_client = 0;
+                       total_gap_dv_requests_sent = 0;
+
+
+                       for (i = 0; i < NUM_PEERS; i++)
+                               {
+                                       if (GNUNET_shutdown_test () == 
GNUNET_YES)
+                                               break;
+
+                                       sock =
+                                               GNUNET_client_connection_create 
(NULL, peer_array[i]->config);
+                                       GNUNET_STATS_get_statistics (NULL, 
sock, &getGAPStats, NULL);
+                                       GNUNET_client_connection_destroy (sock);
+                               }
+
+                       new_total_gap_queries_sent = total_gap_queries_sent - 
old_total_gap_queries_sent;
+                       new_total_gap_requests_started = 
total_gap_requests_started - old_total_gap_requests_started;
+                       new_total_gap_replies_to_client = 
total_gap_replies_to_client - old_total_gap_replies_to_client;
+                       new_total_gap_dv_requests_sent = 
total_gap_dv_requests_sent - old_total_gap_dv_requests_sent;
+
+                       fprintf(stdout, "Total gap requests initiated: 
%llu\nTotal gap queries sent: %llu\nTotal dv requests sent: %llu\nTotal replies 
to clients: %llu\n", new_total_gap_requests_started, 
new_total_gap_requests_started, new_total_gap_dv_requests_sent, 
new_total_gap_replies_to_client);
                        if (GNUNET_shutdown_test() == GNUNET_YES)
                                break;
                        GNUNET_free(file_uri);





reply via email to

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