🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

Re: cpu usage

#10890
From: Christian Lotze
Date: Fri, 19 Mar 2004 12:39
18 lines
1598 bytes
<Neil> schrieb/wrote:

> is there a way I can get the percentage of cpu my app is using
> (like in windows task manager)?
>
> Thanks

Yes:
GetProcessTimes( GetCurrentProcess(), t1, t2, t3, t4 );
t3 is Kerneltime in 100ns-Setps
t4 is Usertime in 100ns-Setps
t3+t4 is overall CPU-Time of Process

use a timer and calculate Percent = (actualtime-oldtime) /
((actualTickCount-OldTickCount)*100)
works fine and results are equal to Taskmanager!

HTH, Christian
Technical Details
Message-ID: <c3eplh$4ki$02$1@news.t-online.com>
Path: arc1-ca.pugleaf.net!archiver1.google.com!news2.google.com!fu-berlin.de!news.belwue.de!newsfeed01.sul.t-online.de!newsmm00.sul.t-online.de!t-online.de!news.t-online.com!not-for-mail
References: <405ac517@newsgroups.borland.com>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 10cc67,b73ce7c3abfea216
X-Google-Attributes: gid10cc67,public
X-Google-ArrivalTime: 2004-03-19 04:40:13 PST
Path: arc1-ca.pugleaf.net!archiver1.google.com!news2.google.com!fu-berlin.de!news.belwue.de!newsfeed01.sul.t-online.de!newsmm00.sul.t-online.de!t-online.de!news.t-online.com!not-for-mail
From: "Christian Lotze" <reply@news.lotze-web.de>
Newsgroups: borland.public.cppbuilder.nativeapi
Subject: Re: cpu usage
Date: Fri, 19 Mar 2004 13:39:12 +0100
Organization: T-Online
Lines: 20
Message-ID: <c3eplh$4ki$02$1@news.t-online.com>
References: <405ac517@newsgroups.borland.com>
Reply-To: "Christian Lotze" <reply@news.lotze-web.de>
Mime-Version: 1.0
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 8bit
X-Trace: news.t-online.com 1079699953 02 4754 hMAkGY3lRUPaIR 040319 12:39:13
X-Complaints-To: usenet-abuse@t-online.de
X-ID: ZGLPnqZCweBC0UBDwtPYOy7JRr8noDz+S6AQ4ihbRIL4+3bfO-wVr8
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2800.1106
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1106