Skip to content

CI_Benchmark

Mathieu Nayrolles edited this page Jan 20, 2016 · 1 revision

CI_Benchmark

Benchmark Class

This class enables you to mark points and calculate the time difference between them. Memory consumption can also be displayed.

  • Class name: CI_Benchmark
  • Namespace:

Properties

$marker

public array $marker = array()

List of all benchmark markers

  • Visibility: public

Methods

mark

void CI_Benchmark::mark(string $name)

Set a benchmark marker

Multiple calls to this function can be made so that several execution points can be timed.

  • Visibility: public

Arguments

  • $name string - <p>Marker name</p>

elapsed_time

string CI_Benchmark::elapsed_time(string $point1, string $point2, integer $decimals)

Elapsed time

Calculates the time difference between two marked points.

If the first parameter is empty this function instead returns the {elapsed_time} pseudo-variable. This permits the full system execution time to be shown in a template. The output class will swap the real value for this variable.

  • Visibility: public

Arguments

  • $point1 string - <p>A particular marked point</p>
  • $point2 string - <p>A particular marked point</p>
  • $decimals integer - <p>Number of decimal places</p>

memory_usage

string CI_Benchmark::memory_usage()

Memory Usage

Simply returns the {memory_usage} marker.

This permits it to be put it anywhere in a template without the memory being calculated until the end. The output class will swap the real value for this variable.

  • Visibility: public
Clone this wiki locally