Add atrace calls to runtime start and heap create

Bug: 20727525

Change-Id: I91a74b793fb9eda8ed580244a6a5fd313ef2eb27
diff --git a/runtime/java_vm_ext.cc b/runtime/java_vm_ext.cc
index 2d3d19c..eb9c32d 100644
--- a/runtime/java_vm_ext.cc
+++ b/runtime/java_vm_ext.cc
@@ -16,6 +16,8 @@
 
 #include "jni_internal.h"
 
+#define ATRACE_TAG ATRACE_TAG_DALVIK
+#include <cutils/trace.h>
 #include <dlfcn.h>
 
 #include "art_method.h"
@@ -788,9 +790,11 @@
 // JNI Invocation interface.
 
 extern "C" jint JNI_CreateJavaVM(JavaVM** p_vm, JNIEnv** p_env, void* vm_args) {
+  ATRACE_BEGIN(__FUNCTION__);
   const JavaVMInitArgs* args = static_cast<JavaVMInitArgs*>(vm_args);
   if (IsBadJniVersion(args->version)) {
     LOG(ERROR) << "Bad JNI version passed to CreateJavaVM: " << args->version;
+    ATRACE_END();
     return JNI_EVERSION;
   }
   RuntimeOptions options;
@@ -800,6 +804,7 @@
   }
   bool ignore_unrecognized = args->ignoreUnrecognized;
   if (!Runtime::Create(options, ignore_unrecognized)) {
+    ATRACE_END();
     return JNI_ERR;
   }
   Runtime* runtime = Runtime::Current();
@@ -808,10 +813,12 @@
     delete Thread::Current()->GetJniEnv();
     delete runtime->GetJavaVM();
     LOG(WARNING) << "CreateJavaVM failed";
+    ATRACE_END();
     return JNI_ERR;
   }
   *p_env = Thread::Current()->GetJniEnv();
   *p_vm = runtime->GetJavaVM();
+  ATRACE_END();
   return JNI_OK;
 }