| OLD | NEW |
| (Empty) |
| 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | |
| 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. | |
| 4 | |
| 5 #include "vm/vtune.h" | |
| 6 | |
| 7 #include <jitprofiling.h> | |
| 8 | |
| 9 #include "platform/assert.h" | |
| 10 | |
| 11 namespace dart { | |
| 12 | |
| 13 bool VTuneCodeObserver::IsActive() const { | |
| 14 return (iJIT_IsProfilingActive() == iJIT_SAMPLING_ON); | |
| 15 } | |
| 16 | |
| 17 | |
| 18 void VTuneCodeObserver::Notify(const char* name, | |
| 19 uword base, | |
| 20 uword prologue_offset, | |
| 21 uword size, | |
| 22 bool optimized) { | |
| 23 ASSERT(IsActive()); | |
| 24 iJIT_Method_Load jmethod; | |
| 25 memset(&jmethod, 0, sizeof(jmethod)); | |
| 26 jmethod.method_id = iJIT_GetNewMethodID(); | |
| 27 jmethod.method_name = const_cast<char*>(name); | |
| 28 jmethod.method_load_address = reinterpret_cast<void*>(base); | |
| 29 jmethod.method_size = size; | |
| 30 iJIT_NotifyEvent(iJVM_EVENT_TYPE_METHOD_LOAD_FINISHED, &jmethod); | |
| 31 } | |
| 32 | |
| 33 } // namespace dart | |
| OLD | NEW |