Skip to content

Instantly share code, notes, and snippets.

@DavidPoliakoff
Last active August 4, 2017 15:39
Show Gist options
  • Save DavidPoliakoff/ceee3ac7857a0e4779c84e83791b318d to your computer and use it in GitHub Desktop.
Save DavidPoliakoff/ceee3ac7857a0e4779c84e83791b318d to your computer and use it in GitHub Desktop.
Gotcha Example
ssize_t (*orig_read)(int fildes, void *buf, size_t nbyte);
ssize_t read_wrapper(int fildes, void* buf, size_t nbyte){
cali::Annotation("bytes_read").set(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, "cali_bytecounter_tool");
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment