CPUWatcher

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

CPUWatcher

Mariano Martinez Peck
Hi folks. This is why I like writing in books/wikis, because I always learn :)
Now I writing in the book about the Interrupt Key and I come up with this guy I was not even aware of: CPUWatcher. It seemss very cool and useful. However, I am using it wrong, or there is too much dust on it.  I want to ask if I am using it well before debugging and try to make it work.

As the class comment says, I tried to do this:

CPUWatcher startMonitoring.    "process period 20 seconds, sample rate 100 msec"
   
And then I evaluated in a workspace:

[ true ] whileTrue: [ 1+1 ]

It should stop that process when it is using 80% of the CPU, but it doesn't. The process is never stop and the image freeze. I then tried:

CPUWatcher startMonitoring.    "process period 20 seconds, sample rate 100 msec"
CPUWatcher current threshold: 0.3.    "change from 80% to 30%"
   
I have the same results...

any hints?

Cheers

Mariano

_______________________________________________
Pharo-project mailing list
[hidden email]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
Reply | Threaded
Open this post in threaded view
|

Re: CPUWatcher

Levente Uzonyi-2
On Sat, 15 May 2010, Mariano Martinez Peck wrote:

> Hi folks. This is why I like writing in books/wikis, because I always learn
> :)
> Now I writing in the book about the Interrupt Key and I come up with this
> guy I was not even aware of: CPUWatcher. It seemss very cool and useful.
> However, I am using it wrong, or there is too much dust on it.  I want to
> ask if I am using it well before debugging and try to make it work.
>
> As the class comment says, I tried to do this:
>
> CPUWatcher startMonitoring.    "process period 20 seconds, sample rate 100
> msec"
>
> And then I evaluated in a workspace:
>
> [ true ] whileTrue: [ 1+1 ]
>
> It should stop that process when it is using 80% of the CPU, but it doesn't.
> The process is never stop and the image freeze. I then tried:
>
> CPUWatcher startMonitoring.    "process period 20 seconds, sample rate 100
> msec"
> CPUWatcher current threshold: 0.3.    "change from 80% to 30%"
>
> I have the same results...
>
> any hints?

Your code doesn't have any message sends when executed, so it can't be
interrupted.
Btw, you can turn CPUWatcher on from the Process Browser and see the CPU
usage of processes.


Levente

>
> Cheers
>
> Mariano
>

_______________________________________________
Pharo-project mailing list
[hidden email]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
Reply | Threaded
Open this post in threaded view
|

Re: CPUWatcher

Mariano Martinez Peck


On Sat, May 15, 2010 at 8:54 PM, Levente Uzonyi <[hidden email]> wrote:
On Sat, 15 May 2010, Mariano Martinez Peck wrote:

Hi folks. This is why I like writing in books/wikis, because I always learn
:)
Now I writing in the book about the Interrupt Key and I come up with this
guy I was not even aware of: CPUWatcher. It seemss very cool and useful.
However, I am using it wrong, or there is too much dust on it.  I want to
ask if I am using it well before debugging and try to make it work.

As the class comment says, I tried to do this:

CPUWatcher startMonitoring.    "process period 20 seconds, sample rate 100
msec"

And then I evaluated in a workspace:

[ true ] whileTrue: [ 1+1 ]

It should stop that process when it is using 80% of the CPU, but it doesn't.
The process is never stop and the image freeze. I then tried:

CPUWatcher startMonitoring.    "process period 20 seconds, sample rate 100
msec"
CPUWatcher current threshold: 0.3.    "change from 80% to 30%"

I have the same results...

any hints?

Your code doesn't have any message sends when executed, so it can't be interrupted.

Hi Levente. Thanks for the answer, but I didn't understand. Which code do you mean?

If you refer to:

[ true ] whileTrue: [ 1+1 ]

I am sending the message whileTrue: to BlockClosure and the message + to 1. So, I don't understand.

Btw, you can turn CPUWatcher on from the Process Browser and see the CPU usage of processes.


Yes, I tried this before but it happened the same....I tried to test it, evaluating
[ true ] whileTrue: [ 1+1 ]  but it was not interrupted.

I also tried to click several times in the world but with no luck.

Thanks

Mariano
 

Levente


Cheers

Mariano


_______________________________________________
Pharo-project mailing list
[hidden email]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project


_______________________________________________
Pharo-project mailing list
[hidden email]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
Reply | Threaded
Open this post in threaded view
|

Re: CPUWatcher

Levente Uzonyi-2
On Sat, 15 May 2010, Mariano Martinez Peck wrote:

