[BUG][VM] 1929FastPrimFailures.cs
Stephan Rudlof
sr at evolgo.de
Sun Mar 26 04:30:49 UTC 2000
"Raab, Andreas" wrote:
>
> Stephan,
>
> > I'm very concerned (think it's a bug) about one aspect of the
> > implementation, it is the initialization of pluginSessionID in
> > Interpreter>>initializeInterpreter: :
> >
> > It will be initialized by
> > pluginSessionID _ self ioMicroMSecs.
> > ; where
> > - ioMicroMSecs returns a milliseconds value in spite of its name,
> > - starting by zero at startup.
>
> The latter is not true - at least not for any implementation I'm aware of.
> ioMicroMSecs() is usually implemented by a call to the underlying OS timer
> functions and should be an equivalent for the time since system (read OS)
> startup and not Squeak startup. It should therefore be very hard to start
> Squeak even remotely close for this to be a problem.
I'm sorry, but I have to contradict.
For me it is as follows for Ian's Linux port.
In Squeak workspace:
Time millisecondClockValue
13809 7414 "squeak save&quit'ed and just restarted (7 and 13 seconds)
without booting the computer!"
13173889 13157281 "long session"
seems to show that the clock has been resetted at restart.
Callchain:
Time>>millisecondClockValue -> Time>>primMillisecondClock -> <primitive:
135> -> Interpreter>>primitiveMillisecondClock -> external ioMSecs().
But is ioMSecs the same as ioMicroMSecs?
>From sq.h:
...
int ioMSecs(void);
int ioLowResMSecs(void);
int ioMicroMSecs(void);
#define ioMSecs() ((1000 * clock()) / CLOCKS_PER_SEC)
#define ioLowResMSecs() ((1000 * clock()) / CLOCKS_PER_SEC)
#define ioMicroMSecs() ((1000 * clock()) / CLOCKS_PER_SEC)
...
>From sqPlatformSpecific.h:
...
#undef ioMSecs
#undef ioLowResMSecs
#undef ioMicroMSecs
#endif /* UNIX */
...
, so the functions should be used. If the macros would be valid all
would result in the same value, of course.
>From sqXWindow.c:
...
int ioMSecs(void)
{
struct timeval now;
gettimeofday(&now, 0);
if ((now.tv_usec -= startUpTime.tv_usec) < 0) {
now.tv_usec += 1000000;
now.tv_sec -= 1;
}
now.tv_sec -= startUpTime.tv_sec;
return (now.tv_usec / 1000 + now.tv_sec * 1000);
}
int ioMicroMSecs(void)
{
/* return the highest available resolution of the millisecond clock */
return ioMSecs(); /* this already to the nearest millisecond */
}
...
Here ioMicroMSecs(void) returns the same as ioMSecs(void): So the
measure by Time millisecondClockValue should be correct!
My conjecture seems to be correct, or did I miss a point here?
The line
now.tv_sec -= startUpTime.tv_sec;
in ioMSecs should be the reason for measuring time relative to
startup-time, see also
...
void SetUpTimers(void)
{
/* set up the micro/millisecond clock */
gettimeofday(&startUpTime, 0);
...
Greetings,
Stephan
More information about the Squeak-dev
mailing list
|