Left Up Billige Uhr und Uhrenvergleiche

Uhrenvergleich

Bei der Entscheidung, welche Uhr man einsetzt, wenn man sehr feingranular messen möchte,sind folgende Fragen interessent:

Das Programm clockvergleich aus cheapclock2 mißt

Aufruf: clockvergleich N mit N als Zahl der Wiederholungen.

Auswertung

Linux i686 2.20GHz

N=100000
N*clock_gettime(CLOCK_MONOTONIC) 292559636 ticks 1*clock_gettime(CLOCK_MONOTONIC) 2925.6 ticks
User time: 0s 44003us 
System time: 0s 200012us 
Kontextwechsel: 0 freiwillig, 7 unfreiwillig
N*clock_gettime(CLOCK_REALTIME) 277573992 ticks 1*clock_gettime(CLOCK_REALTIME) 2775.74 ticks
User time: 0s 64004us 
System time: 0s 168011us 
Kontextwechsel: 0 freiwillig, 4 unfreiwillig
N*gettimeofday 198504504 ticks 1*getimeofday 1985.05 ticks
User time: 0s 8000us 
System time: 0s 160010us 
Kontextwechsel: 0 freiwillig, 1 unfreiwillig
Calibrating ... 
N*cheap.gettime 36551112 ticks 1*cheap.gettime 365.511 ticks
User time: 0s 32002us 
System time: 0s 0us 
Kontextwechsel: 0 freiwillig, 0 unfreiwillig
N*cheap.timesample 29858456 ticks 1*cheap.timesample 298.585 ticks
User time: 0s 24002us 
System time: 0s 0us 
Kontextwechsel: 0 freiwillig, 1 unfreiwillig

Linux x86_64 2.27GHz (auf vmware esxi)

N=1000000
N*clock_gettime(CLOCK_MONOTONIC) 86645046 ticks 1*clock_gettime(CLOCK_MONOTONIC) 86.645 ticks
User time: 0s 40002us 
System time: 0s 0us 
Kontextwechsel: 0 freiwillig, 3 unfreiwillig
N*clock_gettime(CLOCK_REALTIME) 82580108 ticks 1*clock_gettime(CLOCK_REALTIME) 82.5801 ticks
User time: 0s 36002us 
System time: 0s 0us 
Kontextwechsel: 0 freiwillig, 6 unfreiwillig
N*gettimeofday 91411448 ticks 1*getimeofday 91.4114 ticks
User time: 0s 40003us 
System time: 0s 0us 
Kontextwechsel: 0 freiwillig, 4 unfreiwillig
Calibrating ... 
N*cheap.gettime 96779903 ticks 1*cheap.gettime 96.7799 ticks
User time: 0s 44003us 
System time: 0s 0us 
Kontextwechsel: 0 freiwillig, 6 unfreiwillig
N*cheap.timesample 65299834 ticks 1*cheap.timesample 65.2998 ticks
User time: 0s 28001us 
System time: 0s 0us 
Kontextwechsel: 0 freiwillig, 3 unfreiwillig

Fazit

Zwar sind beim Laptop bei der tsc-Uhr weniger Kontextwechsel beobachtet worden, aber beim x64 scheint dies keinen Einfluß zu haben.

Interessant ist, das die clock_gettime(CLOCK_MONOTONIC) auf beiden systemen teurer ist wie die clock_gettime(CLOCK_REAL).


Informatik- und Netzwerkverein Ravensburg e.V Rudolf Weber