lib/trace: Don't initialize traces if requested num entries is 0
Context: Every-time the SPDK starts, it creates a large file under /dev/shm (130 MB in my setup) which is never removed when the application terminates. The number of trace entries can be tuned using the SPDK runtime option 'num_entries'. A value of 0 for this option considerably reduces the size of the trace file (few MBs) but it is still created. This patch adds a special case in the code when num_entries=0: the trace system would not be initialized, and the trace file would not be created in this case. The rest of the code properly handle the case where the trace system is never initialized. Signed-off-by: Sylvain Didelot <sdidelot@ddn.com> Change-Id: If54a548de4a2ce2def8e57d527d0dc20bc55fe4d Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/606 Reviewed-by: Jim Harris <james.r.harris@intel.com> Reviewed-by: Ben Walker <benjamin.walker@intel.com> Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com> Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
This commit is contained in:
parent
a11aab73e8
commit
1fd3d8e994
@ -87,6 +87,11 @@ spdk_trace_init(const char *shm_name, uint64_t num_entries)
|
||||
int histories_size;
|
||||
uint64_t lcore_offsets[SPDK_TRACE_MAX_LCORE + 1];
|
||||
|
||||
/* 0 entries requested - skip trace initialization */
|
||||
if (num_entries == 0) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
lcore_offsets[0] = sizeof(struct spdk_trace_flags);
|
||||
for (i = 1; i < (int)SPDK_COUNTOF(lcore_offsets); i++) {
|
||||
lcore_offsets[i] = spdk_get_trace_history_size(num_entries) + lcore_offsets[i - 1];
|
||||
|
Loading…
Reference in New Issue
Block a user