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