File: bench_ps.rb

package info (click to toggle)
ruby-sys-proctable 1.3.0-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, forky, sid, trixie
  • size: 396 kB
  • sloc: ruby: 3,656; makefile: 3
file content (21 lines) | stat: -rw-r--r-- 560 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
########################################################################
# bench_ps.rb
#
# Benchmark program to show overall speed and compare the block form
# versus the non-block form. You should run this benchmark via the
# 'rake bench' Rake task.
########################################################################
require 'benchmark'
require 'sys/proctable'

MAX = 10

Benchmark.bm do |bench|
   bench.report("Block form"){
      MAX.times{ Sys::ProcTable.ps{} }
   }

   bench.report("Non-block form"){
      MAX.times{ Sys::ProcTable.ps }
   }
end