2 This file is part of GNUnet.
3 (C) 2010 Christian Grothoff (and other contributing authors)
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.
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.
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.
22 * @file include/gnunet_load_lib.h
23 * @brief functions related to load calculations
24 * @author Christian Grothoff
27 #ifndef GNUNET_LOAD_LIB_H
28 #define GNUNET_LOAD_LIB_H
33 #if 0 /* keep Emacsens' auto-indent happy */
38 #include "gnunet_common.h"
39 #include "gnunet_time_lib.h"
44 struct GNUNET_LOAD_Value;
47 * Create a new load value.
49 * @return the new load value
51 struct GNUNET_LOAD_Value *
52 GNUNET_LOAD_value_init (void);
58 * @param lv value to free
60 #define GNUNET_LOAD_value_free(lv) GNUNET_free (lv)
64 * Get the current load.
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
73 GNUNET_LOAD_get_load (const struct GNUNET_LOAD_Value *load);
77 * Get the average value given to update so far.
79 * @param load load handle
80 * @return zero if update was never called
83 GNUNET_LOAD_get_average (const struct GNUNET_LOAD_Value *load);
87 * Update the current load.
89 * @param load to update
90 * @param data latest measurement value (for example, delay)
93 GNUNET_LOAD_update (struct GNUNET_LOAD_Value *load,
97 #if 0 /* keep Emacsens' auto-indent happy */
104 /* ifndef GNUNET_LOAD_LIB_H */
106 /* end of gnunet_load_lib.h */