cleaner stats
[oweals/gnunet.git] / src / fs / perf_gnunet_service_fs_p2p.c
index b836f6772b13f05c7aee91f34cd830d58d5e0435..ac445899422d4c03bc1dc90a377e50b7a7bd0fe7 100644 (file)
@@ -27,7 +27,7 @@
 #include "fs_test_lib.h"
 #include "gnunet_testing_lib.h"
 
-#define VERBOSE GNUNET_NO
+#define VERBOSE GNUNET_YES
 
 /**
  * File-size we use for testing.
@@ -37,7 +37,7 @@
 /**
  * How long until we give up on transmitting the message?
  */
-#define TIMEOUT GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_MINUTES, 3)
+#define TIMEOUT GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_MINUTES, 300)
 
 #define NUM_DAEMONS 2
 
@@ -82,15 +82,26 @@ struct StatValues
  */
 static struct StatValues stats[] =
   {
-    { "fs", "queries forwarded"},
-    { "fs", "replies received and matched"},
-    { "core", "bytes decrypted"},
-    { "core", "bytes encrypted"},
-    { "transport", "bytes received via TCP"},
-    { "transport", "bytes transmitted via TCP"},
-    { "datacache", "bytes stored"},
-    { "dht", "DHT ROUTE Requests Seen"},
-    { "dht", "DHT ROUTE Requests Forwarded"},
+    { "fs", "# queries forwarded"},
+    { "fs", "# replies received and matched"},
+    { "fs", "# results found locally"},
+    { "fs", "# requests forwarded due to high load"},
+    { "fs", "# requests done for free (low load)"},
+    { "fs", "# P2P searches received"},
+    { "fs", "# replies received for local clients"},
+    { "fs", "# P2P searches discarded (queue length bound)"},
+    { "fs", "# requests dropped due to high load"},
+    { "fs", "# requests dropped by datastore (queue length limit)"},
+    { "fs", "# queries retransmitted to same target"},
+    { "fs", "cummulative artificial delay introduced (ms)"},
+    { "core", "# bytes decrypted"},
+    { "core", "# bytes encrypted"},
+    { "core", "# transmissions delayed due to corking"},
+    { "transport", "# bytes received via TCP"},
+    { "transport", "# bytes transmitted via TCP"},
+    { "datacache", "# bytes stored"},
+    { "dht", "# DHT ROUTE Requests Seen"},
+    { "dht", "# DHT ROUTE Requests Forwarded"},
     { NULL, NULL}
   };
 
@@ -114,7 +125,7 @@ print_stat (void *cls,
 {
   struct StatMaster *sm = cls;
   fprintf (stderr,
-          "Peer %3u: %8s/%40s = %llu\n",
+          "Peer %2u: %12s/%50s = %12llu\n",
           sm->daemon,
           subsystem,
           name,
@@ -122,6 +133,7 @@ print_stat (void *cls,
   return GNUNET_OK;
 }
 
+
 /**
  * Function that gathers stats from all daemons.
  */
@@ -129,6 +141,7 @@ static void
 stat_run (void *cls,
          const struct GNUNET_SCHEDULER_TaskContext *tc);
 
+
 /**
  * Function called when GET operation on stats is done.
  */
@@ -142,6 +155,7 @@ get_done (void *cls,
   GNUNET_SCHEDULER_add_now (sched, &stat_run, sm);
 }
 
+
 /**
  * Function that gathers stats from all daemons.
  */
@@ -154,8 +168,12 @@ stat_run (void *cls,
   if (stats[sm->value].name != NULL)
     {
       GNUNET_STATISTICS_get (sm->stat,
+#if 0
+                            NULL, NULL, 
+#else
                             stats[sm->value].subsystem,
                             stats[sm->value].name,
+#endif
                             GNUNET_TIME_UNIT_FOREVER_REL,
                             &get_done,
                             &print_stat, sm);
@@ -206,7 +224,7 @@ do_report (void *cls,
     }
   else
     {
-      GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+      GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
                  "Timeout during download, shutting down with error\n");
       ok = 1;
       GNUNET_SCHEDULER_add_now (sched, &do_stop, NULL);
@@ -223,7 +241,7 @@ do_download (void *cls,
       GNUNET_FS_TEST_daemons_stop (sched,
                                   NUM_DAEMONS,
                                   daemons);
-      GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+      GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
                  "Timeout during upload attempt, shutting down with error\n");
       ok = 1;
       return;
@@ -250,7 +268,7 @@ do_publish (void *cls,
       GNUNET_FS_TEST_daemons_stop (sched,
                                   NUM_DAEMONS,
                                   daemons);
-      GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+      GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
                  "Error trying to connect: %s\n",
                  emsg);
       ok = 1;
@@ -326,7 +344,7 @@ main (int argc, char *argv[])
     GNUNET_GETOPT_OPTION_END
   };
 
-  GNUNET_DISK_directory_remove ("/tmp/gnunet-perf-fs-lib/");
+  GNUNET_DISK_directory_remove ("/tmp/gnunet-test-fs-lib/");
   GNUNET_log_setup ("perf_gnunet_service_fs_p2p", 
 #if VERBOSE
                    "DEBUG",
@@ -337,7 +355,7 @@ main (int argc, char *argv[])
   GNUNET_PROGRAM_run ((sizeof (argvx) / sizeof (char *)) - 1,
                       argvx, "perf-gnunet-service-fs-p2p",
                      "nohelp", options, &run, NULL);
-  GNUNET_DISK_directory_remove ("/tmp/gnunet-perf-fs-lib/");
+  GNUNET_DISK_directory_remove ("/tmp/gnunet-test-fs-lib/");
   return ok;
 }