How to find thread id of a .Net thread?

How to find thread id of a .Net thread?

Post by Richard Bl » Wed, 09 Mar 2005 05:20:38


You can call

AppDomain.GetCurrentThreadId

on the thread in question - although this method is depricated under version 2.0 of the framework

Regards

Richard Blewett - DevelopMentor
http://www.yqcomputer.com/
http://www.yqcomputer.com/

Hi,
Iam trying to monitor the CPU usage of all the threads running in my application using perfmon. All threads are created using new Thread(ThreadStart). Perfmon gives the thread id and the CPU usage of the threads. But i need to exactly trace at the code level and find which are the threads that are taking excessive CPU time. I want to find out a way to get the thread id so that i can log the thread id when it is created. And then i can compare the thread ids displayed in perfmon. But Thread object does not seem to expose thread id. Kindly suggest me a solution.

Regards
Jag