Commit 112864a8 authored by iposva@chromium.org's avatar iposva@chromium.org

- Record cache hit rates at different levels in the compilation cache

  for scripts.
Review URL: http://codereview.chromium.org/115592

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@2052 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent 3bd462f2
......@@ -36,7 +36,7 @@ enum {
// The number of script generations tell how many GCs a script can
// survive in the compilation cache, before it will be flushed if it
// hasn't been used.
NUMBER_OF_SCRIPT_GENERATIONS = 5,
NUMBER_OF_SCRIPT_GENERATIONS = 8,
// The compilation cache consists of tables - one for each entry
// kind plus extras for the script generations.
......@@ -175,6 +175,17 @@ Handle<JSFunction> CompilationCache::LookupScript(Handle<String> source,
}
}
static void* script_histogram = StatsTable::CreateHistogram(
"V8.ScriptCache",
0,
NUMBER_OF_SCRIPT_GENERATIONS,
NUMBER_OF_SCRIPT_GENERATIONS + 1);
if (script_histogram != NULL) {
// The level NUMBER_OF_SCRIPT_GENERATIONS is equivalent to a cache miss.
StatsTable::AddHistogramSample(script_histogram, generation - SCRIPT);
}
// Once outside the manacles of the handle scope, we need to recheck
// to see if we actually found a cached script. If so, we return a
// handle created in the caller's handle scope.
......
......@@ -75,7 +75,7 @@ class StatsTable : public AllStatic {
// function. min and max define the expected minimum and maximum
// sample values. buckets is the maximum number of buckets
// that the samples will be grouped into.
static void *CreateHistogram(const char* name,
static void* CreateHistogram(const char* name,
int min,
int max,
size_t buckets) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment