aboutsummaryrefslogtreecommitdiff
path: root/tools/perf/scripts/python/compaction-times.py
diff options
context:
space:
mode:
authorJakub Kicinski <[email protected]>2023-06-01 19:35:44 -0700
committerJakub Kicinski <[email protected]>2023-06-02 22:10:47 -0700
commit21b6e302789c412bdde84439b9325c76e2a5c428 (patch)
treedfe24da2cb28675c559b0842b1bd98ccc9a75f86 /tools/perf/scripts/python/compaction-times.py
parenteef9b794eac87022464c28a3763f9030e1d53f80 (diff)
tools: ynl-gen: generate enum-to-string helpers
It's sometimes useful to print the name of an enum value, flag or name of the op. Python can do it, add C helper code gen for getting names of things. Example: static const char * const netdev_xdp_act_strmap[] = { [0] = "basic", [1] = "redirect", [2] = "ndo-xmit", [3] = "xsk-zerocopy", [4] = "hw-offload", [5] = "rx-sg", [6] = "ndo-xmit-sg", }; const char *netdev_xdp_act_str(enum netdev_xdp_act value) { value = ffs(value) - 1; if (value < 0 || value >= (int)MNL_ARRAY_SIZE(netdev_xdp_act_strmap)) return NULL; return netdev_xdp_act_strmap[value]; } Signed-off-by: Jakub Kicinski <[email protected]>
Diffstat (limited to 'tools/perf/scripts/python/compaction-times.py')
0 files changed, 0 insertions, 0 deletions