cool!
Am 2018-01-05 15:43, schrieb Thomas Schnurrenberger:
On 03.01.2018 23:33, Florian Balmer wrote:
The startup delay for `fossil ui' and `fossil server' on Windows XP is
more obvious than possibly sluggish browser navigation, which I
*think* is due to waiting for StartServiceCtrlDispatcherW. This could
be cut down by skipping the call to StartServiceCtrlDispatcherW for
the `ui' and `server' commands, as Fossil always runs in a console
session, and not as a service, in these cases.

I measured the time it takes to call StartServiceCtrlDispatcherW on my
8 year old Windows 7 64bit box: roughly 600 microseconds, I don't think
this is noticeable!

This is the program for taking the time:

***** Start of code *****
#include <stdlib.h>
#include <stdio.h>
#include <inttypes.h>
#include <windows.h>

static void WINAPI win32_http_service_main(
  DWORD argc,
  LPWSTR *argv
){
  return;
}

int main(void){
  LARGE_INTEGER Frequency;
  LARGE_INTEGER StartingTime;
  LARGE_INTEGER EndingTime;
  LARGE_INTEGER ElapsedMicroseconds;
  double        ElapsedSeconds;
  int           rc = 0;

  /* Define the service table. */
  SERVICE_TABLE_ENTRYW ServiceTable[] =
    {{L"", (LPSERVICE_MAIN_FUNCTIONW)win32_http_service_main},
     {NULL, NULL}};

  /* Get frequency and the start time. */
  QueryPerformanceFrequency(&Frequency);
  QueryPerformanceCounter(&StartingTime);

  /* Activity to be timed */
  if( !StartServiceCtrlDispatcherW(ServiceTable) ){
    if( GetLastError()==ERROR_FAILED_SERVICE_CONTROLLER_CONNECT ){
      rc = 1;
    }else{
      rc = 2;
    }
  }
  /* Get end time and convert to seconds. */
  QueryPerformanceCounter(&EndingTime);
  ElapsedMicroseconds.QuadPart = EndingTime.QuadPart
                               - StartingTime.QuadPart;
  ElapsedMicroseconds.QuadPart *= 1000000;
  ElapsedMicroseconds.QuadPart /= Frequency.QuadPart;
  ElapsedSeconds = (double)(EndingTime.QuadPart
                          - StartingTime.QuadPart)/Frequency.QuadPart;
  printf("Elapsed microseconds: %"PRId64"\n",
         ElapsedMicroseconds.QuadPart);
  printf("Elapsed seconds     : %f\n", ElapsedSeconds);
  printf("rc                  : %d\n", rc);

  return 0;
}
***** End of code *****

It would be interesting to known time on your XP boxes.
_______________________________________________
fossil-users mailing list
fossil-users@lists.fossil-scm.org
http://lists.fossil-scm.org:8080/cgi-bin/mailman/listinfo/fossil-users

Reply via email to