Exemplo n.º 1
0
        private bool attachProfiler(int pid, string fileName)
        {
            if (isProfilerLoaded(pid))
            {
                throw new Exception("CLRProfiler is already loaded in the target process.");
            }

            ProfConfig config = new ProfConfig();

            config.usage              = OmvUsage.OmvUsageNone;
            config.bOldFormat         = 0;
            config.szFileName         = fileName;
            config.bDynamic           = 0;
            config.bStack             = 0;
            config.dwSkipObjects      = 0;
            config.szClassToMonitor   = String.Empty;
            config.dwInitialSetting   = 0;
            config.dwDefaultTimeoutMs = maxWaitingTimeInMiliseconds;

            uint result = AttachProfiler(pid, "v4.", getProfilerFullPath(), ref config, noUI);

            profiledProcess = System.Diagnostics.Process.GetProcessById(pid);
            if (WaitForProcessToConnect(GetLogDir(), "Waiting for application to load the CLRProfiler", true, result) > 0)
            {
                return(true);
            }
            else
            {
                profiledProcessEnded();
                return(false);
            }
        }
Exemplo n.º 2
0
 private static extern uint AttachProfiler(int pid, string targetVersion,
                                           string profilerPath, [In] ref ProfConfig profConfig, bool fConsoleMode);
Exemplo n.º 3
0
        private bool attachProfiler(int pid, string fileName)
        {
            if (isProfilerLoaded(pid))
            {
                throw new Exception("CLRProfiler is already loaded in the target process.");
            }

            ProfConfig config = new ProfConfig();
            config.usage = OmvUsage.OmvUsageNone;
            config.bOldFormat = 0;
            config.szFileName = fileName;
            config.bDynamic = 0;
            config.bStack = 0;
            config.dwSkipObjects = 0;
            config.szClassToMonitor = String.Empty;
            config.dwInitialSetting = 0;
            config.dwDefaultTimeoutMs = maxWaitingTimeInMiliseconds;

            uint result = AttachProfiler(pid, "v4.", getProfilerFullPath(), ref config, noUI);

            profiledProcess = System.Diagnostics.Process.GetProcessById(pid);
            if (WaitForProcessToConnect(GetLogDir(), "Waiting for application to load the CLRProfiler", true, result) > 0)
            {
                return true;
            }
            else
            {
                profiledProcessEnded();
                return false;
            }
        }