diff options
author | Sree Harsha Totakura <totakura@in.tum.de> | 2013-02-14 10:41:47 +0000 |
---|---|---|
committer | Sree Harsha Totakura <totakura@in.tum.de> | 2013-02-14 10:41:47 +0000 |
commit | a4d6140c4020e3508ea60c83d04e20208a1c6ba0 (patch) | |
tree | 72513de5166a1b67816c631b4072d9238abbda3d /src/testbed/testbed_api_sd.h | |
parent | f9ce74c5675bdf100036d2237131ccaf7c69f61f (diff) | |
download | gnunet-a4d6140c4020e3508ea60c83d04e20208a1c6ba0.tar.gz gnunet-a4d6140c4020e3508ea60c83d04e20208a1c6ba0.zip |
separate SD calculations
Diffstat (limited to 'src/testbed/testbed_api_sd.h')
-rw-r--r-- | src/testbed/testbed_api_sd.h | 80 |
1 files changed, 80 insertions, 0 deletions
diff --git a/src/testbed/testbed_api_sd.h b/src/testbed/testbed_api_sd.h new file mode 100644 index 000000000..46beec4a1 --- /dev/null +++ b/src/testbed/testbed_api_sd.h | |||
@@ -0,0 +1,80 @@ | |||
1 | /* | ||
2 | This file is part of GNUnet | ||
3 | (C) 2008--2012 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 3, 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 testbed/testbed_api_sd.h | ||
23 | * @brief functions to calculate standard deviation | ||
24 | * @author Sree Harsha Totakura <sreeharsha@totakura.in> | ||
25 | */ | ||
26 | |||
27 | #ifndef TESTBED_API_SD_H | ||
28 | #define TESTBED_API_SD_H | ||
29 | |||
30 | |||
31 | /** | ||
32 | * Opaque handle for calculating SD | ||
33 | */ | ||
34 | struct SDHandle; | ||
35 | |||
36 | |||
37 | /** | ||
38 | * Initialize standard deviation calculation handle | ||
39 | * | ||
40 | * @param max_cnt the maximum number of readings to keep | ||
41 | * @return the initialized handle | ||
42 | */ | ||
43 | struct SDHandle * | ||
44 | GNUNET_TESTBED_SD_init_ (unsigned int max_cnt); | ||
45 | |||
46 | |||
47 | /** | ||
48 | * Frees the memory allocated to the SD handle | ||
49 | * | ||
50 | * @param h the SD handle | ||
51 | */ | ||
52 | void | ||
53 | GNUNET_TESTBED_SD_destroy_ (struct SDHandle *h); | ||
54 | |||
55 | |||
56 | /** | ||
57 | * Add a reading to SD | ||
58 | * | ||
59 | * @param h the SD handle | ||
60 | * @param amount the reading value | ||
61 | */ | ||
62 | void | ||
63 | GNUNET_TESTBED_SD_add_data_ (struct SDHandle *h, unsigned int amount); | ||
64 | |||
65 | |||
66 | /** | ||
67 | * Returns the factor by which the given amount differs from the standard deviation | ||
68 | * | ||
69 | * @param h the SDhandle | ||
70 | * @param amount the value for which the deviation is returned | ||
71 | |||
72 | * @return the deviation from the average; GNUNET_SYSERR if the deviation cannot | ||
73 | * be calculated OR 0 if the deviation is less than the average; a | ||
74 | * maximum of 4 is returned for deviations equal to or larger than 4 | ||
75 | */ | ||
76 | int | ||
77 | GNUNET_TESTBED_SD_deviation_factor_ (struct SDHandle *h, unsigned int amount); | ||
78 | |||
79 | #endif | ||
80 | /* end of testbed_api.h */ | ||