summaryrefslogtreecommitdiffstats
path: root/testsuite/systemtap.maps/pmap_agg_overflow.stp
blob: aa54c6a9a3444434e5430859802f77c89f6d9497 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
# try to induce overflow of pmap aggregation
#   (this will only work on smp machines)

global stat, count, max_count

probe begin {
    if (num_online_cpus() < 2) {
        warn("This test only applies to smp systems...")
        exit()
    }
    max_count = num_online_cpus() * max_map_entries()
}

probe kernel.function("scheduler_tick") {
    i = ++count
    if (i >= max_count) exit()
    stat[i] <<< i
}

probe end {
    # pmap aggregation should overflow here
    foreach (i in stat)
        printf("@count(stat[%d]) = %d\n", i, @count(stat[i]))
}

probe end {
    # sorted pmap aggregation should overflow here
    foreach (i+ in stat)
        printf("@count(stat[%d]) = %d\n", i, @count(stat[i]))
}

function max_map_entries:long() %{
    THIS->__retvalue = MAXMAPENTRIES;
%}

function num_online_cpus:long() %{
    THIS->__retvalue = num_online_cpus();
%}