Nieuws:

Welkom, Gast. Alsjeblieft inloggen of registreren.
Heb je de activerings-mail niet ontvangen?

Auteur Topic: time verklaring  (gelezen 1147 keer)

deKeijzer

  • Gast
time verklaring
« Gepost op: 2008/10/22, 19:09:51 »
Hallo!

Ik gebruik time 'command' om mijn zelfgeschreven scripts te testen op snelheid. Alleen vraag ik mij af wat het nou daadwerklijk betekend.
Dit is de output die ik krijg:

real   0m3.974s
user   0m0.048s
sys   0m0.016s


Betekend dat het systeem er maar 0.016s voor nodig heeft en dat er door allerlei andere processen met hogere prioriteiten 4 seconden over wordt gedaan? Of iets heel anders?

Offline Tico

  • Lid
time verklaring
« Reactie #1 Gepost op: 2008/10/23, 15:52:01 »
The time command runs the specified program command with the given arguments. When command finishes, time writes a message to standard output giving timing statistics about this program run. These statistics consist of
(i) the elapsed real time between invocation and termination,
(ii) the user CPU time (the sum of the tms_utime and tms_cutime values in a struct tms as returned by times(2)), and
(iii) the system CPU time (the sum of the tms_stime and tms_cstime values in a struct tms as returned by times(2)).

Offline BailHope

  • Lid
    • Techneut
time verklaring
« Reactie #2 Gepost op: 2008/10/23, 22:27:54 »
Citaat van: tico
The time command runs the specified program command with the given arguments. When command finishes, time writes a message to standard output giving timing statistics about this program run. These statistics consist of
(i) the elapsed real time between invocation and termination,
(ii) the user CPU time (the sum of the tms_utime and tms_cutime values in a struct tms as returned by times(2)), and
(iii) the system CPU time (the sum of the tms_stime and tms_cstime values in a struct tms as returned by times(2)).
Om dat even te verduidelijken:
(i) de tijd die voorbij is gegaan tussen het starten en het eindigen van het programma of script
(ii) hoe lang dit progamma op de CPU heeft gedraaid. Dit is niet noodzakelijk gelijk aan (i) omdat de processor taken verweeft zodat jij met meerdere programma's kan werken. Deze tijd is dus de totale tijd min de tijd dat andere programma's op de cpu hebben gedraaid (het wordt eigenlijk anders berekend, maar dit is gewoon makkelijker om te begrijpen)
(iii) het derde begrijp ik eigenlijk niet zo goed. Ik denk dat dit de tijd is dat de cpu processen heeft gedraaid die het verweven beheersen. Een programmaatje dat dus kiest welk programma de volgende x aantal milliseconden op de processor mag draaien.
Ubuntu user #12046
Mijn blog voor techneuten: http://techneut.wordpress.com
Voor de professionele IT'er: http://it-potato.blogspot.com

deKeijzer

  • Gast
time verklaring
« Reactie #3 Gepost op: 2008/10/24, 08:55:32 »
Dus als ik het goed begrijp, kan ik het zo interpreteren.

(i) daar moet ik eigenlijk niet te veel op letten, dit is beïnvloedbaar door al het andere dat draait.
(ii) is het interessantst, als ik die tijd omlaag krijg is het script ook daadwerkelijk sneller.