Skip to content

Commit

Permalink
src: slightly simplify V8CoverageConnection::GetFilename
Browse files Browse the repository at this point in the history
PR-URL: nodejs#41748
Reviewed-By: Darshan Sen <[email protected]>
Reviewed-By: Colin Ihrig <[email protected]>
Reviewed-By: Mohammed Keyvanzadeh <[email protected]>
Reviewed-By: Rich Trott <[email protected]>
Reviewed-By: Mestery <[email protected]>
  • Loading branch information
addaleax authored and danielleadams committed Mar 4, 2022
1 parent a402d2a commit 18b5b3d
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 18b5b3d

Please sign in to comment.