aboutsummaryrefslogtreecommitdiff
path: root/src/util/perf_malloc.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/util/perf_malloc.c')
-rw-r--r--src/util/perf_malloc.c30
1 files changed, 15 insertions, 15 deletions
diff --git a/src/util/perf_malloc.c b/src/util/perf_malloc.c
index 4447934af..ee2281edd 100644
--- a/src/util/perf_malloc.c
+++ b/src/util/perf_malloc.c
@@ -11,12 +11,12 @@
11 WITHOUT ANY WARRANTY; without even the implied warranty of 11 WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Affero General Public License for more details. 13 Affero General Public License for more details.
14 14
15 You should have received a copy of the GNU Affero General Public License 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/>. 16 along with this program. If not, see <http://www.gnu.org/licenses/>.
17 17
18 SPDX-License-Identifier: AGPL3.0-or-later 18 SPDX-License-Identifier: AGPL3.0-or-later
19*/ 19 */
20 20
21/** 21/**
22 * @author Christian Grothoff 22 * @author Christian Grothoff
@@ -28,36 +28,36 @@
28#include <gauger.h> 28#include <gauger.h>
29 29
30static uint64_t 30static uint64_t
31perfMalloc () 31perfMalloc()
32{ 32{
33 size_t i; 33 size_t i;
34 uint64_t ret; 34 uint64_t ret;
35 35
36 ret = 0; 36 ret = 0;
37 for (i=1;i<1024 * 1024;i+=1024) 37 for (i = 1; i < 1024 * 1024; i += 1024)
38 { 38 {
39 ret += i; 39 ret += i;
40 GNUNET_free (GNUNET_malloc (i)); 40 GNUNET_free(GNUNET_malloc(i));
41 } 41 }
42 return ret; 42 return ret;
43} 43}
44 44
45 45
46int 46int
47main (int argc, char *argv[]) 47main(int argc, char *argv[])
48{ 48{
49 struct GNUNET_TIME_Absolute start; 49 struct GNUNET_TIME_Absolute start;
50 uint64_t kb; 50 uint64_t kb;
51 51
52 start = GNUNET_TIME_absolute_get (); 52 start = GNUNET_TIME_absolute_get();
53 kb = perfMalloc (); 53 kb = perfMalloc();
54 printf ("Malloc perf took %s\n", 54 printf("Malloc perf took %s\n",
55 GNUNET_STRINGS_relative_time_to_string (GNUNET_TIME_absolute_get_duration (start), 55 GNUNET_STRINGS_relative_time_to_string(GNUNET_TIME_absolute_get_duration(start),
56 GNUNET_YES)); 56 GNUNET_YES));
57 GAUGER ("UTIL", "Allocation", 57 GAUGER("UTIL", "Allocation",
58 kb / 1024 / (1 + 58 kb / 1024 / (1 +
59 GNUNET_TIME_absolute_get_duration 59 GNUNET_TIME_absolute_get_duration
60 (start).rel_value_us / 1000LL), "kb/ms"); 60 (start).rel_value_us / 1000LL), "kb/ms");
61 return 0; 61 return 0;
62} 62}
63 63