hooks
This commit is contained in:
parent
337991d33c
commit
a8d7cd1835
@ -86,9 +86,11 @@
|
||||
* ~/bitcoin/src/main.h
|
||||
*/
|
||||
|
||||
extern "C" {
|
||||
#include <stdint.h>
|
||||
#include <signal.h>
|
||||
#include <stdio.h>
|
||||
}
|
||||
|
||||
#include <boost/algorithm/string/predicate.hpp>
|
||||
#include <boost/filesystem.hpp>
|
||||
@ -2367,6 +2369,63 @@ jstx_to_ctx(const Local<Object> entry, CTransaction& tx, uint256 hashBlock) {
|
||||
}
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Hooks
|
||||
*/
|
||||
|
||||
#if 0
|
||||
static int last_height = -1;
|
||||
|
||||
extern "C" void __attribute__ ((constructor))
|
||||
trace_begin(void) {
|
||||
return;
|
||||
}
|
||||
|
||||
extern "C" void __attribute__ ((destructor))
|
||||
trace_end(void) {
|
||||
return;
|
||||
}
|
||||
|
||||
extern "C" void
|
||||
__cyg_profile_func_enter(void *func, void *caller) {
|
||||
return;
|
||||
}
|
||||
|
||||
extern "C" void
|
||||
__cyg_profile_func_exit(void *func, void *caller) {
|
||||
int cur_height = chainActive.Height();
|
||||
if (cur_height != last_height) {
|
||||
printf("new block\n");
|
||||
last_height = cur_height;
|
||||
}
|
||||
// if (func == &AcceptBlock || caller == &AcceptBlock || func == AcceptBlock || caller == AcceptBlock) {
|
||||
// printf("accept block\n");
|
||||
// }
|
||||
}
|
||||
#endif
|
||||
|
||||
extern "C" {
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#include <unistd.h>
|
||||
|
||||
int printf(const char *, ...);
|
||||
void __cyg_profile_func_enter(void *this_fn, void *call_site) __attribute__((no_instrument_function));
|
||||
void __cyg_profile_func_exit(void *this_fn, void *call_site) __attribute__((no_instrument_function));
|
||||
}
|
||||
|
||||
void __cyg_profile_func_enter(void *this_fn, void *call_site) {
|
||||
printf("enter\n");
|
||||
(void)call_site;
|
||||
}
|
||||
|
||||
void __cyg_profile_func_exit(void *this_fn, void *call_site) {
|
||||
printf("exit\n");
|
||||
(void)call_site;
|
||||
}
|
||||
|
||||
/**
|
||||
* Init
|
||||
*/
|
||||
|
||||
Loading…
Reference in New Issue
Block a user