Sha256: bf25e7674dc6b67bf126bfbcc2941dd411498f4464b5566843129c4592449d08
Contents?: true
Size: 563 Bytes
Versions: 8
Compression:
Stored size: 563 Bytes
Contents
require "redis" require "benchmark" module Appstats class Benchmarker attr_accessor :redis def initialize(data = {}) @redis = data[:redis] || Redis.new end def measure(title,legend) time = Benchmark.measure do yield end record(title,legend,time.real) time end def record(title,legend,point) redis.multi do redis.sadd "benchmarks", title redis.sadd "benchmarks:#{title}", legend redis.rpush "benchmarks:#{title}:#{legend}", point end end end end
Version data entries
8 entries across 8 versions & 1 rubygems