Thinkphp has long needed to function through Debug_start, debug_end methods, and even http://www.aliyun.com/zixun/aggregation/10818.html ">debug classes, The 3.1 version is replaced by a simple G method, which cannot be said to be a gorgeous upgrade.
The G method's function includes the mark position and the interval statistic two function, below see the concrete usage:
Mark Position
The first use of the G method is to mark the location, for example:
G (' begin ');
Indicates that the current position is marked as a begin label, and the execution time of the current position is recorded, and memory consumption can be logged if the environment supports it. The G method tag can be invoked at any location.
Run Time statistics
After marking the position, we can call the G method again for interval statistics, for example:
G (' begin '); // ... Other code Snippet G (' End '); // ... Maybe there's another code here//For statistical interval echo G (' Begin ', ' end '). S ';
G (' Begin ', ' End ') indicates the execution time (in seconds) of the statistic begin position to the end position, and the beginning must be a marked position, and if the ends are not marked at this time, the current position is automatically marked as the last label, and the output is similar to the following:
0.0056s
The default statistic precision is 4 digits after the decimal point, and if 211.html ">" feels this statistic is not accurate enough, you can also set up for example:
G (' Begin ', ' End ', 6). ' S ';
The possible output becomes:
0.005587s
Memory Cost Statistics
If your environment supports memory footprint statistics, you can also use the G method for interval memory cost statistics (in kilobytes), for example:
echo G (' Begin ', ' End ', ' m '). KB ';
The third parameter uses m to represent the memory cost statistics, and the output may be:
625kb
Similarly, if the end tag is not marked, the current position is automatically marked with the first bit of the label.
If the environment does not support memory statistics, the parameter is invalid, and interval running time statistics are still performed.
Forget Debug_start, Debug_end, Boulevard to Jane, you know