wimp_poll_idle
Malcolm Hussain-Gambles (1596) 811 posts |
What exactly does wimp_poll_idle do? This return’s like it was event_poll: This one never seems to return: I assume I’m missing some logic on how this works. |
Rick Murray (539) 13840 posts |
Zero at the end? Shouldn’t you mask to not return Null polls? Oh, and from memory, isn’t the return time (timenow + delay)? Sorry I can’t be more helpful – I’m in the car. ;-) |
Malcolm Hussain-Gambles (1596) 811 posts |
Hey! that’s wonderful! I am a very very happy camper! Now I can do some really dodgy code to do some more cpu savings :-D Thanks very much! |
Steve Pampling (1551) 8170 posts |
I thought it was masking to determine what poll events to respond to, and how long (idle time) to leave before returning to the task “…returning control back to the task as soon as possible after the time in R2”
Passenger I assume, or is that French driving rules in play? :-) |
Malcolm Hussain-Gambles (1596) 811 posts |
It looks like poll_idle, will cause the poll not to return the null event until after the idle time. i.e. if the maximum amount read is small then increase the poll_idle time to allow the network buffer to fill more before coming back into the code again [ on the ES it looks like the network buffer size is around 17k ] That’s the theory anyway, if that makes any sense! |
Martin Avison (27) 1494 posts |
If you want to see the poll rates of your app in action, and its effect on cpu time and other apps, you could try my TaskUsage |
Steve Pampling (1551) 8170 posts |
That’s my understanding of the documentation. |
Malcolm Hussain-Gambles (1596) 811 posts |
That was my hope, however using Martins Usage app, showed me that it isn’t working. However if I use wimp_pollidle instead of event_poll_idle I get “Invalid Object Id (0×0) (0×0) (0×1).” So for now I’m assuming pollidle is broken, either in the toolbox or in RO 5.19/5.21, I’ll keep digging |
Fred Graute (114) 645 posts |
You do have Null events enabled, yes? Otherwise you’ll never get Null events, regardless of PollIdle time. Also be aware that all other enabled events are returned to you immediately. You may need to take that into consideration when, and how, you calculate the next PollIdle time. |
Rick Murray (539) 13840 posts |
Mmm… Been reading the PRM on this. Question occurs to me. If you have no specific need for null polls, is it better to call Wimp_Poll with nulls masked out or Wimp_PollIdle? Surely a normal poll without null events would only return when there is something of interest, and it would save the overheads of setting up a time counter, and for the Wimp to periodically check it? Okay, we could perhaps run the additional code a million times before we clock up a second’s worth of delay, but it’s the principle here… Which is technically the least load on the system? |
Steffen Huber (91) 1953 posts |
If you don’t need the null code, mask it out – this is the most efficient for the system. |
Malcolm Hussain-Gambles (1596) 811 posts |
So… |
Fred Graute (114) 645 posts |
You’d definitely want Wimp_Poll in such a case. Less overhead and no Null events at all.
No, Null events need to be enabled. Here’s a simple testcase (needs Reporter):
With Mask% = 0 you’ll get a Null event once a second. Set Mask% to 1 and you’ll never get a Null event. |
Martin Avison (27) 1494 posts |
If the line… is replaced by… it will display each reason code, with the time it is returned. |
Martin Bazley (331) 379 posts |
|
Malcolm Hussain-Gambles (1596) 811 posts |
@Martin: That’s a great ticker, that’s what made me want to write my application. But if there are any ideas for any RISC OS socket programs, feel free to suggest. |
Malcolm Hussain-Gambles (1596) 811 posts |
@Fred: Thanks, got it working now. I was using the wrong “time”. |
Fred Graute (114) 645 posts |
No problem. Glad to hear it helped you getting your code to work. It would be good to see some new code coming to RISC OS, so Good Luck. :-) |