[PATCH] dix: Provide means to determine server startup time easily.

Rami Ylimäki rami.ylimaki at vincit.fi
Tue Aug 17 07:40:02 PDT 2010


It is useful to provide a way to determine server initialization time
for testers. For example, this patch makes it easy for testers to
verify that the recent xkbcomp modifications have a positive effect on
server startup time on boot.

Signed-off-by: Rami Ylimäki <rami.ylimaki at vincit.fi>
---
 dix/globals.c     |    5 +++++
 dix/main.c        |    8 ++++++++
 include/globals.h |    3 +++
 3 files changed, 16 insertions(+), 0 deletions(-)

diff --git a/dix/globals.c b/dix/globals.c
index b128569..43742a7 100644
--- a/dix/globals.c
+++ b/dix/globals.c
@@ -86,6 +86,11 @@ long maxBigRequestSize = MAX_BIG_REQUEST_SIZE;
 unsigned long globalSerialNumber = 0;
 unsigned long serverGeneration = 0;
 
+/* when X server started initializing itself */
+CARD32 ServerStartTime = 0;
+/* when X server was ready to handle clients */
+CARD32 ServerReadyTime = 0;
+
 /* these next four are initialized in main.c */
 CARD32 ScreenSaverTime;
 CARD32 ScreenSaverInterval;
diff --git a/dix/main.c b/dix/main.c
index 5c46dc1..84232b4 100644
--- a/dix/main.c
+++ b/dix/main.c
@@ -137,6 +137,8 @@ int main(int argc, char *argv[], char *envp[])
     int		i;
     HWEventQueueType	alwaysCheckForInput[2];
 
+    ServerStartTime = GetTimeInMillis();
+
     display = "0";
 
     InitRegions();
@@ -284,6 +286,12 @@ int main(int argc, char *argv[], char *envp[])
     pthread_mutex_unlock(&serverInitCompleteMutex);
 #endif
         
+	ServerReadyTime = GetTimeInMillis();
+	LogMessage(X_INFO, "Server initialized in %lu.%.3lu seconds (%lu.%.3lu -> %lu.%.3lu)\n",
+	           (ServerReadyTime - ServerStartTime) / 1000, (ServerReadyTime - ServerStartTime) % 1000,
+	           ServerStartTime / 1000, ServerStartTime % 1000,
+	           ServerReadyTime / 1000, ServerReadyTime % 1000);
+
 	NotifyParentProcess();
 
 	Dispatch();
diff --git a/include/globals.h b/include/globals.h
index 8b80a65..28932a6 100644
--- a/include/globals.h
+++ b/include/globals.h
@@ -6,6 +6,9 @@
 
 /* Global X server variables that are visible to mi, dix, os, and ddx */
 
+extern _X_EXPORT CARD32 ServerStartTime;
+extern _X_EXPORT CARD32 ServerReadyTime;
+
 extern _X_EXPORT CARD32 defaultScreenSaverTime;
 extern _X_EXPORT CARD32 defaultScreenSaverInterval;
 extern _X_EXPORT CARD32 ScreenSaverTime;
-- 
1.6.3.3



More information about the xorg-devel mailing list