> On Sat, May 15, 2010 at 8:54 PM, Levente Uzonyi <[hidden email]> wrote:
>
>> On Sat, 15 May 2010, Mariano Martinez Peck wrote:
>>
>>  Hi folks. This is why I like writing in books/wikis, because I always
>>> learn
>>> :)
>>> Now I writing in the book about the Interrupt Key and I come up with this
>>> guy I was not even aware of: CPUWatcher. It seemss very cool and useful.
>>> However, I am using it wrong, or there is too much dust on it.  I want to
>>> ask if I am using it well before debugging and try to make it work.
>>>
>>> As the class comment says, I tried to do this:
>>>
>>> CPUWatcher startMonitoring.    "process period 20 seconds, sample rate 100
>>> msec"
>>>
>>> And then I evaluated in a workspace:
>>>
>>> [ true ] whileTrue: [ 1+1 ]
>>>
>>> It should stop that process when it is using 80% of the CPU, but it
>>> doesn't.
>>> The process is never stop and the image freeze. I then tried:
>>>
>>> CPUWatcher startMonitoring.    "process period 20 seconds, sample rate 100
>>> msec"
>>> CPUWatcher current threshold: 0.3.    "change from 80% to 30%"
>>>
>>> I have the same results...
>>>
>>> any hints?
>>>
>>
>> Your code doesn't have any message sends when executed, so it can't be
>> interrupted.
>>
>
> Hi Levente. Thanks for the answer, but I didn't understand. Which code do
> you mean?
>
> If you refer to:
>
> [ true ] whileTrue: [ 1+1 ]
>
> I am sending the message whileTrue: to BlockClosure and the message + to 1.
> So, I don't understand.

In theory yes, but in practice no. Just look at the generated bytecode:

13 <71> pushConstant: true
14 <9D> jumpFalse: 21
15 <76> pushConstant: 1
16 <76> pushConstant: 1
17 <B0> send: +
18 <87> pop
19 <A3 F8> jumpTo: 13
21 <78> returnSelf

As you can see #whileTrue: totally disappeared, no message sends. There's
a send for #+, but that's a B0 bytecode which will not do a real message
send, because both the receiver and the argument is a SmallInteger.
Therefore your code won't send any messages.


Levente

>
> Btw, you can turn CPUWatcher on from the Process Browser and see the CPU
>> usage of processes.
>>
>>
> Yes, I tried this before but it happened the same....I tried to test it,
> evaluating
> [ true ] whileTrue: [ 1+1 ]  but it was not interrupted.
>
> I also tried to click several times in the world but with no luck.
>
> Thanks
>
> Mariano
>
>
>>
>> Levente
>>
>>
>>> Cheers
>>>
>>> Mariano
>>>
>>>
>> _______________________________________________
>> Pharo-project mailing list
>> [hidden email]
>> http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
>>
>

_______________________________________________
Pharo-project mailing list
[hidden email]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
Reply | Threaded
Open this post in threaded view
|

Re: CPUWatcher

Mariano Martinez Peck



Hi Levente. Thanks for the answer, but I didn't understand. Which code do
you mean?

If you refer to:

[ true ] whileTrue: [ 1+1 ]

I am sending the message whileTrue: to BlockClosure and the message + to 1.
So, I don't understand.

In theory yes, but in practice no. Just look at the generated bytecode:


ahhhhh ;)
 
13 <71> pushConstant: true
14 <9D> jumpFalse: 21
15 <76> pushConstant: 1
16 <76> pushConstant: 1
17 <B0> send: +
18 <87> pop
19 <A3 F8> jumpTo: 13
21 <78> returnSelf

As you can see #whileTrue: totally disappeared, no message sends. There's a send for #+, but that's a B0 bytecode which will not do a real message send, because both the receiver and the argument is a SmallInteger.
Therefore your code won't send any messages.


Ok...I got it. But now I tested with this:

[true] whileTrue: [
Transcript open.
Transcript show: 'mariano'.
Transcript close.
]

With bytecodes:

33 <71> pushConstant: true
34 <AC 0C> jumpFalse: 48
36 <41> pushLit: Transcript
37 <D0> send: open
38 <87> pop
39 <41> pushLit: Transcript
40 <23> pushConstant: 'mariano'
41 <E2> send: show:
42 <87> pop
43 <41> pushLit: Transcript
44 <D4> send: close
45 <87> pop
46 <A3 F1> jumpTo: 33
48 <78> returnSelf


Now it should work, isn't it ?   However, I still it doesn't interrupt the process :(

Thanks for the help levente.

Mariano
 


Levente



Btw, you can turn CPUWatcher on from the Process Browser and see the CPU
usage of processes.


Yes, I tried this before but it happened the same....I tried to test it,
evaluating
[ true ] whileTrue: [ 1+1 ]  but it was not interrupted.

I also tried to click several times in the world but with no luck.

Thanks

Mariano



Levente


Cheers

Mariano


_______________________________________________
Pharo-project mailing list
[hidden email]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project



_______________________________________________
Pharo-project mailing list
[hidden email]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project


_______________________________________________
Pharo-project mailing list
[hidden email]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project