Articles in the perf category

  1. "[Performance] Linux Profiling Tools - strace"

    Normal usage

    $ strace gcc hello_world.c
    execve("/usr/bin/gcc", ["gcc", "hello_world.c"], [/* 50 vars */]) = 0
    brk(0)                                  = 0x1c35000
    access("/etc/ld.so.nohwcap", F_OK)      = -1 ENOENT (No such file or directory)
    mmap(NULL, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f8c4a4d2000
    access("/etc/ld.so.preload", R_OK)      = -1 ENOENT …
  2. "[Performance] Linux Profiling Tools - time"

    Shell built-in time

    We often use time command to measure the executing time of a program. It will print program's real, user and sys time respectively.

    However, our commonly used 'time' is just a shell (bash, zsh) built-in command (same kind as 'cd', 'pwd' and etc). In some use cases …

  3. "[Performance] Linux Profiling Tools - vmstat"

    Run vmstat

    #=> update every 1 second
    $ vmstat 1
    procs -----------memory---------- ---swap-- -----io---- -system-- ----cpu----
     r  b   swpd   free   buff  cache   si   so    bi    bo   in   cs us sy id wa
     15  0   2852 46686812 279456 1401196    0    0     0     0    0    0  0  0 100  0
     16  0   2852 46685192 …