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

Function adjustFDLimit

src/perfEvents_linux.cpp:166–172  ·  view source on GitHub ↗

Perf events consume one file descriptor per thread. Make sure the current limit is the highest possible.

Source from the content-addressed store, hash-verified

164// Perf events consume one file descriptor per thread.
165// Make sure the current limit is the highest possible.
166static void adjustFDLimit() {
167 struct rlimit rlim;
168 if (getrlimit(RLIMIT_NOFILE, &rlim) == 0 && rlim.rlim_cur < rlim.rlim_max) {
169 rlim.rlim_cur = rlim.rlim_max;
170 setrlimit(RLIMIT_NOFILE, &rlim);
171 }
172}
173
174// Workaround for the kernel bug: PERF_EVENT_IOC_REFRESH can hang
175// the entire system on Linux 6.16.x and 6.17.x.

Callers 1

startMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected