File tree 3 files changed +11
-17
lines changed
3 files changed +11
-17
lines changed Original file line number Diff line number Diff line change @@ -334,24 +334,21 @@ class DiagnosticFilename {
334
334
335
335
DiagnosticFilename (Environment* env,
336
336
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)) {}
340
339
341
340
DiagnosticFilename (uint64_t thread_id,
342
341
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)) {}
346
344
347
345
const char * operator *() const { return filename_.c_str (); }
348
346
349
347
private:
350
348
static std::string MakeFilename (
351
349
uint64_t thread_id,
352
350
const char * prefix,
353
- const char * ext,
354
- int seq = -1 );
351
+ const char * ext);
355
352
356
353
std::string filename_;
357
354
};
Original file line number Diff line number Diff line change 15
15
#include < cstring>
16
16
#include < ctime>
17
17
#include < cwctype>
18
- #include < atomic>
19
18
#include < fstream>
20
19
#include < iomanip>
21
20
#include < climits> // PATH_MAX
@@ -73,9 +72,6 @@ static void PrintLoadedLibraries(JSONWriter* writer);
73
72
static void PrintComponentVersions (JSONWriter* writer);
74
73
static void PrintRelease (JSONWriter* writer);
75
74
76
- // Global variables
77
- static std::atomic_int seq = {0 }; // sequence number for report filenames
78
-
79
75
// External function to trigger a report, writing to file.
80
76
// The 'name' parameter is in/out: an input filename is used
81
77
// if supplied, and the actual filename is returned.
@@ -99,7 +95,7 @@ std::string TriggerNodeReport(Isolate* isolate,
99
95
filename = options->report_filename ;
100
96
} else {
101
97
filename = *DiagnosticFilename (env != nullptr ? env->thread_id () : 0 ,
102
- " report" , " json" , seq++ );
98
+ " report" , " json" );
103
99
}
104
100
105
101
// Open the report file stream for writing. Supports stdout/err,
Original file line number Diff line number Diff line change 41
41
#include < sys/types.h>
42
42
#endif
43
43
44
+ #include < atomic>
44
45
#include < cstdio>
45
46
#include < iomanip>
46
47
#include < sstream>
47
48
49
+ static std::atomic_int seq = {0 }; // Sequence number for diagnostic filenames.
50
+
48
51
namespace node {
49
52
50
53
// Microseconds in a second, as a float.
@@ -225,8 +228,7 @@ void DiagnosticFilename::LocalTime(TIME_TYPE* tm_struct) {
225
228
std::string DiagnosticFilename::MakeFilename (
226
229
uint64_t thread_id,
227
230
const char * prefix,
228
- const char * ext,
229
- int seq) {
231
+ const char * ext) {
230
232
std::ostringstream oss;
231
233
TIME_TYPE tm_struct;
232
234
LocalTime (&tm_struct);
@@ -262,8 +264,7 @@ std::string DiagnosticFilename::MakeFilename(
262
264
#endif
263
265
oss << " ." << uv_os_getpid ();
264
266
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;
267
268
oss << " ." << ext;
268
269
return oss.str ();
269
270
}
You can’t perform that action at this time.
0 commit comments