How can I get CPU usage and/or RAM usage of a *THREAD* in C# (managed code)?
As said, memory use cannot be answered since that is an attribute of the process as a whole, but CPU use:
Process p = Process.GetCurrentProcess(); // getting current running process of the appforeach (ProcessThread pt in p.Threads){ // use pt.Id / pt.TotalProcessorTime / pt.UserProcessorTime / pt.PrivilegedProcessorTime}
You can't get memory usage per thread because memory is shared between all threads in a process. How would the OS know whether you allocated memory in one thread and used it in another. And what would it mean?
Here's an example which does what you wanthttp://www.codeproject.com/KB/system/processescpuusage.aspx