🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

Re: CPU load - How can I measure it?

#4299
From: Bob Gonder
Date: Wed, 08 Feb 2006 16:01
27 lines
2435 bytes
Alberto wrote:

>> What you are asking doesn't really make sense.
>> If there is nothing else running, then you will get 100% of the CPU.
>> OTOH if your programm is running twice, you will get 50%.
>
>It makes a perfect sense. The program is driven by external interrupts.

Ok, so now all of a sudden, we're working under interrupts.
What kind of interrupts are they? Are they hardware interrupts, or do
you have a program running, looking at a port, that then calls the
filter?
DOS style hardware interrupts can do their job before releasing their
lock on the cpu. That job should be as short as possible.

A different approach would be for the interrupt to quickly schedule a
task (FIFO stack) which a task thread would be working on to keep
empty. If the task thread finds there is more work to do when it
finishes the current task, it drops it's quality before starting the
next task. If it has to wait very long before the next task comes
along, it raises the quality before processing it.
Note that this also adjusts for different CPU speeds.

Windows will take care of the rest of the load balancing.
It will suspend your task thread so other programs can run.
When the thread returns, it will find some stacked work, and speed up
to plow through it.
Technical Details
Message-ID: <e54ku1le1ionfmrg5a3n647r7jkb55auq5@4ax.com>
Path: arc1-ca.pugleaf.net!g2news1.google.com!news2.google.com!news3.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
References: <43e53514@newsgroups.borland.com> <40bcu1hlup9hqfr2qfnl6ob26jaudlqvmt@4ax.com> <43e68b34$1@newsgroups.borland.com> <bqadu11e4stdsh8bhpqblqalm6t7queu8t@4ax.com> <43e91b0d$1@newsgroups.borland.com>

Show Full Headers
Complete Article Headers
X-Google-Thread: 10cc67,e1eea742f875d72d
X-Google-Attributes: gid10cc67,public
X-Google-Language: ENGLISH,ASCII-7-bit
From: Bob Gonder <notbg@notmindspring.invalid>
Newsgroups: borland.public.cppbuilder.nativeapi
Subject: Re: CPU load - How can I measure it?
Date: Wed, 08 Feb 2006 08:01:54 -0800
Organization: MindSpring Enterprises, Inc.
Reply-To: notbg@notmindspring.invalid
Message-ID: <e54ku1le1ionfmrg5a3n647r7jkb55auq5@4ax.com>
References: <43e53514@newsgroups.borland.com> <40bcu1hlup9hqfr2qfnl6ob26jaudlqvmt@4ax.com> <43e68b34$1@newsgroups.borland.com> <bqadu11e4stdsh8bhpqblqalm6t7queu8t@4ax.com> <43e91b0d$1@newsgroups.borland.com>
X-Newsreader: Forte Agent 1.93/32.576 English (American)
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
NNTP-Posting-Host: 69.69.91.178
X-Trace: newsgroups.borland.com 1139414295 69.69.91.178 (8 Feb 2006 07:58:15 -0700)
Lines: 29
Path: arc1-ca.pugleaf.net!g2news1.google.com!news2.google.com!news3.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