public static void DumpHeap()
 {
     if (CLRProfilerControl.isProcessIsUnderProfiler && !CLRProfilerControl.DumpHeap(60000U))
     {
         throw new Exception("Failure to\tdump heap");
     }
 }
Exemple #2
0
 public override void Execute()
 {
     GC.Collect(2);
     GC.WaitForPendingFinalizers();
     CLRProfilerControl.DumpHeap();
     CLRProfilerControl.LogWriteLine("GCDump-- App Shutdown");
     this.FinishExecution();
 }
 public static void LogWriteLine(string format, params object[] args)
 {
     if (!CLRProfilerControl.isProcessIsUnderProfiler)
     {
         return;
     }
     CLRProfilerControl.LogComment(string.Format(format, args));
 }
 public static void LogWriteLine(string comment)
 {
     if (!CLRProfilerControl.isProcessIsUnderProfiler)
     {
         return;
     }
     CLRProfilerControl.LogComment(comment);
     if (!(comment == CLRProfilerControl.killProcessMarker))
     {
         return;
     }
     Process.GetCurrentProcess().Kill();
 }
 static CLRProfilerControl()
 {
     try
     {
         bool allocationLoggingActive = CLRProfilerControl.GetAllocationLoggingActive();
         CLRProfilerControl.SetAllocationLoggingActive(!allocationLoggingActive);
         CLRProfilerControl.isProcessIsUnderProfiler = allocationLoggingActive != CLRProfilerControl.GetAllocationLoggingActive();
         CLRProfilerControl.SetAllocationLoggingActive(allocationLoggingActive);
         CLRProfilerControl.killProcessMarker = Environment.GetEnvironmentVariable("OMV_KILLPROCESS_MARKER");
     }
     catch (DllNotFoundException ex)
     {
         throw new Exception("profilerObj.dll was not found");
     }
 }