diff options
author | Christian Mollekopf <chrigi_1@fastmail.fm> | 2015-12-22 09:23:27 +0100 |
---|---|---|
committer | Christian Mollekopf <chrigi_1@fastmail.fm> | 2015-12-22 09:23:27 +0100 |
commit | 8e6671fe6d6519f1fecf37338a3263a5b88a00d1 (patch) | |
tree | 7ae0f08aef08566176611476bea8a85ae2707025 /tests/getrssusage.h | |
parent | 042d8fb10552d0bcc92647338d9d763357f35880 (diff) | |
download | sink-8e6671fe6d6519f1fecf37338a3263a5b88a00d1.tar.gz sink-8e6671fe6d6519f1fecf37338a3263a5b88a00d1.zip |
An automated test that keeps memory usage in check.
And ensures we scale linearly with the number of entities.
Diffstat (limited to 'tests/getrssusage.h')
-rw-r--r-- | tests/getrssusage.h | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/tests/getrssusage.h b/tests/getrssusage.h new file mode 100644 index 0000000..e47b14c --- /dev/null +++ b/tests/getrssusage.h | |||
@@ -0,0 +1,39 @@ | |||
1 | /* | ||
2 | * Author: David Robert Nadeau | ||
3 | * Site: http://NadeauSoftware.com/ | ||
4 | * License: Creative Commons Attribution 3.0 Unported License | ||
5 | * http://creativecommons.org/licenses/by/3.0/deed.en_US | ||
6 | * | ||
7 | * This file has been adapted to match the coding style of the rest of the codebase. | ||
8 | * | ||
9 | * On windows link against psapi.lib, for the rest the standard library is sufficient. | ||
10 | */ | ||
11 | |||
12 | #pragma once | ||
13 | |||
14 | #if defined(_WIN32) | ||
15 | #include <windows.h> | ||
16 | #include <psapi.h> | ||
17 | |||
18 | #elif defined(__unix__) || defined(__unix) || defined(unix) || (defined(__APPLE__) && defined(__MACH__)) | ||
19 | #include <unistd.h> | ||
20 | #include <sys/resource.h> | ||
21 | |||
22 | #if defined(__APPLE__) && defined(__MACH__) | ||
23 | #include <mach/mach.h> | ||
24 | |||
25 | #elif (defined(_AIX) || defined(__TOS__AIX__)) || (defined(__sun__) || defined(__sun) || defined(sun) && (defined(__SVR4) || defined(__svr4__))) | ||
26 | #include <fcntl.h> | ||
27 | #include <procfs.h> | ||
28 | |||
29 | #elif defined(__linux__) || defined(__linux) || defined(linux) || defined(__gnu_linux__) | ||
30 | #include <stdio.h> | ||
31 | |||
32 | #endif | ||
33 | |||
34 | #else | ||
35 | #error "Cannot define getPeakRSS( ) or getCurrentRSS( ) for an unknown OS." | ||
36 | #endif | ||
37 | |||
38 | size_t getCurrentRSS(); | ||
39 | size_t getPeakRSS(); | ||