#endif
#include "util/compress.h"
+#include "util/perf/cpu_trace.h"
#include "macros.h"
/* 3 is the recomended level, with 22 as the absolute maximum */
util_compress_deflate(const uint8_t *in_data, size_t in_data_size,
uint8_t *out_data, size_t out_buff_size)
{
+ MESA_TRACE_FUNC();
#ifdef HAVE_ZSTD
size_t ret = ZSTD_compress(out_data, out_buff_size, in_data, in_data_size,
ZSTD_COMPRESSION_LEVEL);
util_compress_inflate(const uint8_t *in_data, size_t in_data_size,
uint8_t *out_data, size_t out_data_size)
{
+ MESA_TRACE_FUNC();
#ifdef HAVE_ZSTD
size_t ret = ZSTD_decompress(out_data, out_data_size, in_data, in_data_size);
return !ZSTD_isError(ret);
entry->uncompressed_size = size;
- MESA_TRACE_BEGIN("deflate");
size_t compressed_size =
util_compress_deflate(data, size, entry->compressed_data, max_buf);
- MESA_TRACE_END();
if (!compressed_size)
goto out;
unsigned entry_size = compressed_size + sizeof(*entry);
- MESA_TRACE_BEGIN("blob_put");
- cache->blob_put_cb(key, CACHE_KEY_SIZE, entry, entry_size);
- MESA_TRACE_END();
+ // The curly brackets are here to only trace the blob_put_cb call
+ {
+ MESA_TRACE_SCOPE("blob_put");
+ cache->blob_put_cb(key, CACHE_KEY_SIZE, entry, entry_size);
+ }
out:
free(entry);
if (!entry)
return NULL;
- MESA_TRACE_BEGIN("blob_get");
- signed long entry_size =
- cache->blob_get_cb(key, CACHE_KEY_SIZE, entry, max_blob_size);
- MESA_TRACE_END();
+ signed long entry_size;
+ // The curly brackets are here to only trace the blob_get_cb call
+ {
+ MESA_TRACE_SCOPE("blob_get");
+ entry_size = cache->blob_get_cb(key, CACHE_KEY_SIZE, entry, max_blob_size);
+ }
if (!entry_size) {
free(entry);
}
unsigned compressed_size = entry_size - sizeof(*entry);
- MESA_TRACE_BEGIN("inflate");
bool ret = util_compress_inflate(entry->compressed_data, compressed_size,
data, entry->uncompressed_size);
- MESA_TRACE_END();
if (!ret) {
free(data);
free(entry);