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 <[email protected]> --- v2: The time variables are no more global because they are currently used only in a single function inside X server. LogMessage is still used instead of DebugF. I want the startup time information be available also on release builds so that in principle it would be possible to follow startup time development over time from saved logs. It's also possible to measure the startup time from a parent process by following the signals that X server is sending in NotifyParentProcess. However, in practise it would be nice to have this information in the server log as well. dix/main.c | 10 ++++++++++ 1 files changed, 10 insertions(+), 0 deletions(-) diff --git a/dix/main.c b/dix/main.c index 5c46dc1..1b287ba 100644 --- a/dix/main.c +++ b/dix/main.c @@ -136,6 +136,10 @@ int main(int argc, char *argv[], char *envp[]) { int i; HWEventQueueType alwaysCheckForInput[2]; + /* when X server started initializing itself */ + CARD32 ServerStartTime = GetTimeInMillis(); + /* when X server was ready to handle clients */ + CARD32 ServerReadyTime = ServerStartTime; display = "0"; @@ -284,6 +288,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(); -- 1.6.3.3 _______________________________________________ [email protected]: X.Org development Archives: http://lists.x.org/archives/xorg-devel Info: http://lists.x.org/mailman/listinfo/xorg-devel
