Demonstrations of alisoftirqs, the enhanced version of BCC softirqs.

This program traces soft interrupts (irqs), and stores timing statistics
in-kernel for efficiency.


Example 1

By default, all statistics of all softirq on all CPUs are sampled,
and the output is displayed in a per-softirq and per-CPU flavor.

# alisoftirqs
Tracing soft irq event time... Hit Ctrl-C to end.
^C

CPU0:
   SOFTIRQ           IRQHandler      Count TOTAL_usecs  MAX_usecs
         7                sched          1         59         59

CPU3:
   SOFTIRQ           IRQHandler      Count TOTAL_usecs  MAX_usecs
         1                timer          1          0          0
         3               net_rx          6         29          9
         7                sched          1          1          1
         9                  rcu          1          0          0

CPU4:
   SOFTIRQ           IRQHandler      Count TOTAL_usecs  MAX_usecs
         1                timer         29         11          1
         7                sched         11         26          4
         9                  rcu         19         22          5


Example 2

You can sample statistics on specified CPU only with "-c" option,
and the output will be displayed in a per-softirq flavor.

# alisoftirqs -c 6
Tracing soft irq event time... Hit Ctrl-C to end.
^C

CPU6:
   SOFTIRQ           IRQHandler      Count TOTAL_usecs  MAX_usecs
         1                timer          7          2          0
         7                sched          2          9          8
         9                  rcu          5         10          5


Exampel 3

You can sample statistics of specified softirq only with "-i" option,
and the output will be displayed in a per-CPU flavor.

# alisoftirqs -i 1
Tracing soft irq event time... Hit Ctrl-C to end.
^C

CPU0:
   SOFTIRQ           IRQHandler      Count TOTAL_usecs  MAX_usecs
         1                timer          1          2          2

CPU4:
   SOFTIRQ           IRQHandler      Count TOTAL_usecs  MAX_usecs
         1                timer         26         11          2

CPU7:
   SOFTIRQ           IRQHandler      Count TOTAL_usecs  MAX_usecs
         1                timer          2          5          4



Example 4

The distribution of softirq run time can be printed as a histogram with "-D"
option. The output will be displayed in a per-softirq and per-CPU flavor.

# alisoftirqs -D
Tracing soft irq event time... Hit Ctrl-C to end.
^C

section = CPU 3, softIRQ 3 (net_rx)
     time_usecs          : count     distribution
         0 -> 1          : 0        |                                        |
         2 -> 3          : 2        |****************************************|
         4 -> 7          : 0        |                                        |
         8 -> 15         : 1        |********************                    |

section = CPU 4, softIRQ 1 (timer)
     time_usecs          : count     distribution
         0 -> 1          : 13       |****************************************|

section = CPU 4, softIRQ 7 (sched)
     time_usecs          : count     distribution
         0 -> 1          : 2        |****************************************|
         2 -> 3          : 1        |********************                    |
         4 -> 7          : 2        |****************************************|



USAGE message:

# alisoftirqs -h
usage: alisoftirqs.py [-h] [-T] [-N] [-D] [-c CPU] [-i IRQ]
                       [interval] [outputs]

Summarize soft irq statistics, including total count, time, etc.

positional arguments:
  interval           output interval, in seconds
  outputs            number of outputs

optional arguments:
  -h, --help         show this help message and exit
  -T, --timestamp    include timestamp on output
  -N, --nanoseconds  output in nanoseconds
  -D, --dist         show distributions as histograms
  -c CPU, --cpu CPU  output softIRQ statistics on specific CPU only
  -i IRQ, --irq IRQ  output statistics of specific softIRQ

examples:
    ./alisoftirqs            # sum soft irq event time
    ./alisoftirqs -D         # show soft irq event time as histograms
    ./alisoftirqs -c 0       # show soft irq event time of CPU 0 only
    ./alisoftirqs -i 25      # show event time of IRQ 25 only
    ./alisoftirqs -c 0 -i 25 # show event time of IRQ 25 on CPU 0 only
    ./alisoftirqs 1 10       # print 1 second summaries, 10 times
    ./alisoftirqs -NT 1      # 1s summaries, nanoseconds, and timestamps
