OLD | NEW |
1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file |
2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
4 | 4 |
5 #include "vm/profiler_service.h" | 5 #include "vm/profiler_service.h" |
6 | 6 |
7 #include "vm/growable_array.h" | 7 #include "vm/growable_array.h" |
8 #include "vm/native_symbol.h" | 8 #include "vm/native_symbol.h" |
9 #include "vm/object.h" | 9 #include "vm/object.h" |
10 #include "vm/os.h" | 10 #include "vm/os.h" |
(...skipping 1053 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1064 profile_->sample_count_ = samples_->length(); | 1064 profile_->sample_count_ = samples_->length(); |
1065 } | 1065 } |
1066 | 1066 |
1067 void UpdateMinMaxTimes(int64_t timestamp) { | 1067 void UpdateMinMaxTimes(int64_t timestamp) { |
1068 profile_->min_time_ = | 1068 profile_->min_time_ = |
1069 timestamp < profile_->min_time_ ? timestamp : profile_->min_time_; | 1069 timestamp < profile_->min_time_ ? timestamp : profile_->min_time_; |
1070 profile_->max_time_ = | 1070 profile_->max_time_ = |
1071 timestamp > profile_->max_time_ ? timestamp : profile_->max_time_; | 1071 timestamp > profile_->max_time_ ? timestamp : profile_->max_time_; |
1072 } | 1072 } |
1073 | 1073 |
| 1074 void SanitizeMinMaxTimes() { |
| 1075 if ((profile_->min_time_ == kMaxInt64) && (profile_->max_time_ == 0)) { |
| 1076 profile_->min_time_ = 0; |
| 1077 profile_->max_time_ = 0; |
| 1078 } |
| 1079 } |
| 1080 |
1074 void BuildCodeTable() { | 1081 void BuildCodeTable() { |
1075 ScopeTimer sw("ProfileBuilder::BuildCodeTable", FLAG_trace_profiler); | 1082 ScopeTimer sw("ProfileBuilder::BuildCodeTable", FLAG_trace_profiler); |
1076 for (intptr_t sample_index = 0; | 1083 for (intptr_t sample_index = 0; |
1077 sample_index < samples_->length(); | 1084 sample_index < samples_->length(); |
1078 sample_index++) { | 1085 sample_index++) { |
1079 ProcessedSample* sample = samples_->At(sample_index); | 1086 ProcessedSample* sample = samples_->At(sample_index); |
1080 const int64_t timestamp = sample->timestamp(); | 1087 const int64_t timestamp = sample->timestamp(); |
1081 | 1088 |
1082 // This is our first pass over the sample buffer, use this as an | 1089 // This is our first pass over the sample buffer, use this as an |
1083 // opportunity to determine the min and max time ranges of this profile. | 1090 // opportunity to determine the min and max time ranges of this profile. |
(...skipping 14 matching lines...) Expand all Loading... |
1098 for (intptr_t frame_index = 0; | 1105 for (intptr_t frame_index = 0; |
1099 frame_index < sample->length(); | 1106 frame_index < sample->length(); |
1100 frame_index++) { | 1107 frame_index++) { |
1101 const uword pc = sample->At(frame_index); | 1108 const uword pc = sample->At(frame_index); |
1102 ASSERT(pc != 0); | 1109 ASSERT(pc != 0); |
1103 ProfileCode* code = RegisterProfileCode(pc, timestamp); | 1110 ProfileCode* code = RegisterProfileCode(pc, timestamp); |
1104 ASSERT(code != NULL); | 1111 ASSERT(code != NULL); |
1105 code->Tick(pc, IsExecutingFrame(sample, frame_index), sample_index); | 1112 code->Tick(pc, IsExecutingFrame(sample, frame_index), sample_index); |
1106 } | 1113 } |
1107 } | 1114 } |
| 1115 SanitizeMinMaxTimes(); |
1108 } | 1116 } |
1109 | 1117 |
1110 void FinalizeCodeIndexes() { | 1118 void FinalizeCodeIndexes() { |
1111 ScopeTimer sw("ProfileBuilder::FinalizeCodeIndexes", FLAG_trace_profiler); | 1119 ScopeTimer sw("ProfileBuilder::FinalizeCodeIndexes", FLAG_trace_profiler); |
1112 ProfileCodeTable* live_table = profile_->live_code_; | 1120 ProfileCodeTable* live_table = profile_->live_code_; |
1113 ProfileCodeTable* dead_table = profile_->dead_code_; | 1121 ProfileCodeTable* dead_table = profile_->dead_code_; |
1114 ProfileCodeTable* tag_table = profile_->tag_code_; | 1122 ProfileCodeTable* tag_table = profile_->tag_code_; |
1115 const intptr_t dead_code_index_offset = live_table->length(); | 1123 const intptr_t dead_code_index_offset = live_table->length(); |
1116 const intptr_t tag_code_index_offset = | 1124 const intptr_t tag_code_index_offset = |
1117 dead_table->length() + dead_code_index_offset; | 1125 dead_table->length() + dead_code_index_offset; |
(...skipping 1161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2279 ASSERT(sample_buffer != NULL); | 2287 ASSERT(sample_buffer != NULL); |
2280 | 2288 |
2281 ClearProfileVisitor clear_profile(isolate); | 2289 ClearProfileVisitor clear_profile(isolate); |
2282 sample_buffer->VisitSamples(&clear_profile); | 2290 sample_buffer->VisitSamples(&clear_profile); |
2283 | 2291 |
2284 // Enable profile interrupts. | 2292 // Enable profile interrupts. |
2285 Profiler::BeginExecution(isolate); | 2293 Profiler::BeginExecution(isolate); |
2286 } | 2294 } |
2287 | 2295 |
2288 } // namespace dart | 2296 } // namespace dart |
OLD | NEW |