Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(281)

Side by Side Diff: src/heap/gc-tracer.cc

Issue 2311983002: Revert of [RuntimeCallStats] Move tracing runtime instrumentation closer to the original version. (Closed)
Patch Set: Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/full-codegen/full-codegen.cc ('k') | src/interpreter/interpreter.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 the V8 project authors. All rights reserved. 1 // Copyright 2014 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "src/heap/gc-tracer.h" 5 #include "src/heap/gc-tracer.h"
6 6
7 #include "src/counters.h" 7 #include "src/counters.h"
8 #include "src/heap/heap-inl.h" 8 #include "src/heap/heap-inl.h"
9 #include "src/isolate.h" 9 #include "src/isolate.h"
10 10
11 namespace v8 { 11 namespace v8 {
12 namespace internal { 12 namespace internal {
13 13
14 static intptr_t CountTotalHolesSize(Heap* heap) { 14 static intptr_t CountTotalHolesSize(Heap* heap) {
15 intptr_t holes_size = 0; 15 intptr_t holes_size = 0;
16 OldSpaces spaces(heap); 16 OldSpaces spaces(heap);
17 for (OldSpace* space = spaces.next(); space != NULL; space = spaces.next()) { 17 for (OldSpace* space = spaces.next(); space != NULL; space = spaces.next()) {
18 holes_size += space->Waste() + space->Available(); 18 holes_size += space->Waste() + space->Available();
19 } 19 }
20 return holes_size; 20 return holes_size;
21 } 21 }
22 22
23 23
24 GCTracer::Scope::Scope(GCTracer* tracer, ScopeId scope) 24 GCTracer::Scope::Scope(GCTracer* tracer, ScopeId scope)
25 : tracer_(tracer), scope_(scope) { 25 : tracer_(tracer), scope_(scope) {
26 start_time_ = tracer_->heap_->MonotonicallyIncreasingTimeInMs(); 26 start_time_ = tracer_->heap_->MonotonicallyIncreasingTimeInMs();
27 // TODO(cbruni): remove once we fully moved to a trace-based system. 27 // TODO(cbruni): remove once we fully moved to a trace-based system.
28 if (FLAG_runtime_call_stats) { 28 if (FLAG_runtime_call_stats) {
29 RuntimeCallStats::Enter( 29 RuntimeCallStats::Enter(tracer_->heap_->isolate(), &timer_,
30 tracer_->heap_->isolate()->counters()->runtime_call_stats(), &timer_, 30 &RuntimeCallStats::GC);
31 &RuntimeCallStats::GC);
32 } 31 }
33 // TODO(lpy): Add a tracing equivalent for the runtime call stats.
34 } 32 }
35 33
36 GCTracer::Scope::~Scope() { 34 GCTracer::Scope::~Scope() {
37 tracer_->AddScopeSample( 35 tracer_->AddScopeSample(
38 scope_, tracer_->heap_->MonotonicallyIncreasingTimeInMs() - start_time_); 36 scope_, tracer_->heap_->MonotonicallyIncreasingTimeInMs() - start_time_);
39 // TODO(cbruni): remove once we fully moved to a trace-based system. 37 // TODO(cbruni): remove once we fully moved to a trace-based system.
40 if (FLAG_runtime_call_stats) { 38 if (FLAG_runtime_call_stats) {
41 RuntimeCallStats::Leave( 39 RuntimeCallStats::Leave(tracer_->heap_->isolate(), &timer_);
42 tracer_->heap_->isolate()->counters()->runtime_call_stats(), &timer_);
43 } 40 }
44 // TODO(lpy): Add a tracing equivalent for the runtime call stats.
45 } 41 }
46 42
47 const char* GCTracer::Scope::Name(ScopeId id) { 43 const char* GCTracer::Scope::Name(ScopeId id) {
48 #define CASE(scope) \ 44 #define CASE(scope) \
49 case Scope::scope: \ 45 case Scope::scope: \
50 return "V8.GC_" #scope; 46 return "V8.GC_" #scope;
51 switch (id) { 47 switch (id) {
52 TRACER_SCOPES(CASE) 48 TRACER_SCOPES(CASE)
53 case Scope::NUMBER_OF_SCOPES: 49 case Scope::NUMBER_OF_SCOPES:
54 break; 50 break;
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after
203 } 199 }
204 200
205 int committed_memory = static_cast<int>(heap_->CommittedMemory() / KB); 201 int committed_memory = static_cast<int>(heap_->CommittedMemory() / KB);
206 int used_memory = static_cast<int>(current_.start_object_size / KB); 202 int used_memory = static_cast<int>(current_.start_object_size / KB);
207 heap_->isolate()->counters()->aggregated_memory_heap_committed()->AddSample( 203 heap_->isolate()->counters()->aggregated_memory_heap_committed()->AddSample(
208 start_time, committed_memory); 204 start_time, committed_memory);
209 heap_->isolate()->counters()->aggregated_memory_heap_used()->AddSample( 205 heap_->isolate()->counters()->aggregated_memory_heap_used()->AddSample(
210 start_time, used_memory); 206 start_time, used_memory);
211 // TODO(cbruni): remove once we fully moved to a trace-based system. 207 // TODO(cbruni): remove once we fully moved to a trace-based system.
212 if (FLAG_runtime_call_stats) { 208 if (FLAG_runtime_call_stats) {
213 RuntimeCallStats::Enter(heap_->isolate()->counters()->runtime_call_stats(), 209 RuntimeCallStats::Enter(heap_->isolate(), &timer_, &RuntimeCallStats::GC);
214 &timer_, &RuntimeCallStats::GC);
215 } 210 }
216 // TODO(lpy): Add a tracing equivalent for the runtime call stats.
217 } 211 }
218 212
219 void GCTracer::MergeBaseline(const Event& baseline) { 213 void GCTracer::MergeBaseline(const Event& baseline) {
220 current_.incremental_marking_bytes = 214 current_.incremental_marking_bytes =
221 current_.cumulative_incremental_marking_bytes - 215 current_.cumulative_incremental_marking_bytes -
222 baseline.cumulative_incremental_marking_bytes; 216 baseline.cumulative_incremental_marking_bytes;
223 current_.pure_incremental_marking_duration = 217 current_.pure_incremental_marking_duration =
224 current_.cumulative_pure_incremental_marking_duration - 218 current_.cumulative_pure_incremental_marking_duration -
225 baseline.cumulative_pure_incremental_marking_duration; 219 baseline.cumulative_pure_incremental_marking_duration;
226 for (int i = Scope::FIRST_INCREMENTAL_SCOPE; 220 for (int i = Scope::FIRST_INCREMENTAL_SCOPE;
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
309 } else { 303 } else {
310 Print(); 304 Print();
311 } 305 }
312 306
313 if (FLAG_trace_gc) { 307 if (FLAG_trace_gc) {
314 heap_->PrintShortHeapStatistics(); 308 heap_->PrintShortHeapStatistics();
315 } 309 }
316 310
317 // TODO(cbruni): remove once we fully moved to a trace-based system. 311 // TODO(cbruni): remove once we fully moved to a trace-based system.
318 if (FLAG_runtime_call_stats) { 312 if (FLAG_runtime_call_stats) {
319 RuntimeCallStats::Leave(heap_->isolate()->counters()->runtime_call_stats(), 313 RuntimeCallStats::Leave(heap_->isolate(), &timer_);
320 &timer_);
321 } 314 }
322 // TODO(lpy): Add a tracing equivalent for the runtime call stats.
323 } 315 }
324 316
325 317
326 void GCTracer::SampleAllocation(double current_ms, 318 void GCTracer::SampleAllocation(double current_ms,
327 size_t new_space_counter_bytes, 319 size_t new_space_counter_bytes,
328 size_t old_generation_counter_bytes) { 320 size_t old_generation_counter_bytes) {
329 if (allocation_time_ms_ == 0) { 321 if (allocation_time_ms_ == 0) {
330 // It is the first sample. 322 // It is the first sample.
331 allocation_time_ms_ = current_ms; 323 allocation_time_ms_ = current_ms;
332 new_space_allocation_counter_bytes_ = new_space_counter_bytes; 324 new_space_allocation_counter_bytes_ = new_space_counter_bytes;
(...skipping 494 matching lines...) Expand 10 before | Expand all | Expand 10 after
827 } 819 }
828 820
829 void GCTracer::ResetSurvivalEvents() { recorded_survival_ratios_.Reset(); } 821 void GCTracer::ResetSurvivalEvents() { recorded_survival_ratios_.Reset(); }
830 822
831 void GCTracer::NotifyIncrementalMarkingStart() { 823 void GCTracer::NotifyIncrementalMarkingStart() {
832 incremental_marking_start_time_ = heap_->MonotonicallyIncreasingTimeInMs(); 824 incremental_marking_start_time_ = heap_->MonotonicallyIncreasingTimeInMs();
833 } 825 }
834 826
835 } // namespace internal 827 } // namespace internal
836 } // namespace v8 828 } // namespace v8
OLDNEW
« no previous file with comments | « src/full-codegen/full-codegen.cc ('k') | src/interpreter/interpreter.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698