• Yonghong Song's avatar
    tools/bpf: bpftool: add btf percpu map formated dump · 1a86ad89
    Yonghong Song authored
    The btf pretty print is added to percpu arraymap,
    percpu hashmap and percpu lru hashmap.
    For each <key, value> pair, the following will be
    added to plain/json output:
    
       {
           "key": <pretty_print_key>,
           "values": [{
                 "cpu": 0,
                 "value": <pretty_print_value_on_cpu0>
              },{
                 "cpu": 1,
                 "value": <pretty_print_value_on_cpu1>
              },{
              ....
              },{
                 "cpu": n,
                 "value": <pretty_print_value_on_cpun>
              }
           ]
       }
    
    For example, the following could be part of plain or json formatted
    output:
        {
            "key": 0,
            "values": [{
                    "cpu": 0,
                    "value": {
                        "ui32": 0,
                        "ui16": 0,
                    }
                },{
                    "cpu": 1,
                    "value": {
                        "ui32": 1,
                        "ui16": 0,
                    }
                },{
                    "cpu": 2,
                    "value": {
                        "ui32": 2,
                        "ui16": 0,
                    }
                },{
                    "cpu": 3,
                    "value": {
                        "ui32": 3,
                        "ui16": 0,
                    }
                }
            ]
        }
    Signed-off-by: default avatarYonghong Song <yhs@fb.com>
    Signed-off-by: default avatarDaniel Borkmann <daniel@iogearbox.net>
    1a86ad89
map.c 22.9 KB