Ignore:
Timestamp:
Jan 14, 2019, 7:01:31 PM (6 years ago)
Author:
[email protected]
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):

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/JavaScriptCore/jsc.cpp

    r239569 r239969  
    421421    bool m_treatWatchdogExceptionAsSuccess { false };
    422422    bool m_alwaysDumpUncaughtException { false };
     423    bool m_dumpMemoryFootprint { false };
    423424    bool m_dumpSamplingProfilerData { false };
    424425    bool m_enableRemoteDebugging { false };
     
    25732574    fprintf(stderr, "  --watchdog-exception-ok    Uncaught watchdog exceptions exit with success\n");
    25742575    fprintf(stderr, "  --dumpException            Dump uncaught exception text\n");
     2576    fprintf(stderr, "  --footprint                Dump memory footprint after done executing\n");
    25752577    fprintf(stderr, "  --options                  Dumps all JSC VM options and exits\n");
    25762578    fprintf(stderr, "  --dumpOptions              Dumps all non-default JSC VM options before continuing\n");
     
    27182720        if (!strcmp(arg, "--dumpException")) {
    27192721            m_alwaysDumpUncaughtException = true;
     2722            continue;
     2723        }
     2724
     2725        if (!strcmp(arg, "--footprint")) {
     2726            m_dumpMemoryFootprint = true;
    27202727            continue;
    27212728        }
     
    29292936    printSuperSamplerState();
    29302937
     2938    if (options.m_dumpMemoryFootprint) {
     2939        MemoryFootprint footprint = MemoryFootprint::now();
     2940
     2941        printf("Memory Footprint:\n    Current Footprint: %llu\n    Peak Footprint: %llu\n", footprint.current, footprint.peak);
     2942    }
     2943
    29312944    return result;
    29322945}
Note: See TracChangeset for help on using the changeset viewer.