[Turn off line numbering]1: arg list; 2: var i, out, ref, times, sums, callers, t, tic, max, start, head; 3: 4: head = ["Object<definer>.method Tics (%) Total (%)", "---------------------- ---- --- ----- ---"]; 5: times = #[]; 6: sums = #[]; 7: callers = []; 8: for i in (list) { 9: refresh(); 10: if (type(i) == 'integer) { 11: if (callers) { 12: [[ref, tic], @callers] = callers; 13: times = times.add(ref, ((| times[ref] |) || 0) + i - t); 14: if (!(ref in callers)) 15: sums = sums.add(ref, ((| sums[ref] |) || 0) + i - tic); 16: } 17: t = i; 18: } else { 19: if (callers) { 20: ref = callers[1][1]; 21: times = times.add(ref, ((| times[ref] |) || 0) + i[1] - t); 22: } 23: ref = ._show_ref(i); 24: callers = [[ref, i[1]], @callers]; 25: t = i[1]; 26: } 27: start ?= t; 28: } 29: max = 0.01 * (t - start); 30: out = map i in (times.keys()) to (refresh() && [i.chop(50), times[i], times[i] / max, sums[i], sums[i] / max]); 31: out = out.sort(map i in (out) to (refresh() && -i[2])); 32: out = map i in (out) to (strfmt("%50l%7r%6.1r%%%7r%6.1r%%", @i)); 33: out = head + out; 34: return out;
// Created 27-Mar-1995 as a part of ColdCore, see: @help Credit