print_log2_hist(): check and skip possible paddings (#2155)
Address issue 2154. When a struct S is used as key to a BPF_HISTOGRAM, it is assumed that the second member of S holds the slot. But when S is converted to python from bpf C, a padding may be inserted as a second member. This breaks print_log2_hist(). root@debian:~/bcc/tools# ./softirqs.py -d Tracing soft irq event time... Hit Ctrl-C to end. ^C Traceback (most recent call last): File "./softirqs.py", line 144, in <module> dist.print_log2_hist(label, "softirq", section_print_fn=vec_to_name) File "/usr/local/lib/python2.7/dist-packages/bcc/table.py", line 326, in print_log2_hist vals[slot] = v.value TypeError: list indices must be integers, not str Fix it by skipping the possible padding. Future work would be fixing/working around in the library where the padding is introduced.
Showing
Please register or sign in to comment