0
|
1 |
#!perl
|
|
2 |
#
|
|
3 |
# Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
|
|
4 |
# All rights reserved.
|
|
5 |
# This component and the accompanying materials are made available
|
|
6 |
# under the terms of the License "Eclipse Public License v1.0"
|
|
7 |
# which accompanies this distribution, and is available
|
|
8 |
# at the URL "http://www.eclipse.org/legal/epl-v10.html".
|
|
9 |
#
|
|
10 |
# Initial Contributors:
|
|
11 |
# Nokia Corporation - initial contribution.
|
|
12 |
#
|
|
13 |
# Contributors:
|
|
14 |
#
|
|
15 |
# Description:
|
|
16 |
#
|
|
17 |
|
|
18 |
#--------------------------------------------------------------------------------------------
|
|
19 |
# This is a filter script for MMC/SD cards benchmark test t_med_writebm
|
|
20 |
# Produces csv file from given input
|
|
21 |
#
|
|
22 |
# usage: filter1.pl <log file>
|
|
23 |
#
|
|
24 |
# See t_med_writebm.cpp for more details.
|
|
25 |
#--------------------------------------------------------------------------------------------
|
|
26 |
|
|
27 |
use strict;
|
|
28 |
|
|
29 |
|
|
30 |
my $inpFile; #-- input file name
|
|
31 |
my $line;
|
|
32 |
my $printHdr; #-- 1 if we need to print a header
|
|
33 |
|
|
34 |
#-----------------------------------------------------
|
|
35 |
#-- test tags that we expect to find in the input file
|
|
36 |
#my $KTagPrefix = "~#";
|
|
37 |
#-----------------------------------------------------
|
|
38 |
|
|
39 |
#-- input file
|
|
40 |
$inpFile = $ARGV[0];
|
|
41 |
|
|
42 |
$printHdr = 1;
|
|
43 |
|
|
44 |
#-- process imput file
|
|
45 |
open(INP_FILE, "$inpFile") || die "Can't open input file $inpFile !\n";
|
|
46 |
|
|
47 |
while($line = <INP_FILE>)
|
|
48 |
{
|
|
49 |
if($line=~ /~#pos:(\d*):(\d*).*time:(\d*)/i)
|
|
50 |
{#-- found a string matching pattern; return
|
|
51 |
if($printHdr)
|
|
52 |
{
|
|
53 |
print "W1_pos,W2_pos,time_us\n";
|
|
54 |
$printHdr = 0;
|
|
55 |
}
|
|
56 |
|
|
57 |
print "$1,$2,$3\n";
|
|
58 |
#chomp($line);
|
|
59 |
#print $line."\n";
|
|
60 |
#$matchLine=$line;
|
|
61 |
#last;
|
|
62 |
}
|
|
63 |
elsif($line=~ /~#Local Drive:(\d*)/i)
|
|
64 |
{
|
|
65 |
print("local drive=$1; ");
|
|
66 |
}
|
|
67 |
elsif($line=~ /~#MediaPos:(\d*):(\d*)/i)
|
|
68 |
{
|
|
69 |
print("Media pos=$1:$2; ");
|
|
70 |
}
|
|
71 |
elsif($line=~ /~#WinNum:(\d*)/i)
|
|
72 |
{
|
|
73 |
print("Windows=$1; ");
|
|
74 |
}
|
|
75 |
elsif($line=~ /~#NumWrites:(\d*)/i)
|
|
76 |
{
|
|
77 |
print("NumWrites=$1\n");
|
|
78 |
}
|
|
79 |
elsif($line=~ /~#Window(\d).*sz:(\d*).*posInc:(.\d*)/i)
|
|
80 |
{
|
|
81 |
print("Window$1: size=$2; PosInc=$3\n");
|
|
82 |
}
|
|
83 |
|
|
84 |
}
|
|
85 |
|
|
86 |
|
|
87 |
close (INP_FILE);
|
|
88 |
|
|
89 |
#---
|
|
90 |
|
|
91 |
exit;
|
|
92 |
|
|
93 |
|
|
94 |
#--------------------------------------------------------------------------------------------
|
|
95 |
# Strip spaces from the beginning & end of the string
|
|
96 |
#--------------------------------------------------------------------------------------------
|
|
97 |
sub TrimStr
|
|
98 |
{
|
|
99 |
my @out = @_;
|
|
100 |
for (@out)
|
|
101 |
{
|
|
102 |
s/^\s+//;
|
|
103 |
s/\s+$//;
|
|
104 |
}
|
|
105 |
return wantarray ? @out : $out[0];
|
|
106 |
}
|
|
107 |
|