aboutsummaryrefslogtreecommitdiff
path: root/src/util/load.c
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2013-08-11 21:21:56 +0000
committerChristian Grothoff <christian@grothoff.org>2013-08-11 21:21:56 +0000
commit3d7fefedc9ba60bd8e8448efe8b628446d958536 (patch)
tree61ce41a52cd6e7232cead77818ef265993b2427e /src/util/load.c
parent4a0398474db197abed243a123fb971fbeeffab4b (diff)
downloadgnunet-3d7fefedc9ba60bd8e8448efe8b628446d958536.tar.gz
gnunet-3d7fefedc9ba60bd8e8448efe8b628446d958536.zip
changing time measurement from milliseconds to microseconds
Diffstat (limited to 'src/util/load.c')
-rw-r--r--src/util/load.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/src/util/load.c b/src/util/load.c
index 146e85095..06e284c4c 100644
--- a/src/util/load.c
+++ b/src/util/load.c
@@ -1,10 +1,10 @@
1/* 1/*
2 This file is part of GNUnet. 2 This file is part of GNUnet.
3 (C) 2010 Christian Grothoff (and other contributing authors) 3 (C) 2010, 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,7 +24,7 @@
24 * @author Christian Grothoff 24 * @author Christian Grothoff
25 */ 25 */
26#include "platform.h" 26#include "platform.h"
27#include "gnunet_load_lib.h" 27#include "gnunet_util_lib.h"
28 28
29 29
30#define LOG(kind,...) GNUNET_log_from (kind, "util", __VA_ARGS__) 30#define LOG(kind,...) GNUNET_log_from (kind, "util", __VA_ARGS__)
@@ -87,18 +87,18 @@ internal_update (struct GNUNET_LOAD_Value *load)
87 struct GNUNET_TIME_Relative delta; 87 struct GNUNET_TIME_Relative delta;
88 unsigned int n; 88 unsigned int n;
89 89
90 if (load->autodecline.rel_value == GNUNET_TIME_UNIT_FOREVER_REL.rel_value) 90 if (load->autodecline.rel_value_us == GNUNET_TIME_UNIT_FOREVER_REL.rel_value_us)
91 return; 91 return;
92 delta = GNUNET_TIME_absolute_get_duration (load->last_update); 92 delta = GNUNET_TIME_absolute_get_duration (load->last_update);
93 if (delta.rel_value < load->autodecline.rel_value) 93 if (delta.rel_value_us < load->autodecline.rel_value_us)
94 return; 94 return;
95 if (load->autodecline.rel_value == 0) 95 if (0 == load->autodecline.rel_value_us)
96 { 96 {
97 load->runavg_delay = 0.0; 97 load->runavg_delay = 0.0;
98 load->load = 0; 98 load->load = 0;
99 return; 99 return;
100 } 100 }
101 n = delta.rel_value / load->autodecline.rel_value; 101 n = delta.rel_value_us / load->autodecline.rel_value_us;
102 if (n > 16) 102 if (n > 16)
103 { 103 {
104 load->runavg_delay = 0.0; 104 load->runavg_delay = 0.0;
@@ -126,7 +126,7 @@ GNUNET_LOAD_value_init (struct GNUNET_TIME_Relative autodecline)
126{ 126{
127 struct GNUNET_LOAD_Value *ret; 127 struct GNUNET_LOAD_Value *ret;
128 128
129 ret = GNUNET_malloc (sizeof (struct GNUNET_LOAD_Value)); 129 ret = GNUNET_new (struct GNUNET_LOAD_Value);
130 ret->autodecline = autodecline; 130 ret->autodecline = autodecline;
131 ret->last_update = GNUNET_TIME_absolute_get (); 131 ret->last_update = GNUNET_TIME_absolute_get ();
132 return ret; 132 return ret;