| OLD | NEW |
| 1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 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/arm64/instrument-arm64.h" | 5 #include "src/arm64/instrument-arm64.h" |
| 6 | 6 |
| 7 namespace v8 { | 7 namespace v8 { |
| 8 namespace internal { | 8 namespace internal { |
| 9 | 9 |
| 10 Counter::Counter(const char* name, CounterType type) | 10 Counter::Counter(const char* name, CounterType type) |
| 11 : count_(0), enabled_(false), type_(type) { | 11 : count_(0), enabled_(false), type_(type) { |
| 12 ASSERT(name != NULL); | 12 DCHECK(name != NULL); |
| 13 strncpy(name_, name, kCounterNameMaxLength); | 13 strncpy(name_, name, kCounterNameMaxLength); |
| 14 } | 14 } |
| 15 | 15 |
| 16 | 16 |
| 17 void Counter::Enable() { | 17 void Counter::Enable() { |
| 18 enabled_ = true; | 18 enabled_ = true; |
| 19 } | 19 } |
| 20 | 20 |
| 21 | 21 |
| 22 void Counter::Disable() { | 22 void Counter::Disable() { |
| (...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 137 if (output_stream_ != stderr) { | 137 if (output_stream_ != stderr) { |
| 138 fclose(output_stream_); | 138 fclose(output_stream_); |
| 139 } | 139 } |
| 140 } | 140 } |
| 141 | 141 |
| 142 | 142 |
| 143 void Instrument::Update() { | 143 void Instrument::Update() { |
| 144 // Increment the instruction counter, and dump all counters if a sample period | 144 // Increment the instruction counter, and dump all counters if a sample period |
| 145 // has elapsed. | 145 // has elapsed. |
| 146 static Counter* counter = GetCounter("Instruction"); | 146 static Counter* counter = GetCounter("Instruction"); |
| 147 ASSERT(counter->type() == Cumulative); | 147 DCHECK(counter->type() == Cumulative); |
| 148 counter->Increment(); | 148 counter->Increment(); |
| 149 | 149 |
| 150 if (counter->IsEnabled() && (counter->count() % sample_period_) == 0) { | 150 if (counter->IsEnabled() && (counter->count() % sample_period_) == 0) { |
| 151 DumpCounters(); | 151 DumpCounters(); |
| 152 } | 152 } |
| 153 } | 153 } |
| 154 | 154 |
| 155 | 155 |
| 156 void Instrument::DumpCounters() { | 156 void Instrument::DumpCounters() { |
| 157 // Iterate through the counter objects, dumping their values to the output | 157 // Iterate through the counter objects, dumping their values to the output |
| (...skipping 428 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 586 | 586 |
| 587 | 587 |
| 588 void Instrument::VisitUnimplemented(Instruction* instr) { | 588 void Instrument::VisitUnimplemented(Instruction* instr) { |
| 589 Update(); | 589 Update(); |
| 590 static Counter* counter = GetCounter("Other"); | 590 static Counter* counter = GetCounter("Other"); |
| 591 counter->Increment(); | 591 counter->Increment(); |
| 592 } | 592 } |
| 593 | 593 |
| 594 | 594 |
| 595 } } // namespace v8::internal | 595 } } // namespace v8::internal |
| OLD | NEW |