leak_profiler 0.5.0 → 0.5.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/ext/leak_profiler/leak_profiler.c +12 -2
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b9eee59048d470d4ea437d6eabf4295b4b9fe98b547ed90f43675f56d31b30f4
|
4
|
+
data.tar.gz: 3f85e846b9cb4e9e6232b69c2025e32223a410af5f8c1edf5a8903ebe24d97fd
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e070418ef607471a5364579825addfcde2b1d4f13b882546f88cf24ceaea72754439f770d5c44a5c5e2500520ef579285ac9fa252271176295ab56a6074ec434
|
7
|
+
data.tar.gz: 0be27cc605be614704a20976ec107f9dc56c63235cad4086123365c4f5b2b6ee74ad6cb55320f7cc868cd7661328348ec7797117afd8e018cc3c8a97cf45922f
|
@@ -1,5 +1,8 @@
|
|
1
1
|
#include "ruby.h"
|
2
2
|
|
3
|
+
|
4
|
+
// get the maximum resident set size (RSS) of the current process
|
5
|
+
// return the value in kilobytes
|
3
6
|
#if defined(_WIN32)
|
4
7
|
#include <psapi.h>
|
5
8
|
|
@@ -9,7 +12,7 @@ static VALUE leak_profiler_max_rss(VALUE self)
|
|
9
12
|
if (!GetProcessMemoryInfo(GetCurrentProcess(), &pmc, sizeof(pmc))) {
|
10
13
|
rb_sys_fail("GetProcessMemoryInfo");
|
11
14
|
}
|
12
|
-
return LONG2NUM(pmc.PeakWorkingSetSize);
|
15
|
+
return LONG2NUM(pmc.PeakWorkingSetSize / 1024);
|
13
16
|
}
|
14
17
|
|
15
18
|
#else
|
@@ -18,11 +21,18 @@ static VALUE leak_profiler_max_rss(VALUE self)
|
|
18
21
|
static VALUE leak_profiler_max_rss(VALUE self)
|
19
22
|
{
|
20
23
|
struct rusage usage;
|
24
|
+
long max_rss;
|
25
|
+
|
21
26
|
if (getrusage(RUSAGE_SELF, &usage) == -1) {
|
22
27
|
rb_sys_fail("getrusage");
|
23
28
|
}
|
29
|
+
max_rss = usage.ru_maxrss;
|
30
|
+
|
31
|
+
#if defined(__APPLE__)
|
32
|
+
max_rss = max_rss / 1024;
|
33
|
+
#endif
|
24
34
|
|
25
|
-
return LONG2NUM(
|
35
|
+
return LONG2NUM(max_rss);
|
26
36
|
}
|
27
37
|
|
28
38
|
#endif
|