r3wp [groups: 83 posts: 189283]
  • Home
  • Script library
  • AltME Archive
  • Mailing list
  • Articles Index
  • Site search
 

World: r3wp

[!REBOL3 GUI]

Cyphre
1-Mar-2010
[975x2]
hmm, but this stil doesn't address my question no?
It says the resolution is one milisecond which is cool. So why wait 
10ms doesn't let  CPU idle enough so it is not at 100% of usage?
Gregg
1-Mar-2010
[977x2]
I'm with Richard on this.
I seem to recall that .002 was a lower limit that could cause issues 
in R2 if you went below that.
Cyphre
1-Mar-2010
[979]
Yes, I'm not talking about precisison..this is not important in the 
tests above. The problem is why empty loop with enough IDLE time 
for CPU is making it at 100%
Pekr
1-Mar-2010
[980]
probably only Carl can answer this ...
Henrik
1-Mar-2010
[981]
Cyphre, I'm not sure if this is relevant, but timers under OSX are 
currently broken, so wait will eat CPU no matter what the wait period 
is. Maybe something broke in the last few versions?
Cyphre
1-Mar-2010
[982x2]
I don't know about OSX, sorry. I refer to Win versions just to be 
clear.
Also I just tried to test under some prehistoric alpha prototype 
R3 versions and the 100% usage is there so I wonder noone noticed 
that so far :)
Gregg
1-Mar-2010
[984]
Right. It seems that it's overhead in WAIT.
Cyphre
1-Mar-2010
[985]
Gregg, yes in R2 it looks the resolution that can be measured under 
Windows is ~10ms and you start to burn your CPU at 100% when you 
WAIT 0.0001 which means in R2 the same as WAIT 0.
Gregg
1-Mar-2010
[986]
Right. I thought maybe R3 had an artifact of that, but it doesn't 
seem so. CPU use goes up as you decrease the wait time, there doesn't 
seem to be a magic threshold.
Cyphre
1-Mar-2010
[987]
Gregg, yes it looks like that...either there is some bug in WAIT 
or WAIT is not letting CPU to get IDLE state anymore from some reason.
Gregg
1-Mar-2010
[988x2]
Agreed.
The only possibly related thing I can find is http://curecode.org/rebol3/ticket.rsp?id=379&cursor=30
Cyphre
1-Mar-2010
[990]
I think the OS_Wait() function in Host kit could give us some answer. 
I'll try to recompile with some debug info....
Gregg
1-Mar-2010
[991x2]
Is a simple LOOP with a WAIT in it enough for the bug report?
Ah, OK. That sounds good.
Steeve
1-Mar-2010
[993]
Are you Guys using wait , instead of time events in your GUI ?
Cyphre
1-Mar-2010
[994]
yes,  the above discussion is wait command inside loop.
BTW what time events you mean?
Steeve
1-Mar-2010
[995]
like in R2 the time events generated by the rate propertie
Cyphre
1-Mar-2010
[996]
AFAIK there is no RATE in R3. Or am I missing something?
Steeve
1-Mar-2010
[997x2]
there's no rate but you can generate time events aswell
not documented though
Cyphre
1-Mar-2010
[999]
you mean like make event! [] right?
Steeve
1-Mar-2010
[1000x2]
yep
but constructing an event is not enough, you have to know where to 
push it :)
Cyphre
1-Mar-2010
[1002]
ok, but even if you generate own events you need to WAIT at some 
point so the CPU is not at 100% no?
Steeve
1-Mar-2010
[1003x3]
no, it depends of the duration of the process triggered by your events, 
if it takes too much time, it will froze the CPU obviously.
i have not made tests so far actually
just guessing
Cyphre
1-Mar-2010
[1006]
can you post any example if it is not too big?
Steeve
1-Mar-2010
[1007x2]
i could, perhaps tomorrow, i have not the source at my home.
The principle is simple.

At startup, I build an event time!, the I push it in the block located 
at system/view/event-port/state.

And In my global event handler, each time I receive this event, I 
repush it immedialtly in the queue.

I receive 1000 time! events per seconds in My tests, but it mights 
depend of the speed of your UC
Cyphre
1-Mar-2010
[1009x2]
ok, no hurry...I'll also try to play with it later.
hmm, I pushed event into the event-port/state but nothing happened 
here. the event is still there and was not send to my global handler.
Steeve
1-Mar-2010
[1011]
did you do a do-events ?
Cyphre
1-Mar-2010
[1012]
yes, tried both do-events or just calling VIEW
Steeve
1-Mar-2010
[1013]
i will post it tomorow, it tried only on XP
Cyphre
1-Mar-2010
[1014]
is that some new feature? I'm using 2.100.97.3.1 release under Win 
XP
Steeve
1-Mar-2010
[1015x2]
i don't think so, actually it's a trick i discovered accidentaly. 
I don't thing Carl thought about it
i used 97 too
Cyphre
1-Mar-2010
[1017]
do I need to set the event properties in some specific way?
Steeve
1-Mar-2010
[1018]
i just made
make event! [type: 'time port: port-event]
(yes you need to add the port-event, if not it doen't work)
Cyphre
1-Mar-2010
[1019]
doesn't work here even if I put the reference to event port inside 
the event
Steeve
1-Mar-2010
[1020x2]
Hmm... i will post my complete test then.
How did you created the port-event ?
Cyphre
1-Mar-2010
[1022]
I just put there reference to system/view/event-port
Steeve
1-Mar-2010
[1023]
event-port: system/view/event-port: open event:// 
And then you added you handler at  port-event/awake
right  ?
Cyphre
1-Mar-2010
[1024]
I'm using the official init-view-system so the sequence looks like:
init-view-system
p: system/view/event-port

insert system/view/event-port/state ev: make event! [type: 'time 
port: p]
...