Skip to content

perf tools: Move perf subcommand framework into lib/tools

Josh Poimboeuf lkml 2 versions – Applied

Status from this message: Thanks, applied, trying to go thru the cherry pickable ones in this kit.

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v2 Latest14 patches 27 repliesApplied
  2. v113 patches 10 repliesSuperseded

Changes in v2 from the cover letter

- Fix 'make clean' to remove tests/llvm-src-*.c and other leftover files
- Fix description for "Move tools/lib/string.c to libapi" patch

Patches in v2 Applied

#Subject and filesSizeRepliesApplied
1/14perf: Fix 'make clean'tools/perf/Makefile.perf+11 -24 replies
2/14perf: Use -iquote for local include pathstools/perf/config/Makefile tools/perf/tests/Build tools/perf/tests/bpf.c +2 more+11 -110 replies
3/14perf: Split up util.htools/perf/util/compat-util.h tools/perf/util/config.h tools/perf/util/ctype.h +10 more+323 -2890 replies
4/14perf: Move term functions out of util.ctools/perf/util/Build tools/perf/util/term.c tools/perf/util/term.h +2 more+44 -371 reply
5/14perf: Remove unused pager_use_color variabletools/perf/util/Build tools/perf/util/cache.h tools/perf/util/color.c +1 more+1 -111 reply
6/14perf: Split up cache.htools/perf/perf.h tools/perf/util/abspath.h tools/perf/util/alias.h +5 more+88 -670 replies
7/14perf: Remove cache.htools/perf/builtin-annotate.c tools/perf/builtin-buildid-cache.c tools/perf/builtin-buildid-list.c +49 more+34 -670 replies
8/14perf: Save cmdline arguments earliertools/perf/perf.c tools/perf/util/env.c tools/perf/util/parse-options.c+1 -110 replies
9/14perf: Remove check for unused PERF_PAGER_IN_USEtools/perf/util/pager.c+1 -70 replies
10/14perf: Move cmd_version() to builtin-version.ctools/perf/Build tools/perf/builtin-version.c tools/perf/util/help.c+10 -70 replies
11/14perf: Move help_unknown_cmd() to its own filetools/perf/util/Build tools/perf/util/help-unknown-cmd.c tools/perf/util/help-unknown-cmd.h +2 more+110 -1050 replies
12/14perf tools: Move strlcpy() to tools/lib/string.ctools/include/linux/string.h tools/lib/string.c tools/perf/util/path.c +2 more+25 -230 replies
13/14perf tools: Move tools/lib/string.c to libapitools/lib/api/Build tools/lib/api/string/Build tools/lib/api/string/string.c +11 more+19 -240 replies
14/14perf tools: Move subcommand framework and related utils to libapitools/include/asm-generic/bitops/__fls.h tools/include/asm-generic/bitops/fls.h tools/include/asm-generic/bitops/fls64.h +84 more+265 -18319 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v2 yet.

Read the v2 thread

Cover letter [PATCH v2 00/14] perf tools: Move perf subcommand framework into lib/tools

Ingo suggested that I factor out the perf subcommand functionality (originally copied from git) into tools/lib so that it can be used by stacktool[*] and possibly others.

All the subcommand option handling files have been moved into libapi, including parse-options.c, run-command.c, exec_cmd.c, help.c, usage.c, and their dependencies. Since several of the dependencies are more general-purpose "utilities" which aren't directly related to subcommands, I put everything in 'tools/lib/api/util'. They're linked into perf as part of the libapi.a library.

Patches 1-13 do some cleanups and splitting up of the code in preparation for the move.

Patch 14 does the actual moving of the files into tools/lib/api/util.

Based on tip/perf/core.

[*] https://lkml.kernel.org/r/[email protected]

v2:
- Fix 'make clean' to remove tests/llvm-src-*.c and other leftover files
- Fix description for "Move tools/lib/string.c to libapi" patch

