Method code for $code_lib._trace_profile()

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

out = ["Object<definer>.method                               Tics  (%)  Cummul. (%)"];
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[1] - t);
            sums = sums.add(ref, ((| sums[ref] |) || 0) + i[1] - tic);
        }
        t = i;
    } else {
        if (callers) {
            ref = callers[1][1];
            times = times.add(ref, ((| sums[ref] |) || 0) + i[1] - t);
        }
        ref = strfmt("%l<%l>.%l", i[2], i[3], i[4]);
        callers = [[ref, i[1]], @callers];
        t = i[1];
    }
    start ?= t;
}
max = 0.01 * (t - start);
out = map i in (times.keys()) to (refresh() && [i, times[i], times[i] / max, sums[i], sums[i] / max]);
out = out.sort(out.slice(2));
out = map i in (out) to (strfmt(i, "%50l%7r%7r%7r%7r"));
return out;

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

the Cold Dark