diff options
author | Matthias Wachs <wachs@net.in.tum.de> | 2012-05-30 08:54:23 +0000 |
---|---|---|
committer | Matthias Wachs <wachs@net.in.tum.de> | 2012-05-30 08:54:23 +0000 |
commit | eab4b6722aa4204502f193fb965d9a5193857354 (patch) | |
tree | baabd5a3594542c0f906962f9eb0fadade354e10 /src/statistics | |
parent | 41944c9cbaeeb65e4ec9389094fccc319ebed991 (diff) | |
download | gnunet-eab4b6722aa4204502f193fb965d9a5193857354.tar.gz gnunet-eab4b6722aa4204502f193fb965d9a5193857354.zip |
- adding timestamp for watch mode
Diffstat (limited to 'src/statistics')
-rw-r--r-- | src/statistics/gnunet-statistics.c | 22 |
1 files changed, 20 insertions, 2 deletions
diff --git a/src/statistics/gnunet-statistics.c b/src/statistics/gnunet-statistics.c index c28514144..3eef887fc 100644 --- a/src/statistics/gnunet-statistics.c +++ b/src/statistics/gnunet-statistics.c | |||
@@ -27,6 +27,7 @@ | |||
27 | #include "platform.h" | 27 | #include "platform.h" |
28 | #include "gnunet_getopt_lib.h" | 28 | #include "gnunet_getopt_lib.h" |
29 | #include "gnunet_program_lib.h" | 29 | #include "gnunet_program_lib.h" |
30 | #include "gnunet_util_lib.h" | ||
30 | #include "gnunet_statistics_service.h" | 31 | #include "gnunet_statistics_service.h" |
31 | #include "statistics.h" | 32 | #include "statistics.h" |
32 | 33 | ||
@@ -77,9 +78,26 @@ static int | |||
77 | printer (void *cls, const char *subsystem, const char *name, uint64_t value, | 78 | printer (void *cls, const char *subsystem, const char *name, uint64_t value, |
78 | int is_persistent) | 79 | int is_persistent) |
79 | { | 80 | { |
81 | struct GNUNET_TIME_Absolute now = GNUNET_TIME_absolute_get(); | ||
82 | char * now_str; | ||
80 | if (quiet == GNUNET_NO) | 83 | if (quiet == GNUNET_NO) |
81 | FPRINTF (stdout, "%s%-12s %-50s: %16llu\n", is_persistent ? "!" : " ", | 84 | { |
82 | subsystem, _(name), (unsigned long long) value); | 85 | if (GNUNET_YES == watch) |
86 | { | ||
87 | now_str = GNUNET_STRINGS_absolute_time_to_string(now); | ||
88 | FPRINTF (stdout, "%24s %s%12s %50s: %16llu \n", | ||
89 | now_str, | ||
90 | is_persistent ? "!" : " ", | ||
91 | subsystem, _(name), (unsigned long long) value); | ||
92 | GNUNET_free (now_str); | ||
93 | } | ||
94 | else | ||
95 | { | ||
96 | FPRINTF (stdout, "%s%12s %50s: %16llu \n", | ||
97 | is_persistent ? "!" : " ", | ||
98 | subsystem, _(name), (unsigned long long) value); | ||
99 | } | ||
100 | } | ||
83 | else | 101 | else |
84 | FPRINTF (stdout, "%llu\n", (unsigned long long) value); | 102 | FPRINTF (stdout, "%llu\n", (unsigned long long) value); |
85 | 103 | ||