beaker-benchmark 0.0.2 → 0.0.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: d3d7e588bdbad5a3f018e49fa02f007aa9a6b80c
4
- data.tar.gz: b2f79746d5e092f9e4fbdca47fe02010167a7e17
3
+ metadata.gz: ad458e9ac88b6a8bd55c65a43f5af149db783f55
4
+ data.tar.gz: 4f5d4fcc934e32b208a11a11ab08367a7fd280f0
5
5
  SHA512:
6
- metadata.gz: ad55ce1d5233f656f454b359491a12a21c04ece6dff547d6b0e687eb04fbdba234a29ee72038d0da1ac8f09eda556bee80840c38729475c3f1ac8b00e08426e1
7
- data.tar.gz: ec1b08f2300581e6e8f20692b5f85084991561b6c9d611512cc9adc8143d6b41f32b28ae65a89e3e57941b28dd0f1062eaffc4c37a4f689eab1c2e70d34ccf24
6
+ metadata.gz: bcff00e5ba53f4248c64266863f6e67c600b964391c353b3f84dd441ced9bd0da5783f6054cdb9589e299eefdcc2ea29c8f31042a3e50d2d9ea43531db8a1fd2
7
+ data.tar.gz: c8cd012068de23ec1c350c4974957d6d0125a849708e85e16e655a8fbc8c4054e0f9338dafa5db8d5e7969c140a2d4c0bf1bfc43bae9e1099eb7c56eaac52184
@@ -11,7 +11,7 @@ test_name "measure_perf_on test" do
11
11
  on master, 'sleep 10'
12
12
  end
13
13
 
14
- assert(File.exist?('tmp/atop/ubuntu-server-1404-x64/atop_log_measure_perf_on_test_sleep_test.log'))
14
+ assert(File.exist?("tmp/atop/#{@@session_timestamp}/ubuntu-server-1404-x64/atop_log_measure_perf_on_test_sleep_test.log"))
15
15
  result.log_csv
16
- assert(File.exist?('tmp/atop/ubuntu-server-1404-x64/atop_log_measure_perf_on_test_sleep_test.csv'))
16
+ assert(File.exist?("tmp/atop/#{@@session_timestamp}/ubuntu-server-1404-x64/atop_log_measure_perf_on_test_sleep_test.csv"))
17
17
  end
@@ -1,5 +1,6 @@
1
1
  require 'csv'
2
2
  require 'fileutils'
3
+ require 'time'
3
4
 
4
5
  module Beaker
5
6
  module DSL
@@ -28,7 +29,9 @@ module Beaker
28
29
  PROC_DISK_READ_INDEX = 11
29
30
  PROC_DISK_WRITE_INDEX = 13
30
31
 
31
- TMP_DIR = 'tmp/atop'
32
+ @@session_timestamp = Time.now.getutc.to_i
33
+
34
+ TMP_DIR = "tmp/atop/#{@@session_timestamp}"
32
35
 
33
36
  # Example usage:
34
37
  # test_name('measure_perf_on_puppetserver_start') {
@@ -63,12 +66,12 @@ module Beaker
63
66
 
64
67
  def start_monitoring(infrastructure_host, action_name, include_processes=false, sample_interval=1)
65
68
  raise('Monitoring already in progress, call stop_monitoring before calling start_monitoring a second time') unless @beaker_benchmark_start.nil?
66
- @atop_log = "atop_log_#{action_name.downcase.gsub(/[^a-z0-9]/i, '_')}.log"
67
- @action_name = action_name
69
+ @atop_log_filename = "atop_log_#{action_name.downcase.gsub(/[^a-z0-9]/i, '_')}.log"
70
+ @action_name = action_name
68
71
  setup_atop(infrastructure_host)
69
72
  additional_args = ''
70
73
  additional_args = ',PRC,PRM,PRD' if include_processes
71
- atop_cmd = "sh -c 'nohup atop -P CPU,SWP,DSK#{additional_args} -i #{sample_interval} > #{@atop_log} 2>&1 &'"
74
+ atop_cmd = "sh -c 'nohup atop -P CPU,SWP,DSK#{additional_args} -i #{sample_interval} > #{@atop_log_filename} 2>&1 &'"
72
75
 
73
76
  on(infrastructure_host, atop_cmd)
74
77
  @beaker_benchmark_start = Time.now
@@ -93,20 +96,20 @@ module Beaker
93
96
  end
94
97
 
95
98
  def parse_atop_log(infrastructure_host, duration)
96
- unless infrastructure_host.file_exist?(@atop_log)
97
- raise("atop log does not exist at #{@atop_log}")
99
+ unless infrastructure_host.file_exist?(@atop_log_filename)
100
+ raise("atop log does not exist at #{@atop_log_filename}")
98
101
  end
99
102
 
100
103
  log_dir = "#{TMP_DIR}/#{infrastructure_host.hostname}"
101
104
  FileUtils::mkdir_p log_dir unless Dir.exist? log_dir
102
- scp_from(infrastructure_host, @atop_log, log_dir)
105
+ scp_from(infrastructure_host, @atop_log_filename, log_dir)
103
106
  cpu_usage = []
104
107
  mem_usage = []
105
108
  disk_read = []
106
109
  disk_write = []
107
110
 
108
111
  skip = true
109
- CSV.parse(File.read(File.expand_path(File.basename(@atop_log), log_dir)), { :col_sep => ' ' }) do |row|
112
+ CSV.parse(File.read(File.expand_path(@atop_log_filename, log_dir)), { :col_sep => ' ' }) do |row|
110
113
  #skip the first entry, until the first separator 'SEP'.
111
114
  measure_type = row[MEASURE_TYPE_INDEX]
112
115
  if skip
@@ -3,7 +3,7 @@ module Beaker
3
3
  module BeakerBenchmark
4
4
 
5
5
  module Version
6
- STRING = '0.0.2'
6
+ STRING = '0.0.3'
7
7
  end
8
8
 
9
9
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: beaker-benchmark
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Puppetlabs
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-02-15 00:00:00.000000000 Z
11
+ date: 2018-02-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rspec