Add Profiling API callbacks for R2R methods (dotnet/coreclr#7732)
authorMukul Sabharwal <muks@microsoft.com>
Sat, 22 Oct 2016 02:45:06 +0000 (19:45 -0700)
committerJan Kotas <jkotas@microsoft.com>
Sat, 22 Oct 2016 02:45:06 +0000 (19:45 -0700)
Commit migrated from https://github.com/dotnet/coreclr/commit/ac0cb2fb119f45bd653d44ba9e4a2abed6a23000

src/coreclr/src/vm/readytoruninfo.cpp

index f867036..0fc618a 100644 (file)
@@ -636,6 +636,22 @@ PCODE ReadyToRunInfo::GetEntryPoint(MethodDesc * pMD, BOOL fFixups /*=TRUE*/)
             return NULL;
     }
 
+#ifndef CROSSGEN_COMPILE
+#ifdef PROFILING_SUPPORTED
+        BOOL fShouldSearchCache = TRUE;
+        {
+            BEGIN_PIN_PROFILER(CORProfilerTrackCacheSearches());
+            g_profControlBlock.pProfInterface->
+                JITCachedFunctionSearchStarted((FunctionID)pMD, &fShouldSearchCache);
+            END_PIN_PROFILER();
+        }
+        if (!fShouldSearchCache)
+        {
+            return NULL;
+        }
+#endif // PROFILING_SUPPORTED
+#endif // CROSSGEN_COMPILE
+
     uint id;
     offset = m_nativeReader.DecodeUnsigned(offset, &id);
 
@@ -671,6 +687,17 @@ PCODE ReadyToRunInfo::GetEntryPoint(MethodDesc * pMD, BOOL fFixups /*=TRUE*/)
             m_entryPointToMethodDescMap.InsertValue(PCODEToPINSTR(pEntryPoint), pMD);
     }
 
+#ifndef CROSSGEN_COMPILE
+#ifdef PROFILING_SUPPORTED
+        {
+            BEGIN_PIN_PROFILER(CORProfilerTrackCacheSearches());
+            g_profControlBlock.pProfInterface->
+                JITCachedFunctionSearchFinished((FunctionID)pMD, COR_PRF_CACHED_FUNCTION_FOUND);
+            END_PIN_PROFILER();
+        }
+#endif // PROFILING_SUPPORTED
+#endif // CROSSGEN_COMPILE
+
     if (g_pDebugInterface != NULL)
     {
         g_pDebugInterface->JITComplete(pMD, pEntryPoint);