On Fri, 24 Jun 2005 14:47:03 -0700, "Paulo Eduardo"
<PauloEduardo@discussions.microsoft.com> wrote:
[color=blue]
>Hi, Willy
>
>Actually, the app process are using almost 40% of cpu usage. About % Cpu
>Usage, we need this for avoid to decrease performance of system, and
>consequently the user interactivity with it(slowly,freeze,etc). Also, we
>will go to develop one part of system that scan fixed drives (c:,e:) and,
>probably this will consume more cpu.[/color]
If you reduce the priority, this will prevent your process from
interfering with other processes' CPU use; however, if you're doing
lots of disk I/O, you may need to throttle it manually to prevent
effects on the rest of the system.
[color=blue]
>"Willy Denoyette [MVP]" wrote:
>[color=green]
>> No, it won't, if this is the only process in the system that has runnable
>> threads, nothing will stop the thread to consume 100% of the CPU, if on the
>> other hand other applications are running and their threads have higher
>> priority, your lower priority threads will get much less CPU resources, but
>> be carefull with this, on consumer windows this can lead to thread
>> starvation.
>> I'm also not clear on what your actual CPU consumption is, and why you need
>> to restrict this while it will probably be done automatically when there are
>> other programs running.
>> Willy.
>>
>> "Paulo Eduardo" <PauloEduardo@discussions.microsoft.com> wrote in message
>> news:36EBA7EC-F512-47A4-A85E-EB42B9B32648@microsoft.com...[color=darkred]
>> > Jochen,
>> > our app will be running in background (background process). Actually, we
>> > are
>> > using the default settings for process. The app run when user log on in
>> > windows. Then, for avoid to increase the cpu usage by process, we are
>> > trying
>> > to control the cpu usage. Do you consider that only priority will resolve
>> > this problem?
>> >
>> > Thanks a lot in advance.
>> >
>> >
>> >
>> > "Jochen Kalmbach [MVP]" wrote:
>> >
>> >> Hi Paulo!
>> >>
>> >> > Actually, if I understood you, we are using an event-driven
>> >> > architecture,.
>> >> > We are using in it c functions and c++ methods that use WMI service. We
>> >> > are
>> >> > not using one endless loop (for (;;)) too. Is some local of source
>> >> > code we
>> >> > need to access fixed drives (C:,E:) for search files in them
>> >> > (subdirectories
>> >> > too). Is it possible to control the cpu usage by process creating one
>> >> > thread
>> >> > that control the cpu usage of process? For example, If process is using
>> >> > more
>> >> > than 20% of CPU, the 'thread control' sleep the process for 1s.
>> >>
>> >> Why do you want to limit your CPU usage? Why not just lower your
>> >> priority?
>> >>
>> >> To get the process/thread-times you can use
>> >>
>> >> See: GetProcessTimes
>> >>
http://msdn.microsoft.com/library/de...ocesstimes.asp
>> >>
>> >> or
>> >>
>> >> See: GetThreadTimes
>> >>
http://msdn.microsoft.com/library/en...ocesstimes.asp
>> >>
>> >> You should be aware, that the resolution is about than 10-15 ms...
>> >>
>> >> To implement it correctly you also need to know the number of (logical)
>> >> processors...
>> >>
>> >> See: GetSystemInfo
>> >>
http://msdn.microsoft.com/library/en...systeminfo.asp
>> >>
>> >> --
>> >> Greetings
>> >> Jochen
>> >>
>> >> My blog about Win32 and .NET
>> >>
http://blog.kalmbachnet.de/
>> >>[/color]
>>
>>
>>[/color][/color]
--
Phillip Crews aka Severian
Microsoft MVP, Windows SDK
Posting email address is real, but please post replies on the newsgroup.