---
# System prepended metadata

title: Processing time
tags: [linux2020]

---

# Processing time
###### tags: `linux2020`
## Estimate processing time of your program.
```
$ time ./yourProgram
```
and you will get:
```
real    0m0.008s
user    0m0.007s
sys     0m0.000s
```
1. **real**: is the **real time** passed in the reality when your program running.
2. **user**: meas the running time of your program in **user mode.**
3. **sys**: meas the running time of your program in **system mode.**

Why two modes in Linux? Linux using **system mode** to isolated and protect the kernel. [Reference](http://blog.he96.com/2011/01/linux-timewhat-do-real-user-and-sys.html)

## Estimate processing time of your program mutiple times.
```
$ seq HOW_MANY_TIMES | time xargs -Iz ./yourProgram
```
e.g. Catch the time of running your program 10 times
```
$ seq 10 | time xargs -Iz ./yourProgram
```
and you wil get the output
```
0.61user 0.14system 0:00.38elapsed 197%CPU (0avgtext+0avgdata 33020maxresident)k
0inputs+0outputs (0major+32504minor)pagefaults 0swaps
```
user time = 0.61 s
system time = 0.14 s
elapsed time = 0.38 s
1. **elapsed time** is the **real time** which passed in the reality when your program running.
2. when **user time** > **elapsed time** means your computer has **mutiple processing** and it is open.