Closed Bug 1221844 Opened 9 years ago Closed 9 years ago

TraceLogger: Move 'TraceLogger_Invalidation' to "LOG_ITEM" (used to be "TREE_ITEM").

Categories

(Core :: JavaScript Engine, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla45
Tracking Status
firefox45 --- fixed

People

(Reporter: wuwei, Assigned: wuwei)

References

Details

Attachments

(3 files, 4 obsolete files)

'TraceLogger_Invalidation' is belong to 'TRACELOGGER_TREE_ITEMS'. It would be better to use "AutoTraceLog" instead of timestamp to log 'TraceLogger_Invalidation', otherwise the tracelogger might complain (see attachment).
Attached patch patch (obsolete) — Splinter Review
one line patch.
Attachment #8683427 - Flags: review?(hv1989)
Comment on attachment 8683427 [details] [diff] [review]
patch

Review of attachment 8683427 [details] [diff] [review]:
-----------------------------------------------------------------

The 'TRACELOGGER_TREE_ITEMS' are for items where we would like to track the time it took.
For Invalidation/Bailouts that is not something we want to track. In that case it is more important to know how many times it has occurred.

Your patch indeed solves the issue, by treating Invalidation like a tree_item. Though I would prefer to go the other way and
make Invalidation similar to Bailouts. Can you update and move Invalidation to the 'TRACELOGGER_LOG_ITEMS' list?

Bonus points if you add some debug checks to make sure the correct type is used for the logTimestamp/start/stop functions.
Attachment #8683427 - Flags: review?(hv1989)
(In reply to Hannes Verschore [:h4writer] from comment #2)
> Comment on attachment 8683427 [details] [diff] [review]
> patch
> 
> Review of attachment 8683427 [details] [diff] [review]:
> -----------------------------------------------------------------
> 
> The 'TRACELOGGER_TREE_ITEMS' are for items where we would like to track the
> time it took.
> For Invalidation/Bailouts that is not something we want to track. In that
> case it is more important to know how many times it has occurred.
> 
> Your patch indeed solves the issue, by treating Invalidation like a
> tree_item. Though I would prefer to go the other way and
> make Invalidation similar to Bailouts. Can you update and move Invalidation
> to the 'TRACELOGGER_LOG_ITEMS' list?

Sure. :)


> Bonus points if you add some debug checks to make sure the correct type is
> used for the logTimestamp/start/stop functions.

IIUC these checks would be similar with the checks in TLTextIdIsTreeEvent().
Depends on: 1223636
Assignee: nobody → lazyparser
Status: UNCONFIRMED → NEW
Ever confirmed: true
Summary: TraceLogger: Use "AutoTraceLog" instead of timestamp to log 'TraceLogger_Invalidation'. → TraceLogger: Move 'TraceLogger_Invalidation' to "LOG_ITEM" (used to be "TREE_ITEM").
Attached patch bug1221844.patch (obsolete) — Splinter Review
move to LOG_ITEMS.

It works.
Attachment #8683427 - Attachment is obsolete: true
Attachment #8686534 - Flags: review?(hv1989)
Attached patch bug1221844b.patch (obsolete) — Splinter Review
This patch added range checks in TraceLogTimestamp().

For TREE_ITEMS events, There is a function named 'TLTextIdIsTreeEvent(uint32_t)' guarding for them.
Attachment #8686537 - Flags: review?(hv1989)
Comment on attachment 8686534 [details] [diff] [review]
bug1221844.patch

Review of attachment 8686534 [details] [diff] [review]:
-----------------------------------------------------------------

Thanks!
Attachment #8686534 - Flags: review?(hv1989) → review+
Comment on attachment 8686537 [details] [diff] [review]
bug1221844b.patch

Review of attachment 8686537 [details] [diff] [review]:
-----------------------------------------------------------------

::: js/src/vm/TraceLogging.h
@@ +389,4 @@
>  #endif
>  inline void TraceLogTimestamp(TraceLoggerThread* logger, TraceLoggerTextId textId) {
>  #ifdef JS_TRACE_LOGGING
> +    MOZ_ASSERT(textId > TraceLogger_LastTreeItem && textId < TraceLogger_Last);

Can you add this in TraceLogger::logTimestamp?
Attachment #8686537 - Flags: review?(hv1989)
(In reply to Hannes Verschore [:h4writer] from comment #7)
> Comment on attachment 8686537 [details] [diff] [review]
> bug1221844b.patch
> 
> Review of attachment 8686537 [details] [diff] [review]:
> -----------------------------------------------------------------
> 
> ::: js/src/vm/TraceLogging.h
> @@ +389,4 @@
> >  #endif
> >  inline void TraceLogTimestamp(TraceLoggerThread* logger, TraceLoggerTextId textId) {
> >  #ifdef JS_TRACE_LOGGING
> > +    MOZ_ASSERT(textId > TraceLogger_LastTreeItem && textId < TraceLogger_Last);
> 
> Can you add this in TraceLogger::logTimestamp?

I'm afraid not.
Currently the start/stopEvent() are just wrappers for logTimestamp(), adding checks in logTimestamp() will crash start/stopEvent().

TraceLogger::logTimestamp(uint32_t) was renamed to
TraceLoggerThread::logTimestamp(uint32_t), which is used by
TraceLoggerThread::startEvent(uint32_t id), which accepts TREE_ITEM events.

https://dxr.mozilla.org/mozilla-central/source/js/src/vm/TraceLogging.cpp#498
Flags: needinfo?(hv1989)
Blocks: 1224456
(In reply to Wei Wu [:w :wuwei UTC+8] from comment #8)
> (In reply to Hannes Verschore [:h4writer] from comment #7)
> > Comment on attachment 8686537 [details] [diff] [review]
> > bug1221844b.patch
> > 
> > Review of attachment 8686537 [details] [diff] [review]:
> > -----------------------------------------------------------------
> > 
> > ::: js/src/vm/TraceLogging.h
> > @@ +389,4 @@
> > >  #endif
> > >  inline void TraceLogTimestamp(TraceLoggerThread* logger, TraceLoggerTextId textId) {
> > >  #ifdef JS_TRACE_LOGGING
> > > +    MOZ_ASSERT(textId > TraceLogger_LastTreeItem && textId < TraceLogger_Last);
> > 
> > Can you add this in TraceLogger::logTimestamp?
> 
> I'm afraid not.
> Currently the start/stopEvent() are just wrappers for logTimestamp(), adding
> checks in logTimestamp() will crash start/stopEvent().
> 
> TraceLogger::logTimestamp(uint32_t) was renamed to
> TraceLoggerThread::logTimestamp(uint32_t), which is used by
> TraceLoggerThread::startEvent(uint32_t id), which accepts TREE_ITEM events.
> 
> https://dxr.mozilla.org/mozilla-central/source/js/src/vm/TraceLogging.cpp#498

oh right. Correct.
What about creating a protected function "log", which does the internals of logTimestamp and have logTimestamp and startEvent/stopEvent call this protected function "log"?. In that case we can add the checks in logTimestamp...
Flags: needinfo?(hv1989)
Attached patch bug1221844b.patch (obsolete) — Splinter Review
(In reply to Hannes Verschore [:h4writer] from comment #9)
> oh right. Correct.
> What about creating a protected function "log", which does the internals of
> logTimestamp and have logTimestamp and startEvent/stopEvent call this
> protected function "log"?. In that case we can add the checks in
> logTimestamp...

updated version. passed octane profile generation.
not sure whether Debugger would be affected, ni? instead of r?

so is this patch ok?
Attachment #8686537 - Attachment is obsolete: true
Flags: needinfo?(hv1989)
Comment on attachment 8688797 [details] [diff] [review]
bug1221844b.patch

Review of attachment 8688797 [details] [diff] [review]:
-----------------------------------------------------------------

Yes indeed. Looks good.
Attachment #8688797 - Flags: review+
Flags: needinfo?(hv1989)
rebased.
Attachment #8686534 - Attachment is obsolete: true
rebased.
Attachment #8688797 - Attachment is obsolete: true
Keywords: checkin-needed
https://hg.mozilla.org/mozilla-central/rev/abb793676e19
https://hg.mozilla.org/mozilla-central/rev/c06b198b8167
Status: NEW → RESOLVED
Closed: 9 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla45
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: