Tuesday, April 24, 2007

Quickest Way To Get Rid Of Impetigo

The power of time



instruction
time, used as is, returns statistics of time spent in the execution of the command is passed as parameter. According to man time:





"(...) The time command runs the command with the arguments supplied


two. When command finishes, time writes a message on standard output


returning time statistics on the implementation of this program


. These statistics are made up of (i) the real

time elapsed between the call and the completion of order, (ii)

time user of the processor ( the sum of the values \u200b\u200band
tms_utime

tms_cutime in a struct tms as returned by times (2)), and (iii) the time processor system (the sum of the values \u200b\u200band
tms_stime tms_cstime in a struct tms as returned by times (2)). (...)"

For example: @ dballester
Nebuchadnezzar: ~ $ time scp sqldeveloper-1.1.2.2579-no-jre.zip dballester @ localhost: / tmp/prueba2 . zip dballester @ localhost's password: sqldeveloper-1.1.2.2579-no-jre.zip 100% 39MB 38.8MB / s 00:01
real 0m4.963s user
0m0.688s sys 0m0.104s dballester @ Nebuchadnezzar: ~ $
Ok, but if we read the man's time, it is able to give much more information. What we see real, user and sys is just the default output and the tip of the iceberg. time statistics can give us (among others): the number of times the process has been taken out of main memory, the number of times the system has removed the CPU implementation process for having spent all the allotted time for him, number of messages (sockets) sent and received ...
All these statistics (see man time) can be obtained indicating an output format determined time. As I am, among other things, vague and forgetfulness, I have assembled an script that displays all the statistics. There is no magic, only the show but grouped by area. I leave the code along with an example of execution. For those who are dedicated to consulting think we will be very nice to have this script by hand. GPL2 is licensed so you know you can use, transform and distribute under the limits of that license. Script
time_command.sh available in.solit.us http://in.solit.us/archives/download/23169

Once downloaded your machine, you have to give rights of Execution / Chmod 755 time_command.sh

Release Example
Accepts 2 parameters, the first should be the command to execute, limited in quotes. The second is the log file where you saved the output of the statistics. The second parameter is optional and if not stated a script that will generate the data (date / time to seconds) of run time, and leave it in the same directory where you launched the script ( therefore we must have write in that directory.) I recommend you leave this script in your home and you cast it from there

$
./time_command.sh "scp sqldeveloper-1.1.2.2579-no-jre.zip dballester@localhost:/tmp/prueba2.zip" cp2.log
The authenticity of host 'localhost (127.0.0.1)' can't be established.
RSA key fingerprint is 43:53:7e:71:3a:95:ff:b4:d1:2d:21:dc:c4:1b:ad:1d.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added 'localhost' (RSA) to the list of known hosts.
dballester@localhost's password:
sqldeveloper-1.1.2.2579-no-jre.zip



Log resultante



$ cat cp2.log
Comand executed scp sqldeveloper-1.1.2.2579-no-jre.zip dballester@localhost:/tmp/prueba2.zip
TIME COMMAND

Elapsed real (wall clock) time used by the process, in [hours:]minutes:seconds 0:06.91 Elapsed real (wall clock) time used by the process in seconds 6.91

CPU STASTISTICS

Percentage of the CPU that this job got(1) 13%
Total number of CPU-seconds used by the system on behalf of the process (in kernel mode), in seconds 0.11
Total number of CPU-seconds that the process used directly (in user mode), in seconds 0.82
Number of times that the program was context-switched voluntarily(2) 5437
Number of times the process was context-switched involuntarily (because the time slice expired) 6024
Number of signals delivered to the process 0 MEMORY STATISTICS
Average amount of shared text in the process, in Kilobytes 0
Average size of the process’s unshared data area, in Kilobytes 0
Average unshared stack size of the process in Kilobytes 0
Average total (data+stack+text) memory use of the process, in Kilobytes 0
Maximum resident set size of the process during its lifetime, in Kilobytes 0 Average resident set size of the process in Kilobytes 0 Number of minor, or recoverable, page faults(3) 1031 Number of times the process was swapped out of main memory 0
System’s page size in bytes(4) 4096


I/O STATISTICS

Number of file system inputs by the process 0
Number of file system outputs by the process 0
Number of major, or I/O-requiring, page faults that occurred while the process was running(5) 1
Number of socket messages received by the process 0 Number of socket messages sent by the process 0


(1) This is just user + system times divided by the total running time
(2) For instance while waiting for an I/O operation to complete
(3)These are pages that are not valid (so they fault)
but which have not yet been claimed by other virtual pages.
Thus the data in the page is still valid but the system tables must be updated.
(4) This is a per-system constant, but varies between systems.
(5) These Are faults Actually Where the page has migrated out of primary memory.

















0 comments:

Post a Comment