Skip to content

Commit

Permalink
Merge pull request #176 from lukego/switch-sigprof-to-sigvtalrm
Browse files Browse the repository at this point in the history
Use virtual instead of profile time for vmprofile
  • Loading branch information
lukego authored Aug 1, 2018
2 parents d38be0e + 6b72001 commit a4f36d3
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/lj_vmprofile.c
Original file line number Diff line number Diff line change
Expand Up @@ -88,20 +88,20 @@ static void start_timer(int interval)
struct sigaction sa;
tm.it_value.tv_sec = tm.it_interval.tv_sec = interval / 1000;
tm.it_value.tv_usec = tm.it_interval.tv_usec = (interval % 1000) * 1000;
setitimer(ITIMER_PROF, &tm, NULL);
setitimer(ITIMER_VIRTUAL, &tm, NULL);
sa.sa_flags = SA_SIGINFO | SA_RESTART;
sa.sa_sigaction = vmprofile_signal;
sigemptyset(&sa.sa_mask);
sigaction(SIGPROF, &sa, &state.oldsa);
sigaction(SIGVTALRM, &sa, &state.oldsa);
}

static void stop_timer()
{
struct itimerval tm;
tm.it_value.tv_sec = tm.it_interval.tv_sec = 0;
tm.it_value.tv_usec = tm.it_interval.tv_usec = 0;
setitimer(ITIMER_PROF, &tm, NULL);
sigaction(SIGPROF, NULL, &state.oldsa);
setitimer(ITIMER_VIRTUAL, &tm, NULL);
sigaction(SIGVTALRM, NULL, &state.oldsa);
}

/* -- State that the application can manage via FFI ----------------------- */
Expand Down

0 comments on commit a4f36d3

Please sign in to comment.