Closed Bug 1023461 Opened 10 years ago Closed 10 years ago

Record chrome script file name in BHR

Categories

(Core :: XPCOM, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla33

People

(Reporter: jchen, Assigned: jchen)

Details

Attachments

(3 files)

For chrome scripts, we should record the file name in the hang stack.
This patch eliminates a temporary buffer variable to save some memory.
Attachment #8437959 - Flags: review?(snorp)
This patch moves the hang stack structure, from a Vector, to its own HangStack class that inherits from Vector. The new HangStack class contains an internal string buffer, so that we can use arbitrary text (like chrome script filename or unwound symbol name) as stack frames.
Attachment #8437978 - Flags: review?(vdjeric)
Attachment #8437959 - Flags: review?(snorp) → review+
Comment on attachment 8437986 [details] [diff] [review]
Record filename and line number for chrome JS entries (v1)

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

::: xpcom/threads/ThreadStackHelper.cpp
@@ +257,5 @@
> +    unsigned lineno = JS_PCToLineNumber(nullptr, aEntry->script(),
> +                                        aEntry->pc());
> +    MOZ_ASSERT(filename);
> +
> +    char buffer[48]; // Enough to fit longest js file name from the tree

Should we add some padding here to future proof it a bit? Maybe 64 bytes?
Attachment #8437986 - Flags: review?(snorp) → review+
Comment on attachment 8437978 [details] [diff] [review]
Add HangStack class to support internal string buffer (v1)

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

::: toolkit/components/telemetry/Telemetry.cpp
@@ +3096,5 @@
>    }
>    if (mStack.length() != aOther.mStack.length()) {
>      return false;
>    }
> +  for (size_t i = 0; i < mStack.length(); i++) {

how about moving this logic into a HangStack::operator== method? It'd be nice if this code and the code in the closely-tied isSameAsEntry were in the same method

::: toolkit/components/telemetry/ThreadHangStats.h
@@ +63,5 @@
> +    , mBuffer(mozilla::Move(aOther.mBuffer))
> +  {
> +  }
> +
> +  bool isInBuffer(const char* aEntry) const {

Capitalize the first letter of the method names everywhere
Attachment #8437978 - Flags: review?(vdjeric) → review+
(In reply to Vladan Djeric (:vladan) from comment #5)
> Comment on attachment 8437978 [details] [diff] [review]
> Add HangStack class to support internal string buffer (v1)
> 
> ::: toolkit/components/telemetry/ThreadHangStats.h
> @@ +63,5 @@
> > +    , mBuffer(mozilla::Move(aOther.mBuffer))
> > +  {
> > +  }
> > +
> > +  bool isInBuffer(const char* aEntry) const {
> 
> Capitalize the first letter of the method names everywhere

I chose lowercase because HangStack inherits from mozilla::Vector, which has lowercase names. Also we're overriding base methods like clear(), so IMO for HangStack, we should keep the lowercase convention.
Yeah I figured out that you're using lowercase because you're inheriting from Vector, but it looks odd, since methods like "isInBuffer" and "isSameAsEntry" are clearly not STL methods. Anyway, I prefer uppercase, but if you feel very strongly about it, keep the lowercase.
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: