-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbonnie-parse
executable file
·81 lines (68 loc) · 1.61 KB
/
bonnie-parse
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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
#!/usr/bin/awk -f
#
# (C) Copyright 2015
# Christophe Vu-Brugier <[email protected]>
#
# SPDX-License-Identifier: MIT
#
# Compute the mean and the relative standard deviation of several
# bonnie++ tests.
# The Welford's method is used to compute the mean and the standard
# deviation because it is more accurate and computes a running
# variance.
# See http://www.johndcook.com/standard_deviation.html
#
# Usage: bonnie-parse BONNIE_LOG
#
BEGIN {
FS = ","
HAS_HEADER = 0
MW = 0.0
SW = 0.0
MINW = 2^32
MAXW = -1
ME = 0.0
SE = 0.0
MINE = 2^32
MAXE = -1
MR = 0.0
SR = 0.0
MINR = 2^32
MAXR = -1
}
{
if ($1 == "name" && $2 == "file_size") {
HAS_HEADER = 1
exit 1
}
W = $5 # Write
E = $7 # rEwrite
R = $11 # Read
old_MW = MW
MW += (W - old_MW) / NR
SW += (W - old_MW) * (W - MW)
MINW = (W < MINW) ? W : MINW
MAXW = (W > MAXW) ? W : MAXW
old_ME = ME
ME += (E - old_ME) / NR
SE += (E - old_ME) * (E - ME)
MINE = (E < MINE) ? E : MINE
MAXE = (E > MAXE) ? E : MAXE
old_MR = MR
MR += (R - old_MR) / NR
SR += (R - old_MR) * (R - MR)
MINR = (R < MINR) ? R : MINR
MAXR = (R > MAXR) ? R : MAXR
}
END {
if (HAS_HEADER) {
print "ERROR: please remove the bonnie++ header from your input file." > "/dev/stderr"
exit 1
}
printf "W %6d +/- %.1f %% (min = %6d, max = %6d)\n",
int(MW), (NR > 1) ? 100 * sqrt(SW / (NR - 1)) / MW : 0, MINW, MAXW
printf "RW %6d +/- %.1f %% (min = %6d, max = %6d)\n",
int(ME), (NR > 1) ? 100 * sqrt(SE / (NR - 1)) / ME : 0, MINE, MAXE
printf "R %6d +/- %.1f %% (min = %6d, max = %6d)\n",
int(MR), (NR > 1) ? 100 * sqrt(SR / (NR - 1)) / MR : 0, MINR, MAXR
}