Another answer: you could create a process for each cpu and then pin each
process to that cpu - here's an article on how to pin a process to a cpu - I
think core's work the same as CPU's
http://www.cyberciti.biz/tips/setting-processor-affinity-certain-task-or-process.html

On Wed, Apr 6, 2011 at 12:53 PM, Johann Vincent Paul Tagle <
[email protected]> wrote:

> Maybe you can have something like a wait/pause inside the loop and adjust
> the wait time depending on the output of the load function described in the
> link given.  Or make your loop such that one instance only gives x% load
> (again using waits or something), then your main script starts a loop as a
> subprocess, checks the cpu load, then starts more if needed.  I don't know
> how you can do it such that all cores are at 70% though.
>
>
> On Wed, Apr 6, 2011 at 12:44 PM, John Homer H Alvero 
> <[email protected]>wrote:
>
>> Thanks Johann,
>>
>> I can do while (1) {}; but that will only saturate one core. If I have
>> 4 cores, thats only 25%. I can start another loop which will hog
>> another core (setting core affinity) now on 50% but i need more
>> granular control over cpu usage.
>> Thanks again.
>>
>>
>>
>> On Wed, Apr 6, 2011 at 12:39 PM, Johann Vincent Paul Tagle
>> <[email protected]> wrote:
>> > Another reply:
>> > you also may want to look at this
>> >
>> http://search.cpan.org/~pmorch/Parallel-Loops-0.07/lib/Parallel/Loops.pm
>> > I will wait till late afternoon for more replies and compile them here
>> later
>> > =)
>> > Johann
>> >
>> > On Wed, Apr 6, 2011 at 12:38 PM, Johann Vincent Paul Tagle
>> > <[email protected]> wrote:
>> >>
>> >> I got curious and posted your question at experts-exchange.com.
>>  Here's
>> >> one reply so far:
>> >> this module may get you started
>> >>
>> >>
>> http://search.cpan.org/~burak/Sys-Info-Base-0.73/lib/Sys/Info/Device/CPU.pm
>> >> look at the load function
>> >>
>> >> On Wed, Apr 6, 2011 at 11:21 AM, John Homer H Alvero <
>> [email protected]>
>> >> wrote:
>> >>>
>> >>> Hello,
>> >>>
>> >>> How do I purposely hog CPU (in all cores) in a controlled manner? By
>> >>> controlled manner I mean hogging CPU by 70% only or 80%. Thanks
>> >>> _________________________________________________
>> >>> Philippine Linux Users' Group (PLUG) Mailing List
>> >>> http://lists.linux.org.ph/mailman/listinfo/plug
>> >>> Searchable Archives: http://archives.free.net.ph
>> >>
>> >
>> >
>> > _________________________________________________
>> > Philippine Linux Users' Group (PLUG) Mailing List
>> > http://lists.linux.org.ph/mailman/listinfo/plug
>> > Searchable Archives: http://archives.free.net.ph
>> >
>> _________________________________________________
>> Philippine Linux Users' Group (PLUG) Mailing List
>> http://lists.linux.org.ph/mailman/listinfo/plug
>> Searchable Archives: http://archives.free.net.ph
>>
>
>
_________________________________________________
Philippine Linux Users' Group (PLUG) Mailing List
http://lists.linux.org.ph/mailman/listinfo/plug
Searchable Archives: http://archives.free.net.ph

Reply via email to