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

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

Issue 1825093002: [counters] adding runtime call timers for GC (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: adding gc timer Created 4 years, 9 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
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.
28 if (FLAG_runtime_call_stats) {
29 RuntimeCallStats* stats =
30 tracer_->heap_->isolate()->counters()->runtime_call_stats();
31 timer_.Initialize(&stats->GC, stats->current_timer());
32 stats->Enter(&timer_);
33 }
27 } 34 }
28 35
29 36
30 GCTracer::Scope::~Scope() { 37 GCTracer::Scope::~Scope() {
31 DCHECK(scope_ < NUMBER_OF_SCOPES); // scope_ is unsigned. 38 DCHECK(scope_ < NUMBER_OF_SCOPES); // scope_ is unsigned.
32 tracer_->current_.scopes[scope_] += 39 tracer_->current_.scopes[scope_] +=
33 tracer_->heap_->MonotonicallyIncreasingTimeInMs() - start_time_; 40 tracer_->heap_->MonotonicallyIncreasingTimeInMs() - start_time_;
41 // TODO(cbruni): remove once we fully moved to a trace-based system.
42 if (FLAG_runtime_call_stats) {
43 tracer_->heap_->isolate()->counters()->runtime_call_stats()->Leave(&timer_);
44 }
34 } 45 }
35 46
36 47
37 GCTracer::AllocationEvent::AllocationEvent(double duration, 48 GCTracer::AllocationEvent::AllocationEvent(double duration,
38 size_t allocation_in_bytes) { 49 size_t allocation_in_bytes) {
39 duration_ = duration; 50 duration_ = duration;
40 allocation_in_bytes_ = allocation_in_bytes; 51 allocation_in_bytes_ = allocation_in_bytes;
41 } 52 }
42 53
43 54
(...skipping 876 matching lines...) Expand 10 before | Expand all | Expand 10 after
920 931
921 932
922 bool GCTracer::SurvivalEventsRecorded() const { 933 bool GCTracer::SurvivalEventsRecorded() const {
923 return survival_events_.size() > 0; 934 return survival_events_.size() > 0;
924 } 935 }
925 936
926 937
927 void GCTracer::ResetSurvivalEvents() { survival_events_.reset(); } 938 void GCTracer::ResetSurvivalEvents() { survival_events_.reset(); }
928 } // namespace internal 939 } // namespace internal
929 } // namespace v8 940 } // namespace v8
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698