+my $alloced = 0;
+my $leaked = 0;
+my $freed = 0;
+my $max = 0;
+my $debug = 0;
+my $summary = 0;
+my $by_func = 0;
+
+my @parsed;
+my %cpu;
+my $start_time = 0;
+
+if (!defined($ARGV[0])) {
+ print "No log file specified\n";
+ print "Usage: leak_finder.pl <debug_file> [--option]\n";
+ print " --by-func show leak logs by function name in ascending order.\n";
+ print " --debug print more verbose debugging information.\n";
+ print " --summary implies --by-func, print a summary report by \n";
+ print " the number of total leak bytes of each function \n";
+ print " in ascending order in YAML format.\n";
+ exit
+}
+
+if (defined($ARGV[1]) and $ARGV[1] eq "--debug") {
+ $debug = 1;
+}
+
+if (defined($ARGV[1]) and $ARGV[1] eq "--summary") {
+ $summary = 1;
+ $by_func = 1;
+}
+
+if (defined($ARGV[1]) and ($ARGV[1] eq "--by-func" || $ARGV[1] eq "--by_func")) {
+ $by_func = 1;
+}
+
+open(INFILE, $ARGV[0]);
+#while ($line = <INFILE>) {
+# if ($line =~ m/^(.*)\((.*):(\d+):(.*)\(\)\)/) {
+# @parsed = split(":", $1);
+# if (substr ($parsed[2], -1, 1) eq "F") {
+# chop $parsed[2];
+# $cpu{$parsed[2]} = 0;
+# } else {
+# if (!defined($cpu{$parsed[2]})) {
+# $cpu{$parsed[2]} = $parsed[3];
+# }
+# }
+# }
+#}
+#
+#foreach $time (values %cpu) {
+# if ($start_time < $time) {
+# $start_time = $time;
+# }
+#}
+#
+#print "Starting analysis since $start_time\n";
+
+seek(INFILE, 0, 0);
+while ($line = <INFILE>) {