fix profiling on linux

This commit is contained in:
Philip C Monk 2015-05-13 19:48:29 -04:00
parent 9b9fe1bfb4
commit 7641dfad01

24
n/t.c
View File

@ -349,7 +349,29 @@ u3t_boot(void)
}
#endif
#elif defined(U3_OS_linux)
// TODO: support profiling on linux
{
struct itimerval itm_v;
struct sigaction sig_s;
sigset_t set;
sig_s.sa_handler = _ct_sigaction;
sigemptyset(&(sig_s.sa_mask));
sig_s.sa_flags = 0;
sigaction(SIGPROF, &sig_s, 0);
sigemptyset(&set);
sigaddset(&set, SIGPROF);
if ( 0 != pthread_sigmask(SIG_UNBLOCK, &set, NULL) ) {
perror("pthread_sigmask");
}
itm_v.it_interval.tv_sec = 0;
itm_v.it_interval.tv_usec = 10000;
// itm_v.it_interval.tv_usec = 100000;
itm_v.it_value = itm_v.it_interval;
setitimer(ITIMER_PROF, &itm_v, 0);
}
#elif defined(U3_OS_bsd)
// TODO: support profiling on bsd
#else