MCPcopy Create free account
hub / github.com/async-profiler/async-profiler / signalHandler

Method signalHandler

src/wallClock.cpp:129–145  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

127}
128
129void WallClock::signalHandler(int signo, siginfo_t* siginfo, void* ucontext) {
130 if (_mode == WALL_BATCH) {
131 WallClockEvent event;
132 event._start_time = TSC::ticks();
133 event._time_span = 0;
134 event._thread_state = getThreadState(ucontext);
135 event._samples = 1;
136 u64 trace = Profiler::instance()->recordSample(ucontext, _interval, WALL_CLOCK_SAMPLE, &event);
137 if (event._thread_state == THREAD_SLEEPING && trace != 0) {
138 _thread_cpu_time_buf.add(trace);
139 }
140 } else {
141 ExecutionEvent event(TSC::ticks());
142 event._thread_state = _mode == CPU_ONLY ? THREAD_UNKNOWN : getThreadState(ucontext);
143 Profiler::instance()->recordSample(ucontext, _interval, EXECUTION_SAMPLE, &event);
144 }
145}
146
147void WallClock::recordWallClock(const ThreadSleepState& tss, ThreadState state, int tid) {
148 WallClockEvent event;

Callers

nothing calls this directly

Calls 2

recordSampleMethod · 0.80
addMethod · 0.45

Tested by

no test coverage detected