Chromium Code Reviews| Index: runtime/vm/vtune.cc |
| diff --git a/runtime/vm/vtune.cc b/runtime/vm/vtune.cc |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..5f657c096af909e094aeb814fa8fa97dfe793314 |
| --- /dev/null |
| +++ b/runtime/vm/vtune.cc |
| @@ -0,0 +1,50 @@ |
| +// Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file |
| +// for details. All rights reserved. Use of this source code is governed by a |
| +// BSD-style license that can be found in the LICENSE file. |
| + |
| +#include "vm/vtune.h" |
| + |
| +#if defined(DART_VTUNE_SUPPORT) |
| +# include <jitprofiling.h> |
| +#endif |
| + |
| +namespace dart { |
| + |
| +#if defined(DART_VTUNE_SUPPORT) |
| +bool VTuneCodeObserver::IsActive() const { |
| + return (iJIT_IsProfilingActive() == iJIT_SAMPLING_ON); |
| +} |
| + |
| + |
| +void VTuneCodeObserver::Notify(const char* name, |
| + uword base, |
| + uword prologue_offset, |
| + uword size, |
| + bool optimized) { |
| + ASSERT(IsActive()); |
| + iJIT_Method_Load jmethod; |
| + memset(&jmethod, 0, sizeof(jmethod)); |
| + jmethod.method_id = iJIT_GetNewMethodID(); |
| + jmethod.method_name = const_cast<char*>(name); |
| + jmethod.method_load_address = reinterpret_cast<void*>(base); |
| + jmethod.method_size = size; |
| + iJIT_NotifyEvent(iJVM_EVENT_TYPE_METHOD_LOAD_FINISHED, &jmethod); |
| +} |
| +#else |
| +bool VTuneCodeObserver::IsActive() const { |
|
Ivan Posva
2012/11/27 09:11:20
Do you even need to supply these UNREACHABLE metho
Vyacheslav Egorov (Google)
2012/11/27 16:26:12
Done.
|
| + UNREACHABLE(); |
| + return false; |
| +} |
| + |
| + |
| +void VTuneCodeObserver::Notify(const char* name, |
| + uword base, |
| + uword prologue_offset, |
| + uword size, |
| + bool optimized) { |
| + UNREACHABLE(); |
| +} |
| +#endif |
| + |
| + |
| +} // namespace dart |