Method code for $code_lib._profile_listing()

[Turn on line numbering]
arg list;
var i, out, ref, times, sums, callers, t, tic, max, start, head;

head = ["Object<definer>.method                               Tics    (%)  Total    (%)", "----------------------                               ----    ---  -----    ---"];
times = #[];
sums = #[];
callers = [];
for i in (list) {
    refresh();
    if (type(i) == 'integer) {
        if (callers) {
            [[ref, tic], @callers] = callers;
            times = times.add(ref, ((| times[ref] |) || 0) + i - t);
            if (!(ref in callers))
                sums = sums.add(ref, ((| sums[ref] |) || 0) + i - tic);
        }
        t = i;
    } else {
        if (callers) {
            ref = callers[1][1];
            times = times.add(ref, ((| times[ref] |) || 0) + i[1] - t);
        }
        ref = ._show_ref(i);
        callers = [[ref, i[1]], @callers];
        t = i[1];
    }
    start ?= t;
}
max = 0.01 * (t - start);
out = map i in (times.keys()) to (refresh() && [i.chop(50), times[i], times[i] / max, sums[i], sums[i] / max]);
out = out.sort(map i in (out) to (refresh() && -i[2]));
out = map i in (out) to (strfmt("%50l%7r%6.1r%%%7r%6.1r%%", @i));
out = head + out;
return out;

// $#Edited: 04 Nov 97 06:55 $miro

["// Created 26-Mar-1995 as a part of ColdCore, see: @help Credit"]

the Cold Dark