зеркало из https://github.com/mozilla/gecko-dev.git
a=don, r=pollmann.
- Don't use nsStackBasedTimer.h any more - Fix compile errors in __mysprintf() in nsTimer.cpp - Make stack based timers work.
This commit is contained in:
Родитель
1e9fb0f783
Коммит
f08ec33266
|
@ -5,4 +5,3 @@
|
|||
xp_obs.h
|
||||
stopwatch.h
|
||||
nsTimer.h
|
||||
nsStackBasedTimer.h
|
||||
|
|
|
@ -31,8 +31,7 @@ XPIDL_MODULE = util
|
|||
|
||||
EXPORTS = $(srcdir)/xp_obs.h \
|
||||
$(srcdir)/stopwatch.h \
|
||||
$(srcdir)/nsTimer.h \
|
||||
$(srcdir)/nsStackBasedTimer.h
|
||||
$(srcdir)/nsTimer.h
|
||||
|
||||
XPIDLSRCS = nsITimeRecorder.idl
|
||||
|
||||
|
|
|
@ -33,8 +33,7 @@ XPIDLSRCS = \
|
|||
|
||||
EXPORTS=xp_obs.h \
|
||||
stopwatch.h \
|
||||
nsTimer.h \
|
||||
nsStackBasedTimer.h
|
||||
nsTimer.h
|
||||
|
||||
|
||||
!include $(DEPTH)\config\rules.mak
|
||||
|
|
|
@ -26,7 +26,23 @@
|
|||
#ifdef MOZ_PERF_METRICS
|
||||
|
||||
#include "stopwatch.h"
|
||||
#include "nsStackBasedTimer.h"
|
||||
|
||||
class nsStackBasedTimer
|
||||
{
|
||||
public:
|
||||
nsStackBasedTimer(Stopwatch* aStopwatch) { sw = aStopwatch; }
|
||||
~nsStackBasedTimer() { if (sw) sw->Stop(); }
|
||||
|
||||
void Start(PRBool aReset) { if (sw) sw->Start(aReset); }
|
||||
void Stop(void) { if (sw) sw->Stop(); }
|
||||
void Reset(void) { if (sw) sw->Reset(); }
|
||||
void SaveState(void) { if (sw) sw->SaveState(); }
|
||||
void RestoreState(void) { if (sw) sw->RestoreState(); }
|
||||
void Print(void) { if (sw) sw->Print(); }
|
||||
|
||||
private:
|
||||
Stopwatch* sw;
|
||||
};
|
||||
|
||||
// This should be set from preferences at runtime. For now, make it a compile time flag.
|
||||
#define ENABLE_DEBUG_OUTPUT PR_FALSE
|
||||
|
|
|
@ -24,8 +24,14 @@ DEPTH=..\..\..
|
|||
CSRCS=obs.c
|
||||
REQUIRES=nspr util
|
||||
LIBRARY_NAME=util
|
||||
CPPSRCS=stopwatch.cpp
|
||||
CPP_OBJS=.\$(OBJDIR)\stopwatch.obj
|
||||
CPPSRCS=stopwatch.cpp \
|
||||
nsTimer.cpp \
|
||||
$(NULL)
|
||||
|
||||
CPP_OBJS=.\$(OBJDIR)\stopwatch.obj \
|
||||
.\$(OBJDIR)\nsTimer.obj \
|
||||
$(NULL)
|
||||
|
||||
C_OBJS=.\$(OBJDIR)\obs.obj
|
||||
|
||||
|
||||
|
|
|
@ -22,12 +22,14 @@
|
|||
|
||||
#include "nsTimer.h"
|
||||
#include <stdarg.h>
|
||||
#include <stdio.h>
|
||||
|
||||
char* __mysprintf(char* aFormatString, ... )
|
||||
{
|
||||
va_list argList;
|
||||
int size = vprintf(aFormatString, argList);
|
||||
char* buf = new(sizeof(char) * size);
|
||||
char* buf = new char[size];
|
||||
vsprintf(buf, aFormatString, argList);
|
||||
return buf;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче