Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer
 
PerlMonks  

comment on

( #3333=superdoc: print w/replies, xml ) Need Help??

Ah well ;-) GTop... this Module also has the advantage that you can query any kind of size, and you get it in bytes. Voilà:

package MemImpact::GTop; use strict; use GTop; my @meths = qw(size vsize rss share); my $before = GTop->new->proc_mem($$); my $after = my $now = $before; printf "%-60s % 10d Bytes\n", "$_ initial memory:" , $before->$_ for @meths; print "-" x 77, $/; sub import { my $pack = shift; my $meth = shift; for (@_) { eval "use $_;"; die "Can't load $_:\n$@\n" if $@; $after = GTop->new->proc_mem($$); printf "%-60s % 10d Bytes\n", "$meth after loading $_:" , $aft +er->$meth; printf "%-60s % 10d Bytes\n", "$meth impact of $_:" , $after-> +$meth - $now->$meth; $now = $after; } } END { print "-" x 77, $/; printf "%-60s % 10d Bytes\n", "$_ total impact:" , $after->$_ - $b +efore->$_ for @meths; } 1;
qwurx [shmem] ~ > perl -e 'use MemImpact::GTop qw(rss Moose); use MemI +mpact::GTop qw(rss MooseX::AttributeHelpers)' size initial memory: 934707 +2 Bytes vsize initial memory: 934707 +2 Bytes rss initial memory: 346112 +0 Bytes share initial memory: 250265 +6 Bytes ---------------------------------------------------------------------- +------- rss after loading Moose: 897433 +6 Bytes rss impact of Moose: 551321 +6 Bytes rss after loading MooseX::AttributeHelpers: 1043660 +8 Bytes rss impact of MooseX::AttributeHelpers: 146227 +2 Bytes ---------------------------------------------------------------------- +------- size total impact: 711065 +6 Bytes vsize total impact: 711065 +6 Bytes rss total impact: 697548 +8 Bytes share total impact: 35225 +6 Bytes

In reply to Re^3: memory usage of modules by shmem
in thread memory usage of modules by shmem

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others meditating upon the Monastery: (6)
As of 2023-12-09 10:58 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    What's your preferred 'use VERSION' for new CPAN modules in 2023?











    Results (38 votes). Check out past polls.

    Notices?