File tree Expand file tree Collapse file tree 3 files changed +11
-17
lines changed Expand file tree Collapse file tree 3 files changed +11
-17
lines changed Original file line number Diff line number Diff line change @@ -334,24 +334,21 @@ class DiagnosticFilename {
334334
335335 DiagnosticFilename (Environment* env,
336336 const char * prefix,
337- const char * ext,
338- int seq = -1 ) :
339- filename_ (MakeFilename(env->thread_id (), prefix, ext, seq)) {}
337+ const char * ext) :
338+ filename_ (MakeFilename(env->thread_id (), prefix, ext)) {}
340339
341340 DiagnosticFilename (uint64_t thread_id,
342341 const char * prefix,
343- const char * ext,
344- int seq = -1 ) :
345- filename_(MakeFilename(thread_id, prefix, ext, seq)) {}
342+ const char * ext) :
343+ filename_(MakeFilename(thread_id, prefix, ext)) {}
346344
347345 const char * operator *() const { return filename_.c_str (); }
348346
349347 private:
350348 static std::string MakeFilename (
351349 uint64_t thread_id,
352350 const char * prefix,
353- const char * ext,
354- int seq = -1 );
351+ const char * ext);
355352
356353 std::string filename_;
357354};
Original file line number Diff line number Diff line change 1515#include < cstring>
1616#include < ctime>
1717#include < cwctype>
18- #include < atomic>
1918#include < fstream>
2019#include < iomanip>
2120#include < climits> // PATH_MAX
@@ -73,9 +72,6 @@ static void PrintLoadedLibraries(JSONWriter* writer);
7372static void PrintComponentVersions (JSONWriter* writer);
7473static void PrintRelease (JSONWriter* writer);
7574
76- // Global variables
77- static std::atomic_int seq = {0 }; // sequence number for report filenames
78-
7975// External function to trigger a report, writing to file.
8076// The 'name' parameter is in/out: an input filename is used
8177// if supplied, and the actual filename is returned.
@@ -99,7 +95,7 @@ std::string TriggerNodeReport(Isolate* isolate,
9995 filename = options->report_filename ;
10096 } else {
10197 filename = *DiagnosticFilename (env != nullptr ? env->thread_id () : 0 ,
102- " report" , " json" , seq++ );
98+ " report" , " json" );
10399 }
104100
105101 // Open the report file stream for writing. Supports stdout/err,
Original file line number Diff line number Diff line change 4141#include < sys/types.h>
4242#endif
4343
44+ #include < atomic>
4445#include < cstdio>
4546#include < iomanip>
4647#include < sstream>
4748
49+ static std::atomic_int seq = {0 }; // Sequence number for diagnostic filenames.
50+
4851namespace node {
4952
5053// Microseconds in a second, as a float.
@@ -225,8 +228,7 @@ void DiagnosticFilename::LocalTime(TIME_TYPE* tm_struct) {
225228std::string DiagnosticFilename::MakeFilename (
226229 uint64_t thread_id,
227230 const char * prefix,
228- const char * ext,
229- int seq) {
231+ const char * ext) {
230232 std::ostringstream oss;
231233 TIME_TYPE tm_struct;
232234 LocalTime (&tm_struct);
@@ -262,8 +264,7 @@ std::string DiagnosticFilename::MakeFilename(
262264#endif
263265 oss << " ." << uv_os_getpid ();
264266 oss << " ." << thread_id;
265- if (seq >= 0 )
266- oss << " ." << std::setfill (' 0' ) << std::setw (3 ) << ++seq;
267+ oss << " ." << std::setfill (' 0' ) << std::setw (3 ) << ++seq;
267268 oss << " ." << ext;
268269 return oss.str ();
269270}
You can’t perform that action at this time.
0 commit comments