Ignore:
Timestamp:
Oct 5, 2012, 10:35:49 AM (13 years ago)
Author:
[email protected]
Message:

JSC should have a way to gather and log Heap memory use and pause times
https://bugs.webkit.org/show_bug.cgi?id=98431

Reviewed by Geoffrey Garen.

Source/JavaScriptCore:

In order to improve our infrastructure for benchmark-driven development, we should
have a centralized method of gathering and logging various statistics about the state
of the JS heap. This would allow us to create and to use other tools to analyze the
output of the VM after running various workloads.

The first two statistics that might be interesting is memory use by JSC and GC pause
times. We can control whether this recording happens through the use of the Options
class, allowing us to either use environment variables or command line flags.

(JSC::Heap::collect): If we finish a collection and are still over our set GC heap size,
we end the program immediately and report an error. Also added recording of pause times.

  • heap/Heap.h:

(Heap):
(JSC::Heap::shouldCollect): When we set a specific GC heap size through Options, we
ignore all other heuristics on when we should collect and instead only ask if we're
greater than the amount specified in the Option value. This allows us to view time/memory
tradeoffs more clearly.

  • heap/HeapStatistics.cpp: Added.

(JSC):
(JSC::HeapStatistics::initialize):
(JSC::HeapStatistics::recordGCPauseTime):
(JSC::HeapStatistics::logStatistics):
(JSC::HeapStatistics::exitWithFailure):
(JSC::HeapStatistics::reportSuccess):
(JSC::HeapStatistics::parseMemoryAmount):
(StorageStatistics):
(JSC::StorageStatistics::StorageStatistics):
(JSC::StorageStatistics::operator()):
(JSC::StorageStatistics::objectWithOutOfLineStorageCount):
(JSC::StorageStatistics::objectCount):
(JSC::StorageStatistics::storageSize):
(JSC::StorageStatistics::storageCapacity):
(JSC::HeapStatistics::showObjectStatistics): Moved the old showHeapStatistics (renamed to showObjectStatistics)
to try to start collecting our various memory statistics gathering/reporting mechanisms scattered throughout the
codebase into one place.

  • heap/HeapStatistics.h: Added.

(JSC):
(HeapStatistics):

  • jsc.cpp:

(main):

  • runtime/InitializeThreading.cpp:

(JSC::initializeThreadingOnce): We need to initialize our data structures for recording
statistics if necessary.

  • runtime/Options.cpp: Add new Options for the various types of statistics we'll be gathering.

(JSC::parse):
(JSC):
(JSC::Options::initialize): Initialize the various new options using environment variables.
(JSC::Options::dumpOption):

  • runtime/Options.h:

(JSC):

Tools:

  • DumpRenderTree/mac/DumpRenderTree.mm:

(main): Added a check as to whether we should dump our JSC Heap statistics on exit.

File:
1 edited

Legend:

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

    r130303 r130520  
    2828#include "CopiedSpaceInlineMethods.h"
    2929#include "ExceptionHelpers.h"
     30#include "HeapStatistics.h"
    3031#include "InitializeThreading.h"
    3132#include "Interpreter.h"
     
    529530        res = jscmain(argc, argv);
    530531    EXCEPT(res = 3)
     532    if (Options::logHeapStatisticsAtExit())
     533        HeapStatistics::reportSuccess();
    531534    return res;
    532535}
Note: See TracChangeset for help on using the changeset viewer.