MCPcopy Create free account
hub / github.com/apache/brpc / MakeProfName

Function MakeProfName

src/brpc/builtin/hotspots_service.cpp:310–329  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

308}
309
310static int MakeProfName(ProfilingType type, char* buf, size_t buf_len) {
311 int nr = snprintf(buf, buf_len, "%s/%s/", FLAGS_rpc_profiling_dir.c_str(),
312 GetProgramChecksum());
313 if (nr < 0) {
314 return -1;
315 }
316 buf += nr;
317 buf_len -= nr;
318
319 time_t rawtime;
320 time(&rawtime);
321 struct tm* timeinfo = localtime(&rawtime);
322 const size_t nw = strftime(buf, buf_len, "%Y%m%d.%H%M%S", timeinfo);
323 buf += nw;
324 buf_len -= nw;
325
326 // We have checksum in the path, getpid() is not necessary now.
327 snprintf(buf, buf_len, ".%s", ProfilingType2String(type));
328 return 0;
329}
330
331static void ConsumeWaiters(ProfilingType type, const Controller* cur_cntl,
332 std::vector<ProfilingWaiter>* waiters) {

Callers 1

DoProfilingFunction · 0.70

Calls 4

snprintfFunction · 0.85
GetProgramChecksumFunction · 0.85
ProfilingType2StringFunction · 0.85
c_strMethod · 0.45

Tested by

no test coverage detected