gnunet-svn
[Top][All Lists]
Advanced

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

[gnunet] branch master updated: NSE: Add monitoring feature and make one


From: gnunet
Subject: [gnunet] branch master updated: NSE: Add monitoring feature and make oneshot the default. Also improves output information.
Date: Sun, 31 Mar 2024 09:26:32 +0200

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

martin-schanzenbach pushed a commit to branch master
in repository gnunet.

The following commit(s) were added to refs/heads/master by this push:
     new 4c29dfa6d NSE: Add monitoring feature and make oneshot the default. 
Also improves output information.
4c29dfa6d is described below

commit 4c29dfa6d88487fdea6294de56f5cf5cceb17338
Author: Martin Schanzenbach <schanzen@gnunet.org>
AuthorDate: Sun Mar 31 09:25:52 2024 +0200

    NSE: Add monitoring feature and make oneshot the default. Also improves 
output information.
---
 doc/man/gnunet-nse.1     |  3 +++
 src/cli/nse/gnunet-nse.c | 19 ++++++++++++++++---
 2 files changed, 19 insertions(+), 3 deletions(-)

diff --git a/doc/man/gnunet-nse.1 b/doc/man/gnunet-nse.1
index 5f2d02bfa..193173381 100644
--- a/doc/man/gnunet-nse.1
+++ b/doc/man/gnunet-nse.1
@@ -48,6 +48,9 @@ Use LOGLEVEL for logging.
 Valid values are DEBUG, INFO, WARNING and ERROR.
 .It Fl l Ar LOGFILE | Fl -logfile= Ns Ar LOGFILE
 Configure logging to write logs to LOGFILE.
+.It Fl m | -monitor
+In monitor mode, gnunet-nse will continuously print the NSE estimates,
+instead of giving just a snapshot.
 .It Fl v | -version
 Print GNUnet version number.
 .El
diff --git a/src/cli/nse/gnunet-nse.c b/src/cli/nse/gnunet-nse.c
index edb73c0fc..b88697695 100644
--- a/src/cli/nse/gnunet-nse.c
+++ b/src/cli/nse/gnunet-nse.c
@@ -26,6 +26,7 @@
 
 #include "platform.h"
 #include "gnunet_nse_service.h"
+#include <gnunet_util_lib.h>
 
 /**
  * The handle to the NSE service
@@ -37,6 +38,11 @@ static struct GNUNET_NSE_Handle *nse;
  */
 static int status;
 
+/**
+ * Monitor flag.
+ */
+static int monitor;
+
 
 /**
  * Task to shutdown and clean up all state
@@ -73,11 +79,13 @@ handle_estimate (void *cls,
   (void) cls;
   status = 0;
   fprintf (stdout,
-           "%llu %f %f %f\n",
-           (unsigned long long) timestamp.abs_value_us,
+           "%s: #peers=%f (ld(#peers)=%f, stddev=%f)\n",
+           GNUNET_STRINGS_absolute_time_to_string (timestamp),
            GNUNET_NSE_log_estimate_to_n (estimate),
            estimate,
            std_dev);
+  if (! monitor)
+    GNUNET_SCHEDULER_shutdown ();
 }
 
 
@@ -111,7 +119,12 @@ run (void *cls,
 int
 main (int argc, char *const *argv)
 {
-  static struct GNUNET_GETOPT_CommandLineOption options[] = {
+  struct GNUNET_GETOPT_CommandLineOption options[] = {
+    GNUNET_GETOPT_option_flag ('m',
+                               "monitor",
+                               gettext_noop (
+                                 "Monitor and output current estimates"),
+                               &monitor),
     GNUNET_GETOPT_OPTION_END
   };
 

-- 
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.



reply via email to

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