Debian Codegraph @

script/module-size

raw
1 #!/usr/bin/perl
2 use strict;
3 use warnings;
4 use Memory::Usage;
5
6 if( scalar @ARGV < 1 ) {
7 die "Usage: $0 Module::Name\n";
8 }
9
10 my $m = Memory::Usage->new();
11 $m->record('Base perl plus Memory::Usage');
12 foreach my $module_name (@ARGV) {
13 eval "use $module_name";
14 warn $@ if $@;
15 $m->record("after 'use $module_name'");
16 }
17
18 $m->dump();
19
20 __END__
21
22 =head1 NAME
23
24 module-size -- Spit out estimated size of module code.
25
26 =head1 SYNOPSIS
27
28 module-size Some::Module::Name [ Other::Module ]
29
30 =head1 DESCRIPTION
31
32 Reports the process size after 'use'ing a module. If more than one module name
33 is provided, the modules are included in order, allowing you to compare (for
34 example) the incremental effect of adding other modules to an existing
35 application.
36
37 =head1 SEE ALSO
38
39 L<Memory::Usage>,
40
41 =head1 LICENCE AND COPYRIGHT
42
43 Copyright 2010 Dave O'Neill.
44
45 This program is free software; you can redistribute it and/or modify it
46 under the terms of either: the GNU General Public License as published
47 by the Free Software Foundation; or the Artistic License.
48
49 =cut