]> git.proxmox.com Git - mirror_ubuntu-hirsute-kernel.git/commit
tools/bpf: bpftool: add btf percpu map formated dump
authorYonghong Song <yhs@fb.com>
Wed, 29 Aug 2018 21:43:15 +0000 (14:43 -0700)
committerDaniel Borkmann <daniel@iogearbox.net>
Thu, 30 Aug 2018 12:03:53 +0000 (14:03 +0200)
commit1a86ad89da1c06b2a326953309dcb99f0d079a32
tree768a6dc2c2ed7b998cb2bb0ed3d1ecfbf055a26b
parent6493ebf7242d9b9a2c50db91b9baeb0543990736
tools/bpf: bpftool: add btf percpu map formated dump

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: Yonghong Song <yhs@fb.com>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
tools/bpf/bpftool/map.c