Process 类能解决你的问题。
Process NewProcess;
NewProcess =  System.Diagnostics.Process.GetProcessesByName("你程序的名字");  
NewProcess.Threads.Count ; //线程数
NewProcess.WorkingSet ;//物理内存大小
NewProcess.VirtualMemorySize ; //虚拟内存大小

解决方案 »

  1.   

    给你点意见:
    http://www.microsoft.com/china/MSDN/library/netFramework/netframework/Nfnetprofilerapi.mspx
      

  2.   

    至于用Process
    <script language="C#" runat=server>
    void Page_Load(Object sender, EventArgs ev)
    {
    ProcessInfo[] history = ProcessModelInfo.GetHistory(100);
    for( int i=0; i<history.Length; i++ )
    {
    Response.Write("StartTime:"+ history.StartTime.ToString() + "<BR>");
    Response.Write("Age:" + history.Age.ToString() + "<BR>");
    Response.Write("ProcessID:" + history.ProcessID.ToString() + "<BR>");
    Response.Write("RequestCount:" + history.RequestCount.ToString() + "<BR>");
    Response.Write("Status:" + GetProcessStatus(history.Status ) + "<BR>");
    Response.Write("ShutdownReason:" + GetShutdownReason(history.ShutdownReason) + "<BR>");
    Response.Write("PeakMemoryUsed:" + history.PeakMemoryUsed.ToString() + "<BR>");}
    }public String GetProcessStatus( ProcessStatus ps )
    {
    String s = "Unknown";
    if( ps == ProcessStatus.Alive )
    s = "Alive";
    else if( ps == ProcessStatus.ShuttingDown )
    s = "Shutting Down";
    else if( ps == ProcessStatus.ShutDown )
    s = "Shutdown";
    else if( ps == ProcessStatus.Terminated )
    s = "Terminated";
    return s;
    }public String GetShutdownReason( ProcessShutdownReason psr )
    {
    String s = "Unknown";
    if( psr == ProcessShutdownReason.None )
    s = "N/A";
    else if( psr == ProcessShutdownReason.Unexpected )
    s = "Unexpected";
    else if( psr == ProcessShutdownReason.RequestsLimit )
    s = "Requests Limit";
    else if( psr == ProcessShutdownReason.RequestQueueLimit )
    s = "Request Queue Limit";
    else if( psr == ProcessShutdownReason.Timeout )
    s = "Timeout";
    else if( psr == ProcessShutdownReason.IdleTimeout )
    s = "Idle Timeout";
    else if( psr == ProcessShutdownReason.MemoryLimitExceeded )
    s = "Memory Limit Exceeded";
    return s;
    }
    </script>