Skip to content

Refactor APIs for creating output handler

Tzvetomir Stoyanov (VMware) linux-trace-devel 2 versions – In review

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v2 Latest10 patches 6 repliesIn review
  2. v110 patches 0 repliesSuperseded

Changes in v2 from the cover letter

- Rebased on top of the latest master.

Patches in v2 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/10trace-cmd library: New API for allocating an output handlerlib/trace-cmd/include/private/trace-cmd-private.h lib/trace-cmd/trace-output.c+39 -11 reply
2/10trace-cmd library: New API for setting a message context to an output handlerlib/trace-cmd/include/private/trace-cmd-private.h lib/trace-cmd/trace-output.c+24 -01 reply
3/10trace-cmd library: New API for setting a custom trace directory to an output handlerlib/trace-cmd/include/private/trace-cmd-private.h lib/trace-cmd/trace-output.c+28 -00 replies
4/10trace-cmd library: New API for setting a custom kallsyms to an output handlerlib/trace-cmd/include/private/trace-cmd-private.h lib/trace-cmd/trace-output.c+31 -21 reply
5/10trace-cmd library: New API to inherit parameters from an existing trace filelib/trace-cmd/include/private/trace-cmd-private.h lib/trace-cmd/trace-output.c+34 -00 replies
6/10trace-cmd library: New API tracecmd_output_write_initlib/trace-cmd/include/private/trace-cmd-private.h lib/trace-cmd/trace-output.c+55 -00 replies
7/10trace-cmd library: New API to write headers of a trace filelib/trace-cmd/include/private/trace-cmd-private.h lib/trace-cmd/trace-output.c+43 -40 replies
8/10trace-cmd library: Use the new flow when creating output handlerlib/trace-cmd/trace-output.c+48 -60 replies
9/10trace-cmd: Use the new flow when creating output handlertracecmd/trace-record.c tracecmd/trace-restore.c+79 -82 replies
10/10trace-cmd library: Remove deprecated APIs for creating an output handlerlib/trace-cmd/include/private/trace-cmd-private.h lib/trace-cmd/trace-output.c+1 -1760 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/10] Refactor APIs for creating output handler

In the trace-cmd library there are various APIs for allocating and initializing output handler to a trace file. The existing APIs are use case oriented, with a lot of parameters. Extending them for new use cases, adding more input parameters, will make the library more complex and not easy to use.
Almost all use case oriented APIs for output handler creation are removed and replaced with new flow, which is easier to be extended with new parameters.

Removed APIs:
tracecmd_create_init_fd_msg()
tracecmd_create_init_file_glob()
tracecmd_create_init_fd_glob()
tracecmd_create_init_file_override()

New APIs:
tracecmd_output_allocate()
tracecmd_output_set_msg()
tracecmd_output_set_trace_dir()
tracecmd_output_set_kallsyms()
tracecmd_output_set_from_input()
tracecmd_output_write_init()
tracecmd_output_write_headers()

The new tracecmd_output_allocate() API allocates memory and performs minimal initialization of an output handler to a trace file. No data is written in the file.
The tracecmd_output_set_...() APIs can be used to set various parameters to the newly allocated output handler, that affect the way the data is written into the file.
When the output handler is configured for the desired use case, the tracecmd_output_write_init() is used to start writing to the file, it writes initial magic bytes.
The tracecmd_output_write_headers() API is used to write the initial headers into the file.

This patch-set depends on:
"trace-cmd fixes and clean-ups" patch set.

v2 changes:
- Rebased on top of the latest master.

Tzvetomir Stoyanov (VMware) (10):
trace-cmd library: New API for allocating an output handler trace-cmd library: New API for setting a message context to an output
handler
trace-cmd library: New API for setting a custom trace directory to an
output handler
trace-cmd library: New API for setting a custom kallsyms to an output
handler
trace-cmd library: New API to inherit parameters from an existing
trace file
trace-cmd library: New API tracecmd_output_write_init trace-cmd library: New API to write headers of a trace file trace-cmd library: Use the new flow when creating output handler
trace-cmd: Use the new flow when creating output handler trace-cmd library: Remove deprecated APIs for creating an output
handler

 .../include/private/trace-cmd-private.h       |  25 +-
 lib/trace-cmd/trace-output.c                  | 397 +++++++++++-------
 tracecmd/trace-record.c                       |  55 ++-
 tracecmd/trace-restore.c                      |  32 +-
 4 files changed, 347 insertions(+), 162 deletions(-)
Signature · 1 line
2.33.1