utensil commented at 2016-06-15 03:57:

 dstat -cmndpyr
----total-cpu-usage---- ------memory-usage----- -net/total- -dsk/total- ---procs--- ---system-- --io/total-
usr sys idl wai hiq siq| used  buff  cach  free| recv  send| read  writ|run blk new| int   csw | read  writ
dstat --ipc --lock --socket --unix
--sysv-ipc- ---file-locks-- ------sockets------ --unix-sockets-
msg sem shm|pos lck rea wri|tot tcp udp raw frg|dgm str lis act
strace -T -r -F -c -p PID
Process PIDattached - interrupt to quit
^CProcess PID detached
% time     seconds  usecs/call     calls    errors syscall
------ ----------- ----------- --------- --------- ----------------
perf top -a -e cycles:u -p PID
perf  record -e cycles:u -a -p PID -g
perf report

Zoom: GUI for perf

#
zoom run --time_limit 60 --start immediate  --process `pgrep PROC_NAME` --thread_time_trigger 10 --trace_thread_scheduler --profile_driver perf
# system wide
zoom run --time_limit 10 --start immediate
pstack `pgrep TARGET_PROCESS_NAME`|grep Proc -B 4|awk -f ./thr.awk |column -t

where thr.awk is:

\verb>>>|

BEGIN {
 
}
 
/Thread/ {
    tid = gensub(/\)|:/, "", "g", $6)
}
 
/#1/ {
    doing = $4
    old_tids = doings[doing]
    doings[doing] = sprintf("%s %s", old_tids, tid)
}
 
/Proc/ {
    proc_name = gensub(/\(void\*\)/, "", "g", $4)
    old_doings = procs[proc_name]
    procs[proc_name]= sprintf("%s %s", old_doings, doing)
}
 
END {
    for(proc_name in procs) {
        proc_doing = procs[proc_name]
        # print proc_name, ":\n"
        split(proc_doing, proc_doings, " ")
        for(i in proc_doings) {
                        stat[proc_doings[i]] +=1
                }
                row_first = proc_name
                for(fun in stat) {
                        print row_first, fun, stat[fun], "\n"
                        row_first = "_"
                }
                for(fun in stat) {
                        delete stat[fun]
                }
        }
}

utensil commented at 2016-06-15 04:08:

Debug tools: