Article View: borland.public.cppbuilder.nativeapi
Article #4406Re: CPU load - How can I measure it?
From: Alberto
Date: Sun, 05 Feb 2006 23:36
Date: Sun, 05 Feb 2006 23:36
37 lines
2350 bytes
2350 bytes
Bob Gonder wrote: > Alberto wrote: > > >> I would like, using some Windows API, to measure constantly how much CPU >> load my program is imposing on the processor, with the goal of reducing some >> functionalities if the load is approaching 100%, all in a manner transparent >> to the user. >> > > The simplest way to do that is to let Windows do it for you. > Do your processing in threads, and set their priority one step down > from normal. SetThreadPriority() > > > If you are really set on knowing exactly how much time you are using, > take a look at GetProcessTimes() > Bob, thanks, but my requirements are a bit more sophisticated than that. More specifically, I do a digital filtering of audio signals using a FIR filter with a variable number of taps. What I would like to do is to change dynamically the number of taps in function of the current CPU load, accepting the worsening of the filter performance in exchange for a reduced consumption of CPU time, if need be. GetProcessTimes seems to not be recognized by BCB6, while it is described by the online MSDN, which also warns that it is not supported under Win98. Does it exist a similar function, or equivalent technique, that would work also with Windows 98? I wouldn't like to impose this limitation to my users. Thanks. Alberto di Bene
Technical Details
Message-ID:
<43e68b34$1@newsgroups.borland.com>Path:
arc1-ca.pugleaf.net!g2news1.google.com!news1.google.com!newsfeed.gamma.ru!Gamma.RU!npeer.de.kpn-eurorings.net!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mailReferences:
<43e53514@newsgroups.borland.com> <40bcu1hlup9hqfr2qfnl6ob26jaudlqvmt@4ax.com>Show Full Headers
Complete Article Headers
X-Google-Thread: 10cc67,e1eea742f875d72d X-Google-Attributes: gid10cc67,public X-Google-Language: ENGLISH,ASCII-7-bit Date: Mon, 06 Feb 2006 00:36:42 +0100 From: Alberto <dibene@usa.net> User-Agent: Thunderbird 1.5 (Windows/20051201) MIME-Version: 1.0 Newsgroups: borland.public.cppbuilder.nativeapi Subject: Re: CPU load - How can I measure it? References: <43e53514@newsgroups.borland.com> <40bcu1hlup9hqfr2qfnl6ob26jaudlqvmt@4ax.com> In-Reply-To: <40bcu1hlup9hqfr2qfnl6ob26jaudlqvmt@4ax.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit NNTP-Posting-Host: 151.46.146.104 Message-ID: <43e68b34$1@newsgroups.borland.com> X-Trace: newsgroups.borland.com 1139182388 151.46.146.104 (5 Feb 2006 15:33:08 -0700) Lines: 38 Path: arc1-ca.pugleaf.net!g2news1.google.com!news1.google.com!newsfeed.gamma.ru!Gamma.RU!npeer.de.kpn-eurorings.net!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail