Title: [239969] trunk/Source/_javascript_Core
Revision
239969
Author
msab...@apple.com
Date
2019-01-14 19:01:31 -0800 (Mon, 14 Jan 2019)

Log Message

Add option to JSC to dump memory footprint on script completion
https://bugs.webkit.org/show_bug.cgi?id=193422

Reviewed by Mark Lam.

Added the --footprint option to dump peak and current memory usage.  This uses the same
OS calls added in r2362362.

* jsc.cpp:
(printUsageStatement):
(CommandLine::parseArguments):
(jscmain):

Modified Paths

Diff

Modified: trunk/Source/_javascript_Core/ChangeLog (239968 => 239969)


--- trunk/Source/_javascript_Core/ChangeLog	2019-01-15 02:37:33 UTC (rev 239968)
+++ trunk/Source/_javascript_Core/ChangeLog	2019-01-15 03:01:31 UTC (rev 239969)
@@ -1,3 +1,18 @@
+2019-01-14  Michael Saboff  <msab...@apple.com>
+
+        Add option to JSC to dump memory footprint on script completion
+        https://bugs.webkit.org/show_bug.cgi?id=193422
+
+        Reviewed by Mark Lam.
+
+        Added the --footprint option to dump peak and current memory usage.  This uses the same
+        OS calls added in r2362362.
+
+        * jsc.cpp:
+        (printUsageStatement):
+        (CommandLine::parseArguments):
+        (jscmain):
+
 2019-01-14  Yusuke Suzuki  <yusukesuz...@slowstart.org>
 
         [JSC] AI should check the given constant's array type when folding GetByVal into constant

Modified: trunk/Source/_javascript_Core/jsc.cpp (239968 => 239969)


--- trunk/Source/_javascript_Core/jsc.cpp	2019-01-15 02:37:33 UTC (rev 239968)
+++ trunk/Source/_javascript_Core/jsc.cpp	2019-01-15 03:01:31 UTC (rev 239969)
@@ -420,6 +420,7 @@
     String m_uncaughtExceptionName;
     bool m_treatWatchdogExceptionAsSuccess { false };
     bool m_alwaysDumpUncaughtException { false };
+    bool m_dumpMemoryFootprint { false };
     bool m_dumpSamplingProfilerData { false };
     bool m_enableRemoteDebugging { false };
 
@@ -2572,6 +2573,7 @@
     fprintf(stderr, "  --exception=<name>         Check the last script exits with an uncaught exception with the specified name\n");
     fprintf(stderr, "  --watchdog-exception-ok    Uncaught watchdog exceptions exit with success\n");
     fprintf(stderr, "  --dumpException            Dump uncaught exception text\n");
+    fprintf(stderr, "  --footprint                Dump memory footprint after done executing\n");
     fprintf(stderr, "  --options                  Dumps all JSC VM options and exits\n");
     fprintf(stderr, "  --dumpOptions              Dumps all non-default JSC VM options before continuing\n");
     fprintf(stderr, "  --<jsc VM option>=<value>  Sets the specified JSC VM option\n");
@@ -2720,6 +2722,11 @@
             continue;
         }
 
+        if (!strcmp(arg, "--footprint")) {
+            m_dumpMemoryFootprint = true;
+            continue;
+        }
+
         static const unsigned exceptionStrLength = strlen("--exception=");
         if (!strncmp(arg, "--exception=", exceptionStrLength)) {
             m_uncaughtExceptionName = String(arg + exceptionStrLength);
@@ -2928,6 +2935,12 @@
 
     printSuperSamplerState();
 
+    if (options.m_dumpMemoryFootprint) {
+        MemoryFootprint footprint = MemoryFootprint::now();
+
+        printf("Memory Footprint:\n    Current Footprint: %llu\n    Peak Footprint: %llu\n", footprint.current, footprint.peak);
+    }
+
     return result;
 }
 
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to