Skip to content

Commit

Permalink
src: slightly simplify V8CoverageConnection::GetFilename
Browse files Browse the repository at this point in the history
PR-URL: #41748
Reviewed-By: Darshan Sen <raisinten@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Mohammed Keyvanzadeh <mohammadkeyvanzade94@gmail.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Mestery <mestery@protonmail.com>
  • Loading branch information
addaleax authored and ruyadorno committed Feb 8, 2022
1 parent 869cbb7 commit 43f2aba
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",
uv_os_getpid(),
timestamp,
env()->thread_id());
}

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

0 comments on commit 43f2aba

Please sign in to comment.