Ticket #945: interpinfo_mem_test.pir

File interpinfo_mem_test.pir, 1.5 KB (added by plobsing, 11 years ago)

invoke as ./parrot interpinfo_mem_test.pir 1000000

Line 
1# Copyright (C) 2006-2009, Parrot Foundation.
2# $Id$
3
4.include 'interpinfo.pasm'
5
6.sub 'main' :main
7    .param pmc argv
8    .local int lim, i
9    lim = argv[1]
10
11  outer:
12    i = 0
13    $I0 = interpinfo .INTERPINFO_TOTAL_MEM_ALLOC
14    print "Total Mem Alloc: "
15    say $I0
16    $I0 = interpinfo .INTERPINFO_ACTIVE_PMCS
17    print "Active PMCs: "
18    say $I0
19    $I0 = interpinfo .INTERPINFO_ACTIVE_BUFFERS
20    print "Active Buffers: "
21    say $I0
22    $I0 = interpinfo .INTERPINFO_TOTAL_PMCS
23    print "Total PMCs: "
24    say $I0
25    $I0 = interpinfo .INTERPINFO_TOTAL_BUFFERS
26    print "Total Buffers: "
27    say $I0
28    $I0 = interpinfo .INTERPINFO_HEADER_ALLOCS_SINCE_COLLECT
29    print "Total Header Allocs Since Collect: "
30    say $I0
31    $I0 = interpinfo .INTERPINFO_MEM_ALLOCS_SINCE_COLLECT
32    print "Total Mem Allocs Since Collect: "
33    say $I0
34    $I0 = interpinfo .INTERPINFO_TOTAL_COPIED
35    print "Total Copied: "
36    say $I0
37    $I0 = interpinfo .INTERPINFO_IMPATIENT_PMCS
38    print "Impatient PMCs: "
39    say $I0
40    $I0 = interpinfo .INTERPINFO_GC_LAZY_MARK_RUNS
41    print "GC Lazy Mark Runs: "
42    say $I0
43    # interpinfo no longer answers to EXTENDED_PMCS
44    # $I0 = interpinfo .INTERPINFO_EXTENDED_PMCS
45    # print "Extended PMCs: "
46    # say $I0
47    say ""
48    say "-------------------------------------"
49    say ""
50  loop:
51    consume()
52    consume()
53    consume()
54    consume()
55    inc i
56    if i == lim goto outer
57    goto loop
58
59.end
60
61.sub consume
62.end
63
64# Local Variables:
65#   mode: pir
66#   fill-column: 100
67# End:
68# vim: expandtab shiftwidth=4 ft=pir:
69