MCPcopy Create free account
hub / github.com/apache/mesos / readJemallocSetting

Function readJemallocSetting

3rdparty/libprocess/src/memory_profiler.cpp:191–211  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

189
190template<typename T>
191Try<T> readJemallocSetting(const char* name)
192{
193#ifdef LIBPROCESS_ALLOW_JEMALLOC
194 if (!detectJemalloc()) {
195 return Error(JEMALLOC_NOT_DETECTED_MESSAGE);
196 }
197
198 T value;
199 size_t size = sizeof(value);
200 int error = ::mallctl(name, &value, &size, nullptr, 0);
201
202 if (error) {
203 return Error(strings::format(
204 "Couldn't read option %s: %s", name, ::strerror(error)).get());
205 }
206
207 return value;
208#else
209 UNREACHABLE();
210#endif
211}
212
213
214// Returns an error on failure or the previous value on success.

Callers

nothing calls this directly

Calls 5

detectJemallocFunction · 0.85
formatFunction · 0.85
strerrorFunction · 0.85
ErrorClass · 0.50
getMethod · 0.45

Tested by

no test coverage detected