- 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:
nisheeth%netscape.com 1999-12-22 23:55:29 +00:00
Родитель beeb34ac5b
Коммит 385a10373e
6 изменённых файлов: 26 добавлений и 86 удалений

Просмотреть файл

@ -1,8 +0,0 @@
#
# This is a list of local files which get copied to the mozilla:dist directory
#
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

Просмотреть файл

@ -1,40 +0,0 @@
#!gmake
#
# The contents of this file are subject to the Netscape Public
# License Version 1.1 (the "License"); you may not use this file
# except in compliance with the License. You may obtain a copy of
# the License at http://www.mozilla.org/NPL/
#
# Software distributed under the License is distributed on an "AS
# IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
# implied. See the License for the specific language governing
# rights and limitations under the License.
#
# The Original Code is mozilla.org code.
#
# The Initial Developer of the Original Code is Netscape
# Communications Corporation. Portions created by Netscape are
# Copyright (C) 1998 Netscape Communications Corporation. All
# Rights Reserved.
#
# Contributor(s):
#
MODULE=util
XPIDL_MODULE=util
DEPTH=..\..\..
XPIDLSRCS = \
.\nsITimeRecorder.idl \
$(NULL)
EXPORTS=xp_obs.h \
stopwatch.h \
nsTimer.h \
nsStackBasedTimer.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

Просмотреть файл

@ -1,33 +0,0 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
*
* The contents of this file are subject to the Netscape Public
* License Version 1.1 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.mozilla.org/NPL/
*
* Software distributed under the License is distributed on an "AS
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
* implied. See the License for the specific language governing
* rights and limitations under the License.
*
* The Original Code is Mozilla Communicator client code.
*
* The Initial Developer of the Original Code is Netscape Communications
* Corporation. Portions created by Netscape are
* Copyright (C) 1998 Netscape Communications Corporation. All
* Rights Reserved.
*
* Contributor(s):
*/
#include "nsTimer.h"
#include <stdarg.h>
char* __mysprintf(char* aFormatString, ... )
{
va_list argList;
int size = vprintf(aFormatString, argList);
char* buf = new(sizeof(char) * size);
vsprintf(buf, aFormatString, argList);
return buf;
}