@@ -61,13 +61,6 @@ bt_context_t *jl_to_bt_context(void *sigctx)
6161#endif
6262}
6363
64- uint64_t profile_show_peek_cond_loc ;
65- JL_DLLEXPORT void jl_set_peek_cond (uint64_t cond )
66- {
67- profile_show_peek_cond_loc = cond ;
68- return ;
69- }
70-
7164static int thread0_exit_count = 0 ;
7265static void jl_exit_thread0 (int exitstate , jl_bt_element_t * bt_data , size_t bt_size );
7366
@@ -269,26 +262,6 @@ int exc_reg_is_write_fault(uintptr_t esr) {
269262}
270263#endif
271264
272- static double profile_autostop_time = -1.0 ;
273- static double profile_peek_duration = 1.0 ; // seconds
274-
275- double jl_get_profile_peek_duration (void ) {
276- return profile_peek_duration ;
277- }
278- void jl_set_profile_peek_duration (double t ) {
279- profile_peek_duration = t ;
280- return ;
281- }
282-
283- static void jl_check_profile_autostop (void ) {
284- if ((profile_autostop_time != -1.0 ) && (jl_hrtime () > profile_autostop_time )) {
285- profile_autostop_time = -1.0 ;
286- jl_profile_stop_timer ();
287- jl_safe_printf ("Profile collected. A report will print at the next yield point.\n" );
288- uv_async_send (profile_show_peek_cond_loc );
289- }
290- }
291-
292265#if defined(HAVE_MACH )
293266#include "signals-mach.c"
294267#else
@@ -649,9 +622,6 @@ static void jl_sigsetset(sigset_t *sset)
649622#else
650623 sigaddset (sset , SIGUSR1 );
651624#endif
652- #ifdef SIGTSTP
653- sigaddset (sset , SIGTSTP );
654- #endif
655625#if defined(HAVE_TIMER )
656626 sigaddset (sset , SIGUSR1 );
657627#elif defined(HAVE_ITIMER )
@@ -676,6 +646,18 @@ static void kqueue_signal(int *sigqueue, struct kevent *ev, int sig)
676646}
677647#endif
678648
649+ void trigger_profile_peek (void )
650+ {
651+ jl_safe_printf ("\n=============================================================================================\n" );
652+ jl_safe_printf ("Information request received. A stacktrace will print followed by a %.1f second profile report\n" , profile_peek_duration );
653+ jl_safe_printf ("=============================================================================================\n" );
654+ bt_size_cur = 0 ; // clear profile buffer
655+ if (jl_profile_start_timer () < 0 )
656+ jl_safe_printf ("ERROR: Could not start profile timer\n" );
657+ else
658+ profile_autostop_time = jl_hrtime () + (profile_peek_duration * 1e9 );
659+ }
660+
679661static void * signal_listener (void * arg )
680662{
681663 static jl_bt_element_t bt_data [JL_MAX_BT_SIZE + 1 ];
@@ -697,9 +679,6 @@ static void *signal_listener(void *arg)
697679 kqueue_signal (& sigqueue , & ev , SIGTERM );
698680 kqueue_signal (& sigqueue , & ev , SIGABRT );
699681 kqueue_signal (& sigqueue , & ev , SIGQUIT );
700- #ifdef SIGTSTP
701- kqueue_signal (& sigqueue , & ev , SIGTSTP );
702- #endif
703682#ifdef SIGINFO
704683 kqueue_signal (& sigqueue , & ev , SIGINFO );
705684#else
@@ -784,27 +763,18 @@ static void *signal_listener(void *arg)
784763
785764 int doexit = critical ;
786765#ifdef SIGINFO
787- if (sig == SIGINFO )
766+ if (sig == SIGINFO ) {
767+ if (running != 1 )
768+ trigger_profile_peek ();
788769 doexit = 0 ;
770+ }
789771#else
790772 if (sig == SIGUSR1 )
773+ if (running != 1 )
774+ trigger_profile_peek ();
791775 doexit = 0 ;
792776#endif
793777
794- #ifdef SIGTSTP
795- if (sig == SIGTSTP ) {
796- if (running != 1 ) {
797- jl_safe_printf (" SIGTSTP received. Collecting a %.1f second profile report...\n" , profile_peek_duration );
798- bt_size_cur = 0 ; // clear profile buffer
799- if (jl_profile_start_timer () < 0 )
800- jl_safe_printf ("ERROR: Could not start profile timer\n" );
801- else
802- profile_autostop_time = jl_hrtime () + (profile_peek_duration * 1e9 );
803- }
804- doexit = 0 ;
805- }
806- #endif
807-
808778 bt_size = 0 ;
809779#if !defined(JL_DISABLE_LIBUNWIND )
810780 unw_context_t * signal_context ;
0 commit comments