CI Framework source pages-Benchmark test class benchmark.php

Source: Internet
Author: User
Tags benchmark
CI Framework source Reading---------Benchmark test class benchmark.php
 marker[$name] = Microtime ();} --------------------------------/** * Calculates the time difference between, marked points. * Calculates the time between two points in time. * If The first parameter is empty this function instead returns the * {Elapsed_time} pseudo-variable false variable. This permits license for the full system * Execution time to being shown in a template. The output class would * swap the real value for this variable. * * @accesspublic * @paramstringa particular marked point * @paramstringa particular marked point * @paramintegerthe Numbe R of decimal places * @returnmixed */function elapsed_time ($point 1 = ", $point 2 =", $decimals = 4) {/* * If no definite point of time is given, then Calculates the time the entire program is running. * How can we calculate the running time of the whole program? In fact, this calculation is performed by the output component. * While calling Benchmark::elapsed_time (), (no arguments), essentially the first thing to return is not the time of the whole program to run, or the actual return is a {elapsed_time} tag, and then * output in the processing of outputs, Calculate the entire program run time, because the processing output stage program can be considered as the last stage, so can approximate the total time, and then the output of {elapsed_time} replaced. * the following memory_usage () principle is the same. */if ($point 1 = = ") {return ' {elapsed_time} ';} if (! isset ($this->marker[$point 1])) {RetuRN ";} if (! isset ($this->marker[$point 2])) {$this->marker[$point 2] = Microtime ();} Why this list is used here is because Microtime (); The return value is the format of "msec sec". List ($SM, $ss) = Explode (", $this->marker[$point 1]), List ($em, $es) = Explode (", $this->marker[$point 2]); return Number_format (($em + $es)-($SM + $ss), $decimals);} --------------------------------/** * Memory Usage * * This function returns the {memory_usage} pseudo-variable. * This permits it is put it anywhere in a template * without the memory being calculated until the end. * The output class would swap the real value for this variable. * * @accesspublic * @returnstring */function memory_usage () {return ' {memory_usage} ';}} End Ci_benchmark class/* end of file benchmark.php *//* location:./system/core/benchmark.php */

  • Related Article

    Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.