Skip to content

Commit 43f2aba

Browse files
addaleaxruyadorno
authored andcommitted
src: slightly simplify V8CoverageConnection::GetFilename
PR-URL: #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]>
1 parent 869cbb7 commit 43f2aba

File tree

1 file changed

+6
-12
lines changed

1 file changed

+6
-12
lines changed

src/inspector_profiler.cc

+6-12
Original file line numberDiff line numberDiff line change
@@ -170,18 +170,12 @@ static bool EnsureDirectory(const std::string& directory, const char* type) {
170170
}
171171

172172
std::string V8CoverageConnection::GetFilename() const {
173-
std::string thread_id = std::to_string(env()->thread_id());
174-
std::string pid = std::to_string(uv_os_getpid());
175-
std::string timestamp = std::to_string(
176-
static_cast<uint64_t>(GetCurrentTimeInMicroseconds() / 1000));
177-
char filename[1024];
178-
snprintf(filename,
179-
sizeof(filename),
180-
"coverage-%s-%s-%s.json",
181-
pid.c_str(),
182-
timestamp.c_str(),
183-
thread_id.c_str());
184-
return filename;
173+
uint64_t timestamp =
174+
static_cast<uint64_t>(GetCurrentTimeInMicroseconds() / 1000);
175+
return SPrintF("coverage-%s-%s-%s.json",
176+
uv_os_getpid(),
177+
timestamp,
178+
env()->thread_id());
185179
}
186180

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

0 commit comments

Comments
 (0)