Implementing NS_TIMELINE_MARK_TIMER1 that prints an additional string

along with the timer mark. r=sgehani, sr=sfraser


git-svn-id: svn://10.0.0.236/trunk@108387 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
dp%netscape.com
2001-11-17 20:20:25 +00:00
parent 0a6977e48e
commit 463a8468e2
2 changed files with 10 additions and 4 deletions

View File

@@ -124,7 +124,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_TimelineMarkTimer(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();
PR_EXTERN(nsresult) NS_TimelineEnter(const char *text);
@@ -143,6 +143,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_MARK_TIMER1(timerName, str) NS_TimelineMarkTimer(timerName, str)
/*
* NS_TIMELINE_MARK_ macros for various data types. Each of these
@@ -193,6 +194,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_MARK_TIMER1(timerName, str)
#define NS_TIMELINE_ENTER(text)
#define NS_TIMELINE_LEAVE(text)
#define NS_TIMELINE_MARK_URI(text, uri)

View File

@@ -351,7 +351,7 @@ PR_IMPLEMENT(nsresult) NS_TimelineStopTimer(const char *timerName)
return NS_OK;
}
PR_IMPLEMENT(nsresult) NS_TimelineMarkTimer(const char *timerName)
PR_IMPLEMENT(nsresult) NS_TimelineMarkTimer(const char *timerName, const char *str)
{
if (timers == NULL) {
return NS_ERROR_FAILURE;
@@ -369,8 +369,12 @@ PR_IMPLEMENT(nsresult) NS_TimelineMarkTimer(const char *timerName)
char buf[500];
PRInt32 sec, msec;
ParseTime(accum, sec, msec);
PR_snprintf(buf, sizeof buf, "%s total: %d.%03d",
timerName, sec, msec);
if (!str)
PR_snprintf(buf, sizeof buf, "%s total: %d.%03d",
timerName, sec, msec);
else
PR_snprintf(buf, sizeof buf, "%s total: %d.%03d (%s)",
timerName, sec, msec, str);
NS_TimelineMark(buf);
return NS_OK;