Example #1
0
        public bool CheckParams()
        {
            if (Executable == string.Empty)
            {
                MessageBox.Show("You must enter an executable file to run.", "Configuration Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return(false);
            }

            if (!File.Exists(Executable))
            {
                MessageBox.Show("Executable does not exist.", "Configuration Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return(false);
            }

            using (var tempEngine = new DummyDataEngine())
            {
                bool used = LauncherCommon.TestConnection("localhost", ListenPort, tempEngine);
                if (used)
                {
                    DialogResult result = MessageBox.Show("This port appears to be in use already. Continue anyway?",
                                                          "Port In Use", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2);
                    if (result == DialogResult.No)
                    {
                        return(false);
                    }
                }
            }

            return(true);
        }
Example #2
0
        private void m_testConnectionButton_Click(object sender, EventArgs e)
        {
            int port = 0;

            int.TryParse(m_portTextBox.Text, out port);
            if (port < 1 || port > ushort.MaxValue)
            {
                MessageBox.Show("Port must be between 1 and 65535.", "Launch Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }

            bool result = true;

            using (IDataEngine engine = new DummyDataEngine())
            {
                ConnectProgress progress = new ConnectProgress(m_hostNameTextBox.Text, port, engine, 1);
                progress.ShowDialog();
                if (progress.Client != null)
                {
                    result = true;
                    progress.Client.Dispose();
                }
                else
                {
                    result = false;
                }
            }

            if (result)
            {
                MessageBox.Show("Connection test was successful.", "Connection Test", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
        }
Example #3
0
        public override bool Launch(ConnectDelegate connect)
        {
            StopIIS();

            string config = LauncherCommon.CreateConfigString(ProfilingMode, ListenPort, false, IncludeNative, SamplingInterval, CounterInterval, AllowMethodInlining, TrackGC, TrackAllocs);

            string[] profilerEnv = LauncherCommon.CreateProfilerEnvironment(config, LauncherCommon.GetCounterString(PerformanceCounters));
            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())
                {
                    var client = connect("localhost", ListenPort, engine, 10);
                    if (client != null)
                    {
                        client.Dispose();
                    }
                    else
                    {
                        returnVal = false;
                    }
                }
            }

            LauncherCommon.DeleteEnvironmentVariables("IISADMIN");
            LauncherCommon.DeleteEnvironmentVariables("W3SVC");
            LauncherCommon.DeleteEnvironmentVariables("WAS");

            if (accountSid != null)
            {
                LauncherCommon.ResetAccountEnvironment(accountSid, profilerEnv);
            }

            return(returnVal);
        }
Example #4
0
        public virtual bool CheckParams()
        {
            using (var tempEngine = new DummyDataEngine())
            {
                bool used = LauncherCommon.TestConnection("localhost", ListenPort, tempEngine);
                if (used)
                {
                    DialogResult result = MessageBox.Show("This port appears to be in use already. Continue anyway?",
                                                          "Port In Use", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2);
                    if (result == DialogResult.No)
                    {
                        return(false);
                    }
                }
            }

            return(true);
        }
Example #5
0
		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;
		}
Example #6
0
		public override bool Launch(ConnectDelegate connect)
		{
			StopIIS();

			string config = LauncherCommon.CreateConfigString(ProfilingMode, ListenPort, false, IncludeNative, SamplingInterval, CounterInterval, AllowMethodInlining, TrackGC, TrackAllocs);
			string[] profilerEnv = LauncherCommon.CreateProfilerEnvironment(config, LauncherCommon.GetCounterString(PerformanceCounters));
			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())
				{
					var client = connect("localhost", ListenPort, engine, 10);
					if(client != null)
						client.Dispose();
					else
						returnVal = false;

				}
			}

			LauncherCommon.DeleteEnvironmentVariables("IISADMIN");
			LauncherCommon.DeleteEnvironmentVariables("W3SVC");
			LauncherCommon.DeleteEnvironmentVariables("WAS");

			if(accountSid != null)
				LauncherCommon.ResetAccountEnvironment(accountSid, profilerEnv);

			return returnVal;
		}
Example #7
0
        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);
        }
Example #9
0
		public bool CheckParams()
		{
			if(Executable == string.Empty)
			{
				MessageBox.Show("You must enter an executable file to run.", "Configuration Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
				return false;
			}

			if(!File.Exists(Executable))
			{
				MessageBox.Show("Executable does not exist.", "Configuration Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
				return false;
			}

			using(var tempEngine = new DummyDataEngine())
			{
				bool used = LauncherCommon.TestConnection("localhost", ListenPort, tempEngine);
				if(used)
				{
					DialogResult result = MessageBox.Show("This port appears to be in use already. Continue anyway?",
						"Port In Use", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2);
					if(result == DialogResult.No)
						return false;
				}
			}

			return true;
		}
Example #10
0
		public override bool Launch(ConnectDelegate connect)
		{
			StopService(ServiceName, StopCommand);

			string config = LauncherCommon.CreateConfigString(ProfilingMode, ListenPort, WaitForConnection, IncludeNative, SamplingInterval, CounterInterval, AllowMethodInlining, TrackGC, TrackAllocs);
			string[] profEnv = LauncherCommon.CreateProfilerEnvironment(config, LauncherCommon.GetCounterString(PerformanceCounters));

			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 client = connect("localhost", ListenPort, engine, 10);
				if(client != null)
					client.Dispose();
				else
					returnVal = false;
			}

			if(serviceAccountSid != null)
			{
				LauncherCommon.ResetAccountEnvironment(serviceAccountSid, profEnv);
			}
			else
			{
				LauncherCommon.DeleteEnvironmentVariables(ServiceName);
			}

			return returnVal;
		}
Example #11
0
		public virtual bool CheckParams()
		{
			using(var tempEngine = new DummyDataEngine())
			{
				bool used = LauncherCommon.TestConnection("localhost", ListenPort, tempEngine);
				if(used)
				{
					DialogResult result = MessageBox.Show("This port appears to be in use already. Continue anyway?",
						"Port In Use", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2);
					if(result == DialogResult.No)
						return false;
				}
			}

			return true;
		}
Example #12
0
		private void m_testConnectionButton_Click(object sender, EventArgs e)
		{
			int port = 0;
			int.TryParse(m_portTextBox.Text, out port);
			if(port < 1 || port > ushort.MaxValue)
			{
				MessageBox.Show("Port must be between 1 and 65535.", "Launch Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
				return;
			}

			bool result = true;
			using(IDataEngine engine = new DummyDataEngine())
			{
				ConnectProgress progress = new ConnectProgress(m_hostNameTextBox.Text, port, engine, 1);
				progress.ShowDialog();
				if(progress.Client != null)
				{
					result = true;
					progress.Client.Dispose();
				}
				else
				{
					result = false;
				}
			}

			if(result)
				MessageBox.Show("Connection test was successful.", "Connection Test", MessageBoxButtons.OK, MessageBoxIcon.Information);
		}