[Bf-committers] [RFC] Re: Blender profiling-1 O16.2int
Ton Roosendaal
bf-committers@blender.org
Tue, 26 Aug 2003 13:21:25 +0200
Hi,
Nice you tracked it down, but the solution is not the correct one... in
loops where Blender polls the mouse, this call is made to keep it idle:
(editscreen.c)
static int statechanged= 0;
void BIF_wait_for_statechange(void)
{
if (!statechanged) {
/* Safety, don't wait more than 0.1 seconds */
double stime= PIL_check_seconds_timer();
while (!statechanged) {
winlay_process_events(1);
if ((PIL_check_seconds_timer()-stime)>0.1) break;
}
statechanged= 0;
}
}
It's from the Ghost integration period... apparently the function isn't
correctly implemented here. I don't have time today to investigate
this. But will put it at the list.
At OSX I see the cpu going to 100% load as well while pressing
middlemouse, although interactivity doesn't suffer from it.
-Ton-
On Tuesday, Aug 26, 2003, at 05:34 Europe/Amsterdam, Kester Maddock
wrote:
> On Tue, 26 Aug 2003 2:46, John K. Walton wrote:
>> yes i've mentioned this in the past. holding the middle mouse or right
>> mouse button _without_doing_anything_ eats up cpu time. it is clearly
>> a waste of cpu time. nobody responded.
>
> In source/blender/src/view.c void viewmove(void)
> we have
> while (TRUE)
> {
> getmouseco_sc(mval);
> /* do stuff w/ mouse coordinates */
> }
>
> and getmouseco_sc (& related) poll the mouse when they could be
> waiting for
> mouse events.
>
> The solution is to duplicate
> void getmouse(short *mval)
> {
> winlay_process_events(0);
> window_get_mouse(mainwin, mval);
> }
>
> as
>
> void getmouse_wait(short *mval)
> {
> winlay_process_events(1);
> window_get_mouse(mainwin, mval);
> }
>
> and change all the loops that can use this behaviour to use it.
>
> Kester
> _______________________________________________
> Bf-committers mailing list
> Bf-committers@blender.org
> http://www.blender.org/mailman/listinfo/bf-committers
>
>
------------------------------------------------------------------------
--
Ton Roosendaal Blender Foundation ton@blender.org
http://www.blender.org