-
-
Save KJTsanaktsidis/cbc3229f67bbeda5046b885dc3b82519 to your computer and use it in GitHub Desktop.
rd.h
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// include macros from SystemTap project | |
#include <sys/sdt.h> | |
// ... lots of librdkafka code ... | |
static RD_INLINE RD_UNUSED void *rd_malloc(size_t sz) { | |
void *p = malloc(sz); | |
rd_assert(p); | |
// Add a call to DTRACE_PROBE here to call our probe with the address | |
// of the allocated memory | |
DTRACE_PROBE1(librdkafka, rd_malloc, p); | |
return p; | |
} | |
static RD_INLINE RD_UNUSED void rd_free(void *ptr) { | |
// Call our probe here with the address of the memory being freed | |
DTRACE_PROBE1(librdkafka, rd_free, ptr); | |
free(ptr); | |
} | |
// ... lots more librdkafka code ... |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment