[ Memory ] Re: Thought
As a start for a `normal' interface to the interperters internals, this time no open hack, but a neat interface. Very open to additions. Useful? Feedback please NAME Devel-Internals - Perl extension for internal interpreter statistics SYNOPSIS use Devel::Internals; my $end = sbrk (); my @array = (1..1); print The creation of this array used , sbrk () - $end, bytes\n; # Easier use Devel::Internals; my @array = (1..1); MemUsed creation of array; my @dup = @array; MemUsed duplication of array; DESCRIPTION sbrk returns the current memory top. See sbrk(2) manual page MemUsed ($msg) Used in void context reports the number of bytes used since the previous call to MemUsed with the message passed Used in scalar context returns the current sbrk value Used in list context returns the values saved on every call AUTHOR H.Merijn Brand [EMAIL PROTECTED] COPYRIGHT AND LICENSE Copyright (C) 1996-2002 H.Merijn Brand for PROCURA B.V. This library is free software; you can use it under the same terms as Perl itself SEE ALSO sbrk(2) -- H.Merijn BrandAmsterdam Perl Mongers (http://amsterdam.pm.org/) using perl-5.6.1, 5.8.0 633 on HP-UX 10.20 11.00, AIX 4.2, AIX 4.3, WinNT 4, Win2K pro WinCE 2.11. Smoking perl CORE: [EMAIL PROTECTED] http:[EMAIL PROTECTED]/ [EMAIL PROTECTED] send smoke reports to: [EMAIL PROTECTED], QA: http://qa.perl.org Devel-Internals-0.01.tgz Description: Binary data
Re: [ Memory ] Re: Thought
MemUsed ($msg) Used in void context reports the number of bytes used since the previous call to MemUsed with the message passed Used in scalar context returns the current sbrk value Used in list context returns the values saved on every call Ugh, no, seems very inconsistent to me. And I don't like the implicit print in void context, that's too much kitchensinkish. Having the user write the print or warn explicitely isn't too much asked. How about MemUsed $msg Used in scalar (or void) context returns the current sbrk value. Also stores that value (along with the message) on a stack. Used in list context returns the sbrk and message values saved on every previous scalar call as a list of list refs. MemCheckpoint $msg Used in scalar (or void) context returns the number of bytes since the previous invocation. Also stores that value (along with the message) on a stack. Used in list context returns the incremental values and messages saved on every call as a list of list refs. Roland -- [EMAIL PROTECTED]
RE: [ Memory ] Re: Thought
-BEGIN PGP SIGNED MESSAGE- Moin, On 02-Oct-02 H.Merijn Brand carved into stone: As a start for a `normal' interface to the interperters internals, this time no open hack, but a neat interface. Very open to additions. Useful? Is it accurate? Feedback please NAME Devel-Internals - Perl extension for internal interpreter statistics SYNOPSIS use Devel::Internals; my $end = sbrk (); Can you please use a better name? sbrk() doesn't mean anything to me. my array = (1..1); print The creation of this array used , sbrk () - $end, bytes\n; # Easier use Devel::Internals; my array = (1..1); MemUsed creation of array; MemUsed sounds much better (although I displike CamelHumpSpelling but that's just me :) How about just calling it memory? Cheers, Tels - -- perl -MDev::Bollocks -le'print Dev::Bollocks-rand()' elementarily drive advanced technologies http://bloodgate.com/perl My current Perl projects PGP key available on http://bloodgate.com/tels.asc or via email -BEGIN PGP SIGNATURE- Version: GnuPG v1.0.6 (GNU/Linux) Comment: When cryptography is outlawed, bayl bhgynjf jvyy unir cevinpl. iQEVAwUBPZsLeHcLPEOTuEwVAQHABQf+MzETTn5bnFnzuZfJiMQarUTHzggIUzSK v4/zZHOJ33stVza1VeeJm7tUU8U/t3QiqX9uG5r+DeiNuxhp6OMaoW+CQYSUJ6NS qnJnZPBzfwF6/NTwU4rDv+NX4Xdi/XQqNVg6qVopRIEDlWdqbqq6diLUsZj2qkRO Ze9teSF7bxpn/rzimHn36UI45TrPP1ha5klEIEFXwOiO01bj4/+1rwznkihIBr08 nshzWzN95D6AJk2+q1K5ON6z50J6UtXdGMF68rBb3oDpAJGBOBbWY54OOtIY3dXg QzA4gZVKjql/csqCa8l3wIKb/CAifzeV5kg/RUkD4JXsroFcihTPpg== =sIJ/ -END PGP SIGNATURE-
Re: [ Memory ] Re: Thought
On Wed, Oct 02, 2002 at 05:06:53PM +0200, Tels wrote: On 02-Oct-02 H.Merijn Brand carved into stone: Going to be a bit hard to change, then :-) As a start for a `normal' interface to the interperters internals, this time no open hack, but a neat interface. Very open to additions. Useful? Is it accurate? Feedback please NAME Devel-Internals - Perl extension for internal interpreter statistics SYNOPSIS use Devel::Internals; my $end = sbrk (); Can you please use a better name? sbrk() doesn't mean anything to me. Trouble is that it's entirely accurate. If you know what sbrk() is in Unix, then you know that this would return it. The value is not directly memory used or anything like that. It's the current sbrk() :-) Nicholas Clark