@@ -2325,7 +2325,9 @@ void MemoryUsage(const FunctionCallbackInfo<Value>& args) {
23252325 fields[3 ] = isolate->AdjustAmountOfExternalAllocatedMemory (0 );
23262326
23272327#if ENABLE_TTD_NODE
2328- ab->TTDRawBufferModifyNotifySync (array->ByteOffset (), 4 * sizeof (double ));
2328+ if (s_doTTRecord || s_doTTReplay) {
2329+ ab->TTDRawBufferModifyNotifySync (array->ByteOffset (), 4 * sizeof (double ));
2330+ }
23292331#endif
23302332}
23312333
@@ -2364,8 +2366,10 @@ void Hrtime(const FunctionCallbackInfo<Value>& args) {
23642366 fields[1 ] = (t / NANOS_PER_SEC) & 0xffffffff ;
23652367 fields[2 ] = t % NANOS_PER_SEC;
23662368#if ENABLE_TTD_NODE
2367- ab->TTDRawBufferModifyNotifySync (args[0 ].As <Uint32Array>()->ByteOffset (),
2368- 3 * sizeof (uint32_t ));
2369+ if (s_doTTRecord || s_doTTReplay) {
2370+ ab->TTDRawBufferModifyNotifySync (args[0 ].As <Uint32Array>()->ByteOffset (),
2371+ 3 * sizeof (uint32_t ));
2372+ }
23692373#endif
23702374}
23712375
@@ -2400,7 +2404,9 @@ void CPUUsage(const FunctionCallbackInfo<Value>& args) {
24002404 fields[0 ] = MICROS_PER_SEC * rusage.ru_utime .tv_sec + rusage.ru_utime .tv_usec ;
24012405 fields[1 ] = MICROS_PER_SEC * rusage.ru_stime .tv_sec + rusage.ru_stime .tv_usec ;
24022406#if ENABLE_TTD_NODE
2403- ab->TTDRawBufferModifyNotifySync (array->ByteOffset (), 2 * sizeof (double ));
2407+ if (s_doTTRecord || s_doTTReplay) {
2408+ ab->TTDRawBufferModifyNotifySync (array->ByteOffset (), 2 * sizeof (double ));
2409+ }
24042410#endif
24052411}
24062412
@@ -3654,28 +3660,29 @@ static void PrintHelp() {
36543660 " stderr\n "
36553661 " OPENSSL_CONF load OpenSSL configuration from file\n "
36563662 " \n "
3657- " Documentation can be found at https://nodejs.org/\n "
36583663#if ENABLE_TTD_NODE
3659- " Record/Replay production diagnostics info at http://aka.ms/nodettd\n "
3664+ " Documentation can be found at https://nodejs.org/\n "
3665+ " Record/Replay diagnostics info at http://aka.ms/nodettd\n " );
3666+ #else
3667+ " Documentation can be found at https://nodejs.org/\n " );
36603668#endif
3661- );
36623669}
36633670
36643671#if ENABLE_TTD_NODE
3665- void TTDFlagWarning (const char * msg, const char * arg) {
3666- fprintf (stderr, " %s" , msg);
3667- if (arg != nullptr ) {
3668- fprintf (stderr, " > %s\n " , arg);
3669- }
3672+ void TTDFlagWarning (const char * arg, const char * newflag) {
3673+ fprintf (stderr, " Flag %s is deprecated use %s\n " , arg, newflag);
36703674 fprintf (stderr, " Run with \" -h\" for help with flags.\n " );
36713675
36723676 exit (1 );
36733677}
36743678
36753679void TTDFlagWarning_Cond (bool cond, const char * msg) {
3676- if (!cond) {
3677- TTDFlagWarning (msg, nullptr );
3678- }
3680+ if (!cond) {
3681+ fprintf (stderr, " %s\n " , msg);
3682+ fprintf (stderr, " Run with \" -h\" for help with flags.\n " );
3683+
3684+ exit (1 );
3685+ }
36793686}
36803687#endif
36813688
@@ -3793,38 +3800,38 @@ static void ParseArgs(int* argc,
37933800 trace_enabled_categories = categories;
37943801#if ENABLE_TTD_NODE
37953802 // Parse and extract the TT args
3796- } else if (strcmp (arg, " --record" ) == 0 ) {
3803+ } else if (strcmp (arg, " --record" ) == 0 ) {
37973804 s_doTTRecord = true ;
3798- } else if (strstr (arg, " --replay=" ) == arg) {
3805+ } else if (strstr (arg, " --replay=" ) == arg) {
37993806 s_doTTReplay = true ;
38003807 s_ttoptReplayUri = arg + strlen (" --replay=" );
38013808 s_ttoptReplayUriLength = strlen (s_ttoptReplayUri);
3802- } else if (strstr (arg, " --replay-debug=" ) == arg) {
3809+ } else if (strstr (arg, " --replay-debug=" ) == arg) {
38033810 s_doTTReplay = true ;
38043811 s_doTTDebug = true ;
38053812 s_ttoptReplayUri = arg + strlen (" --replay-debug=" );
38063813 s_ttoptReplayUriLength = strlen (s_ttoptReplayUri);
3807- } else if (strcmp (arg, " --break-first" ) == 0 ) {
3814+ } else if (strcmp (arg, " --break-first" ) == 0 ) {
38083815 s_ttdStartupMode = (0x100 | 0x1 );
38093816 debug_options.do_wait_for_connect ();
3810- } else if (strstr (arg, " --record-interval=" ) == arg) {
3817+ } else if (strstr (arg, " --record-interval=" ) == arg) {
38113818 const char * intervalStr = arg + strlen (" --record-interval=" );
38123819 s_ttdSnapInterval = (uint32_t )atoi (intervalStr);
3813- } else if (strstr (arg, " --record-history=" ) == arg) {
3820+ } else if (strstr (arg, " --record-history=" ) == arg) {
38143821 const char * historyStr = arg + strlen (" --record-history=" );
38153822 s_ttdSnapHistoryLength = (uint32_t )atoi (historyStr);
3816- } else if (strstr (arg, " -TTRecord:" ) == arg) {
3817- TTDFlagWarning (" -TTRecord:[dir] is deprecated use -- record\n " , arg );
3818- } else if (strstr (arg, " -TTReplay:" ) == arg) {
3819- TTDFlagWarning (" -TTReplay:[dir] is deprecated use -- replay=dir\n " , arg );
3820- } else if (strstr (arg, " -TTDebug:" ) == arg) {
3821- TTDFlagWarning (" -TTDebug:[dir] is deprecated use -- replay-debug=dir\n " , arg );
3822- } else if (strstr (arg, " -TTBreakFirst" ) == arg) {
3823- TTDFlagWarning (" -TTBreakFirst is deprecated use -- break-first\n " , arg );
3824- } else if (strstr (arg, " -TTSnapInterval:" ) == arg) {
3825- TTDFlagWarning (" -TTSnapInterval is deprecated use -- record-interval=num\n " , arg );
3826- } else if (strstr (arg, " -TTHistoryLength:" ) == arg) {
3827- TTDFlagWarning (" -TTHistoryLength is deprecated use -- record-history=num\n " , arg );
3823+ } else if (strstr (arg, " -TTRecord:" ) == arg) {
3824+ TTDFlagWarning (arg, " -- record" );
3825+ } else if (strstr (arg, " -TTReplay:" ) == arg) {
3826+ TTDFlagWarning (arg, " -- replay=dir" );
3827+ } else if (strstr (arg, " -TTDebug:" ) == arg) {
3828+ TTDFlagWarning (arg, " -- replay-debug=dir" );
3829+ } else if (strstr (arg, " -TTBreakFirst" ) == arg) {
3830+ TTDFlagWarning (arg, " -- break-first" );
3831+ } else if (strstr (arg, " -TTSnapInterval:" ) == arg) {
3832+ TTDFlagWarning (arg, " -- record-interval=num" );
3833+ } else if (strstr (arg, " -TTHistoryLength:" ) == arg) {
3834+ TTDFlagWarning (arg, " -- record-history=num" );
38283835#endif
38293836 } else if (strcmp (arg, " --track-heap-objects" ) == 0 ) {
38303837 track_heap_objects = true ;
@@ -4607,7 +4614,7 @@ inline int Start(Isolate* isolate, void* isolate_context,
46074614#if ENABLE_TTD_NODE
46084615 // Start time travel after environment is loaded
46094616 if (s_doTTRecord) {
4610- fprintf (stderr, " Recording has been started (after main module loading )...\n " );
4617+ fprintf (stderr, " Recording started (after main module loaded )...\n " );
46114618 JsTTDStart ();
46124619 }
46134620#endif
@@ -4667,7 +4674,7 @@ inline int Start(uv_loop_t* event_loop,
46674674#endif
46684675
46694676#if ENABLE_TTD_NODE
4670- if (s_doTTRecord) {
4677+ if (s_doTTRecord) {
46714678 fprintf (stderr, " Recording is enabled (but not yet started)...\n " );
46724679 }
46734680
@@ -4792,7 +4799,7 @@ inline int Start_TTDReplay(Isolate* isolate, void* isolate_context,
47924799 &s_ttdStartupMode,
47934800 &nextEventTime);
47944801
4795- // don't continue replay actions if we are not in debug mode
4802+ // don't continue replay actions if we are not in debug mode
47964803 continueReplayActions &= s_doTTDebug;
47974804 }
47984805
@@ -4813,7 +4820,7 @@ inline int Start_TTDReplay(uv_loop_t* event_loop,
48134820 params.code_event_handler = vTune::GetVtuneCodeEventHandler ();
48144821#endif
48154822
4816- fprintf (stderr, " Starting TT replay/debug using log in %s\n " , s_ttoptReplayUri);
4823+ fprintf (stderr, " Starting replay/debug using log in %s\n " , s_ttoptReplayUri);
48174824 Isolate* const isolate = Isolate::NewWithTTDSupport (params,
48184825 s_ttoptReplayUriLength,
48194826 s_ttoptReplayUri,
@@ -4929,28 +4936,29 @@ int Start(int argc, char** argv) {
49294936 v8_initialized = true ;
49304937
49314938#if ENABLE_TTD_NODE
4932- bool chk_debug_enabled = debug_options.debugger_enabled () || debug_options.inspector_enabled ();
4939+ bool chk_debug_enabled = debug_options.debugger_enabled ()
4940+ || debug_options.inspector_enabled ();
49334941
49344942 TTDFlagWarning_Cond (!s_doTTRecord || !s_doTTReplay,
49354943 " Cannot enable record & replay at same time.\n " );
49364944
4937- if (s_doTTRecord || s_doTTReplay) {
4945+ if (s_doTTRecord || s_doTTReplay) {
49384946 TTDFlagWarning_Cond (eval_string == nullptr ,
49394947 " Eval mode not supported in record/replay.\n " );
49404948
49414949 TTDFlagWarning_Cond (!force_repl,
49424950 " Repl mode not supported in record/replay.\n " );
49434951 }
49444952
4945- if (s_doTTRecord) {
4953+ if (s_doTTRecord) {
49464954 TTDFlagWarning_Cond (!chk_debug_enabled,
49474955 " Cannot enable debugger with record mode.\n " );
49484956
49494957 TTDFlagWarning_Cond (s_ttdStartupMode == 0x1 ,
49504958 " Cannot set break flags in record mode.\n " );
49514959 }
49524960
4953- if (s_doTTReplay) {
4961+ if (s_doTTReplay) {
49544962 TTDFlagWarning_Cond (!chk_debug_enabled || s_doTTDebug,
49554963 " Must enable --replay-debug if attaching debugger.\n " );
49564964
0 commit comments