This is much faster to give 64 bits of data, and we don't need cryptographic randomness. This brings us back to 413ns per trace. Before: real 0m5.819000-6.472000(6.2064+/-0.26)s user 0m3.779000-4.101000(3.956+/-0.12)s sys 0m2.040000-2.431000(2.2496+/-0.15)s After: real 0m3.981000-4.247000(4.1276+/-0.11)s user 0m3.979000-4.245000(4.126+/-0.11)s sys 0m0.000000-0.002000(0.001+/-0.00063)s Signed-off-by: Rusty Russell <rusty@rustcorp.com.au> Changelog-Fixed: lightingd: trimmed overhead of tracing infrastructure.
25 lines
1.0 KiB
C
25 lines
1.0 KiB
C
#ifndef LIGHTNING_COMMON_TRACE_H
|
|
#define LIGHTNING_COMMON_TRACE_H
|
|
#include "config.h"
|
|
#include <ccan/short_types/short_types.h>
|
|
|
|
#undef TRACE_DEBUG
|
|
|
|
/* name must be a string constant */
|
|
#define trace_span_start(name, key) trace_span_start_(name "", (key))
|
|
void trace_span_start_(const char *name, const void *key);
|
|
void trace_span_end(const void *key);
|
|
void trace_span_tag(const void *key, const char *name, const char *value);
|
|
void trace_cleanup(void);
|
|
void trace_span_remote(u64 trace_id_hi, u64 trade_id_lo, u64 span_id);
|
|
|
|
#define TRACE_LBL __FILE__ ":" stringify(__LINE__)
|
|
void trace_span_suspend_(const void *key, const char *lbl);
|
|
void trace_span_suspend_may_free_(const void *key, const char *lbl);
|
|
void trace_span_resume_(const void *key, const char *lbl);
|
|
#define trace_span_suspend(key) trace_span_suspend_(key, TRACE_LBL)
|
|
#define trace_span_suspend_may_free(key) trace_span_suspend_may_free_(key, TRACE_LBL)
|
|
#define trace_span_resume(key) trace_span_resume_(key, TRACE_LBL)
|
|
|
|
#endif /* LIGHTNING_COMMON_TRACE_H */
|