emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Two strange messages while building Emacs on MS-Windows


From: Eli Zaretskii
Subject: Re: Two strange messages while building Emacs on MS-Windows
Date: Tue, 11 Dec 2012 23:05:44 +0200

> Date: Tue, 11 Dec 2012 21:41:55 +0100
> From: Dani Moncayo <address@hidden>
> Cc: address@hidden, address@hidden
> 
> > So now the new mystery is: why does it take you a whopping 7.5 min to
> > compile the C sources of Emacs?  It takes about 30 sec for me with GCC
> > 3.4.x; GCC 4.7.2 that you use should be about 2 times slower, so I'd
> > expect something like 1 min, not 7.5.
> >
> > Try this:
> >
> >   cd nt
> >   touch ../src/config.h
> >   make -j6
> >
> > and time the last command.
> 
> 0:51

As expected.  So, if compiling the C sources takes 1 min and compiling
the Lisp files takes 6.5 min, how come the bootstrap takes 15 min?
What else takes 7.5 min?

> >>   $ time /c/emacs/trunk/bin/emacs --batch --eval '(message "Hello")'
> >>   Hello
> >>
> >>   real    0m1.189s
> >>   user    0m0.031s
> >>   sys     0m0.000s
> >
> > Maybe that's your problem.  Does the time go down if you repeat that
> > command?
> 
> I've tried that now, and I observe that the "real" component varies
> between 145 and 200 ms (without decreasing or increasing tendency;
> it's kinda random).

Most Windows time measurement have inherent 15-msec granularity.

> I don't know what's the best way to measure execution time from a
> cmd.exe shell.

I attach a program that you could use, call it timep.exe.

/* timep: Emulate Unix `time' command. */
#include <stdio.h>
#include <windows.h>
#include <tchar.h>

LPTSTR SkipArg (const LPTSTR args)
{
   LPTSTR argp = args;

   while (*argp != _T (' '))
     ++argp;
   while (*argp == _T (' '))
     ++argp;
   return argp;
}

int _tmain (int argc, LPTSTR argv [])
{
   STARTUPINFO StartUp;
   PROCESS_INFORMATION ProcInfo;
   union { /* Structure required for file time arithmetic. */
      LONGLONG li;
      FILETIME ft;
   } CreateTime, ExitTime, ElapsedTime;
   FILETIME KernelTime, UserTime;
   SYSTEMTIME ElTiSys, KeTiSys, UsTiSys, StartTimeSys, ExitTimeSys;
   LPTSTR targv = SkipArg (GetCommandLine ());
   OSVERSIONINFO OSVer;
   BOOL IsNT;
   HANDLE hProc;
   DWORD status;

   OSVer.dwOSVersionInfoSize = sizeof(OSVERSIONINFO);
   GetVersionEx (&OSVer);
   IsNT = (OSVer.dwPlatformId == VER_PLATFORM_WIN32_NT);
   /* NT (all versions) returns VER_PLATFORM_WIN32_NT. */
   GetStartupInfo (&StartUp);
   GetSystemTime (&StartTimeSys);

   /* Execute the command line; wait for process to complete. */
   CreateProcess (NULL, targv, NULL, NULL, TRUE,
         NORMAL_PRIORITY_CLASS, NULL, NULL, &StartUp, &ProcInfo);

   /* Assure that we have all REQUIRED access to the process. */
   DuplicateHandle (GetCurrentProcess (), ProcInfo.hProcess,
         GetCurrentProcess (), &hProc,
         PROCESS_QUERY_INFORMATION | SYNCHRONIZE, FALSE, 0);
   WaitForSingleObject (hProc, INFINITE);
   GetExitCodeProcess (hProc, &status);
   GetSystemTime (&ExitTimeSys);

   if (status >= 0 && status < 256 && IsNT) { /* W NT. Elapsed, Kernel, & User 
times. */
      GetProcessTimes (hProc, &CreateTime.ft,
            &ExitTime.ft, &KernelTime, &UserTime);
      ElapsedTime.li = ExitTime.li - CreateTime.li;
      FileTimeToSystemTime (&ElapsedTime.ft, &ElTiSys);
      FileTimeToSystemTime (&KernelTime, &KeTiSys);
      FileTimeToSystemTime (&UserTime, &UsTiSys);
      _ftprintf (stderr, _T ("\nreal\t%02dh%02dm%02d.%03ds\n"),
            ElTiSys.wHour, ElTiSys.wMinute, ElTiSys.wSecond,
            ElTiSys.wMilliseconds);
      _ftprintf (stderr, _T ("user\t%02dh%02dm%02d.%03ds\n"),
            UsTiSys.wHour, UsTiSys.wMinute, UsTiSys.wSecond,
            UsTiSys.wMilliseconds);
      _ftprintf (stderr, _T ("sys\t%02dh%02dm%02d.%03ds\n"),
            KeTiSys.wHour, KeTiSys.wMinute, KeTiSys.wSecond,
            KeTiSys.wMilliseconds);
   } else {
      /* Windows 9x and CE. Elapsed time only. */
   }
   CloseHandle (ProcInfo.hThread); CloseHandle (ProcInfo.hProcess);
   CloseHandle (hProc);
   return 0;
}



reply via email to

[Prev in Thread] Current Thread [Next in Thread]