MCPcopy Create free account
hub / github.com/apple/foundationdb / setupRunLoopProfiler

Function setupRunLoopProfiler

flow/Platform.actor.cpp:3896–3917  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3894}
3895
3896void 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__

Callers 3

mainFunction · 0.85
startMethod · 0.85
runNetworkFunction · 0.85

Calls 5

TraceEventClass · 0.85
initProfilingFunction · 0.85
detailMethod · 0.80
sigactionClass · 0.70
startThreadFunction · 0.70

Tested by

no test coverage detected