Lines Matching +full:- +full:- +full:bins
1 #!/usr/bin/env bcc-lua
2 --[[
9 http://www.apache.org/licenses/LICENSE-2.0
17 -- This example program measures latency of block device operations and plots it
18 -- in a histogram. It is similar to BPF example:
19 -- https://github.com/torvalds/linux/blob/master/samples/bpf/tracex3_kern.c
24 -- Shared part of the program
25 local bins = 100
27 local lat_map = bpf.map('array', bins)
29 -- Kernel-space part of the program
32 end, false, -1, 0)
34 -- The lines below are computing index
35 -- using log10(x)*10 = log2(x)*10/log2(10) = log2(x)*3
36 -- index = 29 ~ 1 usec
37 -- index = 59 ~ 1 msec
38 -- index = 89 ~ 1 sec
39 -- index = 99 ~ 10sec or more
40 local delta = time() - map[ptregs.parm1]
42 if index >= bins then
43 index = bins-1
47 end, false, -1, 0)
48 -- User-space part of the program
53 -- Print header once in a while
59 -- Collect all events
61 for i=29,bins-1 do
68 -- Print histogram symbols based on relative frequency
70 for i=29,bins-1 do