trace: allow to specify multiple tpoint group masks
This change implements mechanism to allow user to define multiple tpoint masks separeted with a comma (e.g. 0x400, 0x8). This is going to be used in the next patch to implement enabling of individual tracepoints inside a tracepoint group. Change-Id: I963f89684aa62b6e1dde57e22ddf835aa2c89f05 Signed-off-by: Krzysztof Karas <krzysztof.karas@intel.com> Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/10536 Community-CI: Broadcom CI <spdk-ci.pdl@broadcom.com> Community-CI: Mellanox Build Bot Tested-by: SPDK CI Jenkins <sys_sgci@intel.com> Reviewed-by: Konrad Sztyber <konrad.sztyber@intel.com> Reviewed-by: Jim Harris <james.r.harris@intel.com>
This commit is contained in:
parent
6237da13c0
commit
f076b51205
@ -368,7 +368,8 @@ app_setup_trace(struct spdk_app_opts *opts)
|
||||
{
|
||||
char shm_name[64];
|
||||
uint64_t tpoint_group_mask;
|
||||
char *end;
|
||||
char *end = NULL, *tpoint_group_mask_str;
|
||||
char *tpoint_group_str, *tp_g_str;
|
||||
|
||||
if (opts->shm_id >= 0) {
|
||||
snprintf(shm_name, sizeof(shm_name), "/%s_trace.%d", opts->name, opts->shm_id);
|
||||
@ -380,24 +381,42 @@ app_setup_trace(struct spdk_app_opts *opts)
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (opts->tpoint_group_mask != NULL) {
|
||||
errno = 0;
|
||||
tpoint_group_mask = strtoull(opts->tpoint_group_mask, &end, 16);
|
||||
if (*end != '\0' || errno) {
|
||||
SPDK_ERRLOG("invalid tpoint mask %s\n", opts->tpoint_group_mask);
|
||||
} else {
|
||||
SPDK_NOTICELOG("Tracepoint Group Mask %s specified.\n", opts->tpoint_group_mask);
|
||||
SPDK_NOTICELOG("Use 'spdk_trace -s %s %s %d' to capture a snapshot of events at runtime.\n",
|
||||
opts->name,
|
||||
opts->shm_id >= 0 ? "-i" : "-p",
|
||||
opts->shm_id >= 0 ? opts->shm_id : getpid());
|
||||
#if defined(__linux__)
|
||||
SPDK_NOTICELOG("Or copy /dev/shm%s for offline analysis/debug.\n", shm_name);
|
||||
#endif
|
||||
spdk_trace_set_tpoint_group_mask(tpoint_group_mask);
|
||||
}
|
||||
if (opts->tpoint_group_mask == NULL) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
tpoint_group_mask_str = strdup(opts->tpoint_group_mask);
|
||||
if (tpoint_group_mask_str == NULL) {
|
||||
SPDK_ERRLOG("Unable to get string of tpoint group mask from opts.\n");
|
||||
return -1;
|
||||
}
|
||||
/* Save a pointer to the original value of the tpoint group mask string
|
||||
* to free later, because spdk_strsepq() modifies given char*. */
|
||||
tp_g_str = tpoint_group_mask_str;
|
||||
while ((tpoint_group_str = spdk_strsepq(&tpoint_group_mask_str, ",")) != NULL) {
|
||||
errno = 0;
|
||||
tpoint_group_mask = strtoull(tpoint_group_str, &end, 16);
|
||||
if (*end != '\0' || errno) {
|
||||
break;
|
||||
}
|
||||
|
||||
spdk_trace_set_tpoint_group_mask(tpoint_group_mask);
|
||||
}
|
||||
|
||||
if (tpoint_group_str != NULL) {
|
||||
SPDK_ERRLOG("invalid tpoint mask %s\n", opts->tpoint_group_mask);
|
||||
} else {
|
||||
SPDK_NOTICELOG("Tracepoint Group Mask %s specified.\n", opts->tpoint_group_mask);
|
||||
SPDK_NOTICELOG("Use 'spdk_trace -s %s %s %d' to capture a snapshot of events at runtime.\n",
|
||||
opts->name,
|
||||
opts->shm_id >= 0 ? "-i" : "-p",
|
||||
opts->shm_id >= 0 ? opts->shm_id : getpid());
|
||||
#if defined(__linux__)
|
||||
SPDK_NOTICELOG("Or copy /dev/shm%s for offline analysis/debug.\n", shm_name);
|
||||
#endif
|
||||
}
|
||||
free(tp_g_str);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user