| 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 235 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 246 bool ProfileCode::IsOptimizedDart() const { | 246 bool ProfileCode::IsOptimizedDart() const { |
| 247 return !code_.IsNull() && code_.is_optimized(); | 247 return !code_.IsNull() && code_.is_optimized(); |
| 248 } | 248 } |
| 249 | 249 |
| 250 | 250 |
| 251 void ProfileCode::SetName(const char* name) { | 251 void ProfileCode::SetName(const char* name) { |
| 252 if (name == NULL) { | 252 if (name == NULL) { |
| 253 name_ = NULL; | 253 name_ = NULL; |
| 254 } | 254 } |
| 255 intptr_t len = strlen(name); | 255 intptr_t len = strlen(name); |
| 256 name_ = Thread::Current()->zone()->Alloc<const char>(len + 1); | 256 name_ = Thread::Current()->zone()->Alloc<char>(len + 1); |
| 257 strncpy(const_cast<char*>(name_), name, len); | 257 strncpy(name_, name, len); |
| 258 const_cast<char*>(name_)[len] = '\0'; | 258 name_[len] = '\0'; |
| 259 } | 259 } |
| 260 | 260 |
| 261 | 261 |
| 262 void ProfileCode::GenerateAndSetSymbolName(const char* prefix) { | 262 void ProfileCode::GenerateAndSetSymbolName(const char* prefix) { |
| 263 const intptr_t kBuffSize = 512; | 263 const intptr_t kBuffSize = 512; |
| 264 char buff[kBuffSize]; | 264 char buff[kBuffSize]; |
| 265 OS::SNPrint(&buff[0], kBuffSize-1, "%s [%" Px ", %" Px ")", | 265 OS::SNPrint(&buff[0], kBuffSize-1, "%s [%" Px ", %" Px ")", |
| 266 prefix, start(), end()); | 266 prefix, start(), end()); |
| 267 SetName(buff); | 267 SetName(buff); |
| 268 } | 268 } |
| (...skipping 2008 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2277 Isolate* isolate = thread->isolate(); | 2277 Isolate* isolate = thread->isolate(); |
| 2278 | 2278 |
| 2279 // Disable thread interrupts while processing the buffer. | 2279 // Disable thread interrupts while processing the buffer. |
| 2280 DisableThreadInterruptsScope dtis(thread); | 2280 DisableThreadInterruptsScope dtis(thread); |
| 2281 | 2281 |
| 2282 ClearProfileVisitor clear_profile(isolate); | 2282 ClearProfileVisitor clear_profile(isolate); |
| 2283 sample_buffer->VisitSamples(&clear_profile); | 2283 sample_buffer->VisitSamples(&clear_profile); |
| 2284 } | 2284 } |
| 2285 | 2285 |
| 2286 } // namespace dart | 2286 } // namespace dart |
| OLD | NEW |