diff options
author | Christian Grothoff <christian@grothoff.org> | 2013-08-11 21:21:56 +0000 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2013-08-11 21:21:56 +0000 |
commit | 3d7fefedc9ba60bd8e8448efe8b628446d958536 (patch) | |
tree | 61ce41a52cd6e7232cead77818ef265993b2427e /src/util/speedup.c | |
parent | 4a0398474db197abed243a123fb971fbeeffab4b (diff) | |
download | gnunet-3d7fefedc9ba60bd8e8448efe8b628446d958536.tar.gz gnunet-3d7fefedc9ba60bd8e8448efe8b628446d958536.zip |
changing time measurement from milliseconds to microseconds
Diffstat (limited to 'src/util/speedup.c')
-rw-r--r-- | src/util/speedup.c | 24 |
1 files changed, 14 insertions, 10 deletions
diff --git a/src/util/speedup.c b/src/util/speedup.c index 6cb8a4e05..2482decea 100644 --- a/src/util/speedup.c +++ b/src/util/speedup.c | |||
@@ -1,10 +1,10 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of GNUnet. | 2 | This file is part of GNUnet. |
3 | (C) 2001, 2002, 2006, 2009 Christian Grothoff (and other contributing authors) | 3 | (C) 2011-2013 Christian Grothoff (and other contributing authors) |
4 | 4 | ||
5 | GNUnet is free software; you can redistribute it and/or modify | 5 | GNUnet is free software; you can redistribute it and/or modify |
6 | it under the terms of the GNU General Public License as published | 6 | it under the terms of the GNU General Public License as published |
7 | by the Free Software Foundation; either version 2, or (at your | 7 | by the Free Software Foundation; either version 3, or (at your |
8 | option) any later version. | 8 | option) any later version. |
9 | 9 | ||
10 | GNUnet is distributed in the hope that it will be useful, but | 10 | GNUnet is distributed in the hope that it will be useful, but |
@@ -24,8 +24,7 @@ | |||
24 | * @brief functions to speedup peer execution by manipulation system time | 24 | * @brief functions to speedup peer execution by manipulation system time |
25 | */ | 25 | */ |
26 | #include "platform.h" | 26 | #include "platform.h" |
27 | #include "gnunet_time_lib.h" | 27 | #include "gnunet_util_lib.h" |
28 | #include "gnunet_scheduler_lib.h" | ||
29 | 28 | ||
30 | #define LOG(kind,...) GNUNET_log_from (kind, "util", __VA_ARGS__) | 29 | #define LOG(kind,...) GNUNET_log_from (kind, "util", __VA_ARGS__) |
31 | 30 | ||
@@ -45,10 +44,11 @@ do_speedup (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | |||
45 | speedup_task = GNUNET_SCHEDULER_NO_TASK; | 44 | speedup_task = GNUNET_SCHEDULER_NO_TASK; |
46 | if (0 != (GNUNET_SCHEDULER_REASON_SHUTDOWN & tc->reason)) | 45 | if (0 != (GNUNET_SCHEDULER_REASON_SHUTDOWN & tc->reason)) |
47 | return; | 46 | return; |
48 | current_offset += delta.rel_value; | 47 | current_offset += delta.rel_value_us; |
49 | GNUNET_TIME_set_offset (current_offset); | 48 | GNUNET_TIME_set_offset (current_offset); |
50 | LOG (GNUNET_ERROR_TYPE_DEBUG, | 49 | LOG (GNUNET_ERROR_TYPE_DEBUG, |
51 | "Speeding up execution time by %llu ms\n", delta.rel_value); | 50 | "Speeding up execution time by %s\n", |
51 | GNUNET_STRINGS_relative_time_to_string (delta, GNUNET_NO)); | ||
52 | speedup_task = GNUNET_SCHEDULER_add_delayed (interval, &do_speedup, NULL); | 52 | speedup_task = GNUNET_SCHEDULER_add_delayed (interval, &do_speedup, NULL); |
53 | } | 53 | } |
54 | 54 | ||
@@ -67,15 +67,18 @@ GNUNET_SPEEDUP_start_ (const struct GNUNET_CONFIGURATION_Handle *cfg) | |||
67 | if (GNUNET_OK != GNUNET_CONFIGURATION_get_value_time (cfg, "testing", "SPEEDUP_DELTA", &delta)) | 67 | if (GNUNET_OK != GNUNET_CONFIGURATION_get_value_time (cfg, "testing", "SPEEDUP_DELTA", &delta)) |
68 | return GNUNET_SYSERR; | 68 | return GNUNET_SYSERR; |
69 | 69 | ||
70 | if ((0 == interval.rel_value) || (0 == delta.rel_value)) | 70 | if ((0 == interval.rel_value_us) || (0 == delta.rel_value_us)) |
71 | { | 71 | { |
72 | LOG (GNUNET_ERROR_TYPE_DEBUG, | 72 | LOG (GNUNET_ERROR_TYPE_DEBUG, |
73 | "Speed up disabled\n"); | 73 | "Speed up disabled\n"); |
74 | return GNUNET_OK; | 74 | return GNUNET_OK; |
75 | } | 75 | } |
76 | LOG (GNUNET_ERROR_TYPE_DEBUG, | 76 | LOG (GNUNET_ERROR_TYPE_DEBUG, |
77 | "Speed up execution time %llu ms every %llu ms\n", | 77 | "Speed up execution by %s\n", |
78 | delta.rel_value, interval.rel_value); | 78 | GNUNET_STRINGS_relative_time_to_string (delta, GNUNET_NO)); |
79 | LOG (GNUNET_ERROR_TYPE_DEBUG, | ||
80 | "Speed up executed every %s\n", | ||
81 | GNUNET_STRINGS_relative_time_to_string (interval, GNUNET_NO)); | ||
79 | speedup_task = GNUNET_SCHEDULER_add_now_with_lifeness (GNUNET_NO, &do_speedup, NULL); | 82 | speedup_task = GNUNET_SCHEDULER_add_now_with_lifeness (GNUNET_NO, &do_speedup, NULL); |
80 | return GNUNET_OK; | 83 | return GNUNET_OK; |
81 | } | 84 | } |
@@ -92,7 +95,8 @@ GNUNET_SPEEDUP_stop_ ( ) | |||
92 | GNUNET_SCHEDULER_cancel (speedup_task); | 95 | GNUNET_SCHEDULER_cancel (speedup_task); |
93 | speedup_task = GNUNET_SCHEDULER_NO_TASK; | 96 | speedup_task = GNUNET_SCHEDULER_NO_TASK; |
94 | } | 97 | } |
95 | if ((0 != interval.rel_value) && (0 != delta.rel_value)) | 98 | if ( (0 != interval.rel_value_us) && |
99 | (0 != delta.rel_value_us) ) | ||
96 | LOG (GNUNET_ERROR_TYPE_DEBUG, | 100 | LOG (GNUNET_ERROR_TYPE_DEBUG, |
97 | "Stopped execution speed up\n"); | 101 | "Stopped execution speed up\n"); |
98 | } | 102 | } |