Difference between revisions of "Timestamp"

From WA2IAC Wiki
Jump to: navigation, search
(awk)
m
 
Line 35: Line 35:
 
</pre>
 
</pre>
  
This was run on a machine under Ubuntu 14.10. Here are the results:
+
Summary:
  
 +
Perhaps surprisingly, the awk and perl versions performed the best. The difference between the perl and awk versions were slight. The perl version, at most, used 10% more memory and resources than the awk version. Very impressive for the "kitchen sink" language.
  
 +
The tests were performed on a machine under Ubuntu 14.10. Here are the results:
  
  
Line 43: Line 45:
  
  
==shell==
 
  
==awk==
+
 
 +
===shell===
 +
bash version
 +
<pre>
 +
  188.36  user
 +
  779.17  system
 +
13:25.67  elapsed
 +
    120%  CPU
 +
(0avgtext+0avgdata 6072maxresident)k
 +
0inputs+0outputs
 +
(0major+28033858minor)pagefaults
 +
0          swaps
 +
</pre>
 +
 
 +
===awk===
 
awk version
 
awk version
 
<pre>
 
<pre>
6.49user
+
  6.49    user
12.23system
+
  12.23    system
0:12.42 elapsed
+
0:12.42   elapsed
150 %CPU (0avgtext+0avgdata 6072maxresident)k
+
  150 %   CPU
0inputs+0outputs pagefaults 0swaps
+
(0avgtext+0avgdata 6072maxresident)k
 +
0inputs+0outputs pagefaults
 +
      0    swaps
 +
</pre>
 +
 
 +
===daemontools===
 +
 
 +
daemontools
 +
<pre>
 +
  6.03    user
 +
  17.68    system
 +
0:13.12    elapsed 180%CPU (0avgtext+0avgdata 6080maxresident)k
 +
0inputs+0outputs
 +
(0major+139066minor)pagefaults
 +
0swaps
 +
</pre>
 +
 
 +
===ts===
 +
ts version
 +
<pre>
 +
  16.81  user
 +
  14.19  system
 +
0:16.22  elapsed
 +
    191  %CPU
 +
(0avgtext+0avgdata 7864maxresident)k
 +
0inputs+0outputs
 +
(0major+210354minor)pagefaults
 +
0        swaps
 +
</pre>
 +
 
 +
===perl===
 +
 
 +
perl
 +
<pre>
 +
  6.78    user
 +
11.80    system
 +
0:12.20  elapsed
 +
  152%  CPU
 +
(0avgtext+0avgdata 7868maxresident)k
 +
0inputs+0outputs
 +
0major+141587minor)pagefaults
 +
0swaps
 +
</pre>
 +
 
 +
==Random==
 +
 
 +
===Shell History===
  
==daemontools==
+
Shell History Timestamping
  
==ts==
+
HISTTIMEFORMAT takes format string of strftime. Check out the strftime manual to choose and construct the timestamp that suit your taste. My favorite is “%F %T “.
 +
export HISTTIMEFORMAT="%F %T "
  
==perl==
+
Execute history again and you will see the effect on the spot, bare in mind that the timestamp for command lines that executed at previous sessions may not valid, as the time was not tracked.

Latest revision as of 19:26, 10 July 2015