The Joy of Linux commands--time

Source: Internet
Author: User

Time used to count the total times that command execution took

Example one:

 Time ls bin  etc  Games  include  Java  lib  lib64  libexec  local  sbin  share  src  tmpreal    0m0.004suser    0m0.001ssys    0m0.002s
    • Real time is the wall clock time, which is the time the command starts executing to the end. This short time includes the time slices that other processes occupy, and the time it takes to block the process.
    • User time is the CPU time that the process spends in user mode, which is the only time that is really spent executing the process, and the time in other processes and spending blocking states is not counted.
    • SYS time is the amount of CPU time spent in kernel mode, representing the time it takes to take a system call in the kernel, which is the CPU time actually used by the process.

Example two, comparing the time difference between different algorithms

[Email protected] test]# Time  forIinch`seq 1111`; Docount=${#i}; DoneReal 0m0.036suser 0m0.024ssys 0m0.021s[[email protected] test]# Time  forIinch`seq 1111`; DoCount= 'Echo$i |WC-M '; DoneReal 0m5.985suser 0m1.618ssys 0m5.729s[[email protected] test]# Time  forIinch`seq 1111`; DoCount= 'ExprLength $i '; DoneReal 0m3.938suser 0m1.163ssys 0m3.225s

It can be seen that the algorithm with ${#var} is optimal

The output information shows the real time, user time, and sys time spent by this command, respectively. Real time is the wall clock time, which is the time the command starts executing to the end. This short time includes the time slices that other processes occupy, and the time it takes to block the process. User time is the CPU time that the process spends in user mode, which is the only time that is really spent executing the process, and the time in other processes and spending blocking states is not counted. SYS time is the amount of CPU time spent in kernel mode, representing the time it takes to take a system call in the kernel, which is the CPU time actually used by the process.

From: Http://man.linuxde.net/time

The Joy of Linux commands--time

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.