Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(461)

Unified Diff: runtime/vm/vtune.cc

Issue 11412106: Support VTune's JIT interface. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: add vtune.{cc,h} Created 8 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« runtime/vm/vm.gypi ('K') | « runtime/vm/vtune.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/vtune.cc
diff --git a/runtime/vm/vtune.cc b/runtime/vm/vtune.cc
new file mode 100644
index 0000000000000000000000000000000000000000..bd659b47d0344df83e7ca4fb066793ab49e1c0f6
--- /dev/null
+++ b/runtime/vm/vtune.cc
@@ -0,0 +1,42 @@
+// 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 VTune::IsActive() {
+ return (iJIT_IsProfilingActive() == iJIT_SAMPLING_ON);
+}
+
+
+void VTune::Register(const char* name, uword base, uword size) {
+ if (!IsActive()) return;
+
+ 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 VTune::IsActive() {
+ return false;
+}
+
+
+void VTune::Register(const char* name, uword base, uword size) {
+ /* Nothing to do */
+}
+#endif
+
+
+} // namespace dart
« runtime/vm/vm.gypi ('K') | « runtime/vm/vtune.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698