delorie.com/archives/browse.cgi | search |
X-Authentication-Warning: | delorie.com: mail set sender to djgpp-bounces using -f |
Message-ID: | <127e01c464de$b95ca3b0$0600000a@broadpark.no> |
From: | "Gisle Vanem" <giva AT bgnett DOT no> |
To: | "djgpp" <djgpp AT delorie DOT com> |
References: | <2l4majF8iuhdU1 AT uni-berlin DOT de> |
Subject: | Re: Microsoft clock() |
Date: | Thu, 8 Jul 2004 13:28:42 +0200 |
MIME-Version: | 1.0 |
X-Priority: | 3 |
X-MSMail-Priority: | Normal |
X-Mailer: | Microsoft Outlook Express 6.00.2800.1409 |
X-MimeOLE: | Produced By Microsoft MimeOLE V6.00.2800.1409 |
Reply-To: | djgpp AT delorie DOT com |
"Alex Vinokur" <alexvn AT foot DOT com> said: > That concerns gpp (DJGPP) too. > Note. g++ (Cygwin) generates valid CPU used time. Please define "CPU used time". > start_clock = clock(); .. > sleep (3); .. > $ dj > > time : start = 1089292733 sec, end = 1089292736 sec > time : elapsed (wall clock) time = 3 sec > > clock : start = 0 ticks, end = 275 ticks > clock : cumulative processor time = 3.02198 sec So what? What do you think sleep(3) should do? djgpp programs does not magically release the allocated CPU time as other threaded environments may do. > So, one can see that gpp and g++ generate quite different "cumulative processor time". > It seems that "cumulative processor time" generated by g++ (Cygwin) is more believable. That's no surprise since CygWin is a Windows and multi-thread aware environment. BTW. A slightly modified program for MingW (replacing sleep(3) with Sleep(3000) which off-course yields to other processes) gives similar output as for djgpp: time : start = 1089285777 sec, end = 1089285780 sec time : elapsed (wall clock) time = 3 sec clock : start = 31 ticks, end = 3031 ticks clock : cumulative processor time = 3 sec No surprise here either since MSVCRT defines clock() behaviour different from CygWin (or Posix). MSDN says: ... The amount of time that has elapsed since the start of the calling process is not necessarily equal to the actual amount of processor time that that process has used. I.e. clock() gives you the wall-clock. --gv
webmaster | delorie software privacy |
Copyright © 2019 by DJ Delorie | Updated Jul 2019 |