While userspace probes have a high overhead when enabled due to the trap, it is still cleaner and slightly more efficient to not have all of the SPDK_DTRACE_PROBE macros implicitly capture the tsc counter as an argument. So rename the existing SPDK_DTRACE_PROBE macros to SPDK_DTRACE_PROBE_TICKS, and create new SPDK_DTRACE_PROBE macros without the implicit ticks argument. Note this does cause slight breakage if there is any out-of-tree code that using SPDK_DTRACE_PROBE previously, and programs written against those probes would need to adjust their arguments. But the likelihood of such code existing is practically nil, so I'm just renaming the macros to their ideal state. All of the nvmf SPDK_DTRACE_PROBE calls are changed to use the new _TICKS variants. The event one is left without _TICKS - we have no in-tree scripts that use the tsc for that event. Signed-off-by: Jim Harris <james.r.harris@intel.com> Change-Id: Icb965b7b8f13c23d671263326029acb88c82d9df Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/17669 Community-CI: Mellanox Build Bot Reviewed-by: Ben Walker <benjamin.walker@intel.com> Tested-by: SPDK CI Jenkins <sys_sgci@intel.com> Reviewed-by: Mike Gerdts <mgerdts@nvidia.com> Reviewed-by: Konrad Sztyber <konrad.sztyber@intel.com>
53 lines
1.8 KiB
C
53 lines
1.8 KiB
C
/* SPDX-License-Identifier: BSD-3-Clause
|
|
* Copyright (C) 2021 Intel Corporation.
|
|
* All rights reserved.
|
|
*/
|
|
|
|
#ifndef SPDK_INTERNAL_USDT_H
|
|
#define SPDK_INTERNAL_USDT_H
|
|
|
|
#include "spdk/config.h"
|
|
#include "spdk/env.h"
|
|
|
|
#if defined(SPDK_CONFIG_USDT) && !defined(SPDK_UNIT_TEST)
|
|
|
|
#if defined(__aarch64__)
|
|
#define STAP_SDT_ARG_CONSTRAINT nr
|
|
#endif
|
|
|
|
#include <sys/sdt.h>
|
|
|
|
#define SPDK_DTRACE_PROBE(name) DTRACE_PROBE1(spdk,name,0)
|
|
#define SPDK_DTRACE_PROBE1(name,a1) DTRACE_PROBE2(spdk,name,0,a1)
|
|
#define SPDK_DTRACE_PROBE2(name,a1,a2) DTRACE_PROBE3(spdk,name,0,a1,a2)
|
|
#define SPDK_DTRACE_PROBE3(name,a1,a2,a3) DTRACE_PROBE4(spdk,name,0,a1,a2,a3)
|
|
#define SPDK_DTRACE_PROBE4(name,a1,a2,a3,a4) DTRACE_PROBE5(spdk,name,0,a1,a2,a3,a4)
|
|
|
|
/* These variants implicitly add a TSC argument at the front of the caller's arguments.
|
|
* These are useful for scripts that require an exact timestamp for correlating
|
|
* USDT events with those captured by the lower-overhead SPDK tracing framework.
|
|
*/
|
|
#define SPDK_DTRACE_PROBE_TICKS(name) DTRACE_PROBE1(spdk,name,spdk_get_ticks())
|
|
#define SPDK_DTRACE_PROBE1_TICKS(name,a1) DTRACE_PROBE2(spdk,name,spdk_get_ticks(),a1)
|
|
#define SPDK_DTRACE_PROBE2_TICKS(name,a1,a2) DTRACE_PROBE3(spdk,name,spdk_get_ticks(),a1,a2)
|
|
#define SPDK_DTRACE_PROBE3_TICKS(name,a1,a2,a3) DTRACE_PROBE4(spdk,name,spdk_get_ticks(),a1,a2,a3)
|
|
#define SPDK_DTRACE_PROBE4_TICKS(name,a1,a2,a3,a4) DTRACE_PROBE5(spdk,name,spdk_get_ticks(),a1,a2,a3,a4)
|
|
|
|
#else
|
|
|
|
#define SPDK_DTRACE_PROBE(...)
|
|
#define SPDK_DTRACE_PROBE1(...)
|
|
#define SPDK_DTRACE_PROBE2(...)
|
|
#define SPDK_DTRACE_PROBE3(...)
|
|
#define SPDK_DTRACE_PROBE4(...)
|
|
|
|
#define SPDK_DTRACE_PROBE_TICKS(...)
|
|
#define SPDK_DTRACE_PROBE1_TICKS(...)
|
|
#define SPDK_DTRACE_PROBE2_TICKS(...)
|
|
#define SPDK_DTRACE_PROBE3_TICKS(...)
|
|
#define SPDK_DTRACE_PROBE4_TICKS(...)
|
|
|
|
#endif
|
|
|
|
#endif /* SPDK_INTERNAL_USDT_H */
|