@@ -61,13 +61,6 @@ bt_context_t *jl_to_bt_context(void *sigctx)
61
61
#endif
62
62
}
63
63
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
-
71
64
static int thread0_exit_count = 0 ;
72
65
static void jl_exit_thread0 (int exitstate , jl_bt_element_t * bt_data , size_t bt_size );
73
66
@@ -269,26 +262,6 @@ int exc_reg_is_write_fault(uintptr_t esr) {
269
262
}
270
263
#endif
271
264
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
-
292
265
#if defined(HAVE_MACH )
293
266
#include "signals-mach.c"
294
267
#else
@@ -649,9 +622,6 @@ static void jl_sigsetset(sigset_t *sset)
649
622
#else
650
623
sigaddset (sset , SIGUSR1 );
651
624
#endif
652
- #ifdef SIGTSTP
653
- sigaddset (sset , SIGTSTP );
654
- #endif
655
625
#if defined(HAVE_TIMER )
656
626
sigaddset (sset , SIGUSR1 );
657
627
#elif defined(HAVE_ITIMER )
@@ -676,6 +646,18 @@ static void kqueue_signal(int *sigqueue, struct kevent *ev, int sig)
676
646
}
677
647
#endif
678
648
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
+
679
661
static void * signal_listener (void * arg )
680
662
{
681
663
static jl_bt_element_t bt_data [JL_MAX_BT_SIZE + 1 ];
@@ -697,9 +679,6 @@ static void *signal_listener(void *arg)
697
679
kqueue_signal (& sigqueue , & ev , SIGTERM );
698
680
kqueue_signal (& sigqueue , & ev , SIGABRT );
699
681
kqueue_signal (& sigqueue , & ev , SIGQUIT );
700
- #ifdef SIGTSTP
701
- kqueue_signal (& sigqueue , & ev , SIGTSTP );
702
- #endif
703
682
#ifdef SIGINFO
704
683
kqueue_signal (& sigqueue , & ev , SIGINFO );
705
684
#else
@@ -784,27 +763,18 @@ static void *signal_listener(void *arg)
784
763
785
764
int doexit = critical ;
786
765
#ifdef SIGINFO
787
- if (sig == SIGINFO )
766
+ if (sig == SIGINFO ) {
767
+ if (running != 1 )
768
+ trigger_profile_peek ();
788
769
doexit = 0 ;
770
+ }
789
771
#else
790
772
if (sig == SIGUSR1 )
773
+ if (running != 1 )
774
+ trigger_profile_peek ();
791
775
doexit = 0 ;
792
776
#endif
793
777
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
-
808
778
bt_size = 0 ;
809
779
#if !defined(JL_DISABLE_LIBUNWIND )
810
780
unw_context_t * signal_context ;
0 commit comments