Program deadlines through the terminal

I wrote a C ++ program for which I would like to set aside the time needed to complete - is there any terminal command I could use?

+3
source share
5 answers

You can use the time command, which is available on most (possibly all) Linux distributions. It will print the time spent by both the system and the user, and the total time.

for instance

bash-4.1 $ time (sleep 1; sleep 1)

will output something like

real 0m2.020s
user 0m0.014s
sys 0m0.005s

As you can see in parentheses, you can run each command chain that you want.

+4
source

He called timein * nix

+3
source

(, 1000), . time.h time_t - , . .

0

Measure-Command PowerShell.

0

:)

g++, :

g++ -std=c++14 c++/dijkstra_shortest_reach_2.cpp -o dsq

, :

./dsq

, :

./dsq < input07Dijkstra.txt

.

, :

time(./dsq < input07Dijkstra.txt)

:

time(./dsq)

:

real    0m16.082s
user    0m15.968s
sys     0m0.089s

, !

0

Source: https://habr.com/ru/post/1785086/


All Articles