Imported Upstream version 58.1
[platform/upstream/icu.git] / source / test / perf / ubrkperf / UBrkPerf_r.pl
1 #!/usr/bin/perl
2 #  ********************************************************************
3 #  * Copyright (C) 2016 and later: Unicode, Inc. and others.
4 #  * License & terms of use: http://www.unicode.org/copyright.html#License
5 #  ********************************************************************
6 #  ********************************************************************
7 #  * Copyright (c) 2002-2013, International Business Machines
8 #  * Corporation and others. All Rights Reserved.
9 #  ********************************************************************
10
11 #use strict;
12
13 require "../perldriver/Common.pl";
14
15 use lib '../perldriver';
16
17 use PerfFramework;
18
19 my $options = {
20     "title"=>"BreakIterator performance regression: ICU (".$ICUPreviousVersion." and ".$ICULatestVersion.")",
21     "headers"=>"ICU".$ICUPreviousVersion." ICU".$ICULatestVersion,
22     "operationIs"=>"code point",
23     "eventIs"=>"break",
24     "passes"=>"10",
25     "time"=>"5",
26     #"outputType"=>"HTML",
27     "dataDir"=>$CollationDataPath,
28     "outputDir"=>"../results"
29 };
30
31 # programs
32 # tests will be done for all the programs. Results will be stored and connected
33 my $m1 = "-- -m char";
34 my $m2 = "-- -m word";
35 my $m3 = "-- -m line";
36 my $m4 = "-- -m sentence";
37
38 my $m;
39
40 if(@_ >= 0) {
41   $m = "-- -m ".shift;
42 } else {
43   $m = $m1;
44 }
45
46 my $p1; # Previous
47 my $p2; # Latest
48
49 if ($OnWindows) {
50     $p1 = "cd ".$ICUPrevious."/bin && ".$ICUPathPrevious."/ubrkperf/$WindowsPlatform/Release/ubrkperf.exe";
51     $p2 = "cd ".$ICULatest."/bin && ".$ICUPathLatest."/ubrkperf/$WindowsPlatform/Release/ubrkperf.exe";
52 } else {
53     $p1 = "LD_LIBRARY_PATH=".$ICUPrevious."/source/lib:".$ICUPrevious."/source/tools/ctestfw ".$ICUPathPrevious."/ubrkperf/ubrkperf";
54     $p2 = "LD_LIBRARY_PATH=".$ICULatest."/source/lib:".$ICULatest."/source/tools/ctestfw ".$ICUPathLatest."/ubrkperf/ubrkperf";
55 }
56
57 my $dataFiles = {
58     "en",
59     [
60         "thesis.txt",
61         "2drvb10.txt",
62         "ulyss10.txt",
63         "nvsbl10.txt",
64         "vfear11a.txt",
65         "TestNames_Asian.txt",
66         "TestNames_Chinese.txt",
67         "TestNames_Japanese.txt",
68         "TestNames_Japanese_h.txt",
69         "TestNames_Japanese_k.txt",
70         "TestNames_Korean.txt",
71         "TestNames_Latin.txt",
72         "TestNames_SerbianSH.txt",
73         "TestNames_SerbianSR.txt",
74         "TestNames_Thai.txt",
75         "Testnames_Russian.txt",
76     ],
77     "th",
78     [
79         "TestNames_Thai.txt",
80         "th18057.txt"
81     ]
82 };
83
84
85 my $tests = {
86     "TestForwardChar",      ["$p1,$m1,TestICUForward", "$p2,$m1,TestICUForward"],
87     "TestForwardWord",      ["$p1,$m2,TestICUForward", "$p2,$m2,TestICUForward"],
88     "TestForwardLine",      ["$p1,$m3,TestICUForward", "$p2,$m3,TestICUForward"],
89     "TestForwardSentence",  ["$p1,$m4,TestICUForward", "$p2,$m4,TestICUForward"],
90
91     "TestIsBoundChar",      ["$p1,$m1,TestICUIsBound", "$p2,$m1,TestICUIsBound"],
92     "TestIsBoundWord",      ["$p1,$m2,TestICUIsBound", "$p2,$m2,TestICUIsBound"],
93     "TestIsBoundLine",      ["$p1,$m3,TestICUIsBound", "$p2,$m3,TestICUIsBound"],
94     "TestIsBoundSentence",  ["$p1,$m4,TestICUIsBound", "$p2,$m4,TestICUIsBound"],
95 };
96
97 runTests($options, $tests, $dataFiles);
98
99