[trace] Keep track of a uint64_t tracing context
The most common information that you want to track between begin() and end() is the timestamp of the begin function, so you can measure the duration of the (de)compression call. Allow the tracing library to put this information inside the `ZSTD_TraceCtx`, so it doesn't need to keep a global map in this case. If a single uint64_t is not enough, the tracing library can return a unique identifier (like the context pointer) instead, and use it as a key in a map. This keeps the simple case simple.
This commit is contained in:
@@ -21,6 +21,7 @@
|
||||
*********************************************************/
|
||||
#include "../common/mem.h" /* BYTE, U16, U32 */
|
||||
#include "../common/zstd_internal.h" /* ZSTD_seqSymbol */
|
||||
#include "../common/zstd_trace.h" /* ZSTD_TraceCtx */
|
||||
|
||||
|
||||
|
||||
@@ -178,7 +179,9 @@ struct ZSTD_DCtx_s
|
||||
#endif
|
||||
|
||||
/* Tracing */
|
||||
int tracingEnabled;
|
||||
#if ZSTD_TRACE
|
||||
ZSTD_TraceCtx traceCtx;
|
||||
#endif
|
||||
}; /* typedef'd to ZSTD_DCtx within "zstd.h" */
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user