Skip to content

Instantly share code, notes, and snippets.

@luislavena
Created December 8, 2011 21:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save luislavena/1448652 to your computer and use it in GitHub Desktop.
Save luislavena/1448652 to your computer and use it in GitHub Desktop.
Environment information:
CPU: Core 2 Duo T7500 2.2 GHz
RAM: 4 GB
OS: Windows 7 x64 Ultimate
AV: Windows Security Essentials 2.1.1116.0 (WSE)
Profile: High Performance
HDD: ImDisk 1.5GB, 0% fragmentation
TMA runs:
```
FOR /L %G IN (1,1,10) DO ECHO %G && SLEEP 1 && file_access.exe >> results-wse-{on,off}[-ne].txt
```
Collected:
File exist, File not exist, both with WSE on and off.
Results processed:
+-----------------------+----------------+-------------------+-----------------+--------------------+
| load_ok |
+-----------------------+----------------+-------------------+-----------------+--------------------+
| Function | Exist (WSE On) | No exist (WSE On) | Exist (WSE Off) | No exist (WSE Off) |
+-----------------------+----------------+-------------------+-----------------+--------------------+
| access() | 48.72811 | 17.45623 | 23.66393 | 16.61612 |
| open() | 77.29283 | 25.53095 | 61.56358 | 24.78415 |
| stat() | 1206.39600 | 40.28003 | 1041.07350 | 62.45037 |
| OpenFile() | 83.96732 | 539.50980 | 79.15986 | 493.39550 |
| CreateFile() | 40.46673 | 18.80981 | 40.23338 | 18.52975 |
| GetFileAttributesEx() | 17.87629 | 12.92880 | 17.45623 | 12.92880 |
| GetFileAttributes() | 12.69546 | 13.58225 | 12.64879 | 13.30219 |
+-----------------------+----------------+-------------------+-----------------+--------------------+
require "terminal-table"
re = /^(.*)\:\s+(\d+\.\d+)/
group_names = {
"Exist (WSE On)" => "results-wse-on.txt",
"No exist (WSE On)" => "results-wse-on-ne.txt",
"Exist (WSE Off)" => "results-wse-off.txt",
"No exist (WSE Off)" => "results-wse-off-ne.txt",
}
# build stats and store in rows
rows = Hash.new { |h, k| h[k] = [] }
group_names.each do |name, filename|
stats = Hash.new { |h, k| h[k] = [] }
File.open(filename, "r") do |f|
f.readlines.each do |line|
if m = line.match(re)
key, value = m[1], m[2].to_f
key.gsub!("time", "")
stats[key.strip] << value
end
end
end
stats.each do |key, values|
size = values.length.to_f
sum = values.inject(0) { |acc, value| acc + value }
avg = sum / size
rows[key] << avg
end
end
table = Terminal::Table.new :title => "load_ok" do |t|
t.headings = ["Function", *group_names.keys]
rows.each do |key, values|
formatted = values.collect { |v| { :value => "%4.5f" % v, :alignment => :right } }
t.add_row [key, *formatted]
end
end
puts table
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment