Class: FileIoMonitor
- Inherits:
-
TimingTest
- Object
- TimingTest
- FileIoMonitor
- Defined in:
- lib/load/monitors/file_io_monitor.rb
Instance Attribute Summary
Attributes inherited from TimingTest
#index, #logger, #owner, #params, #target_code
Instance Method Summary collapse
-
#initialize ⇒ FileIoMonitor
constructor
A new instance of FileIoMonitor.
- #pause_after_run ⇒ Object
- #run ⇒ Object
- #test_code ⇒ Object
Methods inherited from TimingTest
#assert, #ellaped_millis, #log, #server_url, #set_up, #tear_down, #time_block, #timing
Constructor Details
#initialize ⇒ FileIoMonitor
Returns a new instance of FileIoMonitor.
8 9 10 |
# File 'lib/load/monitors/file_io_monitor.rb', line 8 def initialize @sleep_seconds = 4 end |
Instance Method Details
#pause_after_run ⇒ Object
31 32 33 |
# File 'lib/load/monitors/file_io_monitor.rb', line 31 def pause_after_run sleep @sleep_seconds end |
#run ⇒ Object
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/load/monitors/file_io_monitor.rb', line 12 def run file_name = "./log/file_io_bench_#{Time.now.to_i}.dat" (1..200).each do |i| File.open(file_name, 'w') { |file| (1..1000).each do |j| file.write("Test text #{j} aohoasihdf oiahsdf pohiasdfha oisdhf aiousdfgho iausgdf oaia aiusdhfia hdfihdsfi ahsdfi ahudf \n") file.flush end } File.readlines(file_name).each do |line| if (!line.start_with? "Test text") raise "Error reading back file" end end File.delete(file_name) end end |
#test_code ⇒ Object
36 37 38 |
# File 'lib/load/monitors/file_io_monitor.rb', line 36 def test_code return ("monitor.file") end |