Josh Poimboeuf (14):
perf: Fix 'make clean'
perf: Use -iquote for local include paths
perf: Split up util.h
perf: Move term functions out of util.c
perf: Remove unused pager_use_color variable
perf: Split up cache.h
perf: Remove cache.h
perf: Save cmdline arguments earlier
perf: Remove check for unused PERF_PAGER_IN_USE
perf: Move cmd_version() to builtin-version.c
perf: Move help_unknown_cmd() to its own file
perf tools: Move strlcpy() to tools/lib/string.c
perf tools: Move tools/lib/string.c to libapi
perf tools: Move subcommand framework and related utils to libapi

 tools/include/asm-generic/bitops/__fls.h           |   2 +-
 tools/include/asm-generic/bitops/fls.h             |   2 +-
 tools/include/asm-generic/bitops/fls64.h           |   2 +-
 tools/lib/api/Build                                |   2 +
 tools/lib/api/Makefile                             |   6 +-
 tools/lib/api/string/Build                         |   1 +
 tools/lib/{ => api/string}/string.c                |  24 +-
 tools/{include/linux => lib/api/string}/string.h   |  15 +-
 tools/lib/api/util/Build                           |  13 +
 tools/{perf => lib/api}/util/abspath.c             |   6 +-
 tools/lib/api/util/abspath.h                       |  11 +
 tools/lib/api/util/cfg.c                           |  12 +
 tools/lib/api/util/cfg.h                           |  15 +
 tools/lib/api/util/compat-util.h                   | 129 +++++++++
 tools/{perf => lib/api}/util/ctype.c               |   3 +-
 tools/lib/api/util/ctype.h                         |  52 ++++
 tools/{perf => lib/api}/util/exec_cmd.c            |  42 +--
 tools/{perf => lib/api}/util/exec_cmd.h            |  18 +-
 tools/{perf => lib/api}/util/help.c                | 134 ++-------
 tools/{perf => lib/api}/util/help.h                |   3 +
 tools/{perf => lib/api}/util/pager.c               |  14 +-
 tools/lib/api/util/pager.h                         |   7 +
 tools/{perf => lib/api}/util/parse-options.c       |  30 +-
 tools/{perf => lib/api}/util/parse-options.h       |  10 +-
 tools/{perf => lib/api}/util/run-command.c         |  12 +-
 tools/{perf => lib/api}/util/run-command.h         |  10 +-
 tools/{perf => lib/api}/util/sigchain.c            |   4 +-
 tools/{perf => lib/api}/util/sigchain.h            |   6 +-
 tools/{perf => lib/api}/util/strbuf.c              |   6 +-
 tools/{perf => lib/api}/util/strbuf.h              |   8 +-
 tools/lib/api/util/term.c                          |  36 +++
 tools/lib/api/util/term.h                          |   7 +
 tools/{perf => lib/api}/util/usage.c               |   4 +-
 tools/lib/api/util/usage.h                         |  23 ++
 tools/{perf => lib/api}/util/wrapper.c             |   4 +-
 .../{perf/util/cache.h => lib/api/util/wrapper.h}  |  65 +----
 tools/perf/Build                                   |   3 +-
 tools/perf/MANIFEST                                |   2 -
 tools/perf/Makefile.perf                           |  13 +-
 tools/perf/arch/x86/util/intel-pt.c                |   2 +-
 tools/perf/bench/futex-hash.c                      |   2 +-
 tools/perf/bench/futex-lock-pi.c                   |   2 +-
 tools/perf/bench/futex-requeue.c                   |   2 +-
 tools/perf/bench/futex-wake-parallel.c             |   2 +-
 tools/perf/bench/futex-wake.c                      |   2 +-
 tools/perf/bench/mem-functions.c                   |   2 +-
 tools/perf/bench/numa.c                            |   2 +-
 tools/perf/bench/sched-messaging.c                 |   2 +-
 tools/perf/bench/sched-pipe.c                      |   2 +-
 tools/perf/builtin-annotate.c                      |   3 +-
 tools/perf/builtin-bench.c                         |   2 +-
 tools/perf/builtin-buildid-cache.c                 |   4 +-
 tools/perf/builtin-buildid-list.c                  |   4 +-
 tools/perf/builtin-config.c                        |   3 +-
 tools/perf/builtin-data.c                          |   2 +-
 tools/perf/builtin-evlist.c                        |   2 +-
 tools/perf/builtin-help.c                          |  11 +-
 tools/perf/builtin-inject.c                        |   2 +-
 tools/perf/builtin-kmem.c                          |   5 +-
 tools/perf/builtin-kvm.c                           |   3 +-
 tools/perf/builtin-list.c                          |   4 +-
 tools/perf/builtin-lock.c                          |   3 +-
 tools/perf/builtin-mem.c                           |   2 +-
 tools/perf/builtin-probe.c                         |   2 +-
 tools/perf/builtin-record.c                        |   2 +-
 tools/perf/builtin-report.c                        |   3 +-
 tools/perf/builtin-sched.c                         |   3 +-
 tools/perf/builtin-script.c                        |  13 +-
 tools/perf/builtin-stat.c                          |   2 +-
 tools/perf/builtin-timechart.c                     |   3 +-
 tools/perf/builtin-top.c                           |   3 +-
 tools/perf/builtin-trace.c                         |   4 +-
 tools/perf/builtin-version.c                       |   9 +
 tools/perf/builtin.h                               |   2 +-
 tools/perf/config/Makefile                         |   4 +-
 tools/perf/perf.c                                  |  30 +-
 tools/perf/perf.h                                  |  13 +
 tools/perf/tests/Build                             |   6 +-
 tools/perf/tests/attr.c                            |   4 +-
 tools/perf/tests/bpf.c                             |   4 +-
 tools/perf/tests/builtin-test.c                    |   2 +-
 tools/perf/tests/llvm.c                            |   4 +-
 tools/perf/ui/browser.c                            |   1 -
 tools/perf/ui/browsers/header.c                    |   2 +-
 tools/perf/ui/gtk/browser.c                        |   2 +-
 tools/perf/ui/gtk/hists.c                          |   2 +-
 tools/perf/ui/gtk/setup.c                          |   2 +-
 tools/perf/ui/helpline.h                           |   2 +-
 tools/perf/ui/progress.c                           |   2 +-
 tools/perf/ui/setup.c                              |   7 +-
 tools/perf/ui/tui/progress.c                       |   2 +-
 tools/perf/ui/tui/setup.c                          |   1 -
 tools/perf/ui/tui/util.c                           |   1 -
 tools/perf/ui/ui.h                                 |   1 +
 tools/perf/util/Build                              |  20 +-
 tools/perf/util/alias.c                            |   2 +-
 tools/perf/util/alias.h                            |   7 +
 tools/perf/util/annotate.c                         |   1 -
 tools/perf/util/auxtrace.c                         |   4 +-
 tools/perf/util/bpf-loader.c                       |   2 +-
 tools/perf/util/cgroup.c                           |   2 +-
 tools/perf/util/color.c                            |   4 +-
 tools/perf/util/config.c                           |   3 +-
 tools/perf/util/config.h                           |  18 ++
 tools/perf/util/debug.c                            |   1 -
 tools/perf/util/env.c                              |   9 -
 tools/perf/util/environment.c                      |   8 -
 tools/perf/util/evlist.c                           |   2 +-
 tools/perf/util/header.c                           |   2 +-
 tools/perf/util/help-unknown-cmd.c                 | 103 +++++++
 tools/perf/util/help-unknown-cmd.h                 |   0
 tools/perf/util/intel-pt-decoder/insn.c            |   2 +-
 .../perf/util/intel-pt-decoder/intel-pt-decoder.c  |   1 -
 tools/perf/util/levenshtein.c                      |   2 +-
 tools/perf/util/llvm-utils.c                       |   1 -
 tools/perf/util/lzma.h                             |   8 +
 tools/perf/util/map.c                              |   2 +-
 tools/perf/util/ordered-events.c                   |   2 +-
 tools/perf/util/parse-branch-options.c             |   2 +-
 tools/perf/util/parse-events.c                     |   5 +-
 tools/perf/util/parse-regs-options.c               |   2 +-
 tools/perf/util/path.c                             |  20 +-
 tools/perf/util/path.h                             |  12 +
 tools/perf/util/probe-event.c                      |   1 -
 tools/perf/util/probe-file.c                       |   1 -
 tools/perf/util/python-ext-sources                 |   1 -
 tools/perf/util/quote.c                            |   2 +-
 tools/perf/util/sort.h                             |   3 +-
 tools/perf/util/srcline.h                          |  16 ++
 tools/perf/util/string.h                           |  34 +++
 tools/perf/util/thread.h                           |   4 +-
 tools/perf/util/util.c                             |  34 ---
 tools/perf/util/util.h                             | 314 ++-------------------
 tools/perf/util/zlib.h                             |   8 +
 134 files changed, 864 insertions(+), 765 deletions(-)
 create mode 100644 tools/lib/api/string/Build
 rename tools/lib/{ => api/string}/string.c (73%)
 rename tools/{include/linux => lib/api/string}/string.h (23%)
 create mode 100644 tools/lib/api/util/Build
 rename tools/{perf => lib/api}/util/abspath.c (90%)
 create mode 100644 tools/lib/api/util/abspath.h
 create mode 100644 tools/lib/api/util/cfg.c
 create mode 100644 tools/lib/api/util/cfg.h
 create mode 100644 tools/lib/api/util/compat-util.h
 rename tools/{perf => lib/api}/util/ctype.c (97%)
 create mode 100644 tools/lib/api/util/ctype.h
 rename tools/{perf => lib/api}/util/exec_cmd.c (72%)
 rename tools/{perf => lib/api}/util/exec_cmd.h (14%)
 rename tools/{perf => lib/api}/util/help.c (59%)
 rename tools/{perf => lib/api}/util/help.h (85%)
 rename tools/{perf => lib/api}/util/pager.c (88%)
 create mode 100644 tools/lib/api/util/pager.h
 rename tools/{perf => lib/api}/util/parse-options.c (97%)
 rename tools/{perf => lib/api}/util/parse-options.h (98%)
 rename tools/{perf => lib/api}/util/run-command.c (96%)
 rename tools/{perf => lib/api}/util/run-command.h (87%)
 rename tools/{perf => lib/api}/util/sigchain.c (93%)
 rename tools/{perf => lib/api}/util/sigchain.h (53%)
 rename tools/{perf => lib/api}/util/strbuf.c (97%)
 rename tools/{perf => lib/api}/util/strbuf.h (95%)
 create mode 100644 tools/lib/api/util/term.c
 create mode 100644 tools/lib/api/util/term.h
 rename tools/{perf => lib/api}/util/usage.c (97%)
 create mode 100644 tools/lib/api/util/usage.h
 rename tools/{perf => lib/api}/util/wrapper.c (92%)
 rename tools/{perf/util/cache.h => lib/api/util/wrapper.h} (22%)
 create mode 100644 tools/perf/builtin-version.c
 create mode 100644 tools/perf/util/alias.h
 create mode 100644 tools/perf/util/config.h
 delete mode 100644 tools/perf/util/environment.c
 create mode 100644 tools/perf/util/help-unknown-cmd.c
 create mode 100644 tools/perf/util/help-unknown-cmd.h
 create mode 100644 tools/perf/util/lzma.h
 create mode 100644 tools/perf/util/path.h
 create mode 100644 tools/perf/util/srcline.h
 create mode 100644 tools/perf/util/string.h
 create mode 100644 tools/perf/util/zlib.h
Signature · 1 line
2.4.3