GNUnet  0.11.x
gnunet_load_lib.h
Go to the documentation of this file.
1 /*
2  This file is part of GNUnet.
3  Copyright (C) 2010 GNUnet e.V.
4 
5  GNUnet is free software: you can redistribute it and/or modify it
6  under the terms of the GNU Affero General Public License as published
7  by the Free Software Foundation, either version 3 of the License,
8  or (at your 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  Affero General Public License for more details.
14 
15  You should have received a copy of the GNU Affero General Public License
16  along with this program. If not, see <http://www.gnu.org/licenses/>.
17 
18  SPDX-License-Identifier: AGPL3.0-or-later
19  */
20 
32 #ifndef GNUNET_LOAD_LIB_H
33 #define GNUNET_LOAD_LIB_H
34 
35 #ifdef __cplusplus
36 extern "C"
37 {
38 #if 0 /* keep Emacsens' auto-indent happy */
39 }
40 #endif
41 #endif
42 
43 #include "gnunet_common.h"
44 #include "gnunet_time_lib.h"
45 
49 struct GNUNET_LOAD_Value;
50 
59 struct GNUNET_LOAD_Value *
61 
62 
69 void
72 
73 
79 #define GNUNET_LOAD_value_free(lv) GNUNET_free (lv)
80 
81 
91 double
93 
94 
101 double
103 
104 
111 void
112 GNUNET_LOAD_update (struct GNUNET_LOAD_Value *load, uint64_t data);
113 
114 
115 #if 0 /* keep Emacsens' auto-indent happy */
116 {
117 #endif
118 #ifdef __cplusplus
119 }
120 #endif
121 
122 /* ifndef GNUNET_LOAD_LIB_H */
123 #endif
124  /* end of group */
126 
127 /* end of gnunet_load_lib.h */
struct GNUNET_LOAD_Value * GNUNET_LOAD_value_init(struct GNUNET_TIME_Relative autodecline)
Create a new load value.
Definition: load.c:124
static void load()
Load persistent values from disk.
double GNUNET_LOAD_get_load(struct GNUNET_LOAD_Value *load)
Get the current load.
Definition: load.c:200
double GNUNET_LOAD_get_average(struct GNUNET_LOAD_Value *load)
Get the average value given to update so far.
Definition: load.c:215
void GNUNET_LOAD_update(struct GNUNET_LOAD_Value *load, uint64_t data)
Update the current load.
Definition: load.c:236
struct GNUNET_TIME_Relative autodecline
How fast should the load decline if no values are added?
Definition: load.c:40
Values we track for load calculations.
Definition: load.c:35
commonly used definitions; globals in this file are exempt from the rule that the module name ("commo...
void GNUNET_LOAD_value_set_decline(struct GNUNET_LOAD_Value *load, struct GNUNET_TIME_Relative autodecline)
Change the value by which the load automatically declines.
Definition: load.c:142
uint32_t data
The data value.
Time for relative time used by GNUnet, in microseconds.