Created
April 4, 2014 07:59
-
-
Save hirose31/9970134 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env perl | |
| # Time-stamp: <2014-04-04 16:58:12 JST, hirose31> | |
| use strict; | |
| use warnings; | |
| use IO::File; | |
| STDOUT->autoflush(1); | |
| STDERR->autoflush(1); | |
| use Data::Dumper; | |
| BEGIN { | |
| sub p($) { | |
| local $Data::Dumper::Indent = 1; | |
| local $Data::Dumper::Deepcopy = 1; | |
| local $Data::Dumper::Sortkeys = 1; | |
| local $Data::Dumper::Terse = 1; | |
| local $Data::Dumper::Useqq = 1; | |
| local $Data::Dumper::Quotekeys = 0; | |
| my $d = Dumper($_[0]); | |
| $d =~ s/\\x{([0-9a-z]+)}/chr(hex($1))/ge; | |
| print STDERR $d; | |
| } | |
| } | |
| use Time::HiRes qw(sleep); | |
| system(qq{echo "./dump-perl-memusage -p $$" > /tmp/d}); | |
| $SIG{CHLD} = sub { warn "got SIGCHLD\n" }; | |
| while (1) { | |
| if (my $pid = fork) { | |
| print '.'; | |
| # sleep 0.1; | |
| } else { | |
| $SIG{CHLD} = 'DEFAULT'; | |
| sleep 0.1; | |
| exit; | |
| } | |
| } | |
| __END__ | |
| while true; do bash /tmp/d; rm -f /tmp/dump_memusage.* ; done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment