From 213c76750c230c55f2b9cccc09dcb211a4c64252 Mon Sep 17 00:00:00 2001 From: "waterson%netscape.com" Date: Sun, 9 Aug 1998 20:32:48 +0000 Subject: [PATCH] Added some info to the begin-session timing trace. git-svn-id: svn://10.0.0.236/trunk@7638 18797224-902f-48f8-a5cc-f745e15eee43 --- mozilla/network/main/mktrace.c | 48 +++++++++++++++++++++++++++++++--- 1 file changed, 45 insertions(+), 3 deletions(-) diff --git a/mozilla/network/main/mktrace.c b/mozilla/network/main/mktrace.c index 955a2e1f88b..73ceb819190 100644 --- a/mozilla/network/main/mktrace.c +++ b/mozilla/network/main/mktrace.c @@ -15,12 +15,16 @@ * Copyright (C) 1998 Netscape Communications Corporation. All Rights * Reserved. */ + +#define FORCE_PR_LOG /* So that this works in an optimized build */ + #include "mkutils.h" #include "mktrace.h" #include "timing.h" #include "prprf.h" #include "plstr.h" #include "prlog.h" +#include "prsystem.h" #include "prtime.h" #include "plhash.h" @@ -97,6 +101,11 @@ void _MK_TraceMsg(char *fmt, ...) { static PRLogModuleInfo* gTimingLog = NULL; static const char* gTimingModuleName = "nsTiming"; +/** + * Rev this if the output format changes significantly + */ +#define TIMING_VERSION 0x10000 + /** * Ensure that the log module actually exists before trying to use it. * @return FALSE if something goes wrong. @@ -105,9 +114,42 @@ static PRBool EnsureLogModule(void) { if (gTimingLog == NULL) { - if ((gTimingLog = PR_NewLogModule(gTimingModuleName)) != NULL) { - /* Off to start with */ - gTimingLog->level = PR_LOG_NONE; + if ((gTimingLog = PR_NewLogModule(gTimingModuleName)) == NULL) + return PR_FALSE; + + /* _On_ to start with -- if the env is set up */ + gTimingLog->level = PR_LOG_NOTICE; + + { + /* Dump the session info */ + char hostname[SYS_INFO_BUFFER_LENGTH]; + char sysname[SYS_INFO_BUFFER_LENGTH]; + char release[SYS_INFO_BUFFER_LENGTH]; + char arch[SYS_INFO_BUFFER_LENGTH]; + + if (PR_GetSystemInfo(PR_SI_HOSTNAME, hostname, sizeof(hostname)) != PR_SUCCESS) + hostname[0] = '\0'; + + if (PR_GetSystemInfo(PR_SI_SYSNAME, sysname, sizeof(sysname)) != PR_SUCCESS) + sysname[0] = '\0'; + + if (PR_GetSystemInfo(PR_SI_RELEASE, release, sizeof(release)) != PR_SUCCESS) + release[0] = '\0'; + + if (PR_GetSystemInfo(PR_SI_ARCHITECTURE, arch, sizeof(arch)) != PR_SUCCESS) + arch[0] = '\0'; + + TimingWriteMessage("begin-session,%08x,%s,%s,%s,%s,%s,%ld", + TIMING_VERSION, hostname, sysname, + release, arch, +#ifdef DEBUG + "debug", +#else + "opt", +#endif + 0 /* XXX build number */ + ); + } }