line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
/* You may distribute under the terms of either the GNU General Public License |
2
|
|
|
|
|
|
|
* or the Artistic License (the same terms as Perl itself) |
3
|
|
|
|
|
|
|
* |
4
|
|
|
|
|
|
|
* (C) Paul Evans, 2018 -- leonerd@leonerd.org.uk |
5
|
|
|
|
|
|
|
*/ |
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
#include "EXTERN.h" |
8
|
|
|
|
|
|
|
#include "perl.h" |
9
|
|
|
|
|
|
|
#include "XSUB.h" |
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
MODULE = Net::Prometheus::PerlCollector PACKAGE = Net::Prometheus::PerlCollector |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
void |
14
|
|
|
|
|
|
|
count_heap() |
15
|
|
|
|
|
|
|
INIT: |
16
|
|
|
|
|
|
|
SV *arena; |
17
|
|
|
|
|
|
|
STRLEN arenas = 0, svs = 0; |
18
|
|
|
|
|
|
|
CODE: |
19
|
0
|
0
|
|
|
|
|
for(arena = PL_sv_arenaroot; arena; arena = (SV *)SvANY(arena)) { |
20
|
0
|
|
|
|
|
|
const SV *arenaend = &arena[SvREFCNT(arena)]; |
21
|
|
|
|
|
|
|
SV *sv; |
22
|
|
|
|
|
|
|
|
23
|
0
|
|
|
|
|
|
arenas++; |
24
|
|
|
|
|
|
|
|
25
|
0
|
0
|
|
|
|
|
for(sv = arena + 1; sv < arenaend; sv++) |
26
|
0
|
0
|
|
|
|
|
if(SvTYPE(sv) != 0xFF && SvREFCNT(sv)) |
|
|
0
|
|
|
|
|
|
27
|
0
|
|
|
|
|
|
svs++; |
28
|
|
|
|
|
|
|
} |
29
|
|
|
|
|
|
|
|
30
|
0
|
0
|
|
|
|
|
EXTEND(SP, 2); |
31
|
0
|
|
|
|
|
|
mPUSHu(arenas); |
32
|
0
|
|
|
|
|
|
mPUSHu(svs); |
33
|
0
|
|
|
|
|
|
XSRETURN(2); |