summaryrefslogtreecommitdiff
path: root/benchmark/memory_wrapper.rb
diff options
context:
space:
mode:
Diffstat (limited to 'benchmark/memory_wrapper.rb')
-rw-r--r--benchmark/memory_wrapper.rb16
1 files changed, 16 insertions, 0 deletions
diff --git a/benchmark/memory_wrapper.rb b/benchmark/memory_wrapper.rb
new file mode 100644
index 0000000..f96b6f2
--- /dev/null
+++ b/benchmark/memory_wrapper.rb
@@ -0,0 +1,16 @@
+
+write_file, target, script_file = ARGV
+
+load(script_file)
+require_relative '../test/lib/memory_status'
+open(write_file, 'wb'){|f|
+ ms = Memory::Status.new
+ case target.to_sym
+ when :peak
+ key = ms.member?(:hwm) ? :hwm : :peak
+ when :size
+ key = ms.member?(:rss) ? :rss : :size
+ end
+
+ f.puts ms[key]
+}