beaker-benchmark 0.0.2 → 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/acceptance/tests/measure_perf_on.rb +2 -2
- data/lib/beaker-benchmark/helpers.rb +11 -8
- data/lib/beaker-benchmark/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ad458e9ac88b6a8bd55c65a43f5af149db783f55
|
4
|
+
data.tar.gz: 4f5d4fcc934e32b208a11a11ab08367a7fd280f0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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?(
|
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?(
|
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
|
-
|
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
|
-
@
|
67
|
-
@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} > #{@
|
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?(@
|
97
|
-
raise("atop log does not exist at #{@
|
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, @
|
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(
|
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
|
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.
|
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-
|
11
|
+
date: 2018-02-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rspec
|