| 3894 | } |
| 3895 | |
| 3896 | void setupRunLoopProfiler() { |
| 3897 | #ifdef __linux__ |
| 3898 | if (!profileThread && FLOW_KNOBS->RUN_LOOP_PROFILING_INTERVAL > 0) { |
| 3899 | TraceEvent("StartingRunLoopProfilingThread").detail("Interval", FLOW_KNOBS->RUN_LOOP_PROFILING_INTERVAL); |
| 3900 | initProfiling(); |
| 3901 | profileThread = true; |
| 3902 | |
| 3903 | struct sigaction action; |
| 3904 | action.sa_handler = profileHandler; |
| 3905 | sigfillset(&action.sa_mask); |
| 3906 | action.sa_flags = 0; |
| 3907 | sigaction(SIGPROF, &action, nullptr); |
| 3908 | |
| 3909 | // Start a thread which will use signals to log stacks on long events |
| 3910 | pthread_t* mainThread = (pthread_t*)malloc(sizeof(pthread_t)); |
| 3911 | *mainThread = pthread_self(); |
| 3912 | startThread(&checkThread, (void*)mainThread, 0, "fdb-loopprofile"); |
| 3913 | } |
| 3914 | #else |
| 3915 | // No slow task profiling for other platforms! |
| 3916 | #endif |
| 3917 | } |
| 3918 | |
| 3919 | // UnitTest for getMemoryInfo |
| 3920 | #ifdef __linux__ |
no test coverage detected