From: Joseph M. Newcomer on
But the details of GetAverageRGB and OutputColor are unknown!
joe

On Thu, 01 Apr 2010 13:32:55 -0400, Hector Santos <sant9442(a)nospam.gmail.com> wrote:

>Joe,
>
>He has a thread loop:
>
> do {
> GetAverageRGB()
> OutputColor()
> } while (KeepRunning);
>
>which is where it slows down and picks up again.
>
>Joseph M. Newcomer wrote:
>
>> How are you copying get? GetPixel()? That is certainly the wrong way to go about it, if
>> that is what you are doing. You would want to create a DC and capture the bitmap (as I
>> described in my essay on capturing windows), but be aware that you are consuming GDI
>> resources, and if you consume too many, you will eventually hit problems. Since you have
>> not actually described the algorithm in any detail, or shown any code, there is no way to
>> tell what is going wrong from this description, so I've just made a few guesses as to what
>> might be happening.
>> joe
>>
>> On Wed, 31 Mar 2010 15:30:42 -0700, GrayFox <GrayFox(a)discussions.microsoft.com> wrote:
>>
>>> I'm writing a program that copies the bitmap of the desktop (like a
>>> screenshot), calculates the average RGB value of the screen, and send it over
>>> USB.
>>> Everything is working and I manage to get 30+ loops per second, which is
>>> good enough.
>>>
>>> However, after some time (varying between ~20 sec and ~1 min 30 sec), and
>>> not doing anything else, the loops per second suddenly drop to about 10 loops
>>> per second, which is too slow for my purpose. This transition happens within
>>> a fraction of a second.
>>>
>>> When I watch the Task Manager, and don't see anything special happening. The
>>> CPU time for my process remains the same, the total CPU usage is quite
>>> stable, memory usage is stable as well.
>>>
>>> I've tried changing Thread priority and Process priority but nothing seems
>>> to work. I am at a loss here.
>>>
>>> Anyone has any ideas? I would greatly appreciate any suggestions, advice and
>>> thoughts.
>> Joseph M. Newcomer [MVP]
>> email: newcomer(a)flounder.com
>> Web: http://www.flounder.com
>> MVP Tips: http://www.flounder.com/mvp_tips.htm
Joseph M. Newcomer [MVP]
email: newcomer(a)flounder.com
Web: http://www.flounder.com
MVP Tips: http://www.flounder.com/mvp_tips.htm
From: GrayFox on
I found the problem guys!

It seems that some intel processors, which my laptop has, sometimes slow
down their CPU frequency, why beats me, but they do. Normally my clockspeed
is around 2200 MHz, but once in a while it drops to about 900 MHz, which is
also proportional with a drop from 30 to about 14.
I found this out using CPU-Z, which someone on another forum recommended me.

Now all I have to do is make sure my processor won't do this crazy stuff
ever again!
Which is going to be quite difficult I'm afraid... :-(

Anyway, everybody thanks a lot for your help!
From: Joseph M. Newcomer on
Check out your power management settings. Essentially, when there is no user input, the
power-safe settings will reduce CPU clock speed to conserve battery power.

This is not an accident; this is deliberate, and you choose that this will happen via your
power managment settings.

For example, I set my laptop to reduce cllock speed when running on battery but to NOT
exercise power-safing strategies like this when plugged into wall power.
joe
On Thu, 1 Apr 2010 13:01:02 -0700, GrayFox <GrayFox(a)discussions.microsoft.com> wrote:

>I found the problem guys!
>
>It seems that some intel processors, which my laptop has, sometimes slow
>down their CPU frequency, why beats me, but they do. Normally my clockspeed
>is around 2200 MHz, but once in a while it drops to about 900 MHz, which is
>also proportional with a drop from 30 to about 14.
>I found this out using CPU-Z, which someone on another forum recommended me.
>
>Now all I have to do is make sure my processor won't do this crazy stuff
>ever again!
>Which is going to be quite difficult I'm afraid... :-(
>
>Anyway, everybody thanks a lot for your help!
Joseph M. Newcomer [MVP]
email: newcomer(a)flounder.com
Web: http://www.flounder.com
MVP Tips: http://www.flounder.com/mvp_tips.htm
From: GrayFox on
Sure, that makes sense, but my laptop does it even when I'm in high
performance profile. There is no way to turn it off in the BIOS or anything
either. I contacted Acer and they told me it wasn't possible. That sucks man!

"Joseph M. Newcomer" wrote:

> Check out your power management settings. Essentially, when there is no user input, the
> power-safe settings will reduce CPU clock speed to conserve battery power.
>
> This is not an accident; this is deliberate, and you choose that this will happen via your
> power managment settings.
>
> For example, I set my laptop to reduce cllock speed when running on battery but to NOT
> exercise power-safing strategies like this when plugged into wall power.
> joe
> On Thu, 1 Apr 2010 13:01:02 -0700, GrayFox <GrayFox(a)discussions.microsoft.com> wrote:
>
> >I found the problem guys!
> >
> >It seems that some intel processors, which my laptop has, sometimes slow
> >down their CPU frequency, why beats me, but they do. Normally my clockspeed
> >is around 2200 MHz, but once in a while it drops to about 900 MHz, which is
> >also proportional with a drop from 30 to about 14.
> >I found this out using CPU-Z, which someone on another forum recommended me.
> >
> >Now all I have to do is make sure my processor won't do this crazy stuff
> >ever again!
> >Which is going to be quite difficult I'm afraid... :-(
> >
> >Anyway, everybody thanks a lot for your help!
> Joseph M. Newcomer [MVP]
> email: newcomer(a)flounder.com
> Web: http://www.flounder.com
> MVP Tips: http://www.flounder.com/mvp_tips.htm
> .
>