NAME

Devel::Arena - Perl extension for inspecting the core's arena structures

SYNOPSIS

use Devel::Arena 'sv_stats';
# Get hash ref describing the arenas for SV heads
$sv_stats = sv_stats;

DESCRIPTION

Inspect the arena structures that perl uses for SV allocation.

HARNESS_PERL_SWITCHES=-MDevel::Arena=write_stats_at_END make test

EXPORT

None by default.

  • sv_stats

    Returns a hashref giving stats derived from inspecting the SV heads via the arena pointers. Details of the contents of the hash subject to change.

  • shared_string_table

    Returns a hashref giving the share counts for each entry in the shared string table. The hashref doesn't use shared keys itself, so it doesn't affect the thing that it is measuring.

  • sizes

    Returns a hashref containing sizes of various core perl types, C types, and other size related info (specifically 'hek_key offset')

  • HEK_size STRING

    Calculates the size of the hash key needed to store STRING.

  • shared_string_table_effectiveness

    Calculates the effectiveness of the shared string table. Returns a hashref of stats. Currently this is just

    {
      'shared' => 57560,
      'unshared' => 77197
    };

    It ignores malloc() overhead, and the possibility that some shared strings aren't used as hash keys (eg shared hash key scalars).

  • write_stats_at_END

    Not really a function, but if you import write_stats_at_END then Devel::Arena will write out a Storable dump of all stats at END time. The file is written into a file into a file in the current directory named $$ . '.sv_stats'. This allows you to do things such as

    HARNESS_PERL_SWITCHES=-MDevel::Arena=write_stats_at_END make test

    to analyse the resource usage in regression tests.

SEE ALSO

sv.c in the perl core.

AUTHOR

Nicholas Clark, <nick@talking.bollo.cx>

COPYRIGHT AND LICENSE

Copyright (C) 2005 by Nicholas Clark

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.8.6 or, at your option, any later version of Perl 5 you may have available.