public override bool Launch() { ClrConfig config = new ClrConfig { ProfilingMode = ProfilingMode, ListenPort = ListenPort, WaitForConnection = WaitForConnection, IncludeNative = IncludeNative, SamplingInterval = SamplingInterval, CounterInterval = CounterInterval, AllowMethodInlining = AllowMethodInlining, TrackGC = TrackGC, TrackAllocs = TrackAllocs, WeightedSampling = WeightedSampling, }; string configString = config.CreateString(); var psi = new ProcessStartInfo(Executable, Arguments); LauncherCommon.SetProcessOptions(psi, configString, LauncherCommon.GetCounterString(PerformanceCounters), true); psi.WorkingDirectory = string.IsNullOrEmpty(WorkingDir) ? Path.GetDirectoryName(Executable) : WorkingDir; try { Process.Start(psi); } catch (Exception ex) { MessageBox.Show(ex.Message, "Launch Error"); return(false); } return(true); }
public override bool Launch() { StopIIS(); ClrConfig config = new ClrConfig { ProfilingMode = ProfilingMode, ListenPort = ListenPort, WaitForConnection = WaitForConnection, IncludeNative = IncludeNative, SamplingInterval = SamplingInterval, CounterInterval = CounterInterval, AllowMethodInlining = AllowMethodInlining, TrackGC = TrackGC, TrackAllocs = TrackAllocs, WeightedSampling = WeightedSampling, }; string configString = config.CreateString(); string[] profilerEnv = LauncherCommon.CreateProfilerEnvironment(configString, LauncherCommon.GetCounterString(PerformanceCounters), true); string[] baseEnv = LauncherCommon.GetServicesEnvironment(); baseEnv = LauncherCommon.ReplaceTempDir(baseEnv, Path.GetTempPath()); string[] env = LauncherCommon.CombineEnvironments(baseEnv, profilerEnv); LauncherCommon.SetEnvironmentVariables("IISADMIN", env); LauncherCommon.SetEnvironmentVariables("W3SVC", env); LauncherCommon.SetEnvironmentVariables("WAS", env); string accountName = GetASP_NETaccountName(); string accountSid = null; if(accountName != null) { accountSid = LauncherCommon.GetAccountSid(accountName); if(accountSid != null) LauncherCommon.SetAccountEnvironment(accountSid, profilerEnv); } bool returnVal = StartIIS(); if(returnVal) { Thread.Sleep(1000); //we need to create a connection in order to know when CLR has been loaded using(IDataEngine engine = new DummyDataEngine()) { ConnectProgress progress = new ConnectProgress("localhost", ListenPort, engine, 20); progress.ShowDialog(); if(progress.Client != null) { progress.Client.Dispose(); } else { returnVal = false; } } } LauncherCommon.DeleteEnvironmentVariables("IISADMIN"); LauncherCommon.DeleteEnvironmentVariables("W3SVC"); LauncherCommon.DeleteEnvironmentVariables("WAS"); if(accountSid != null) LauncherCommon.ResetAccountEnvironment(accountSid, profilerEnv); return returnVal; }
public override bool Launch() { StopIIS(); ClrConfig config = new ClrConfig { ProfilingMode = ProfilingMode, ListenPort = ListenPort, WaitForConnection = WaitForConnection, IncludeNative = IncludeNative, SamplingInterval = SamplingInterval, CounterInterval = CounterInterval, AllowMethodInlining = AllowMethodInlining, TrackGC = TrackGC, TrackAllocs = TrackAllocs, WeightedSampling = WeightedSampling, }; string configString = config.CreateString(); string[] profilerEnv = LauncherCommon.CreateProfilerEnvironment(configString, LauncherCommon.GetCounterString(PerformanceCounters), true); string[] baseEnv = LauncherCommon.GetServicesEnvironment(); baseEnv = LauncherCommon.ReplaceTempDir(baseEnv, Path.GetTempPath()); string[] env = LauncherCommon.CombineEnvironments(baseEnv, profilerEnv); LauncherCommon.SetEnvironmentVariables("IISADMIN", env); LauncherCommon.SetEnvironmentVariables("W3SVC", env); LauncherCommon.SetEnvironmentVariables("WAS", env); string accountName = GetASP_NETaccountName(); string accountSid = null; if (accountName != null) { accountSid = LauncherCommon.GetAccountSid(accountName); if (accountSid != null) { LauncherCommon.SetAccountEnvironment(accountSid, profilerEnv); } } bool returnVal = StartIIS(); if (returnVal) { Thread.Sleep(1000); //we need to create a connection in order to know when CLR has been loaded using (IDataEngine engine = new DummyDataEngine()) { ConnectProgress progress = new ConnectProgress("localhost", ListenPort, engine, 20); progress.ShowDialog(); if (progress.Client != null) { progress.Client.Dispose(); } else { returnVal = false; } } } LauncherCommon.DeleteEnvironmentVariables("IISADMIN"); LauncherCommon.DeleteEnvironmentVariables("W3SVC"); LauncherCommon.DeleteEnvironmentVariables("WAS"); if (accountSid != null) { LauncherCommon.ResetAccountEnvironment(accountSid, profilerEnv); } return(returnVal); }
public override bool Launch() { StopService(ServiceName, StopCommand); ClrConfig config = new ClrConfig { ProfilingMode = ProfilingMode, ListenPort = ListenPort, WaitForConnection = WaitForConnection, IncludeNative = IncludeNative, SamplingInterval = SamplingInterval, CounterInterval = CounterInterval, AllowMethodInlining = AllowMethodInlining, TrackGC = TrackGC, TrackAllocs = TrackAllocs, WeightedSampling = WeightedSampling, }; string configString = config.ToString(); string[] profEnv = LauncherCommon.CreateProfilerEnvironment(configString, LauncherCommon.GetCounterString(PerformanceCounters), true); string serviceAccountSid = null; string serviceAccountName = LauncherCommon.GetServiceAccountName(ServiceName); if (serviceAccountName != null && serviceAccountName.StartsWith(@".\")) { serviceAccountName = Environment.MachineName + serviceAccountName.Substring(1); } if (serviceAccountName != null && serviceAccountName != "LocalSystem") { serviceAccountSid = LauncherCommon.GetAccountSid(serviceAccountName); } if (serviceAccountSid != null) { //set environment for target account LauncherCommon.SetAccountEnvironment(serviceAccountSid, profEnv); } else { string[] baseEnv = LauncherCommon.GetServicesEnvironment(); baseEnv = LauncherCommon.ReplaceTempDir(baseEnv, Path.GetTempPath()); string[] combinedEnv = LauncherCommon.CombineEnvironments(baseEnv, profEnv); LauncherCommon.SetEnvironmentVariables(ServiceName, combinedEnv); } bool returnVal = true; StartService(ServiceName, StartCommand); Thread.Sleep(1000); using (var engine = new DummyDataEngine()) { var progress = new ConnectProgress("localhost", ListenPort, engine, 10); progress.ShowDialog(); if (progress.Client != null) { progress.Client.Dispose(); } else { returnVal = false; } } if (serviceAccountSid != null) { LauncherCommon.ResetAccountEnvironment(serviceAccountSid, profEnv); } else { LauncherCommon.DeleteEnvironmentVariables(ServiceName); } return(returnVal); }
public override bool Launch() { ClrConfig config = new ClrConfig { ProfilingMode = ProfilingMode, ListenPort = ListenPort, WaitForConnection = WaitForConnection, IncludeNative = IncludeNative, SamplingInterval = SamplingInterval, CounterInterval = CounterInterval, AllowMethodInlining = AllowMethodInlining, TrackGC = TrackGC, TrackAllocs = TrackAllocs, WeightedSampling = WeightedSampling, }; string configString = config.CreateString(); var psi = new ProcessStartInfo(Executable, Arguments); LauncherCommon.SetProcessOptions(psi, configString, LauncherCommon.GetCounterString(PerformanceCounters), true); psi.WorkingDirectory = string.IsNullOrEmpty(WorkingDir) ? Path.GetDirectoryName(Executable) : WorkingDir; try { Process.Start(psi); } catch(Exception ex) { MessageBox.Show(ex.Message, "Launch Error"); return false; } return true; }
public override bool Launch() { StopService(ServiceName, StopCommand); ClrConfig config = new ClrConfig { ProfilingMode = ProfilingMode, ListenPort = ListenPort, WaitForConnection = WaitForConnection, IncludeNative = IncludeNative, SamplingInterval = SamplingInterval, CounterInterval = CounterInterval, AllowMethodInlining = AllowMethodInlining, TrackGC = TrackGC, TrackAllocs = TrackAllocs, WeightedSampling = WeightedSampling, }; string configString = config.ToString(); string[] profEnv = LauncherCommon.CreateProfilerEnvironment(configString, LauncherCommon.GetCounterString(PerformanceCounters), true); string serviceAccountSid = null; string serviceAccountName = LauncherCommon.GetServiceAccountName(ServiceName); if(serviceAccountName != null && serviceAccountName.StartsWith(@".\")) serviceAccountName = Environment.MachineName + serviceAccountName.Substring(1); if(serviceAccountName != null && serviceAccountName != "LocalSystem") { serviceAccountSid = LauncherCommon.GetAccountSid(serviceAccountName); } if(serviceAccountSid != null) { //set environment for target account LauncherCommon.SetAccountEnvironment(serviceAccountSid, profEnv); } else { string[] baseEnv = LauncherCommon.GetServicesEnvironment(); baseEnv = LauncherCommon.ReplaceTempDir(baseEnv, Path.GetTempPath()); string[] combinedEnv = LauncherCommon.CombineEnvironments(baseEnv, profEnv); LauncherCommon.SetEnvironmentVariables(ServiceName, combinedEnv); } bool returnVal = true; StartService(ServiceName, StartCommand); Thread.Sleep(1000); using(var engine = new DummyDataEngine()) { var progress = new ConnectProgress("localhost", ListenPort, engine, 10); progress.ShowDialog(); if(progress.Client != null) { progress.Client.Dispose(); } else { returnVal = false; } } if(serviceAccountSid != null) { LauncherCommon.ResetAccountEnvironment(serviceAccountSid, profEnv); } else { LauncherCommon.DeleteEnvironmentVariables(ServiceName); } return returnVal; }