Linux Learning Record (iii): Time related

Source: Internet
Author: User
Tags switches

Time can not only be counted, but also reflect CPU, memory and so on.

One, time

Format: Time [options] [commands] [arguments]

Such as

Time LS

Real 0m0.016s <== actual use (real time)

User 0m0.001s <== Usage time (the process spent in user mode)

SYS 0m0.002s <== kernel state usage time (the process spent in kernel mode)

The time command, followed by the-p parameter, can print only the number of seconds, not printing units.

Such as

Time–p ls

Real 0.01
User 0.00
SYS 0.00

Second, a more powerful external command/usr/bin/time

In fact:

[Email protected] ~]# type-a time
Time is a shell keyword
Time Is/usr/bin/time

Time is/usr/bin/time a simple execution

/usr/bin/time usage

[Email protected] ~]#/usr/bin/time
Usage:/usr/bin/time [-APVV] [-f format] [-o file] [--append] [--verbose]
[--portability] [--format=format] [--output=file] [--version]
[--help] command [arg ...]

Such as

/usr/bin/time ls

0.00user 0.00system 0:00.01elapsed 10%cpu (0avgtext+0avgdata 4080maxresident) k
0inputs+0outputs (0major+294minor) pagefaults 0swaps

It's strong.

/usr/bin/time–v ls

Command being timed: "LS"
User Time (seconds): 0.00
System Time (seconds): 0.00
Percent of CPU This job got:10%
Elapsed (Wall Clock) time (H:MM:SS or M:SS): 0:00.01
Average shared Text Size (Kbytes): 0
Average unshared Data Size (Kbytes): 0
Average stack size (Kbytes): 0
Average Total size (Kbytes): 0
Maximum resident set Size (Kbytes): 4096
Average resident set Size (Kbytes): 0
Major (requiring I/O) page faults:0
Minor (Reclaiming a frame) page faults:298
Voluntary context Switches:1
Involuntary context Switches:8
swaps:0
File system inputs:0
File system outputs:0
Socket Messages sent:0
Socket Messages received:0
Signals delivered:0
Page size (bytes): 4096
Exit status:0

Redirect to File note format

{Time command-line;} 2>file

(Time command-line) 2>file

Linux Learning Record (iii): Time related

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.