Permalink
Browse files

More data for 6.823 lab 2.

  • Loading branch information...
1 parent 5f962df commit adf09e62e98587f7990c43f8a997845b0c67464b Victor Costan committed Nov 3, 2009
Showing with 1,645 additions and 195 deletions.
  1. +66 −67 src/6.823/lab2/all.tex
  2. +3 −3 src/6.823/lab2/code/aligned_accesses.rb
  3. +31 −5 src/6.823/lab2/code/lab2common.rb
  4. +0 −54 src/6.823/lab2/code/original_plot.rb
  5. +0 −43 src/6.823/lab2/code/per_register_plot.rb
  6. +46 −0 src/6.823/lab2/code/working_set.rb
  7. +7 −0 src/6.823/lab2/data/1.yml
  8. +7 −0 src/6.823/lab2/data/10.yml
  9. +7 −0 src/6.823/lab2/data/11.yml
  10. +7 −0 src/6.823/lab2/data/12.yml
  11. +7 −0 src/6.823/lab2/data/13.yml
  12. +7 −0 src/6.823/lab2/data/14.yml
  13. +7 −0 src/6.823/lab2/data/15.yml
  14. +7 −0 src/6.823/lab2/data/16.yml
  15. +7 −0 src/6.823/lab2/data/17.yml
  16. +7 −0 src/6.823/lab2/data/2.yml
  17. +7 −0 src/6.823/lab2/data/3.yml
  18. +7 −0 src/6.823/lab2/data/4.yml
  19. +7 −0 src/6.823/lab2/data/5.yml
  20. +7 −0 src/6.823/lab2/data/6.yml
  21. +7 −0 src/6.823/lab2/data/7.yml
  22. +7 −0 src/6.823/lab2/data/8.yml
  23. +7 −0 src/6.823/lab2/data/9.yml
  24. +0 −1 src/6.823/lab2/data/accesses/applu_base.none_______applu.in
  25. +0 −1 ..._a10.img___-stride___2___-startx___134___-starty___220___-endx___139___-endy___225___-objects___1
  26. +0 −1 src/6.823/lab2/data/accesses/bzip2_base.x86_linux___input.random___2
  27. +0 −1 src/6.823/lab2/data/accesses/cc1_base.x86_linux___cccp.i___-o___foo
  28. +0 −1 src/6.823/lab2/data/accesses/crafty_base.x86_linux_______crafty.in
  29. +0 −1 src/6.823/lab2/data/accesses/equake_base.none_______inp.in
  30. +0 −1 src/6.823/lab2/data/accesses/gap_base.x86_linux___-l___input___-q___-m___64M_______test.in
  31. +0 −1 src/6.823/lab2/data/accesses/gzip_base.x86_linux___input.compressed___2
  32. +0 −1 src/6.823/lab2/data/accesses/mesa_base.none___-frames___10___-meshfile___mesa.in
  33. +0 −1 src/6.823/lab2/data/accesses/parser_base.x86_linux___2.1.dict___-batch_______test.in
  34. +0 −1 src/6.823/lab2/data/accesses/swim_base.none_______swim.in
  35. +7 −0 src/6.823/lab2/data/aligned.yml
  36. +1 −0 src/6.823/lab2/data/aligned/applu_base.none.txt
  37. +1 −0 src/6.823/lab2/data/aligned/art_base.none.txt
  38. +1 −0 src/6.823/lab2/data/aligned/bzip2_base.x86_linux.txt
  39. +1 −0 src/6.823/lab2/data/aligned/cc1_base.x86_linux.txt
  40. +1 −0 src/6.823/lab2/data/aligned/crafty_base.x86_linux.txt
  41. +1 −0 src/6.823/lab2/data/aligned/equake_base.none.txt
  42. +1 −0 src/6.823/lab2/data/aligned/gap_base.x86_linux.txt
  43. +1 −0 src/6.823/lab2/data/aligned/gzip_base.x86_linux.txt
  44. +1 −0 src/6.823/lab2/data/aligned/mesa_base.none.txt
  45. +1 −0 src/6.823/lab2/data/aligned/parser_base.x86_linux.txt
  46. +1 −0 src/6.823/lab2/data/aligned/swim_base.none.txt
  47. +3 −0 src/6.823/lab2/data/x3/r10b2a1/applu_base.none.txt
  48. +3 −0 src/6.823/lab2/data/x3/r10b2a1/art_base.none.txt
  49. +3 −0 src/6.823/lab2/data/x3/r10b2a1/bzip2_base.x86_linux.txt
  50. +3 −0 src/6.823/lab2/data/x3/r10b2a1/cc1_base.x86_linux.txt
  51. +3 −0 src/6.823/lab2/data/x3/r10b2a1/crafty_base.x86_linux.txt
  52. +3 −0 src/6.823/lab2/data/x3/r10b2a1/equake_base.none.txt
  53. +3 −0 src/6.823/lab2/data/x3/r10b2a1/gap_base.x86_linux.txt
  54. +3 −0 src/6.823/lab2/data/x3/r10b2a1/gzip_base.x86_linux.txt
  55. +3 −0 src/6.823/lab2/data/x3/r10b2a1/mesa_base.none.txt
  56. +3 −0 src/6.823/lab2/data/x3/r10b2a1/parser_base.x86_linux.txt
  57. +96 −0 src/6.823/lab2/data/x3/r10b2a1/success.yml
  58. +3 −0 src/6.823/lab2/data/x3/r10b2a1/swim_base.none.txt
  59. +3 −0 src/6.823/lab2/data/x3/r11b2a1/applu_base.none.txt
  60. +3 −0 src/6.823/lab2/data/x3/r11b2a1/art_base.none.txt
  61. +3 −0 src/6.823/lab2/data/x3/r11b2a1/bzip2_base.x86_linux.txt
  62. +3 −0 src/6.823/lab2/data/x3/r11b2a1/cc1_base.x86_linux.txt
  63. +3 −0 src/6.823/lab2/data/x3/r11b2a1/crafty_base.x86_linux.txt
  64. +3 −0 src/6.823/lab2/data/x3/r11b2a1/equake_base.none.txt
  65. +3 −0 src/6.823/lab2/data/x3/r11b2a1/gap_base.x86_linux.txt
  66. +3 −0 src/6.823/lab2/data/x3/r11b2a1/gzip_base.x86_linux.txt
  67. +3 −0 src/6.823/lab2/data/x3/r11b2a1/mesa_base.none.txt
  68. +3 −0 src/6.823/lab2/data/x3/r11b2a1/parser_base.x86_linux.txt
  69. +96 −0 src/6.823/lab2/data/x3/r11b2a1/success.yml
  70. +3 −0 src/6.823/lab2/data/x3/r11b2a1/swim_base.none.txt
  71. +3 −0 src/6.823/lab2/data/x3/r12b2a1/applu_base.none.txt
  72. +3 −0 src/6.823/lab2/data/x3/r12b2a1/art_base.none.txt
  73. +3 −0 src/6.823/lab2/data/x3/r12b2a1/bzip2_base.x86_linux.txt
  74. +3 −0 src/6.823/lab2/data/x3/r12b2a1/cc1_base.x86_linux.txt
  75. +3 −0 src/6.823/lab2/data/x3/r12b2a1/crafty_base.x86_linux.txt
  76. +3 −0 src/6.823/lab2/data/x3/r12b2a1/equake_base.none.txt
  77. +3 −0 src/6.823/lab2/data/x3/r12b2a1/gap_base.x86_linux.txt
  78. +3 −0 src/6.823/lab2/data/x3/r12b2a1/gzip_base.x86_linux.txt
  79. +3 −0 src/6.823/lab2/data/x3/r12b2a1/mesa_base.none.txt
  80. +3 −0 src/6.823/lab2/data/x3/r12b2a1/parser_base.x86_linux.txt
  81. +96 −0 src/6.823/lab2/data/x3/r12b2a1/success.yml
  82. +3 −0 src/6.823/lab2/data/x3/r12b2a1/swim_base.none.txt
  83. +3 −0 src/6.823/lab2/data/x3/r13b2a1/applu_base.none.txt
  84. +3 −0 src/6.823/lab2/data/x3/r13b2a1/art_base.none.txt
  85. +3 −0 src/6.823/lab2/data/x3/r13b2a1/bzip2_base.x86_linux.txt
  86. +3 −0 src/6.823/lab2/data/x3/r13b2a1/cc1_base.x86_linux.txt
  87. +3 −0 src/6.823/lab2/data/x3/r13b2a1/crafty_base.x86_linux.txt
  88. +3 −0 src/6.823/lab2/data/x3/r13b2a1/equake_base.none.txt
  89. +3 −0 src/6.823/lab2/data/x3/r13b2a1/gap_base.x86_linux.txt
  90. +3 −0 src/6.823/lab2/data/x3/r13b2a1/gzip_base.x86_linux.txt
  91. +3 −0 src/6.823/lab2/data/x3/r13b2a1/mesa_base.none.txt
  92. +3 −0 src/6.823/lab2/data/x3/r13b2a1/parser_base.x86_linux.txt
  93. +96 −0 src/6.823/lab2/data/x3/r13b2a1/success.yml
  94. +3 −0 src/6.823/lab2/data/x3/r13b2a1/swim_base.none.txt
  95. +3 −0 src/6.823/lab2/data/x3/r8b2a1/applu_base.none.txt
  96. +3 −0 src/6.823/lab2/data/x3/r8b2a1/art_base.none.txt
  97. +3 −0 src/6.823/lab2/data/x3/r8b2a1/bzip2_base.x86_linux.txt
  98. +3 −0 src/6.823/lab2/data/x3/r8b2a1/cc1_base.x86_linux.txt
  99. +3 −0 src/6.823/lab2/data/x3/r8b2a1/crafty_base.x86_linux.txt
  100. +3 −0 src/6.823/lab2/data/x3/r8b2a1/equake_base.none.txt
  101. +3 −0 src/6.823/lab2/data/x3/r8b2a1/gap_base.x86_linux.txt
  102. +3 −0 src/6.823/lab2/data/x3/r8b2a1/gzip_base.x86_linux.txt
  103. +3 −0 src/6.823/lab2/data/x3/r8b2a1/mesa_base.none.txt
  104. +3 −0 src/6.823/lab2/data/x3/r8b2a1/parser_base.x86_linux.txt
  105. +96 −0 src/6.823/lab2/data/x3/r8b2a1/success.yml
  106. +3 −0 src/6.823/lab2/data/x3/r8b2a1/swim_base.none.txt
  107. +3 −0 src/6.823/lab2/data/x3/r9b2a1/applu_base.none.txt
  108. +3 −0 src/6.823/lab2/data/x3/r9b2a1/art_base.none.txt
  109. +3 −0 src/6.823/lab2/data/x3/r9b2a1/bzip2_base.x86_linux.txt
  110. +3 −0 src/6.823/lab2/data/x3/r9b2a1/cc1_base.x86_linux.txt
  111. +3 −0 src/6.823/lab2/data/x3/r9b2a1/crafty_base.x86_linux.txt
  112. +3 −0 src/6.823/lab2/data/x3/r9b2a1/equake_base.none.txt
  113. +3 −0 src/6.823/lab2/data/x3/r9b2a1/gap_base.x86_linux.txt
  114. +3 −0 src/6.823/lab2/data/x3/r9b2a1/gzip_base.x86_linux.txt
  115. +3 −0 src/6.823/lab2/data/x3/r9b2a1/mesa_base.none.txt
  116. +3 −0 src/6.823/lab2/data/x3/r9b2a1/parser_base.x86_linux.txt
  117. +96 −0 src/6.823/lab2/data/x3/r9b2a1/success.yml
  118. +3 −0 src/6.823/lab2/data/x3/r9b2a1/swim_base.none.txt
  119. +96 −0 src/6.823/lab2/data/x3/r9b2a2/success.yml
  120. +96 −0 src/6.823/lab2/data/x3/r9b2a4/success.yml
  121. +96 −0 src/6.823/lab2/data/x3/r9b2a5/success.yml
  122. +96 −0 src/6.823/lab2/data/x3/r9b3a1/success.yml
  123. +96 −0 src/6.823/lab2/data/x3/r9b4a1/success.yml
  124. +96 −0 src/6.823/lab2/data/x3/r9b5a1/success.yml
  125. +12 −12 src/6.823/lab2/figs/unaligned_accesses.tex
  126. BIN src/6.823/lab2/figs/working_set.png
