🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.cppbuilder.nativeapi
Article #2710

Getting a thread's state and CPU utilization

#2710
From: Dennis Jones
Date: Sun, 14 Jan 2007 08:19
18 lines
1648 bytes
Hello,

Does anyone know if there is a way to determine the state of a currently 
running thread?  I'd like to be able to find out if a thread is executing, 
terminated, or waiting on a synchronization object (such as a critical 
section or mutex).  There seems to be support for this capability in .NET 
(according to MDSN, it's in the System.Threading namespace), which suggests 
that this must be possible in Windows, but I would need to do it using Win32 
API functions.

Also, is it possible to get a thread's current CPU utilization?  For 
example, if my application is using 80-90% of the CPU resources, I'd really 
like to be able to determine which threads are very busy, and which ones are 
using little or no CPU time.

Thanks,

- Dennis 
Technical Details
Message-ID: <45a9e77e$1@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!g2news2.google.com!news4.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail

Show Full Headers
Complete Article Headers
X-Google-Thread: 10cc67,2c2b36b510895e0f,start
X-Google-Attributes: gid10cc67,public
X-Google-Language: ENGLISH,ASCII-7-bit
From: "Dennis Jones" <nospam@nospam.com>
Newsgroups: borland.public.cppbuilder.nativeapi
Subject: Getting a thread's state and CPU utilization
Date: Sun, 14 Jan 2007 00:19:26 -0800
Lines: 20
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2900.3028
X-RFC2646: Format=Flowed; Original
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.3028
NNTP-Posting-Host: 71.245.109.58
Message-ID: <45a9e77e$1@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1168762750 71.245.109.58 (14 Jan 2007 00:19:10 -0800)
Path: arc1-ca.pugleaf.net!g2news2.google.com!news4.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail