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 #if defined(DART_VTUNE_SUPPORT) |
| 8 # include <jitprofiling.h> |
| 9 #endif |
| 10 |
| 11 namespace dart { |
| 12 |
| 13 #if defined(DART_VTUNE_SUPPORT) |
| 14 bool VTune::IsActive() { |
| 15 return (iJIT_IsProfilingActive() == iJIT_SAMPLING_ON); |
| 16 } |
| 17 |
| 18 |
| 19 void VTune::Register(const char* name, uword base, uword size) { |
| 20 if (!IsActive()) return; |
| 21 |
| 22 iJIT_Method_Load jmethod; |
| 23 memset(&jmethod, 0, sizeof(jmethod)); |
| 24 jmethod.method_id = iJIT_GetNewMethodID(); |
| 25 jmethod.method_name = const_cast<char*>(name); |
| 26 jmethod.method_load_address = reinterpret_cast<void*>(base); |
| 27 jmethod.method_size = size; |
| 28 iJIT_NotifyEvent(iJVM_EVENT_TYPE_METHOD_LOAD_FINISHED, &jmethod); |
| 29 } |
| 30 #else |
| 31 bool VTune::IsActive() { |
| 32 return false; |
| 33 } |
| 34 |
| 35 |
| 36 void VTune::Register(const char* name, uword base, uword size) { |
| 37 /* Nothing to do */ |
| 38 } |
| 39 #endif |
| 40 |
| 41 |
| 42 } // namespace dart |
OLD | NEW |