On Sat, 15 May 2010, Mariano Martinez Peck wrote:
On Sat, May 15, 2010 at 8:54 PM, Levente Uzonyi <leves@elte.hu> 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 Pharo-project@lists.gforge.inria.fr http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project