[Bugs] #2141 UNSP: Memory and CPU status indicator for the frame.
Sugar Labs Bugs
bugtracker-noreply at sugarlabs.org
Fri Aug 13 05:08:59 EDT 2010
#2141: Memory and CPU status indicator for the frame.
------------------------------------------+---------------------------------
Reporter: m_anish | Owner: tomeu
Type: enhancement | Status: new
Priority: Unspecified by Maintainer | Milestone: Unspecified by Release Team
Component: sugar | Version: Unspecified
Severity: Unspecified | Keywords: r? dextrose
Distribution: Unspecified | Status_field: Unconfirmed
------------------------------------------+---------------------------------
Changes (by m_anish):
* keywords: r! dextrose => r? dextrose
Comment:
Replying to [comment:4 tomeu]:
> Replying to [comment:3 m_anish]:
> > Replying to [comment:2 tomeu]:
> >
> > Thanks for the review.
> >
> > > > + self.create_palette()
> > >
> > > Why create the palette at this point?
> >
> > The system resources are computed at 5 second intervals. So, if I
create the palette when the frame is invoked and attempt to view the the
resource icon's palette immediately, I'll see a palette with two empty
progress-bars and no text for a few seconds. Note that this will happen
only for the first time when viewing the frame icon's palette.
> >
> > To overcome this, I create the palette early. So as soon as I attempt
to view it for the first time, I won't see empty info as in the case above
>
> Maybe I'm missing something: why not compute the data when the palette
is first displayed, then update it every 5 seconds until the palette is
closed?
There are two reasons for this
==Reason 1==
Its because of the way the resource usage numbers are acquired. Memory
usage can be computed instantaneously by reading /proc/meminfo.
However, CPU usage cannot be computed instantaneously. It is computed by
finding the difference in /proc/stat numbers between two snapshots (which,
in this case are 5 seconds apart). Thus, if I were to start my CPU usage
computation the moment the palette is made visible, something like this
would happen:
1) Palette invoked/made visible
2.a) Compute memory usage
2.b) Start computing CPU usage -> take initial /proc/stat snapshot
... 5 seconds later ...
3) Take 2nd /proc/stat snapshot. From difference between two snapshots,
compute CPU usage
4) Update palette with CPU and memory usage numbers (Until this time, the
palette would display two empty progress bars)
Note: This problem of an 'empty' palette will happen only for the very
first time when viewing the palette. Every subsequent time, the palette
would contain meaningful data whenever visible.
==Reason 2==
Also, unlike the previous versions of this patch, I am dynamically
changing the frame icon based on current available resources. This way, a
user can simply make the frame visible and get an abstract idea of system
resources just by looking at the icon which would either be normal, happy
or sad (or error when an exception happens), much like visual feedback the
speaker or network icons provide. It is another reason why I cannot limit
my resource-usage computation to the palette-is-visible time window.
--
Ticket URL: <http://bugs.sugarlabs.org/ticket/2141#comment:5>
Sugar Labs <http://sugarlabs.org/>
Sugar Labs bug tracking system
More information about the Bugs
mailing list