| 308 | } |
| 309 | |
| 310 | static 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 | |
| 331 | static void ConsumeWaiters(ProfilingType type, const Controller* cur_cntl, |
| 332 | std::vector<ProfilingWaiter>* waiters) { |
no test coverage detected