Fix the no password save issue for ajax login
[chromium-blink-merge.git] / tools / memory_watcher / scripts / finditem.pl
blob4962fa3e41b7e5ae42b23cc65fd1f4de0649cecf
1 #!/usr/bin/perl
2 # Copyright (c) 2012 The Chromium Authors. All rights reserved.
3 # Use of this source code is governed by a BSD-style license that can be
4 # found in the LICENSE file.
6 sub process_raw($$) {
7 my $file = shift;
8 my $search = shift;
10 my %leaks = ();
12 my $save = 0;
13 my $print = 0;
14 my $bytes = 0;
15 my $calls = 0;
16 my $sum_bytes = 0;
17 my $sum_calls = 0;
19 open (LOGFILE, "$file") or die("could not open $file");
20 while(<LOGFILE>) {
21 my $line = $_;
22 if ($line =~ m/([0-9]*) bytes, ([0-9]*) items/) {
23 $save = "";
24 $print = 0;
25 $bytes = $1;
26 $calls = $2;
28 elsif ($line =~ m/$search/) {
29 $print = 1;
31 elsif ($line =~ m/=============/) {
32 $save .= $line;
33 if ($print) {
34 print "$bytes bytes ($calls calls)\n";
35 print $save;
36 $sum_bytes += $bytes;
37 $sum_calls += $calls;
38 $save = "";
39 $print = 0;
40 $calls = 0;
43 $save .= $line;
45 print("TOTAL: $sum_bytes bytes ($sum_calls calls)\n");
49 # ----- Main ------------------------------------------------
51 # Get the command line argument
52 my $filename = shift;
53 my $search = shift;
55 # Process the file.
56 process_raw($filename, $search);