defn stackused(t) { local i; i = 0; while i < t.stksize do { if (*(t.stk+i) & 0xff) != 0xfe then return t.stksize-i; i++; } return 0; } defn stacksused() { local mainpid, p, tq, t; mainpid = pid; p = (Proc)_threadpq.$head; while p != 0 do { setproc(p.pid); tq = (Tqueue)p.threads; t = (Thread)tq.$head; while t != 0 do { print(stackused(t), "/", t.stksize, "\n"); t = t.nextt; } p = p.next; } setproc(mainpid); } print("stack");