First steps migrating to SizeMe
[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
11 sizeme_store
12 sizeme_graph
13 tests
14 Add R(un) and E(nd) tokens
15 Support multiple runs
16 Name runs to allow total_size (for example) of multiple data structures
17
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
d3b8a135 28Devel::Memory - Perl extension for finding the memory usage of Perl variables
5a83b7cf 29
30=head1 SYNOPSIS
31
d3b8a135 32 use Devel::Memory 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
d3b8a135 109 http://rt.cpan.org/NoAuth/Bugs.html?Dist=Devel-Memory
5a83b7cf 110
111=head1 COPYRIGHT
112
d3b8a135 113Copyright (C) 2005 Dan Sugalski, Copyright (C) 2007-2008 Tels,
114Copyright (C) 2011-2012 Nicholas Clark, Copyright 2012 (C) Tim Bunce.
5a83b7cf 115
116This module is free software; you can redistribute it and/or modify it
117under the same terms as Perl v5.8.8.
118
119=cut