One of the methods in my controller has a long piece of code logic, and I will not post the specific code. I would like to ask you how to know how long it takes to execute this method and how fast it will take! One of the methods in my controller has a long piece of code logic, and I will not post the specific code. I would like to ask you how to know how long it takes to execute this method and how fast it will take!
Reply content:
One of the methods in my controller has a long piece of code logic, and I will not post the specific code. I would like to ask you how to know how long it takes to execute this method and how fast it will take!
Thank you for your invitation. In fact, it is very simple. you only need to output two times at the entrance and end of your method. do you not get the program execution time after the end time minus the start time! No. Of course, you should pay special attention to it. it takes microseconds to make a better comparison.PhpMicrotime
You can use this method at the beginning and end, just try the difference.
Function microtime_float () {list ($ usec, $ sec) = explode ("", microtime (); return (float) $ usec + (float) $ sec );}