/
sample-3_mean.R
58 lines (43 loc) · 1.4 KB
/
sample-3_mean.R
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
#
# sample-3_mean.R, 25 Mar 20
#
# Data from:
# Statistical Performance Comparisons of Computers
# Tianshi Chen and Yunji Chen and Qi Guo and Olivier Temam and Tue Wu and Weiwu Hu
#
# Example from:
# Evidence-based Software Engineering: based on the publicly available data
# Derek M. Jones
#
# TAG benchmark_computer performance_sample
source("ESEUR_config.r")
bench_pop=read.csv(paste0(ESEUR_dir, "statistics/office_rsynth.gcc.basetime.csv.xz"))
bench_pop$clocks=bench_pop$clocks/1e9
NUM_SAMPLES=100
sample_mean=function(sample_size)
{
a_sample=sample(bench_pop$clocks, size=sample_size)
return(c(mean(a_sample), sd(a_sample)))
}
plot_sample=function(sample_vec)
{
plot(0.1, log="y", xaxt="n", bty="n",
ylab="Execution time (billion cycles)\n", xlab="",
xlim=c(1, ncol(size_3)), ylim=c(min(sample_vec[1,])/10,
max(sample_vec[1,])*2))
dummy=sapply(1:NUM_SAMPLES,
function(X)
{
lines(c(X, X), c(sample_vec[1, X]-sample_vec[2, X],
sample_vec[1, X]+sample_vec[2, X]),
col=point_col)
points(X, sample_vec[1, X], col="red")
})
pop_mean=mean(bench_pop$clocks)
pop_sd=sd(bench_pop$clocks)
lines(c(1, NUM_SAMPLES), c(pop_mean, pop_mean), col="blue")
lines(c(1, NUM_SAMPLES), c(pop_mean-pop_sd, pop_mean-pop_sd), col="green")
lines(c(1, NUM_SAMPLES), c(pop_mean+pop_sd, pop_mean+pop_sd), col="green")
}
size_3=replicate(NUM_SAMPLES, sample_mean(3))
plot_sample(size_3)