~slub.team/goobi-indexserver/3.x

« back to all changes in this revision

Viewing changes to lucene/contrib/benchmark/scripts/shingle.bm2jira.pl

  • Committer: Sebastian Meyer
  • Date: 2012-08-03 09:12:40 UTC
  • Revision ID: sebastian.meyer@slub-dresden.de-20120803091240-x6861b0vabq1xror
Remove Lucene and Solr source code and add patches instead
Fix Bug #985487: Auto-suggestion for the search interface

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
#!/usr/bin/perl
2
 
#
3
 
# Licensed to the Apache Software Foundation (ASF) under one or more
4
 
# contributor license agreements.  See the NOTICE file distributed with
5
 
# this work for additional information regarding copyright ownership.
6
 
# The ASF licenses this file to You under the Apache License, Version 2.0
7
 
# (the "License"); you may not use this file except in compliance with
8
 
# the License.  You may obtain a copy of the License at
9
 
10
 
#     http://www.apache.org/licenses/LICENSE-2.0
11
 
#
12
 
# Unless required by applicable law or agreed to in writing, software
13
 
# distributed under the License is distributed on an "AS IS" BASIS,
14
 
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
 
# See the License for the specific language governing permissions and
16
 
# limitations under the License.
17
 
#
18
 
# ----------
19
 
# shingle.bm2jira.pl
20
 
#
21
 
# Converts Lucene contrib-benchmark output produced using the 
22
 
# conf/shingle.alg file into a JIRA-formatted table.
23
 
#
24
 
 
25
 
use strict;
26
 
use warnings;
27
 
 
28
 
my %min_elapsed = ();
29
 
 
30
 
#Operation           round  runCnt  recsPerRun  rec/s      elapsedSec  avgUsedMem  avgTotalMem
31
 
#BigramsAndUnigrams  0      1       255691      21,147.22  12.09       15,501,840  35,061,760
32
 
#BigramsOnly   -  -  0 -  - 1 -  -  127383   -  16,871.92  7.55    -   31,725,312  41,746,432
33
 
#FourgramsAndUnigrams
34
 
#FourgramsOnly
35
 
#UnigramsOnly
36
 
 
37
 
while (<>) {
38
 
  if (/^((?:Uni|Bi|Four)grams\S+)[-\s]*([^\s{].*)/) {
39
 
    my $operation = $1;
40
 
    my $stats = $2;
41
 
    my $max_shingle_size 
42
 
    = ($operation =~ /^Bigrams/ ? 2 : $operation =~ /^Unigrams/ ? 1 : 4);
43
 
    my $output_unigrams 
44
 
      = ($operation =~ /(?:AndUnigrams|UnigramsOnly)$/ ? 'yes' : 'no'); 
45
 
    my ($elapsed) = $stats =~ /(?:[\d,.]+[-\s]*){4}([.\d]+)/;
46
 
    $min_elapsed{$max_shingle_size}{$output_unigrams} = $elapsed
47
 
      unless (defined($min_elapsed{$max_shingle_size}{$output_unigrams})
48
 
              && $elapsed >= $min_elapsed{$max_shingle_size}{$output_unigrams});
49
 
  }
50
 
}
51
 
 
52
 
# Print out platform info
53
 
print "JAVA:\n", `java -version 2>&1`, "\nOS:\n";
54
 
if ($^O =~ /win/i) {
55
 
  print "$^O\n";
56
 
  eval {
57
 
    require Win32;
58
 
    print Win32::GetOSName(), "\n", Win32::GetOSVersion(), "\n";
59
 
  };
60
 
  die "Error loading Win32: $@" if ($@);
61
 
} else {
62
 
  print `uname -a 2>&1`;
63
 
}
64
 
 
65
 
print "\n||Max Shingle Size||Unigrams?||Elapsed||\n";
66
 
 
67
 
for my $max_shingle_size (sort { $a <=> $b } keys %min_elapsed) {
68
 
  for my $output_unigrams (sort keys %{$min_elapsed{$max_shingle_size}}) {
69
 
    my $size = (1 == $max_shingle_size ? '1 (Unigrams)' : $max_shingle_size);   
70
 
    printf "|$size|$output_unigrams|\%2.2fs|\n",
71
 
           $min_elapsed{$max_shingle_size}{$output_unigrams};
72
 
  }
73
 
}