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:
@@ -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)
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user