View
@@ -1,9 +1,71 @@
+The lab assignments under-specifies the operation of virtual-indexed caches, as
+it does not specify what method to use to avoid aliasing (having multiple
+entries in the cache for the same physical address, if it's represented by
+multiple virtual addresses).
+
+My implementations do the following when a new block is brought into the cache:
+\begin{itemize}
+ \item The virtually-indexed physically-tagged cache checks the tags in all
+ the cache lines that could potentially hold the virtual address (one line for
+ small caches, more lines for large caches), and invalidates any location that
+ has the same tag.
+ \item The virtually-indexed virtually-tagged cache checks the physical bits
+ in the tags (could be zero bits, if the cache is big enough) against the
+ physical bits in the new block's address, and invalidates all the blocks
+ whose bits match.
+\end{itemize}
+
+\section{Question 1}
+
+\section{Question 2}
+
+To determine the working set sizes, I used direct-mapped caches with the
+minimum block size (4 bytes). I used a 32Mb cache for computing the compulsory
+misses. 32Mb seems like a good size for the RAM in a 2000-era computer, and
+higher values made the \texttt{caches} pintool crash.
+
+Figure \ref{q2:miss_rates} shows the miss rates. Table \ref{q2:working_set}
+shows the probable working set sizes, based on the miss rates obtained above.
+
+\begin{figure}[htb]
+ \includegraphics[width=6.8in]{6.823/lab2/figs/working_set.png}
+ \caption{Miss rates in direct-mapped physically-indexed physically-tagged
+ caches with 4-byte blocks. }
+ \label{q2:miss_rates}.
+\end{figure}
+
+\begin{figure}[htb]
+\center
+
+\begin{tabular}{lcr}
+\hline
+Benchmark & Integer / FP & Working set size \\
+\hline
+bzip2 & INT & \\
+cc1 & INT & \\
+crafty & INT & \\
+gap & INT & \\
+gzip & INT & \\
+parser & INT & \\
+\hline
+applu & FP & \\
+art & FP & \\
+equake & FP & \\
+mesa & FP & \\
+swim & FP & \\
+\hline
+\end{tabular}
+
+\caption{The working set sizes for the SPEC 2000 benchmark suite. }
+\label{q2:working_set}
+\end{figure}
+
\section{Question 3}
The fourth cache model doesn't make any sense. The different cache models in
this lab are motivated by the desire of parallelizing cache access and address
translation.
-If the cache is physically index, it means the cache access cannot start unil
+If the cache is physically indexed, it means the cache access cannot start unil
after address translation. Since we waited for address translation anyway, we
might as well use the physical address for the tag. There's no reason to deal
with the additional complexities of using virtual tagging.
@@ -49,74 +111,11 @@ \section{Question 5}
\texttt{mesa}, which is a software OpenGL implementation, and therefore has to
work with a software framebuffer.
-The assumption of aligned accesses seems to make sense. The numbers reported
-above are an upper bound of unaligned accesses because, from a cache
-perspective, byte accesses can be satisfied even if they're unaligned, and
+The assumption of aligned accesses seems to make sense for most benchmarks. The
+numbers reported above are an upper bound of unaligned accesses because, from a
+cache perspective, byte accesses can be satisfied even if they're unaligned, and
multibyte accesses are only problematic if they span across 2 cache blocks.
Furthermore, the applications which are most impacted by unaligned access don't
really run on consumer computers -- most people don't compile their code, and a
vast majority of desktop and mobile platforms have accelerated graphics
nowadays.
-
-
-\section{X 1}
-Figure \ref{q1:frequencies} shows the dependencies obtained as suggested in the
-lab handout.
-
-\begin{figure}[htb]
- \includegraphics[width=6.8in]{6.823/lab1/figs/frequencies.png}
- \caption{Instruction dependency frequencies for the 11 benchmarks. }
- \label{q1:frequencies}.
-\end{figure}
-
-The graph is not too helpful, except to tell us that most instructions depend
-on registers written in the past 4-5 instructions. Therefore, we use figure
-\ref{q1:frequencies_zoom} to take a better look at the dependencies at most 5
-instructions apart.
-
-\begin{figure}[htb]
- \includegraphics[width=6.8in]{6.823/lab1/figs/frequencies_zoom.png}
- \caption{Instruction dependency frequencies for the 11 benchmarks. }
- \label{q1:frequencies_zoom}.
-\end{figure}
-
-Given the dependency statistics, it seesms like architecture A would be
-significantly faster than architecture B. In each benchmark, between 40\% -
-80\% of the instructions depend on the previous instruction. In architecture B,
-all instructions with dependencies on the previous instruction would have to be
-stalled for 1 cycle, while the previous instruction writes its registers. This
-means 40\%-80\% pipeline bubbles, which could be avoided by the forwarding
-circuitry.
-
-\section{X 2}
-
-Figure \ref{q2:reg_frequencies} shows the per-register breakdown for the
-instruction dependency. For each register and instruction distance, we computed
-the proportion of dependencies that are owed to that register. We averaged the
-values for each benchmark. We only plotted registers which contributed a
-dependency of at least 0.005\% on for at least one distance.
-
-\begin{figure}[htb]
- \includegraphics[width=6.8in]{6.823/lab1/figs/reg_frequencies.png}
- \caption{Instruction dependency frequencies broken down by register. }
- \label{q2:reg_frequencies}.
-\end{figure}
-
-The graph suggests that a few registers are responsible for most dependencies.
-This is not very surprising, given the x86 architecture's predilection to use
-the \texttt{eax} register as an accumulator, \texttt{esi} and \texttt{edi}
-as pointers, and the presence of a condition flags register.
-
-The best (but most difficult to implement) suggestion would be to give the
-instruction set a makeover so it looks more like a RISC instruction set. It's
-not cool to have 8 registers, and instructions with limitations on the registers
-they can use. However, as Alpha found out, this strategy might not work
-commercially.\footnote{One could argue that, even though the strategy failed in
-the 1990s, we're living in a different landscape right now, where many servers
-are running some flavor of UNIX/Linux. So, maybe the instruction set will be
-redesigned one day.}
-
-Assuming we're stuck with the ISA, it seems that (limited) forwarding is very
-worth-while. The dependencies seem to taper off after 4 cycles, so it's
-probably not worth forwarding for more than 4 cycles. This is important in
-super-pipelined architectures, like the latest Pentiums and Core processors.
@@ -8,9 +8,9 @@
require 'gnuplot'
require '6.823/lab2/code/lab2common.rb'
-bench_cases_fix_names 'accesses'
+bench_cases_fix_names 'aligned'
cases = bench_cases
-stats = bench_values(cases)
+stats = aligned_access_values(cases)
stats.keys.each do |name|
total_r, total_w, aligned_r, aligned_w = *stats[name]
stats[name] = [(total_r - aligned_r) / total_r.to_f,
@@ -31,7 +31,7 @@
f.write " \\\\\n\\hline\n"
stats.keys.sort.each do |name|
f.write "#{name} "
- f.write stats[name].map { |number| "& #{'%.5f' % number}\\% " }.join
+ f.write stats[name].map { |number| "& #{'%.5f' % (number * 100)}\\% " }.join
f.write " \\\\\n\\hline\n"
end
f.write "\\end{tabular}\n"
@@ -5,34 +5,60 @@
# License:: Public Domain
-def bench_cases_fix_names(dir_name = 'accesses')
+def bench_cases_fix_names(dir_name = 'aligned')
files = Dir.glob("6.823/lab2/data/#{dir_name}/*")
files.each_with_index do |file, i|
['.out', '.o'].each do |suffix|
len = suffix.length
next unless file[-len, len] == suffix
- File.rename file, file[0...-len]
+ File.rename file, file[0...-len] + '.txt'
files[i] = file[0...-len]
end
end
end
def bench_cases
- files = Dir.glob('6.823/lab2/data/accesses/*')
+ files = Dir.glob('6.823/lab2/data/aligned/*')
names = files.map { |file| File.basename(file) }.
map { |file| file[0...file.index('_base')] }
Hash[*names.zip(files).flatten]
end
-def bench_values(cases, base_dir = 'original')
+def aligned_access_values(cases, base_dir = 'aligned')
{}.tap do |values|
cases.each do |name, file|
# total_reads, total_writes, aligned_reads, aligned_writes
- numbers = File.read(file.gsub('/original/', "/#{base_dir}/")).split(',').
+ numbers = File.read(file.gsub('/aligned/', "/#{base_dir}/")).split(',').
select { |token| !token.empty? }.map { |token| token.to_i }
values[name] = numbers
end
end
end
+
+def cache_perf_values(cases, base_dir = 'r9b2a1')
+ bench_cases_fix_names "x3/#{base_dir}"
+
+ {}.tap do |values|
+ cases.each do |name, file|
+ # total_reads, total_writes, aligned_reads, aligned_writes
+ stats = {}
+ File.read(file.gsub('/aligned/', "/x3/#{base_dir}/")).split("\n").
+ each do |line|
+ label, number_string = *line.split(':')
+ label = label.split.map { |token| token[0, 1] }.
+ select { |ch| "vp".index ch }.join.to_sym
+ total_reads, total_writes, hit_reads, hit_writes = *number_string.
+ split(',').select { |token| !token.empty? }.
+ map { |token| token.to_i }
+ numbers = [(total_reads + total_writes - hit_reads - hit_writes) /
+ (total_reads + total_writes).to_f,
+ (total_reads - hit_reads) / total_reads.to_f,
+ (total_writes - hit_writes) / total_writes.to_f]
+ stats[label] = numbers
+ end
+ values[name] = stats
+ end
+ end
+end
@@ -1,54 +0,0 @@
-#!/usr/bin/env ruby
-#
-# Author:: Victor Costan
-# Copyright:: none
-# License:: Public Domain
-
-# This program needs the gnuplot gem to run. Install with the following command:
-# gem install gnuplot
-
-require 'rubygems'
-require 'gnuplot'
-require '6.823/lab1/code/lab1common.rb'
-
-bench_cases_fix_names 'original'
-bench_cases_fix_names 'accurate'
-cases = bench_cases
-originals = bench_values(bench_cases)
-
-
-Gnuplot.open do |gp|
- Gnuplot::Plot.new gp do |plot|
- plot.terminal 'png small size 1024,768'
- plot.output '6.823/lab1/figs/frequencies.png'
- plot.ylabel '% Instructions'
- plot.xlabel 'Distance'
-
- originals.keys.sort.each do |name|
- data = originals[name]
- plot.data << Gnuplot::DataSet.new([(1..data.length).to_a, data]) do |ds|
- ds.title = name
- ds.with = 'lines'
- ds.linewidth = 1
- end
- end
- end
-
- maxpoints = 4
- Gnuplot::Plot.new gp do |plot|
- plot.terminal 'png small size 1024,768'
- plot.output '6.823/lab1/figs/frequencies_zoom.png'
- plot.ylabel '% Instructions'
- plot.xlabel 'Distance'
-
- originals.keys.sort.each do |name|
- data = originals[name]
- plot.data << Gnuplot::DataSet.new([(1..maxpoints).to_a,
- data[0, maxpoints]]) do |ds|
- ds.title = name
- ds.with = 'lines'
- ds.linewidth = 1
- end
- end
- end
-end
@@ -1,43 +0,0 @@
-#!/usr/bin/env ruby
-#
-# Author:: Victor Costan
-# Copyright:: none
-# License:: Public Domain
-
-# This program needs the gnuplot gem to run. Install with the following command:
-# gem install gnuplot
-
-require 'rubygems'
-require 'gnuplot'
-require '6.823/lab1/code/lab1common.rb'
-
-bench_cases_fix_names 'detailed'
-cases = bench_cases
-details = bench_detailed_values bench_cases, 'detailed'
-
-reg_count = details.values.first[:reg_stats].length
-stat_count = details.values.first[:numbers].length
-register_stats = (0...reg_count).map do |reg|
- (0...stat_count).map do |i|
- details.map { |name, detail| detail[:reg_stats][reg][i] }.
- inject(0) { |acc, n| acc + n} / details.length
- end
-end
-
-Gnuplot.open do |gp|
- Gnuplot::Plot.new gp do |plot|
- plot.terminal 'png small size 1024,768'
- plot.output '6.823/lab1/figs/reg_frequencies.png'
- plot.ylabel '% Instructions'
- plot.xlabel 'Distance'
-
- register_stats.each_with_index do |stats, i|
- next if stats.max < 0.005
- plot.data << Gnuplot::DataSet.new([(1..stat_count).to_a, stats]) do |ds|
- ds.title = "Reg #{i}"
- ds.with = 'lines'
- ds.linewidth = 1
- end
- end
- end
-end
@@ -0,0 +1,46 @@
+#!/usr/bin/env ruby
+#
+# Author:: Victor Costan
+# Copyright:: none
+# License:: Public Domain
+
+require 'rubygems'
+require 'gnuplot'
+require '6.823/lab2/code/lab2common.rb'
+
+bench_cases_fix_names 'aligned'
+cases = bench_cases
+data_sets = {'r8b2a1' => '1k' , 'r9b2a1' => '2k', 'r10b2a1' => '4k',
+ 'r11b2a1' => '8k', 'r12b2a1' => '16k', 'r13b2a1' => '32k'}
+stats = data_sets.keys.map do |data_set|
+ values = cache_perf_values(cases, data_set)
+ [data_set, values]
+end
+
+Gnuplot.open do |gp|
+ maxpoints = 4
+ Gnuplot::Plot.new gp do |plot|
+ plot.terminal 'png small size 1024,768'
+ plot.output '6.823/lab2/figs/working_set.png'
+ plot.ylabel '% Misses'
+ plot.xlabel 'Benchmark'
+
+ xtics = []
+ stats.first.last.keys.sort.each_with_index { |name, i| xtics << [name, i] }
+ plot.xtics '(' + xtics.map { |name, i| %Q|"#{name}" #{i}| }.join(', ') + ')'
+
+ stats.each do |data_set|
+ name, data = *data_set
+ bench_names = data.keys.sort
+ bench_values = bench_names.map do |bench_name|
+ data[bench_name][:pp].first * 100
+ end
+ plot.data << Gnuplot::DataSet.new([(0...bench_names.length).to_a,
+ bench_values]) do |ds|
+ ds.title = data_sets[name]
+ ds.with = 'lines'
+ ds.linewidth = 1
+ end
+ end
+ end
+end
@@ -0,0 +1,7 @@
+---
+:tool_binary: caches
+:output_dir: tests/x3/r9b2a1
+:tool_args: -m 32 -p 12 -r 9 -b 2 -a 1
+:skip_tests:
+- AMMP 1
+- MGRID 1
Oops, something went wrong.

0 comments on commit adf09e6

Please sign in to comment.