Re: mvbar plugin creates too much cpu load

Tom,

I accidentally sent the patch with 10s, but as I said, the number was
out of the blue anyway. I did some further testing and usleep(waitup)
works well, too (reduces the load from 50% to 10%). I edited e2p_cpbar.c
as well.

uwe

Am Sonntag, den 02.11.2008, 10:19 +1100 schrieb tpgww@xxxxxxxxxxx:
> > the mvbar plugin creates huge cpu load here, it seems that this is due
> > to unlimited refreshes of the progressbar. Adding a random usleep() to
> > the loop resolves the problem. I simply chose a random number to test
> > it, I attach the 'svn diff' anyway.
> > 
> Uwe, I guess you really don't want a 10-second refresh interval. A few lines 
> further down from the change you suggested, there's a
>   usleep (1000)
> I can't think of any compelling reason for ~1kHZ progress refreshes, so how 
> about
>   usleep (100000)
> instead ?
> 
> Likewise in cpbar plugin, at line 379.
> 
> Regards
> Tom
> 
> 
Index: plugins/e2p_mvbar.c
===================================================================
--- plugins/e2p_mvbar.c (Revision 1343)
+++ plugins/e2p_mvbar.c (Arbeitskopie)
@@ -365,6 +365,7 @@
                        gtk_progress_bar_set_text (GTK_PROGRESS_BAR 
(wdata->progbar), progresstext);
                        gtk_progress_bar_set_fraction (GTK_PROGRESS_BAR 
(wdata->progbar), fraction);
                        gdk_threads_leave ();
+                       usleep (waitup);
 
                        if (wdata->bflags & E2_BARTASK_PAUSEREQ //pause was 
requested
                                && GTK_IS_DIALOG (wdata->dialog) && 
GTK_WIDGET_VISIBLE (wdata->dialog))
Index: plugins/e2p_cpbar.c
===================================================================
--- plugins/e2p_cpbar.c (Revision 1343)
+++ plugins/e2p_cpbar.c (Arbeitskopie)
@@ -359,6 +359,7 @@
                        gtk_progress_bar_set_text (GTK_PROGRESS_BAR 
(wdata->progbar), progresstext);
                        gtk_progress_bar_set_fraction (GTK_PROGRESS_BAR 
(wdata->progbar), fraction);
                        gdk_threads_leave ();
+                       usleep (50000);
 
                        if (wdata->bflags & E2_BARTASK_PAUSEREQ //pause was 
requested
                                && GTK_IS_DIALOG (wdata->dialog) && 
GTK_WIDGET_VISIBLE (wdata->dialog))

Other related posts: