Skip to content

Instantly share code, notes, and snippets.

@DavidPoliakoff
Created August 4, 2017 15:39
Show Gist options
  • Save DavidPoliakoff/2246a82f2a5500d8e138ec9dcf1e2f2f to your computer and use it in GitHub Desktop.
Save DavidPoliakoff/2246a82f2a5500d8e138ec9dcf1e2f2f to your computer and use it in GitHub Desktop.
Gotcha_tau
ssize_t (*orig_read)(int fildes, void *buf, size_t nbyte);
ssize_t read_wrapper(int fildes, void* buf, size_t nbyte){
TAU_REGISTER_CONTEXT_EVENT(event, "Bytes read");
TAU_CONTEXT_EVENT(event, nbyte);
return orig_read(fildes, buf, nbyte);
}
struct gotcha_binding_t wrap_actions[] = {
{ "read", read_wrapper, &orig_read }
};
void init_bytecounter_tool(){
gotcha_wrap(wrap_actions, 1, "tau_bytecounter_tool");
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment