$usr/bin/time -p python xxx.py
Note that we specifically use the / usr / bin / time instead of time, which means that we are using the time command system, rather than the more simple and useless shell built-in version of the time. If you use time --verbose, the result of an error, then the time is probably the shell you use the built-in time instead of system commands. By using -p switch,
We got three results:
• real record overall time-consuming.
• user records the time spent on tasks on the CPU, but the core function of the time spent is not included.
• sys kernel function records the time it takes.
More parameters can be obtained by --verbose command
Here is the most useful indicators might be Major (requiring I / O) page faults, because it indicates whether the operating system since the data RAM does not exist and needs to read a page from disk. And this will bring a speed penalty.