gnunet-svn
[Top][All Lists]
Advanced

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

[GNUnet-SVN] [taler-exchange] branch master updated (e9c9ca73 -> b7bbc4c


From: gnunet
Subject: [GNUnet-SVN] [taler-exchange] branch master updated (e9c9ca73 -> b7bbc4cc)
Date: Tue, 02 Oct 2018 17:28:19 +0200

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

dold pushed a change to branch master
in repository exchange.

    from e9c9ca73 fix loop that checks link response
     new 97afbe63 write exchange stats on exit
     new b7bbc4cc print CPU time for benchmark descendant processes

The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 src/benchmark/taler-exchange-benchmark.c |  6 ++++
 src/exchange/taler-exchange-httpd.c      | 49 ++++++++++++++++++++++++++++++++
 2 files changed, 55 insertions(+)

diff --git a/src/benchmark/taler-exchange-benchmark.c 
b/src/benchmark/taler-exchange-benchmark.c
index 7b63b987..031b68a3 100644
--- a/src/benchmark/taler-exchange-benchmark.c
+++ b/src/benchmark/taler-exchange-benchmark.c
@@ -28,6 +28,7 @@
 #include "platform.h"
 #include <gnunet/gnunet_util_lib.h>
 #include <microhttpd.h>
+#include <sys/resource.h>
 #include "taler_util.h"
 #include "taler_signatures.h"
 #include "taler_exchange_service.h"
@@ -999,6 +1000,8 @@ main (int argc,
   duration = GNUNET_TIME_absolute_get_duration (start_time);
   if (GNUNET_OK == result)
   {
+    struct rusage usage;
+    GNUNET_assert (0 == getrusage(RUSAGE_CHILDREN, &usage));
     fprintf (stdout,
              "Executed (Withdraw=%u, Deposit=%u, Refresh~=%5.2f) * Reserve=%u 
* Parallel=%u, operations in %s\n",
              howmany_coins,
@@ -1023,6 +1026,9 @@ main (int argc,
              howmany_reserves,
              howmany_clients,
              (unsigned long long) duration.rel_value_us);
+    fprintf (stdout, "cpu time: sys %llu user %llu\n", \
+             (unsigned long long) (usage.ru_stime.tv_sec * 1000 * 1000 + 
usage.ru_stime.tv_usec),
+             (unsigned long long) (usage.ru_utime.tv_sec * 1000 * 1000 + 
usage.ru_utime.tv_usec));
   }
   return (GNUNET_OK == result) ? 0 : result;
 }
diff --git a/src/exchange/taler-exchange-httpd.c 
b/src/exchange/taler-exchange-httpd.c
index cd6d7793..5fc491a5 100644
--- a/src/exchange/taler-exchange-httpd.c
+++ b/src/exchange/taler-exchange-httpd.c
@@ -26,6 +26,7 @@
 #include <jansson.h>
 #include <microhttpd.h>
 #include <pthread.h>
+#include <sys/resource.h>
 #include "taler-exchange-httpd_parsing.h"
 #include "taler-exchange-httpd_mhd.h"
 #include "taler-exchange-httpd_deposit.h"
@@ -845,6 +846,52 @@ open_unix_path (const char *unix_path,
 
 
 /**
+ * Called when the main thread exits, writes out performance
+ * stats if requested.
+ */
+static void
+write_stats ()
+{
+
+  struct GNUNET_DISK_FileHandle *fh;
+  pid_t pid = getpid ();
+  char *benchmark_dir;
+  char *s;
+  struct rusage usage;
+
+  benchmark_dir = getenv ("GNUNET_BENCHMARK_DIR");
+
+  if (NULL == benchmark_dir)
+    return;
+
+  GNUNET_asprintf (&s, "%s/taler-exchange-%llu-%llu.txt",
+                   benchmark_dir,
+                   (unsigned long long) pid);
+
+  fh = GNUNET_DISK_file_open (s,
+                              (GNUNET_DISK_OPEN_WRITE |
+                               GNUNET_DISK_OPEN_TRUNCATE |
+                               GNUNET_DISK_OPEN_CREATE),
+                              (GNUNET_DISK_PERM_USER_READ |
+                               GNUNET_DISK_PERM_USER_WRITE));
+  GNUNET_assert (NULL != fh);
+  GNUNET_free (s);
+
+  /* Collect stats, summed up for all threads */
+  GNUNET_assert (0 == getrusage(RUSAGE_SELF, &usage));
+
+  GNUNET_asprintf (&s, "time_exchange sys %llu user %llu\n", \
+                   (unsigned long long) (usage.ru_stime.tv_sec * 1000 * 1000 + 
usage.ru_stime.tv_usec),
+                   (unsigned long long) (usage.ru_utime.tv_sec * 1000 * 1000 + 
usage.ru_utime.tv_usec));
+  GNUNET_assert (GNUNET_SYSERR != GNUNET_DISK_file_write_blocking (fh, s, 
strlen (s)));
+  GNUNET_free (s);
+
+  GNUNET_assert (GNUNET_OK == GNUNET_DISK_file_close (fh));
+}
+
+
+
+/**
  * The main function of the taler-exchange-httpd server ("the exchange").
  *
  * @param argc number of arguments from the command line
@@ -982,6 +1029,8 @@ main (int argc,
     return 1;
   }
 
+  atexit (write_stats);
+
 #if HAVE_DEVELOPER
   if (NULL != input_filename)
   {

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



reply via email to

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