Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nodejs/node.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnna Henningsen <anna@addaleax.net>2022-01-29 15:54:01 +0300
committerJames M Snell <jasnell@gmail.com>2022-02-05 19:01:06 +0300
commitc18ad4b01297548582a04000aae5ba7d862377f5 (patch)
tree40932edea4ceb180fe601207f44e2ad429da62ba /src/inspector_profiler.cc
parent8e681d51b403dd09045a391ed30e71d4a80bfd4d (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.cc18
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) {