Adding benchmarking to any script

From TBwiki
Revision as of 10:12, 22 February 2021 by Luc Morissette (Talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search
This article applies to: Product Version
ProSBC 3.1
Tmedia 2.9, 2.10, 3.0, 3.2

Routing scripts need to be well designed to allow for maximum performance of a system.
To help evaluating the performance of a script (or part of a script), you can use this benchmarking tool.

Three lines need to be added.
At the start of the script:

require 'benchmark'

In the main class, before the function to evaluate:

  bm = Benchmark.measure do

In the main class, after the function to evaluate:

  log_trace 3, "It took #{bm.real.to_s[0..7]} seconds to do this function"

This will print in the gateway application log the time it took to run this function.

Personal tools