Clean up and renaming
[oweals/gnunet.git] / src / include / gnunet_load_lib.h
index 7af00ccd3eac5c9f5be95f058cc4a7765743113a..ef596807a8f0bc4ed287478da71c0a96731405bb 100644 (file)
@@ -1,27 +1,32 @@
 /*
      This file is part of GNUnet.
-     (C) 2010 Christian Grothoff (and other contributing authors)
+     Copyright (C) 2010 GNUnet e.V.
 
-     GNUnet is free software; you can redistribute it and/or modify
-     it under the terms of the GNU General Public License as published
-     by the Free Software Foundation; either version 2, or (at your
-     option) any later version.
+     GNUnet is free software: you can redistribute it and/or modify it
+     under the terms of the GNU Affero General Public License as published
+     by the Free Software Foundation, either version 3 of the License,
+     or (at your option) any later version.
 
      GNUnet is distributed in the hope that it will be useful, but
      WITHOUT ANY WARRANTY; without even the implied warranty of
      MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-     General Public License for more details.
+     Affero General Public License for more details.
 
-     You should have received a copy of the GNU General Public License
-     along with GNUnet; see the file COPYING.  If not, write to the
-     Free Software Foundation, Inc., 59 Temple Place - Suite 330,
-     Boston, MA 02111-1307, USA.
-*/
+     You should have received a copy of the GNU Affero General Public License
+     along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+     SPDX-License-Identifier: AGPL3.0-or-later
+ */
 
 /**
- * @file include/gnunet_load_lib.h
- * @brief functions related to load calculations
  * @author Christian Grothoff
+ *
+ * @file
+ * Functions related to load calculations
+ *
+ * @defgroup load  Load library
+ * Load calculations.
+ * @{
  */
 
 #ifndef GNUNET_LOAD_LIB_H
@@ -46,10 +51,24 @@ struct GNUNET_LOAD_Value;
 /**
  * Create a new load value.
  *
+ * @param autodecline speed at which this value should automatically
+ *        decline in the absence of external events; at the given
+ *        frequency, 0-load values will be added to the load
  * @return the new load value
  */
 struct GNUNET_LOAD_Value *
-GNUNET_LOAD_value_init (void);
+GNUNET_LOAD_value_init (struct GNUNET_TIME_Relative autodecline);
+
+
+/**
+ * Change the value by which the load automatically declines.
+ *
+ * @param load load to update
+ * @param autodecline frequency of load decline
+ */
+void
+GNUNET_LOAD_value_set_decline (struct GNUNET_LOAD_Value *load,
+                               struct GNUNET_TIME_Relative autodecline);
 
 
 /**
@@ -70,7 +89,7 @@ GNUNET_LOAD_value_init (void);
  *         that we could not do proper calculations
  */
 double
-GNUNET_LOAD_get_load (const struct GNUNET_LOAD_Value *load);
+GNUNET_LOAD_get_load (struct GNUNET_LOAD_Value *load);
 
 
 /**
@@ -80,7 +99,7 @@ GNUNET_LOAD_get_load (const struct GNUNET_LOAD_Value *load);
  * @return zero if update was never called
  */
 double
-GNUNET_LOAD_get_average (const struct GNUNET_LOAD_Value *load);
+GNUNET_LOAD_get_average (struct GNUNET_LOAD_Value *load);
 
 
 /**
@@ -90,8 +109,7 @@ GNUNET_LOAD_get_average (const struct GNUNET_LOAD_Value *load);
  * @param data latest measurement value (for example, delay)
  */
 void
-GNUNET_LOAD_update (struct GNUNET_LOAD_Value *load,
-                   uint64_t data);
+GNUNET_LOAD_update (struct GNUNET_LOAD_Value *load, uint64_t data);
 
 
 #if 0                           /* keep Emacsens' auto-indent happy */
@@ -103,4 +121,7 @@ GNUNET_LOAD_update (struct GNUNET_LOAD_Value *load,
 
 /* ifndef GNUNET_LOAD_LIB_H */
 #endif
+
+/** @} */  /* end of group */
+
 /* end of gnunet_load_lib.h */