-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathformat-spec.sh
More file actions
executable file
·40 lines (37 loc) · 1005 Bytes
/
format-spec.sh
File metadata and controls
executable file
·40 lines (37 loc) · 1005 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
#!/bin/bash
#
# A script to format SPEC CPU 2006 spec.ratio files
#
# Copyright (C) 2022 Embecosm <www.embecosm.com>
#
# Contributor: Jeremy Bennett <jeremy.bennett@embecosm.com>
#
# SPDX-License-Identifier: GPL-3.0-or-later
#
# I am forever being asked to present SPEC CPU results on Markdown. This
# script just provides convenient formatting
#
# Usage: format-spec.sh <spec.ratio file>
#
# Output is on standard output
if [ $# != 1 ]
then
echo "Usage: format-spec.sh <spec.ratio file>"
fi
spec_file=$1
printf "| %-15s | %6s |\n" "Benchmark" "Ratio"
printf "| %-15s | %6s |\n" ":--------------" "-----:"
while read -r line
do
if [[ "${line}" =~ ^[0-9] ]]
then
bm=$(echo ${line} | sed -e '/^[0-9]/s/ .*//')
sr=$(echo ${line} | cut -d ' ' -f 4)
printf "| %-15s | %6.2f |\n" "${bm}" "${sr}"
elif [[ "${line}" =~ ^Spec ]]
then
sr=$(echo ${line} | cut -d ' ' -f 3)
printf "| %-15s | %6s |\n" " " " "
printf "| %-15s | %6.2f |\n" "SPEC ratio" "${sr}"
fi
done < ${spec_file}