diff --git a/public/client/TracySysTrace.cpp b/public/client/TracySysTrace.cpp index 58ec5e80..4672c485 100644 --- a/public/client/TracySysTrace.cpp +++ b/public/client/TracySysTrace.cpp @@ -420,10 +420,22 @@ struct SysTraceState int ctxBufferIdx = 0; bool ctxSwitchCallchain = false; RingBuffer* ring = nullptr; + int* redirectFd = nullptr; + int numRedirectFd = 0; }; static SysTraceState s_state; +// Sampling events of one kind on one CPU share a ring: the first thread's event owns it +// (the sharedRingFd array, per event kind and CPU), the others are redirected into it with +// PERF_EVENT_IOC_SET_OUTPUT. Redirected fds are kept open, and enabled by the worker. +static void CloseRedirectFds() +{ + for( int i=0; i