a=chofmann. Add NSPR logging facilities to the stopwatch code. Make Print() dump stopwatch info to the NSPR log. Set NSPR_LOG_MODULES=gecko_timing:1 in your environment to get timing logs printed to the file specified in the NSPR_LOG_FILE environment variable.

git-svn-id: svn://10.0.0.236/trunk@48974 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
nisheeth%netscape.com
1999-09-24 08:39:43 +00:00
parent b6b8bf59c1
commit bf42b552d5
3 changed files with 26 additions and 5 deletions

View File

@@ -1,4 +1,5 @@
#include "nscore.h"
#include "prlog.h"
const double gTicks = 1.0e-7;
@@ -26,6 +27,21 @@ const double gTicks = 1.0e-7;
# define NS_RESTORE_STOPWATCH_STATE(_sw)
#endif
#ifdef RAPTOR_PERF_METRICS
static PRLogModuleInfo* gLogStopwatchModule = PR_NewLogModule("gecko_timing");
#define RAPTOR_TRACE_STOPWATCHES 0x1
#define RAPTOR_STOPWATCH_TRACE(_args) \
PR_BEGIN_MACRO \
PR_LOG(gLogStopwatchModule, RAPTOR_TRACE_STOPWATCHES, _args); \
PR_END_MACRO
#else
#define RAPTOR_TRACE_STOPWATCHES
#define RAPTOR_STOPWATCH_TRACE(_args)
#endif
class Stopwatch {
private:

View File

@@ -18,12 +18,17 @@
MODULE=util
DEPTH=..\..\..
CSRCS=obs.c
!if defined(MOZ_PERF)
CPPSRCS=stopwatch.cpp
CPP_OBJS=.\$(OBJDIR)\stopwatch.obj
!endif
REQUIRES=nspr util
LIBRARY_NAME=util
!if defined(MOZ_PERF)
DEFINES=-DRAPTOR_PERF_METRICS
CPPSRCS=stopwatch.cpp
CPP_OBJS=.\$(OBJDIR)\stopwatch.obj
LCFLAGS = \
$(LCFLAGS) \
$(DEFINES) \
$(NULL)
!endif
C_OBJS=.\$(OBJDIR)\obs.obj

View File

@@ -187,6 +187,6 @@ void Stopwatch::Print(void) {
int min = int(realt / 60);
realt -= min * 60;
int sec = int(realt);
printf("Real time %d:%d:%d, CP time %.3f", hours, min, sec, CpuTime());
RAPTOR_STOPWATCH_TRACE(("Real time %d:%d:%d, CP time %.3f", hours, min, sec, CpuTime()));
}