build_omnetpp revision ea3479446a4ee8c7a1f017f7594cc37f56dc12e6
1#!/bin/bash -x
2
3cd examples/omnetpp/cpu2006-redhat-ia32
4
5# Contains the optimization flags.
6flags=''
7
8# The index of the parameter.
9i=1
10
11# Indicate whether it is parsing the gcc param.
12in_gcc_param=false
13
14for parameter in "$@"
15  do
16    #  The last parameter is the file name.
17    if [ "$i" == "$#" ]; then
18      file=$parameter
19      break
20    fi
21
22    # The param is not a flag, it combines with the flag that comes right after.
23    # For example, --param max-inline-insns-single 
24    if [ "$parameter" == "-param" ]; then
25      in_gcc_param=true
26      flags+=-$parameter' '
27      let i++
28      continue
29    fi
30
31    # In in_gcc_param section, this flag follows the key word '--param'.
32    if [ $in_gcc_param == true ]; then
33      flags+=$parameter' '
34      let i++
35      in_gcc_param=false
36      continue
37    fi
38
39    # Normal flags.
40    flags+=-$parameter' '
41    let i++
42  done
43
44# Change the configuration file.
45content=$(sed s/amd64-m64-gcc41-kk/test$file/ config/linux64-amd64-pgi.cfg)
46echo "$content" | sed s/-O2/-O1\ "$flags"/ >config/linux64-amd64-pgi$file.cfg
47. ./shrc
48/usr/bin/time -o temp$file runspec --config linux64-amd64-pgi$file -D --action=build  471.omnetpp
49
50state=$?
51
52outfile="./benchspec/CPU2006/471.omnetpp/run/build_base_test$file.0000/omnetpp"
53
54if [ $state -eq 0 ];then
55  user_time=$(cat build_timer$file | grep "user" | cut -d "u" -f 1)
56  output_file="$file"
57
58  checksum=$(readelf -x .text $outfile | md5sum | cut -d " " -f 1)
59  file_size=$(ls -l $outfile | cut -d " " -f 5)
60  text_section=$(readelf -SW $outfile | grep ".text")
61  size_hex=$(echo $text_section | sed "s/\s\{1,\}/\ /g" | cut -d ' ' -f 6)
62  size=$(echo $size_hex | ( echo "ibase=16" ; tr '[:lower:]' '[:upper:]') | bc)
63
64  echo $checksum $user_time $output_file $file_size $size
65else
66  echo "error" "error" "error" "error" "error"
67fi
68
69return $state