diff options
author | Anna Henningsen <anna@addaleax.net> | 2022-01-29 15:54:01 +0300 |
---|---|---|
committer | James M Snell <jasnell@gmail.com> | 2022-02-05 19:01:06 +0300 |
commit | c18ad4b01297548582a04000aae5ba7d862377f5 (patch) | |
tree | 40932edea4ceb180fe601207f44e2ad429da62ba /src/inspector_profiler.cc | |
parent | 8e681d51b403dd09045a391ed30e71d4a80bfd4d (diff) |
src: slightly simplify V8CoverageConnection::GetFilename
PR-URL: https://github.com/nodejs/node/pull/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>
Diffstat (limited to 'src/inspector_profiler.cc')
-rw-r--r-- | src/inspector_profiler.cc | 18 |
1 files changed, 6 insertions, 12 deletions
diff --git a/src/inspector_profiler.cc b/src/inspector_profiler.cc index e40b4b99cc8..db8bda8524d 100644 --- a/src/inspector_profiler.cc +++ b/src/inspector_profiler.cc @@ -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) { |