Reviewers: Michael Starzinger,
Message:
PTAL.
Description:
Add histograms to track fraction of heap spaces and percentage of crankshaft
code.
BUG=None
Please review this at https://codereview.chromium.org/27023003/
SVN Base: https://v8.googlecode.com/svn/branches/bleeding_edge
Affected files (+78, -4 lines):
M src/codegen.cc
M src/heap.h
M src/heap.cc
M src/mark-compact.cc
M src/v8-counters.h
Index: src/codegen.cc
diff --git a/src/codegen.cc b/src/codegen.cc
index
d33c7f06bd44e077badacee8ec2e3ca2bf1b1014..b15324c8cf0ba6f98a7a8fa481f58bc2de0606bb
100644
--- a/src/codegen.cc
+++ b/src/codegen.cc
@@ -116,6 +116,8 @@ Handle<Code>
CodeGenerator::MakeCodeEpilogue(MacroAssembler* masm,
false, is_crankshafted);
isolate->counters()->total_compiled_code_size()->Increment(
code->instruction_size());
+ isolate->heap()->IncrementCodeGeneratedBytes(is_crankshafted,
+ code->instruction_size());
code->set_prologue_offset(info->prologue_offset());
return code;
}
Index: src/heap.cc
diff --git a/src/heap.cc b/src/heap.cc
index
b0335d0efdd5da06accdc84acf018f626cf8fd66..7b9f67ab6e517f7be4e5188eb3c27671083c7f3e
100644
--- a/src/heap.cc
+++ b/src/heap.cc
@@ -141,6 +141,8 @@ Heap::Heap()
mark_sweeps_since_idle_round_started_(0),
gc_count_at_last_idle_gc_(0),
scavenges_since_last_idle_round_(kIdleScavengeThreshold),
+ full_codegen_bytes_(0),
+ crankshaft_codegen_bytes_(0),
gcs_since_last_deopt_(0),
#ifdef VERIFY_HEAP
no_weak_object_verification_scope_depth_(0),
@@ -508,10 +510,30 @@ void Heap::GarbageCollectionEpilogue() {
isolate_->counters()->number_of_symbols()->Set(
string_table()->NumberOfElements());
+ if (full_codegen_bytes_ + crankshaft_codegen_bytes_ > 0) {
+ isolate_->counters()->codegen_fraction_crankshaft()->AddSample(
+ static_cast<int>((crankshaft_codegen_bytes_ * 100.0) /
+ (crankshaft_codegen_bytes_ + full_codegen_bytes_)));
+ }
+
if (CommittedMemory() > 0) {
isolate_->counters()->external_fragmentation_total()->AddSample(
static_cast<int>(100 - (SizeOfObjects() * 100.0) /
CommittedMemory()));
+ isolate_->counters()->heap_fraction_new_space()->
+ AddSample(static_cast<int>(
+ (new_space()->CommittedMemory() * 100.0) / CommittedMemory()));
+ isolate_->counters()->heap_fraction_old_pointer_space()->AddSample(
+ static_cast<int>(
+ (old_pointer_space()->CommittedMemory() * 100.0) /
+ CommittedMemory()));
+ isolate_->counters()->heap_fraction_old_data_space()->AddSample(
+ static_cast<int>(
+ (old_data_space()->CommittedMemory() * 100.0) /
+ CommittedMemory()));
+ isolate_->counters()->heap_fraction_code_space()->
+ AddSample(static_cast<int>(
+ (code_space()->CommittedMemory() * 100.0) /
CommittedMemory()));
isolate_->counters()->heap_fraction_map_space()->AddSample(
static_cast<int>(
(map_space()->CommittedMemory() * 100.0) / CommittedMemory()));
@@ -522,6 +544,9 @@ void Heap::GarbageCollectionEpilogue() {
AddSample(static_cast<int>(
(property_cell_space()->CommittedMemory() * 100.0) /
CommittedMemory()));
+ isolate_->counters()->heap_fraction_lo_space()->
+ AddSample(static_cast<int>(
+ (lo_space()->CommittedMemory() * 100.0) / CommittedMemory()));
isolate_->counters()->heap_sample_total_committed()->AddSample(
static_cast<int>(CommittedMemory() / KB));
@@ -535,6 +560,8 @@ void Heap::GarbageCollectionEpilogue() {
heap_sample_property_cell_space_committed()->
AddSample(static_cast<int>(
property_cell_space()->CommittedMemory() / KB));
+ isolate_->counters()->heap_sample_code_space_committed()->AddSample(
+ static_cast<int>(code_space()->CommittedMemory() / KB));
}
#define
UPDATE_COUNTERS_FOR_SPACE(space) \
Index: src/heap.h
diff --git a/src/heap.h b/src/heap.h
index
f5b99d6e53dd28d794baac7b99807eeb90d8fb08..850c1327a1fa8f183d50ce364f9089c2d10061b3
100644
--- a/src/heap.h
+++ b/src/heap.h
@@ -1660,6 +1660,22 @@ class Heap {
total_regexp_code_generated_ += size;
}
+ void IncrementCodeGeneratedBytes(bool is_crankshafted, int size) {
+ if (is_crankshafted) {
+ crankshaft_codegen_bytes_ += size;
+ } else {
+ full_codegen_bytes_ += size;
+ }
+ }
+
+ void DecrementCodeGeneratedBytes(bool is_crankshafted, int size) {
+ if (is_crankshafted) {
+ crankshaft_codegen_bytes_ -= size;
+ } else {
+ full_codegen_bytes_ -= size;
+ }
+ }
+
// Returns maximum GC pause.
double get_max_gc_pause() { return max_gc_pause_; }
@@ -2355,6 +2371,9 @@ class Heap {
unsigned int gc_count_at_last_idle_gc_;
int scavenges_since_last_idle_round_;
+ intptr_t full_codegen_bytes_;
+ intptr_t crankshaft_codegen_bytes_;
+
// If the --deopt_every_n_garbage_collections flag is set to a positive
value,
// this variable holds the number of garbage collections since the last
// deoptimization triggered by garbage collection.
Index: src/mark-compact.cc
diff --git a/src/mark-compact.cc b/src/mark-compact.cc
index
65d838cdf95b895a8c86430f452f9b8e1715dcf2..963d95cd486d48efbaa784518bd0f96010e67218
100644
--- a/src/mark-compact.cc
+++ b/src/mark-compact.cc
@@ -1006,10 +1006,14 @@ void CodeFlusher::ProcessJSFunctionCandidates() {
Code* code = shared->code();
MarkBit code_mark = Marking::MarkBitFrom(code);
if (!code_mark.Get()) {
- if (FLAG_trace_code_flushing && shared->is_compiled()) {
- PrintF("[code-flushing clears: ");
- shared->ShortPrint();
- PrintF(" - age: %d]\n", code->GetAge());
+ if (shared->is_compiled()) {
+ isolate_->heap()->DecrementCodeGeneratedBytes(
+ code->is_crankshafted(), code->instruction_size());
+ if (FLAG_trace_code_flushing) {
+ PrintF("[code-flushing clears: ");
+ shared->ShortPrint();
+ PrintF(" - age: %d]\n", code->GetAge());
+ }
}
shared->set_code(lazy_compile);
candidate->set_code(lazy_compile);
@@ -1053,6 +1057,10 @@ void
CodeFlusher::ProcessSharedFunctionInfoCandidates() {
candidate->ShortPrint();
PrintF(" - age: %d]\n", code->GetAge());
}
+ if (candidate->is_compiled()) {
+ isolate_->heap()->DecrementCodeGeneratedBytes(
+ code->is_crankshafted(), code->instruction_size());
+ }
candidate->set_code(lazy_compile);
}
Index: src/v8-counters.h
diff --git a/src/v8-counters.h b/src/v8-counters.h
index
c1541b097f616f475605b4e56f26ca9260321924..35ca392ab8698af3ef3fa5f25b2f9ae5208d9c8b
100644
--- a/src/v8-counters.h
+++ b/src/v8-counters.h
@@ -51,6 +51,7 @@ namespace internal {
HT(compile_lazy, V8.CompileLazy)
#define HISTOGRAM_PERCENTAGE_LIST(HP) \
+ /* Heap fragmentation. */ \
HP(external_fragmentation_total, \
V8.MemoryExternalFragmentationTotal) \
HP(external_fragmentation_old_pointer_space, \
@@ -67,12 +68,26 @@ namespace internal {
V8.MemoryExternalFragmentationPropertyCellSpace) \
HP(external_fragmentation_lo_space, \
V8.MemoryExternalFragmentationLoSpace) \
+ /* Percentages of heap committed to each space. */ \
+ HP(heap_fraction_new_space, \
+ V8.MemoryHeapFractionNewSpace) \
+ HP(heap_fraction_old_pointer_space, \
+ V8.MemoryHeapFractionOldPointerSpace) \
+ HP(heap_fraction_old_data_space, \
+ V8.MemoryHeapFractionOldDataSpace) \
+ HP(heap_fraction_code_space, \
+ V8.MemoryHeapFractionCodeSpace) \
HP(heap_fraction_map_space, \
V8.MemoryHeapFractionMapSpace) \
HP(heap_fraction_cell_space, \
V8.MemoryHeapFractionCellSpace) \
HP(heap_fraction_property_cell_space, \
V8.MemoryHeapFractionPropertyCellSpace) \
+ HP(heap_fraction_lo_space, \
+ V8.MemoryHeapFractionLoSpace) \
+ /* Percentage of crankshafted codegen. */ \
+ HP(codegen_fraction_crankshaft, \
+ V8.CodegenFractionCrankshaft) \
#define HISTOGRAM_MEMORY_LIST(HM) \
@@ -84,6 +99,8 @@ namespace internal {
V8.MemoryHeapSampleCellSpaceCommitted) \
HM(heap_sample_property_cell_space_committed, \
V8.MemoryHeapSamplePropertyCellSpaceCommitted) \
+ HM(heap_sample_code_space_committed, \
+ V8.MemoryHeapSampleCodeSpaceCommitted) \
// WARNING: STATS_COUNTER_LIST_* is a very large macro that is causing MSVC
@@ -150,6 +167,7 @@ namespace internal {
SC(total_stubs_code_size, V8.TotalStubsCodeSize) \
/* Amount of (JS) compiled code. */ \
SC(total_compiled_code_size, V8.TotalCompiledCodeSize) \
+ SC(total_crankshaft_code_size, V8.TotalCrankshaftCodeSize) \
SC(gc_compactor_caused_by_request, V8.GCCompactorCausedByRequest) \
SC(gc_compactor_caused_by_promoted_data, \
V8.GCCompactorCausedByPromotedData) \
--
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
---
You received this message because you are subscribed to the Google Groups "v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.