예제 #1
0
		private void AttachProfiler(int PID)
		{
			//Check for already profiling
			if(profilerTable==null){return;	}
			if(profilerTable.ContainsKey(PID)){return;}

			string processName=null;
			try
			{
				processName=System.Diagnostics.Process.GetProcessById(PID).MainModule.ModuleName ;
			}
			catch
			{		
				try
				{
					processName=System.Diagnostics.Process.GetProcessById(PID).ProcessName;
					if(processName!=null)  
					{
						if(!processName.ToLower().EndsWith(".exe"))
						{
							processName+=".exe";
						}
					}
				}
				catch(Exception ex)
				{
					MessageBox.Show(ex.Message,"Error!",MessageBoxButtons.OK,MessageBoxIcon.Error)   ;
					return;	
				}				
			}
			
			string configString=null;
			if(Configurator.g_FunctionFlag!=0)
			{
				configString="PERFORMANCE_ANALYSIS";
			}
			else if(Configurator.g_ObjectFlag!=0)
			{
				configString="MEMORY_ANALYSIS";
			}
			if(Configurator.g_FunctionFlag==0 && Configurator.g_ObjectFlag==0)
			{
				//Do Nothing
			}
			else
			{
				try
				{
					ProfilerControl perfControl=new ProfilerControl(PID,processName,true,Configurator.g_FunctionFlag ,Configurator.g_ObjectFlag ,configString,null);					
					perfControl.Text =Convert.ToString(PID)+ ":"+ processName;	//V.Imp.
					perfControl.Show(); 
				}
				catch(Exception ex)
				{
					MessageBox.Show(ex.Message,"Error!",MessageBoxButtons.OK,MessageBoxIcon.Error)   ;
					return;	
				}				
			}
			Application.DoEvents(); 
		}
예제 #2
0
					}
					catch{}
					try
					{
						CloseHandle(pInfo.hProcess);					
					}
					catch{}