2015-05-10 16:35:52 -05:00
|
|
|
// 10 may 2015
|
|
|
|
#include "uipriv_windows.h"
|
|
|
|
|
|
|
|
static FILE *fprof = NULL;
|
|
|
|
|
2015-05-11 10:46:34 -05:00
|
|
|
__attribute__((no_instrument_function)) static void init(void)
|
2015-05-10 16:35:52 -05:00
|
|
|
{
|
2015-05-11 10:46:34 -05:00
|
|
|
if (fprof != NULL)
|
|
|
|
return;
|
2015-05-10 22:02:16 -05:00
|
|
|
fprof = fopen("profiler.out", "w");
|
|
|
|
if (fprof == NULL) {
|
|
|
|
fprintf(stderr, "error opening profiler output file\n");
|
|
|
|
abort();
|
|
|
|
}
|
2015-05-11 10:46:34 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
__attribute__((no_instrument_function)) void __cyg_profile_func_enter(void *this_fn, void *call_site)
|
|
|
|
{
|
|
|
|
LARGE_INTEGER counter;
|
|
|
|
|
|
|
|
init();
|
|
|
|
QueryPerformanceCounter(&counter);
|
|
|
|
fprintf(fprof, "enter %p %I64d\n", this_fn, counter.QuadPart);
|
|
|
|
fflush(fprof);
|
|
|
|
}
|
|
|
|
|
|
|
|
__attribute__((no_instrument_function)) void __cyg_profile_func_exit(void *this_fn, void *call_site)
|
|
|
|
{
|
|
|
|
LARGE_INTEGER counter;
|
|
|
|
|
|
|
|
init();
|
|
|
|
QueryPerformanceCounter(&counter);
|
|
|
|
fprintf(fprof, "leave %p %I64d\n", this_fn, counter.QuadPart);
|
|
|
|
fflush(fprof);
|
2015-05-10 16:35:52 -05:00
|
|
|
}
|