Assorted minor changes.
[p5sagit/Devel-Size.git] / README
CommitLineData
0e977dbc 1TODO
2
3 Rename to Devel::SizeMe
4 Devel::SizeMe::Core - loads XS and sets options
5 Devel::SizeMe - loads XS
6 -d:SizeMe=opts
7 Devel::SizeMe::Stream - parse raw stream
8 Devel::SizeMe::Store - db write
9 Devel::SizeMe::Data - db read / orlite?
10 Devel::SizeMe::Graph - data reading/processing for sizeme_graph
24638fb4 11 sizeme_store - script wrapper for Devel::SizeMe::Store
12 sizeme_graph - Mojolicious app wrapper using Devel::SizeMe::Graph
0e977dbc 13 tests
5e2e22f3 14 Support multiple runs to same sizeme_store process, generating separate files
0e977dbc 15 Name runs to allow total_size (for example) of multiple data structures
16
d81c4128 17Issues:
18 two cases where PERL_SUBVERSION is check with a plain || (marked XXX)
0e977dbc 19Optimizations:
20 Remove depth from stream?
21Future
22 Add addr to leaf to visualize memory layout
23 Add token for ptr to node already seen (identified by addr I presume)
24 so we can move from a Tree to a DAG and see alternative name paths.
25
26
5a83b7cf 27=pod
28
d3b8a135 29Devel::Memory - Perl extension for finding the memory usage of Perl variables
5a83b7cf 30
31=head1 SYNOPSIS
32
d3b8a135 33 use Devel::Memory qw(size total_size);
5a83b7cf 34
35 my $size = size("A string");
5a83b7cf 36 my @foo = (1, 2, 3, 4, 5);
37 my $other_size = size(\@foo);
d3b8a135 38 my $total_size = total_size( $ref_to_data );
5a83b7cf 39
40=head1 DESCRIPTION
41
d3b8a135 42Acts like Devel::Size 0.77 is the PERL_DMEM env var is not set.
43
44Except that it also provides perl_size() and heap_size() functions.
45
46If PERL_DMEM env var is set to an empty string then all the *_size functions
47dump a textual representation of the memory data to stderr.
48
49If PERL_DMEM env var is set to a string that starts with "|" then the
50remainder of the string is taken to be a command name and popen() is used to
51start the command and the raw memory data is piped to it.
52
53If PERL_DMEM env var is set to anything else it is treated as the name of a
54file the raw memory data should be written to.
55
56The dmemtree.pl script can be used to process the raw memory data.
57Typically run via the PERL_DMEM env var. For example:
58
59 export PERL_DMEM='|./dmemtree.pl --text'
60 export PERL_DMEM='|./dmemtree.pl --dot=dmemtree.dot'
61 export PERL_DMEM='|./dmemtree.pl --db=dmemtree.db'
62
63The --text output is similar to the textual representation output by the module
64when the PERL_DMEM env var is set to an empty string.
65
66The --dot output is suitable for feeding to Graphviz.
67
68The --db output is a SQLite database. (Very subject to change.)
69
70Example usage:
71
72 PERL_DMEM='|./dmemtree.pl --db=dmemtree.db' perl -MDevel::Size=:all -e 'total_size(sub { })'
73
74The dmemview.pl script is a Mojolicious::Lite application that serves data to
75an interactive treemap visualization of the memory use. It can be run as:
76
77 dmemview.pl daemon
78
79and then open http://127.0.0.1:3000
80
5a83b7cf 81
82=head1 Build and Install
83
84To build and install this module, you need:
85
9fc9ab86 86 Perl
87 a working C or C++ compiler
88 a make (or namke on Windows) utility
5a83b7cf 89
90Follow these steps:
91
92On Linux, Cygwin, or Unix:
93
9fc9ab86 94 perl Makefile.PL
95 make
96 make test
97 sudo make install
98
5a83b7cf 99On Windows:
100
9fc9ab86 101 perl Makefile.PL
102 nmake
103 nmake test
104 nmake install
5a83b7cf 105
106=head1 BUGREPORTS
107
108Please report bugs to:
109
d3b8a135 110 http://rt.cpan.org/NoAuth/Bugs.html?Dist=Devel-Memory
5a83b7cf 111
112=head1 COPYRIGHT
113
d3b8a135 114Copyright (C) 2005 Dan Sugalski, Copyright (C) 2007-2008 Tels,
115Copyright (C) 2011-2012 Nicholas Clark, Copyright 2012 (C) Tim Bunce.
5a83b7cf 116
117This module is free software; you can redistribute it and/or modify it
118under the same terms as Perl v5.8.8.
119
120=cut