aboutsummaryrefslogtreecommitdiff
path: root/src/include/gnunet_load_lib.h
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2010-09-18 19:10:12 +0000
committerChristian Grothoff <christian@grothoff.org>2010-09-18 19:10:12 +0000
commit3756b235a8ef6a680a1bc7197c1ce45d778af09c (patch)
treeec506ec28427cfc7813711b938fccbbbb6d1d728 /src/include/gnunet_load_lib.h
parentd24bc034571753884f63bdb9c45ec53ef289121c (diff)
downloadgnunet-3756b235a8ef6a680a1bc7197c1ce45d778af09c.tar.gz
gnunet-3756b235a8ef6a680a1bc7197c1ce45d778af09c.zip
plane hacking
Diffstat (limited to 'src/include/gnunet_load_lib.h')
-rw-r--r--src/include/gnunet_load_lib.h106
1 files changed, 106 insertions, 0 deletions
diff --git a/src/include/gnunet_load_lib.h b/src/include/gnunet_load_lib.h
new file mode 100644
index 000000000..7af00ccd3
--- /dev/null
+++ b/src/include/gnunet_load_lib.h
@@ -0,0 +1,106 @@
1/*
2 This file is part of GNUnet.
3 (C) 2010 Christian Grothoff (and other contributing authors)
4
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
7 by the Free Software Foundation; either version 2, or (at your
8 option) any later version.
9
10 GNUnet is distributed in the hope that it will be useful, but
11 WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 General Public License for more details.
14
15 You should have received a copy of the GNU General Public License
16 along with GNUnet; see the file COPYING. If not, write to the
17 Free Software Foundation, Inc., 59 Temple Place - Suite 330,
18 Boston, MA 02111-1307, USA.
19*/
20
21/**
22 * @file include/gnunet_load_lib.h
23 * @brief functions related to load calculations
24 * @author Christian Grothoff
25 */
26
27#ifndef GNUNET_LOAD_LIB_H
28#define GNUNET_LOAD_LIB_H
29
30#ifdef __cplusplus
31extern "C"
32{
33#if 0 /* keep Emacsens' auto-indent happy */
34}
35#endif
36#endif
37
38#include "gnunet_common.h"
39#include "gnunet_time_lib.h"
40
41/**
42 * Opaque load handle.
43 */
44struct GNUNET_LOAD_Value;
45
46/**
47 * Create a new load value.
48 *
49 * @return the new load value
50 */
51struct GNUNET_LOAD_Value *
52GNUNET_LOAD_value_init (void);
53
54
55/**
56 * Free a load value.
57 *
58 * @param lv value to free
59 */
60#define GNUNET_LOAD_value_free(lv) GNUNET_free (lv)
61
62
63/**
64 * Get the current load.
65 *
66 * @param load load handle
67 * @return zero for below-average load, otherwise
68 * number of std. devs we are above average;
69 * 100 if the latest updates were so large
70 * that we could not do proper calculations
71 */
72double
73GNUNET_LOAD_get_load (const struct GNUNET_LOAD_Value *load);
74
75
76/**
77 * Get the average value given to update so far.
78 *
79 * @param load load handle
80 * @return zero if update was never called
81 */
82double
83GNUNET_LOAD_get_average (const struct GNUNET_LOAD_Value *load);
84
85
86/**
87 * Update the current load.
88 *
89 * @param load to update
90 * @param data latest measurement value (for example, delay)
91 */
92void
93GNUNET_LOAD_update (struct GNUNET_LOAD_Value *load,
94 uint64_t data);
95
96
97#if 0 /* keep Emacsens' auto-indent happy */
98{
99#endif
100#ifdef __cplusplus
101}
102#endif
103
104/* ifndef GNUNET_LOAD_LIB_H */
105#endif
106/* end of gnunet_load_lib.h */