Implemented resetTimer().

b=106551; r=dp; sr=sfraser


git-svn-id: svn://10.0.0.236/trunk@108548 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
sgehani%netscape.com 2001-11-20 03:33:11 +00:00
parent ba16eef595
commit 73bcd89098
2 changed files with 36 additions and 0 deletions

View File

@ -106,6 +106,8 @@ interface nsITimelineService : nsISupports
void stopTimer(in string timerName);
void markTimer(in string timerName);
void resetTimer(in string timerName);
};
%{C++
@ -124,6 +126,7 @@ interface nsITimelineService : nsISupports
PR_EXTERN(nsresult) NS_TimelineMark(const char *text, ...);
PR_EXTERN(nsresult) NS_TimelineStartTimer(const char *timerName);
PR_EXTERN(nsresult) NS_TimelineStopTimer(const char *timerName);
PR_EXTERN(nsresult) NS_TimelineResetTimer(const char *timerName);
PR_EXTERN(nsresult) NS_TimelineMarkTimer(const char *timerName, const char *str=nsnull);
PR_EXTERN(nsresult) NS_TimelineIndent();
PR_EXTERN(nsresult) NS_TimelineOutdent();
@ -143,6 +146,7 @@ PR_EXTERN(nsresult) NS_TimelineLeave(const char *text);
#define NS_TIMELINE_START_TIMER(timerName) NS_TimelineStartTimer(timerName)
#define NS_TIMELINE_STOP_TIMER(timerName) NS_TimelineStopTimer(timerName)
#define NS_TIMELINE_MARK_TIMER(timerName) NS_TimelineMarkTimer(timerName)
#define NS_TIMELINE_RESET_TIMER(timerName) NS_TimelineResetTimer(timerName)
#define NS_TIMELINE_MARK_TIMER1(timerName, str) NS_TimelineMarkTimer(timerName, str)
/*
@ -194,6 +198,7 @@ PR_EXTERN(nsresult) NS_TimelineLeave(const char *text);
#define NS_TIMELINE_START_TIMER(timerName)
#define NS_TIMELINE_STOP_TIMER(timerName)
#define NS_TIMELINE_MARK_TIMER(timerName)
#define NS_TIMELINE_RESET_TIMER(timerName)
#define NS_TIMELINE_MARK_TIMER1(timerName, str)
#define NS_TIMELINE_ENTER(text)
#define NS_TIMELINE_LEAVE(text)

View File

@ -79,6 +79,7 @@ class nsTimelineServiceTimer {
* measured.
*/
void stop(PRTime now);
void reset();
PRTime getAccum();
PRTime getAccum(PRTime now);
@ -122,6 +123,12 @@ void nsTimelineServiceTimer::stop(PRTime now)
PR_Unlock(mLock);
}
void nsTimelineServiceTimer::reset()
{
mStart = 0;
mAccum = 0;
}
PRTime nsTimelineServiceTimer::getAccum()
{
PRTime accum;
@ -380,6 +387,24 @@ PR_IMPLEMENT(nsresult) NS_TimelineMarkTimer(const char *timerName, const char *s
return NS_OK;
}
PR_IMPLEMENT(nsresult) NS_TimelineResetTimer(const char *timerName)
{
if (timers == NULL) {
return NS_ERROR_FAILURE;
}
PR_Lock(timerLock);
nsTimelineServiceTimer *timer
= (nsTimelineServiceTimer *)PL_HashTableLookup(timers, timerName);
PR_Unlock(timerLock);
if (timer == NULL) {
return NS_ERROR_FAILURE;
}
timer->reset();
return NS_OK;
}
PR_IMPLEMENT(nsresult) NS_TimelineIndent()
{
indent++; // Could have threading issues here.
@ -445,6 +470,12 @@ NS_IMETHODIMP nsTimelineService::MarkTimer(const char *timerName)
return NS_TimelineMarkTimer(timerName);
}
/* void resetTimer (in string timerName); */
NS_IMETHODIMP nsTimelineService::ResetTimer(const char *timerName)
{
return NS_TimelineResetTimer(timerName);
}
/* void indent (); */
NS_IMETHODIMP nsTimelineService::Indent()
{