All of lore.kernel.org
 help / color / mirror / Atom feed
* Re: [Powertop] Too much memory consumption by powertop
@ 2015-04-29 21:14 Alexandra Yates
  0 siblings, 0 replies; 6+ messages in thread
From: Alexandra Yates @ 2015-04-29 21:14 UTC (permalink / raw)
  To: powertop

[-- Attachment #1: Type: text/plain, Size: 3148 bytes --]


> At Wed, 29 Apr 2015 10:39:37 -0700 (PDT),
> Alexandra Yates wrote:
>>
>>
>> > At Tue, 28 Apr 2015 10:14:17 -0700 (PDT),
>> > Alexandra Yates wrote:
>> >>
>> >>
>> >> > As powertop list is for subscribers only, here Takashi's
>> >> > findings concerning a big memory waste fowarded:
>> >> >
>> >> > ----------  Forwarded Message  ----------
>> >> >
>> >> > Subject: Too much memory consumption by powertop
>> >> > Date: Tuesday, April 28, 2015, 05:32:41 PM
>> >> > From: Takashi Iwai <tiwai(a)suse.de>
>> >> > To: powertop(a)lists.01.org
>> >> > CC: trenn(a)suse.de
>> >> >
>> >> > Hi,
>> >> >
>> >> > I noticed that powertop consumes way too much memory than needed.
>> It
>> >> > constantly takes over 170MB RES, sometimes over 200MB.
>> >> >
>> >> > Then I looked at profile, and it showed that most of memory is
>> >> > allocated for newpad_sp().  Indeed, the current code allocates a
>> pad
>> >> > of the fixed size of 1000x1000 (!) for each tab, and we have five
>> >> > tabs, so five times of that.  No wonder that such a small neat CUI
>> >> > program is so hungry.
>> >> >
>> >> > For example, a hack like below already reduces the memory footprint
>> >> > to around 20MB, 90% cut.  Not bad.
>> >> >
>> >> > --- a/src/display.cpp
>> >> > +++ b/src/display.cpp
>> >> > @@ -48,7 +48,7 @@ void create_tab(const string &name, cons
>> >> >         if (!w)
>> >> >                 w = new(class tab_window);
>> >> >
>> >> > -       w->win = newpad(1000,1000);
>> >> > +       w->win = newpad(80,160); // XXX FIXME XXX
>> >> >         tab_names.push_back(name);
>> >> >         tab_windows[name] = w;
>> >> >         tab_translations[name] = translation;
>> >> >
>> >> > Can anyone look into this and give a better / smarter solution?
>> >> >
>> >> >
>> >> > thanks,
>> >> >
>> >> > Takashi
>> >> > -----------------------------------------
>> >> > _______________________________________________
>> >> > PowerTop mailing list
>> >> > PowerTop(a)lists.01.org
>> >> > https://lists.01.org/mailman/listinfo/powertop
>> >> >
>> >>
>> >> To avoid the high memory consumption on testing run it on HTML mode
>> so
>> >> that the powertop.html report is generated in the background.
>> >
>> > Yeah, starting firefox is smaller than powertop, indeed :)
>> >
>> >
>> > Takashi
>> >
>>
>> Now if you really want save resources you could go by having your output
>> on a .txt file.
>
> Heh, I don't need to save so much memory at all.  But consumption of
> 200MB for this kind of tool with CUI, not GUI, is just bad.  One may
> call it a bug.
>
> Your suggestion is helpful, but it's neither solution nor workaround
> in this regard.

I agree it is problematic that n-curses is sucking all these memory to
show txt on the command line interface.   However, at the moment the only
thing I can provide you is to use the other capabilities of powertop
collecting data via html or txt.

It would be awesome if you could take, Arjan's and Auke's feedback and
help us spin a patch that addresses this issue.

>
>
> thanks,
>
> Takashi
>


Thank you,
Alexandra.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [Powertop] Too much memory consumption by powertop
@ 2015-04-29 17:39 Alexandra Yates
  0 siblings, 0 replies; 6+ messages in thread
From: Alexandra Yates @ 2015-04-29 17:39 UTC (permalink / raw)
  To: powertop

[-- Attachment #1: Type: text/plain, Size: 2191 bytes --]


> At Tue, 28 Apr 2015 10:14:17 -0700 (PDT),
> Alexandra Yates wrote:
>>
>>
>> > As powertop list is for subscribers only, here Takashi's
>> > findings concerning a big memory waste fowarded:
>> >
>> > ----------  Forwarded Message  ----------
>> >
>> > Subject: Too much memory consumption by powertop
>> > Date: Tuesday, April 28, 2015, 05:32:41 PM
>> > From: Takashi Iwai <tiwai(a)suse.de>
>> > To: powertop(a)lists.01.org
>> > CC: trenn(a)suse.de
>> >
>> > Hi,
>> >
>> > I noticed that powertop consumes way too much memory than needed.  It
>> > constantly takes over 170MB RES, sometimes over 200MB.
>> >
>> > Then I looked at profile, and it showed that most of memory is
>> > allocated for newpad_sp().  Indeed, the current code allocates a pad
>> > of the fixed size of 1000x1000 (!) for each tab, and we have five
>> > tabs, so five times of that.  No wonder that such a small neat CUI
>> > program is so hungry.
>> >
>> > For example, a hack like below already reduces the memory footprint
>> > to around 20MB, 90% cut.  Not bad.
>> >
>> > --- a/src/display.cpp
>> > +++ b/src/display.cpp
>> > @@ -48,7 +48,7 @@ void create_tab(const string &name, cons
>> >         if (!w)
>> >                 w = new(class tab_window);
>> >
>> > -       w->win = newpad(1000,1000);
>> > +       w->win = newpad(80,160); // XXX FIXME XXX
>> >         tab_names.push_back(name);
>> >         tab_windows[name] = w;
>> >         tab_translations[name] = translation;
>> >
>> > Can anyone look into this and give a better / smarter solution?
>> >
>> >
>> > thanks,
>> >
>> > Takashi
>> > -----------------------------------------
>> > _______________________________________________
>> > PowerTop mailing list
>> > PowerTop(a)lists.01.org
>> > https://lists.01.org/mailman/listinfo/powertop
>> >
>>
>> To avoid the high memory consumption on testing run it on HTML mode so
>> that the powertop.html report is generated in the background.
>
> Yeah, starting firefox is smaller than powertop, indeed :)
>
>
> Takashi
>

Now if you really want save resources you could go by having your output
on a .txt file.

Thank you,
Alexandra.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [Powertop] Too much memory consumption by powertop
@ 2015-04-28 21:54 Arjan van de Ven
  0 siblings, 0 replies; 6+ messages in thread
From: Arjan van de Ven @ 2015-04-28 21:54 UTC (permalink / raw)
  To: powertop

[-- Attachment #1: Type: text/plain, Size: 610 bytes --]

> Maybe a more sensible 250x250 size would be a good default, as I seem to be able to fill a 1080p screen with just under 250 columns, and it would give some scrolling overhead?
>
> that's at least a 16x reduction already compared to 1000x1000.
>
> You could dynamically calculate the number based on the terminal properties, but that would likely break on terminal resizes.

it;s a bit more subtle

this is the canvas on which the text gets put,
your terminal is just a viewport into that canvas.

the number of cpus etc determines how big that canvas needs to be, not the width of our terminal


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [Powertop] Too much memory consumption by powertop
@ 2015-04-28 21:29 Kok, Auke-jan H
  0 siblings, 0 replies; 6+ messages in thread
From: Kok, Auke-jan H @ 2015-04-28 21:29 UTC (permalink / raw)
  To: powertop

[-- Attachment #1: Type: text/plain, Size: 2254 bytes --]

On Tue, Apr 28, 2015 at 10:14 AM, Alexandra Yates <
alexandra.yates(a)linux.intel.com> wrote:

>
> > As powertop list is for subscribers only, here Takashi's
> > findings concerning a big memory waste fowarded:
> >
> > ----------  Forwarded Message  ----------
> >
> > Subject: Too much memory consumption by powertop
> > Date: Tuesday, April 28, 2015, 05:32:41 PM
> > From: Takashi Iwai <tiwai(a)suse.de>
> > To: powertop(a)lists.01.org
> > CC: trenn(a)suse.de
> >
> > Hi,
> >
> > I noticed that powertop consumes way too much memory than needed.  It
> > constantly takes over 170MB RES, sometimes over 200MB.
> >
> > Then I looked at profile, and it showed that most of memory is
> > allocated for newpad_sp().  Indeed, the current code allocates a pad
> > of the fixed size of 1000x1000 (!) for each tab, and we have five
> > tabs, so five times of that.  No wonder that such a small neat CUI
> > program is so hungry.
> >
> > For example, a hack like below already reduces the memory footprint
> > to around 20MB, 90% cut.  Not bad.
> >
> > --- a/src/display.cpp
> > +++ b/src/display.cpp
> > @@ -48,7 +48,7 @@ void create_tab(const string &name, cons
> >         if (!w)
> >                 w = new(class tab_window);
> >
> > -       w->win = newpad(1000,1000);
> > +       w->win = newpad(80,160); // XXX FIXME XXX
> >         tab_names.push_back(name);
> >         tab_windows[name] = w;
> >         tab_translations[name] = translation;
> >
> > Can anyone look into this and give a better / smarter solution?
>
> To avoid the high memory consumption on testing run it on HTML mode so
> that the powertop.html report is generated in the background.


Right, but if you do want to run it in a terminal, 80x160 would limit the
size of the viewport to just a standard 80cols worth, which isn't very wide.

Maybe a more sensible 250x250 size would be a good default, as I seem to be
able to fill a 1080p screen with just under 250 columns, and it would give
some scrolling overhead?

that's at least a 16x reduction already compared to 1000x1000.

You could dynamically calculate the number based on the terminal
properties, but that would likely break on terminal resizes.

Cheers,

Auke

[-- Attachment #2: attachment.html --]
[-- Type: text/html, Size: 3090 bytes --]

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [Powertop] Too much memory consumption by powertop
@ 2015-04-28 17:14 Alexandra Yates
  0 siblings, 0 replies; 6+ messages in thread
From: Alexandra Yates @ 2015-04-28 17:14 UTC (permalink / raw)
  To: powertop

[-- Attachment #1: Type: text/plain, Size: 1779 bytes --]


> As powertop list is for subscribers only, here Takashi's
> findings concerning a big memory waste fowarded:
>
> ----------  Forwarded Message  ----------
>
> Subject: Too much memory consumption by powertop
> Date: Tuesday, April 28, 2015, 05:32:41 PM
> From: Takashi Iwai <tiwai(a)suse.de>
> To: powertop(a)lists.01.org
> CC: trenn(a)suse.de
>
> Hi,
>
> I noticed that powertop consumes way too much memory than needed.  It
> constantly takes over 170MB RES, sometimes over 200MB.
>
> Then I looked at profile, and it showed that most of memory is
> allocated for newpad_sp().  Indeed, the current code allocates a pad
> of the fixed size of 1000x1000 (!) for each tab, and we have five
> tabs, so five times of that.  No wonder that such a small neat CUI
> program is so hungry.
>
> For example, a hack like below already reduces the memory footprint
> to around 20MB, 90% cut.  Not bad.
>
> --- a/src/display.cpp
> +++ b/src/display.cpp
> @@ -48,7 +48,7 @@ void create_tab(const string &name, cons
>         if (!w)
>                 w = new(class tab_window);
>
> -       w->win = newpad(1000,1000);
> +       w->win = newpad(80,160); // XXX FIXME XXX
>         tab_names.push_back(name);
>         tab_windows[name] = w;
>         tab_translations[name] = translation;
>
> Can anyone look into this and give a better / smarter solution?
>
>
> thanks,
>
> Takashi
> -----------------------------------------
> _______________________________________________
> PowerTop mailing list
> PowerTop(a)lists.01.org
> https://lists.01.org/mailman/listinfo/powertop
>

To avoid the high memory consumption on testing run it on HTML mode so
that the powertop.html report is generated in the background.

Thank you,
Alexandra.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Powertop] Too much memory consumption by powertop
@ 2015-04-28 15:58 Thomas Renninger
  0 siblings, 0 replies; 6+ messages in thread
From: Thomas Renninger @ 2015-04-28 15:58 UTC (permalink / raw)
  To: powertop

[-- Attachment #1: Type: text/plain, Size: 1383 bytes --]

As powertop list is for subscribers only, here Takashi's
findings concerning a big memory waste fowarded:

----------  Forwarded Message  ----------

Subject: Too much memory consumption by powertop
Date: Tuesday, April 28, 2015, 05:32:41 PM
From: Takashi Iwai <tiwai(a)suse.de>
To: powertop(a)lists.01.org
CC: trenn(a)suse.de

Hi,

I noticed that powertop consumes way too much memory than needed.  It
constantly takes over 170MB RES, sometimes over 200MB.

Then I looked at profile, and it showed that most of memory is
allocated for newpad_sp().  Indeed, the current code allocates a pad
of the fixed size of 1000x1000 (!) for each tab, and we have five
tabs, so five times of that.  No wonder that such a small neat CUI
program is so hungry.

For example, a hack like below already reduces the memory footprint
to around 20MB, 90% cut.  Not bad.

--- a/src/display.cpp
+++ b/src/display.cpp
@@ -48,7 +48,7 @@ void create_tab(const string &name, cons
        if (!w)
                w = new(class tab_window);
 
-       w->win = newpad(1000,1000);
+       w->win = newpad(80,160); // XXX FIXME XXX
        tab_names.push_back(name);
        tab_windows[name] = w;
        tab_translations[name] = translation;

Can anyone look into this and give a better / smarter solution?


thanks,

Takashi
-----------------------------------------

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2015-04-29 21:14 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-04-29 21:14 [Powertop] Too much memory consumption by powertop Alexandra Yates
  -- strict thread matches above, loose matches on Subject: below --
2015-04-29 17:39 Alexandra Yates
2015-04-28 21:54 Arjan van de Ven
2015-04-28 21:29 Kok, Auke-jan H
2015-04-28 17:14 Alexandra Yates
2015-04-28 15:58 Thomas Renninger

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.