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

Function MakeProfName

src/brpc/builtin/pprof_service.cpp:74–94  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

72}
73
74int MakeProfName(ProfilingType type, char* buf, size_t buf_len) {
75 // Add pprof_ prefix to separate from /hotspots
76 int nr = snprintf(buf, buf_len, "%s/pprof_%s/", FLAGS_rpc_profiling_dir.c_str(),
77 GetProgramChecksum());
78 if (nr < 0) {
79 return -1;
80 }
81 buf += nr;
82 buf_len -= nr;
83
84 time_t rawtime;
85 time(&rawtime);
86 struct tm* timeinfo = localtime(&rawtime);
87 const size_t nw = strftime(buf, buf_len, "%Y%m%d.%H%M%S", timeinfo);
88 buf += nw;
89 buf_len -= nw;
90
91 // We have checksum in the path, getpid() is not necessary now.
92 snprintf(buf, buf_len, ".%s", ProfilingType2String(type));
93 return 0;
94}
95
96void PProfService::profile(
97 ::google::protobuf::RpcController* controller_base,

Callers 3

profileMethod · 0.70
contentionMethod · 0.70
JeProfileDumpFunction · 0.50

Calls 4

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

Tested by

no test coverage detected