From 19c1d632f1f6416b19bc052c1234658f8e232319 Mon Sep 17 00:00:00 2001 From: Krzysztof Karas Date: Fri, 23 Sep 2022 12:00:03 +0200 Subject: [PATCH] trace: update trace help inside SPDK target Delete bit masks from trace help (found inside build/bin/spdk_tgt -h help text), as they do not provide useful information, are much harder to remember and use, and migh leave user confused. Since we provide trace group names anyway, bit masks are excessive. Change --tpoint-group-mask parameter name to --tpoint-group, because we do not provide bit masks anymore. Drop "default" tpoint group mask from help text, since it does not enable any tracepoints and may confuse the user. Change-Id: I2ca780883dfa7822e76523e9ba1fc65a7bfe5a99 Signed-off-by: Krzysztof Karas Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/14656 Tested-by: SPDK CI Jenkins Community-CI: Mellanox Build Bot Reviewed-by: Jim Harris Reviewed-by: Ben Walker --- doc/applications.md | 4 ++-- lib/event/app.c | 6 +++--- lib/trace/trace_flags.c | 21 ++++++++++++++------- scripts/bash-completion/spdk | 2 +- test/blobfs/rocksdb/rocksdb.sh | 4 ++-- test/iscsi_tgt/trace_record/trace_record.sh | 2 +- 6 files changed, 23 insertions(+), 16 deletions(-) diff --git a/doc/applications.md b/doc/applications.md index ea173d935..84203962a 100644 --- a/doc/applications.md +++ b/doc/applications.md @@ -29,7 +29,7 @@ Param | Long Param | Type | Default | Descript -------- | ---------------------- | -------- | ---------------------- | ----------- -c | --config | string | | @ref cmd_arg_config_file -d | --limit-coredump | flag | false | @ref cmd_arg_limit_coredump --e | --tpoint-group-mask | integer | 0x0 | @ref cmd_arg_limit_tpoint_group_mask +-e | --tpoint-group | integer | | @ref cmd_arg_limit_tpoint_group_mask -g | --single-file-segments | flag | | @ref cmd_arg_single_file_segments -h | --help | flag | | show all available parameters and exit -i | --shm-id | integer | | @ref cmd_arg_multi_process @@ -61,7 +61,7 @@ to RLIM_INFINITY. Specifying `--limit-coredump` will not set the resource limit SPDK has an experimental low overhead tracing framework. Tracepoints in this framework are organized into tracepoint groups. By default, all tracepoint -groups are disabled. `--tpoint-group-mask` can be used to enable a specific +groups are disabled. `--tpoint-group` can be used to enable a specific subset of tracepoint groups in the application. Note: Additional documentation on the tracepoint framework is in progress. diff --git a/lib/event/app.c b/lib/event/app.c index 5b93bb968..a9f377093 100644 --- a/lib/event/app.c +++ b/lib/event/app.c @@ -62,8 +62,8 @@ static const struct option g_cmdline_options[] = { {"config", required_argument, NULL, CONFIG_FILE_OPT_IDX}, #define LIMIT_COREDUMP_OPT_IDX 'd' {"limit-coredump", no_argument, NULL, LIMIT_COREDUMP_OPT_IDX}, -#define TPOINT_GROUP_MASK_OPT_IDX 'e' - {"tpoint-group-mask", required_argument, NULL, TPOINT_GROUP_MASK_OPT_IDX}, +#define TPOINT_GROUP_OPT_IDX 'e' + {"tpoint-group", required_argument, NULL, TPOINT_GROUP_OPT_IDX}, #define SINGLE_FILE_SEGMENTS_OPT_IDX 'g' {"single-file-segments", no_argument, NULL, SINGLE_FILE_SEGMENTS_OPT_IDX}, #define HELP_OPT_IDX 'h' @@ -812,7 +812,7 @@ spdk_app_parse_args(int argc, char **argv, struct spdk_app_opts *opts, case LIMIT_COREDUMP_OPT_IDX: opts->enable_coredump = false; break; - case TPOINT_GROUP_MASK_OPT_IDX: + case TPOINT_GROUP_OPT_IDX: opts->tpoint_group_mask = optarg; break; case SINGLE_FILE_SEGMENTS_OPT_IDX: diff --git a/lib/trace/trace_flags.c b/lib/trace/trace_flags.c index cd3ea302d..953a7f442 100644 --- a/lib/trace/trace_flags.c +++ b/lib/trace/trace_flags.c @@ -193,23 +193,30 @@ void spdk_trace_mask_usage(FILE *f, const char *tmask_arg) { struct spdk_trace_register_fn *register_fn; + bool first_group_name = true; - fprintf(f, " %s, --tpoint-group-mask [:]\n", tmask_arg); - fprintf(f, " group_mask - tracepoint group mask "); - fprintf(f, "for spdk trace buffers (default 0x0"); + fprintf(f, " %s, --tpoint-group [:]\n", tmask_arg); + fprintf(f, " group_name - tracepoint group name "); + fprintf(f, "for spdk trace buffers ("); register_fn = g_reg_fn_head; while (register_fn) { - fprintf(f, ", %s 0x%x", register_fn->name, 1 << register_fn->tgroup_id); + if (first_group_name) { + fprintf(f, "%s", register_fn->name); + first_group_name = false; + } else { + fprintf(f, ", %s", register_fn->name); + } register_fn = register_fn->next; } - fprintf(f, ", all 0xffff)\n"); + fprintf(f, ", all)\n"); fprintf(f, " tpoint_mask - tracepoint mask for enabling individual"); fprintf(f, " tpoints inside a tracepoint group."); fprintf(f, " First tpoint inside a group can be"); - fprintf(f, " enabled by setting tpoint_mask to 1 (e.g. 0x8:1).\n"); - fprintf(f, " Masks can be combined (e.g. 0x400,0x8:1).\n"); + fprintf(f, " enabled by setting tpoint_mask to 1 (e.g. bdev:0x1).\n"); + fprintf(f, " Groups and masks can be combined (e.g."); + fprintf(f, " thread,bdev:0x1).\n"); fprintf(f, " All available tpoints can be found in"); fprintf(f, " /include/spdk_internal/trace_defs.h\n"); } diff --git a/scripts/bash-completion/spdk b/scripts/bash-completion/spdk index 9cee5283f..7c3236063 100644 --- a/scripts/bash-completion/spdk +++ b/scripts/bash-completion/spdk @@ -133,7 +133,7 @@ _spdk_opt_to_complete() { --iova-mode) COMPREPLY=($(compgen -W 'pa va' -- "$cur")) ;; - --tpoint-group-mask | -e) + --tpoint-group | -e) COMPREPLY=($(compgen -W '$(_get_tpoint_g_masks)' -- "$cur")) compopt -o nosort ;; diff --git a/test/blobfs/rocksdb/rocksdb.sh b/test/blobfs/rocksdb/rocksdb.sh index b23864e5f..87f47dae8 100755 --- a/test/blobfs/rocksdb/rocksdb.sh +++ b/test/blobfs/rocksdb/rocksdb.sh @@ -44,7 +44,7 @@ run_step() { run_bsdump() { # 0x80 is the bit mask for BlobFS tracepoints - $SPDK_EXAMPLE_DIR/blobcli -j $ROCKSDB_CONF -b Nvme0n1 --tpoint-group-mask 0x80 &> bsdump.txt + $SPDK_EXAMPLE_DIR/blobcli -j $ROCKSDB_CONF -b Nvme0n1 --tpoint-group blobfs &> bsdump.txt } # In the autotest job, we copy the rocksdb source to just outside the spdk directory. @@ -83,7 +83,7 @@ trap 'dump_db_bench_on_err; run_bsdump || :; rm -f $ROCKSDB_CONF; sanitize_resul if [ -z "$SKIP_MKFS" ]; then # 0x80 is the bit mask for BlobFS tracepoints - run_test "blobfs_mkfs" $rootdir/test/blobfs/mkfs/mkfs $ROCKSDB_CONF Nvme0n1 --tpoint-group-mask 0x80 + run_test "blobfs_mkfs" $rootdir/test/blobfs/mkfs/mkfs $ROCKSDB_CONF Nvme0n1 --tpoint-group blobfs fi mkdir -p $output_dir/rocksdb diff --git a/test/iscsi_tgt/trace_record/trace_record.sh b/test/iscsi_tgt/trace_record/trace_record.sh index 5a411e3ae..0cd1e5479 100755 --- a/test/iscsi_tgt/trace_record/trace_record.sh +++ b/test/iscsi_tgt/trace_record/trace_record.sh @@ -36,7 +36,7 @@ fio_py="$rootdir/scripts/fio-wrapper" timing_enter start_iscsi_tgt echo "start iscsi_tgt with trace enabled" -"${ISCSI_APP[@]}" -m 0xf --num-trace-entries $NUM_TRACE_ENTRIES --tpoint-group-mask 0xf & +"${ISCSI_APP[@]}" -m 0xf --num-trace-entries $NUM_TRACE_ENTRIES --tpoint-group all & iscsi_pid=$! echo "Process pid: $iscsi_pid"