Commit 76a42c71 authored by Avri Altman's avatar Avri Altman Committed by Tomasz Zawadzki
Browse files

lib/event: Make spdk_app_setup_trace() public



Expose `app_setup_trace()` as public. This enables standalone SPDK
applications to set up tracing using the unified framework, including
support for group and individual tracepoint selection via `spdk_app_opts`.

This approach is chosen instead of refactoring standalone tools to use
the full SPDK Application Framework, which would add unnecessary
complexity and dependencies. By making only the trace setup function
public, we provide feature parity for tracing while keeping utilities
lightweight, simple, and compatible with existing workflows.

Change-Id: I550b0a99849e71197b3af352c2ecf8f2cbd9affa
Signed-off-by: default avatarAvri Altman <avri.altman@sandisk.com>
Reviewed-on: https://review.spdk.io/c/spdk/spdk/+/26440


Reviewed-by: default avatarJacek Kalwas <jacek.kalwas@nutanix.com>
Reviewed-by: default avatarJim Harris <jim.harris@nvidia.com>
Community-CI: Mellanox Build Bot
Reviewed-by: default avatarAnkit Kumar <ankit.kumar@samsung.com>
Tested-by: default avatarSPDK Automated Test System <spdkbot@gmail.com>
parent 212920b8
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -2,6 +2,10 @@

## v26.01: (Upcoming Release)

### event

Added new public API: `spdk_app_setup_trace()` to set up SPDK tracing for applications.

## v25.09

### bdev
+11 −0
Original line number Diff line number Diff line
@@ -366,6 +366,17 @@ void spdk_framework_enable_context_switch_monitor(bool enabled);
 */
bool spdk_framework_context_switch_monitor_enabled(void);

/**
 * Set up SPDK tracing for the application.
 *
 * Initializes the trace shared memory region and enables tracepoint groups or
 * individual tracepoints as specified in the spdk_app_opts structure.
 *
 * \param opts Application options structure, must be initialized.
 * \return 0 on success, -1 on failure.
 */
int spdk_app_setup_trace(struct spdk_app_opts *opts);

#ifdef __cplusplus
}
#endif
+1 −1
Original line number Diff line number Diff line
@@ -7,7 +7,7 @@ SPDK_ROOT_DIR := $(abspath $(CURDIR)/../..)
include $(SPDK_ROOT_DIR)/mk/spdk.common.mk

SO_VER := 15
SO_MINOR := 0
SO_MINOR := 1

CFLAGS += $(ENV_CFLAGS) -Wno-address-of-packed-member

+4 −4
Original line number Diff line number Diff line
@@ -564,8 +564,8 @@ app_setup_env(struct spdk_app_opts *opts)
	return rc;
}

static int
app_setup_trace(struct spdk_app_opts *opts)
int
spdk_app_setup_trace(struct spdk_app_opts *opts)
{
	char		shm_name[64];
	uint64_t	tpoint_group_mask, tpoint_mask = -1ULL;
@@ -976,13 +976,13 @@ spdk_app_start(struct spdk_app_opts *opts_user, spdk_msg_fn start_fn,
	 * Disable and ignore trace setup if setting num_entries
	 * to be 0.
	 *
	 * Note the call to app_setup_trace() is located here
	 * Note the call to spdk_app_setup_trace() is located here
	 * ahead of app_setup_signal_handlers().
	 * That's because there is not an easy/direct clean
	 * way of unwinding alloc'd resources that can occur
	 * in app_setup_signal_handlers().
	 */
	if (opts->num_entries != 0 && app_setup_trace(opts) != 0) {
	if (opts->num_entries != 0 && spdk_app_setup_trace(opts) != 0) {
		return 1;
	}

+1 −0
Original line number Diff line number Diff line
@@ -12,6 +12,7 @@
	spdk_app_get_core_mask;
	spdk_app_parse_args;
	spdk_app_usage;
	spdk_app_setup_trace;
	spdk_event_allocate;
	spdk_event_call;
	spdk_framework_enable_context_switch_monitor;