Re: Help CPU usage at 8.9% ?



Unfortunately, that was not it... I changed the time out to 5000 and still
got the same cpu usage. The funny thing is that the sample code that comes
with gtkrgb has the same code, except for the table, and the cpu usage is
less than 1%. 
-r

On Wed, 15 Nov 2000, Darin Fisher wrote:

> My guess would be that the cpu usage results from the 100 millisecond 
> timeout.  I bet if you increased the timeout you would notice the cpu 
> usage drop.  You have to consider how much work the bar() method is 
> doing... if it doing relatively a lot of work then that would explain 
> the cpu usage.
> 
> Darin
> 
> 
> Rasoul Hajikhani wrote:
> 
> > I have this piece of code that when run, has a 9.0% cpu usage
> >  GtkWidget create_bars (void)
> >      71 {
> >      72         GtkWidget *lh, *table;
> >      73         int i, count, count1;
> >      74 
> >      75         char buffer[20];
> >      76 
> >      77         table = gtk_table_new(_TWO, _TWTYTWO, FALSE);
> >      78 
> >      79         vrule = gtk_vruler_new();
> >      80         gtk_ruler_set_metric( GTK_RULER(vrule), GTK_PIXELS );
> >      81         gtk_ruler_set_range( GTK_RULER(vrule), _TWOH, _NON, _NON,
> > _TWOH);
> >      82         gtk_table_attach_defaults( GTK_TABLE(table),
> >      83                                    vrule,
> >      84                                    _NON,
> >      85                                    _NON,
> >      86                                    _ONE);
> >      87         gtk_table_set_col_spacings( GTK_TABLE (table),
> >      88                                      _FIVE);
> >      89 
> >      90         for (i = _NON; i < _TWTY; i++)
> >      91         {
> >      92                 count1 = count = i;
> >      93                 count++;
> >      94                 count1++;
> >      95 
> >      96                 lh = gtk_level_hold_new(_TWOH,
> >      97                                          _TEN,
> >      98                                          GTK_LEVEL_HOLD_FADE,
> >      99                                          _EIGHT,
> >     100                                          _THREE,
> >     101                                          _TWO);
> >     102 
> >     103                 gtk_box_pack_start(GTK_BOX(table), lh, _NON, _NON,
> > _NON);
> >     104                 gtk_table_attach_defaults( GTK_TABLE(table),
> >     105                                            lh,
> >     106                                            count,
> >     107                                            count + _ONE,
> >     108                                            _NON,
> >     109                                            _ONE);
> >     110 
> >     111                 sprintf(buffer, "Label%d", i);
> >     112 
> >     113                 label = gtk_label_new (buffer);
> > 
> > 			gtk_table_attach_defaults( GTK_TABLE(table),
> >     115                                            label,
> >     116                                            count1,
> >     117                                            count1 + _ONE,
> >     118                                            _ONE,
> >     119                                            _TWO);
> >     120 
> >     121                 gtk_timeout_add(100, bar, lh);
> >     122         }
> >     123 
> >     124         return table;
> >     125 
> >     126 }
> > I really do not understand why such high cpu usage. On top of that, when I
> > put this in my application which has a whole lot of other things, the cpu
> > usage goes to 20%. However, my application without the above code, has
> > less that 1% cpu usage. Can any one PLEASE help...
> > -r
> > 
> > 
> > _______________________________________________
> > gtk-list mailing list
> > gtk-list gnome org
> > http://mail.gnome.org/mailman/listinfo/gtk-list
> 
> 
> 
> _______________________________________________
> gtk-list mailing list
> gtk-list gnome org
> http://mail.gnome.org/mailman/listinfo/gtk-list
> 





[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]