NOTE: This site has just upgraded to Forester 5.x and is still having some style and functionality issues, we will fix them ASAP.

Investigate Linux performance tools [uts-0155]

#### utensil opened issue at 2014-08-30 12:31:

- [ ] Investigate sysdig
- [ ] 20 Command Line Tools to Monitor Linux Performance
- [ ] Performance analysis tools based on Linux perf_events (aka perf) and ftrace


#### 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
------ ----------- ----------- --------- --------- ----------------
```

```
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:

```awk
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:
- GDB dashboard
- Record and Replay Framework
- Immunity Debugger