notes
[oweals/gnunet.git] / src / util / benchmark.c
index f832931ee02443ffc13f3259e3ac9a0d78d983fb..b5fc2752c8a0cfa42f027629116c19a00bdf0430 100644 (file)
@@ -64,8 +64,9 @@ write_benchmark_data (struct BenchmarkData *bd)
     return;
   }
 
-  GNUNET_asprintf (&s, "%s/gnunet-benchmark-ops-%llu-%llu.txt",
+  GNUNET_asprintf (&s, "%s/gnunet-benchmark-ops-%s-%llu-%llu.txt",
                    benchmark_dir,
+                   (pid == tid) ? "main" : "thread",
                    (unsigned long long) pid,
                    (unsigned long long) tid);
 
@@ -116,8 +117,9 @@ write_benchmark_data (struct BenchmarkData *bd)
 
   GNUNET_assert (GNUNET_OK == GNUNET_DISK_file_close (fh));
 
-  GNUNET_asprintf (&s, "%s/gnunet-benchmark-urls-%llu-%llu.txt",
+  GNUNET_asprintf (&s, "%s/gnunet-benchmark-urls-%s-%llu-%llu.txt",
                    benchmark_dir,
+                   (pid == tid) ? "main" : "thread",
                    (unsigned long long) pid,
                    (unsigned long long) tid);
 
@@ -133,11 +135,12 @@ write_benchmark_data (struct BenchmarkData *bd)
   for (unsigned int i = 0; i < bd->urd_len; i++)
   {
     struct UrlRequestData *urd = &bd->urd[i];
-    GNUNET_asprintf (&s, "url %s status %u count %llu time_us %llu\n",
+    GNUNET_asprintf (&s, "url %s status %u count %llu time_us %llu time_us_max %llu\n",
                      urd->request_url,
                      urd->status,
                      (unsigned long long) urd->count,
-                     (unsigned long long) urd->time.rel_value_us);
+                     (unsigned long long) urd->time.rel_value_us,
+                     (unsigned long long) urd->time_max.rel_value_us);
     GNUNET_assert (GNUNET_SYSERR != GNUNET_DISK_file_write_blocking (fh, s, strlen (s)));
     GNUNET_free (s);
   }
@@ -175,6 +178,7 @@ thread_destructor (void *cls)
     return;
   
   GNUNET_assert (NULL != bd);
+  write_benchmark_data (bd);
 }