Skip to content

Commit

Permalink
src: slightly simplify V8CoverageConnection::GetFilename
Browse files Browse the repository at this point in the history
  • Loading branch information
addaleax committed Jan 29, 2022
1 parent ef4c115 commit af5ab24
Showing 1 changed file with 6 additions and 12 deletions.
18 changes: 6 additions & 12 deletions src/inspector_profiler.cc
Original file line number Diff line number Diff line change
Expand Up @@ -170,18 +170,12 @@ static bool EnsureDirectory(const std::string& directory, const char* type) {
}

std::string V8CoverageConnection::GetFilename() const {
std::string thread_id = std::to_string(env()->thread_id());
std::string pid = std::to_string(uv_os_getpid());
std::string timestamp = std::to_string(
static_cast<uint64_t>(GetCurrentTimeInMicroseconds() / 1000));
char filename[1024];
snprintf(filename,
sizeof(filename),
"coverage-%s-%s-%s.json",
pid.c_str(),
timestamp.c_str(),
thread_id.c_str());
return filename;
uint64_t timestamp =
static_cast<uint64_t>(GetCurrentTimeInMicroseconds() / 1000);
return SPrintF("coverage-%s-%s-%s.json",
env()->thread_id(),
uv_os_getpid(),
timestamp);
}

void V8ProfilerConnection::WriteProfile(Local<Object> result) {
Expand Down

0 comments on commit af5ab24

Please sign in to comment.