common: Add trace_cleanup() function for unit tests

This commit is contained in:
Christian Decker 2023-12-15 10:51:56 +10:30 committed by Rusty Russell
parent 7717f6e4df
commit 7ce0942ee2
2 changed files with 9 additions and 0 deletions

View file

@ -195,6 +195,13 @@ void trace_span_resume(const void *key)
current = trace_span_find(numkey);
DTRACE_PROBE1(lightningd, span_resume, current->id);
}
void trace_cleanup(void)
{
free(active_spans);
active_spans = NULL;
}
#else /* HAVE_USDT */
void trace_span_start(const char *name, const void *key) {}
@ -202,5 +209,6 @@ void trace_span_end(const void *key) {}
void trace_span_suspend(const void *key) {}
void trace_span_resume(const void *key) {}
void trace_span_tag(const void *key, const char *name, const char *value) {}
void trace_cleanup(void) {}
#endif /* HAVE_USDT */

View file

@ -7,5 +7,6 @@ void trace_span_end(const void *key);
void trace_span_suspend(const void *key);
void trace_span_resume(const void *key);
void trace_span_tag(const void *key, const char *name, const char *value);
void trace_cleanup(void);
#endif /* LIGHTNING_COMMON_TRACE_H */