Closed Bug 499692 Opened 16 years ago Closed 14 years ago

Implement performance and memory sampler hooks for external scripting languages

Categories

(Tamarin Graveyard :: Tools, defect, P4)

Tracking

(Not tracked)

RESOLVED FIXED
Q1 12 - Brannan

People

(Reporter: achicu, Assigned: treilly)

References

Details

(Whiteboard: has-patch)

Attachments

(1 file, 17 obsolete files)

41.57 KB, patch
treilly
: review+
stejohns
: superreview+
Details | Diff | Splinter Review
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US) AppleWebKit/530.5 (KHTML, like Gecko) Chrome/2.0.172.31 Safari/530.5 Build Identifier: 1. Implement a method to inject callstack nodes from external scripting languages, so that you can profile both AS3 and the other scripting language. 2. Add sample types that for external scripting languages objects. Reproducible: Always
Attached patch patch (obsolete) — Splinter Review
Attachment #384891 - Flags: review?(tierney)
Component: API → Tools
Attached patch patch (obsolete) — Splinter Review
Attachment #384891 - Attachment is obsolete: true
Attachment #385084 - Flags: superreview?
Attachment #385084 - Flags: review?
Attachment #384891 - Flags: review?(tierney)
Attachment #385084 - Flags: review? → review?(treilly)
Comment on attachment 385084 [details] [diff] [review] patch Getting closer! Can we union functionId with the fields you don't need in CallStackNode/Element? What's forceWrite for?
If we union the functionId with something else it will become hard to write the samples in Sampler::writeRawSample (considering x86 / x64 differences), so that reading them is as simple as reinterpreting that buffer as StackTrace::Element. I'm looking at a solution right now. forceWrite: It is used to bypass the check for samplingAllAllocs. In case samplingAllAllocs is disabled (and is disabled by default) I still want to sample the objects from the external script language. It will only be true when called from the other language allocator.
If m_info == 0 it means the stack node is a fake CallFrame or it is an external script callframe. The fake CallFrame uses m_name and both use m_linenum. We can use another value for m_info (for example 1) in the case of the external script frame and union {{m_name, m_filename} with m_functionId} in the x86 case and {m_filename with functionId} in the x64 bit build. I'm working on a patch.
Attachment #385138 - Flags: review?(treilly)
Attached patch patch fix (obsolete) — Splinter Review
Moved "#ifdef DEBUGGER" out of AvmCore::createSampler(). The patch with StackTrace::Element already contains this fix.
Attachment #385084 - Attachment is obsolete: true
Attachment #385143 - Flags: review?(treilly)
Attachment #385084 - Flags: superreview?
Attachment #385084 - Flags: review?(treilly)
Comment on attachment 385138 [details] [diff] [review] patch with union in StackTrace::Element Looks good to me, asking Ed for superreview.
Attachment #385138 - Flags: superreview?(edwsmith)
Attachment #385138 - Flags: review?(treilly)
Attachment #385138 - Flags: review+
Attachment #385143 - Flags: review?(treilly) → review+
Attachment #385138 - Flags: superreview?(edwsmith) → superreview-
Comment on attachment 385138 [details] [diff] [review] patch with union in StackTrace::Element The #ifdef AVMPLUS_64BIT code isn't needed, since it doesn't reduce the structure size. If it's really needed, a good comment explaining why is required. Also, AVMPLUS_64BIT is deprecated, please use VMCFG_64BIT.
Attached patch patch without AVMPLUS 64 BIT (obsolete) — Splinter Review
I've removed AVMPLUS 64 BIT.
Attachment #385138 - Attachment is obsolete: true
Attachment #387655 - Flags: superreview?(edwsmith)
Attachment #387655 - Flags: review?(treilly)
Attachment #387655 - Flags: superreview?(edwsmith)
Attachment #387655 - Flags: review?(treilly)
Attachment #387655 - Flags: superreview+
Renamed hasFunctionId() to isAS3Sample() and used VMCFG_64BIT instead. I've used the #ifdef VMCFG_64BIT becuase Element is serialized in Sampler.cpp and we can not let the compiler auto arrange the elements in the union. (In Sampler::writeRawSample the Element is serialized by writing values one by one, while in Sampler::readSample the Element is deserialized by reinterpreting the pointer to the start of the buffer as an Element*)
Attachment #387655 - Attachment is obsolete: true
Attachment #387663 - Flags: superreview?(edwsmith)
Attachment #387663 - Flags: review?(treilly)
Attachment #387663 - Flags: review?(treilly) → review+
Comment on attachment 387663 [details] [diff] [review] added comment and used VMCFG_64BIT The part about how we decode by casting to Element* (explaining why the 64bit specialization is needed) also deserves a comment, since it actually explains *why* we do this layout. (ok, it forces the compiler, but why...). add that explanation to the comment, and otherwise, looks ok.
Attachment #387663 - Flags: superreview?(edwsmith) → superreview+
Attached patch added a better comment (obsolete) — Splinter Review
Attachment #387663 - Attachment is obsolete: true
Attachment #387664 - Flags: superreview?(edwsmith)
Attachment #387664 - Flags: review?(treilly)
Comment on attachment 387664 [details] [diff] [review] added a better comment cool, by the way: once we R+, no need to re-review even if minor tweaks were requested.
Attachment #387664 - Flags: superreview?(edwsmith)
Attachment #387664 - Flags: superreview+
Attachment #387664 - Flags: review?(treilly)
* fixed isAS3Sample to actually detect AS3, not script samples * rearranged the Element struct elements as MSVC++ compiler increased the struct size to 24 bytes because the largest element (uint64_t) was in the middle of the struct and padded with 4 bytes after first (m_info) and after the last (m_linenum)
Attachment #387664 - Attachment is obsolete: true
Attachment #385143 - Attachment is obsolete: true
Last patch needs a review request (if you want it reviewed)....
Attachment #389892 - Flags: superreview?(stejohns)
Attachment #389892 - Flags: review?(treilly)
Attachment #389892 - Flags: review?(treilly) → review+
Comment on attachment 389892 [details] [diff] [review] fixed an issue and rearranged Element struct to avoid MSVC compiler padding Patch will no longer apply cleanly after the patch for https://bugzilla.mozilla.org/show_bug.cgi?id=487027 was pushed. (Cleanup of the patch results in code that won't compile). Please rebase the patch to the current tip with that in mind.
Attachment #389892 - Flags: superreview?(stejohns) → superreview-
Attached patch rebased patch (obsolete) — Splinter Review
Attachment #391297 - Flags: superreview?(stejohns)
Attachment #391297 - Flags: review?(treilly)
Attachment #389892 - Attachment is obsolete: true
Comment on attachment 391297 [details] [diff] [review] rebased patch -- General comment: while I understand the need and motivation for this change (to wit: dealing with struct padding issues while conserving memory via intelligent unioning), I'm concerned that the way this is coded is a bit brittle and perhaps subject to breakage from future changes, since both StackTrace::Element and Sampler::writeRawSample have to remain in careful synchronization to avoid memory corruption. Could we consolidate all the 32/64 special-casing into StackTrace::Element and avoid having to have Sampler::writeRawSample also know about the intimate details? -- FAKE_CALL_FRAME doesn't appear to be used anywhere. Do we need it? What's it for? -- In Sampler.cpp, the comment: // FIXME: can filename can be stored in the AbstractInfo? is troublesome; what is the "AbstractInfo"? In general, checking in code with known things that require fixing is not something we want to do. -- Style Nit: existing code in Sampler favors using NULL (rather than 0) for null pointers; can we maintain this rather than mixing usage? -- Style Nit: the coding style if (condition) { foo(); } else { bar(); } is not preferred in this codebase, instead please use if (condition) { foo(); } else { bar(); }
Attachment #391297 - Flags: superreview?(stejohns) → superreview-
That FIXME is an ancient one from me and isn't introduced by this patch. It refers to the fact having 3 elements (line,file,info) could be 2 elements (line,info) if we stored the file in the info
Attachment #391297 - Flags: review?(treilly) → review+
Attached patch patchSplinter Review
Addressed Steven's comments.
Attachment #391297 - Attachment is obsolete: true
Attachment #391580 - Flags: superreview?(stejohns)
Attachment #391580 - Flags: review?(treilly)
Attachment #391580 - Flags: review?(treilly) → review+
Attachment #391580 - Flags: superreview?(stejohns) → superreview+
Comment on attachment 391580 [details] [diff] [review] patch much nicer! thanks for taking the time to clean it up. who's pushing this, me or Tommy?
pushed: changeset: 2288:0d9774c9f7ac user: Tommy Reilly <treilly@adobe.com> date: Fri Jul 31 10:43:12 2009 -0400 summary: implement performance and memory sampler hooks for external scripting languages (r=stejohns,me,ed)
Attached patch patch (obsolete) — Splinter Review
The CallStackNodes for the external scripting language do not use stack memory, instead I create a big buffer from the start. In that case I need to be able to remove CallStackNodes from the list when sampling stops while still having CallStackNodes from the external language in the list.
Attachment #394048 - Flags: superreview?(stejohns)
Attachment #394048 - Flags: review?(treilly)
This change makes me nervous -- I don't want to approve it until I can see the context of how it is being used.
Attachment #394048 - Flags: review?(treilly) → review+
I cannot keep CallStackNodes on the stack and I use a 200 elements buffer instead. When the buffer is full (recursion level is > 200) the stack trace is not updated anymore, but it still keeps taking samples. However, when sampling is stopped while external script CallStackNodes are in the list, the nodes have to be removed, because the buffer is deleted. This is what I use to delete the external script nodes: CallStackNode* prevAS3StackNode = NULL; // points to the last AS3 node CallStackNode* stackNode = core->callStack; while (stackNode) { if (stackNode->functionId()) { // Remove this external script node if (prevAS3StackNode) { // Update the previous AS3 node to link to the following one. prevAS3StackNode->setNext(stackNode->next()); } else { // This is the first node in the list. Update the head of the list. core->callStack = stackNode->next(); } } else { // update the last AS3 stack node prevAS3StackNode = stackNode; } stackNode = stackNode->next(); }
Comment on attachment 394048 [details] [diff] [review] patch Approved on the condition a comment is added, explaining this is only for use by the external profiler, etc...
Attachment #394048 - Flags: superreview?(stejohns) → superreview+
Attached patch fix (obsolete) — Splinter Review
Fixing "void CallStackNode::init(AvmCore* core, uint64_t functionId, int32_t lineno)" to correctly set the m_info to NULL for External Script call stack nodes.
Attachment #395055 - Flags: superreview?(stejohns)
Attachment #395055 - Flags: review?(treilly)
Attachment #395055 - Flags: superreview?(stejohns) → superreview+
Comment on attachment 394048 [details] [diff] [review] patch pushed as changeset: 2381:bf258eb2e048
Attachment #394048 - Attachment is obsolete: true
Attachment #395055 - Attachment is obsolete: true
Attachment #395055 - Flags: review?(treilly)
Comment on attachment 395055 [details] [diff] [review] fix pushed as changeset: 2381:bf258eb2e048
Attachment #401398 - Flags: superreview?
Attachment #401398 - Flags: review?
Comment on attachment 401398 [details] [diff] [review] Write the id as as double not as uint64 want me to push this for you?
Attachment #401398 - Flags: superreview?
Attachment #401398 - Flags: review?
Attachment #401398 - Flags: review+
yes please
Comment on attachment 401398 [details] [diff] [review] Write the id as as double not as uint64 pushed to redux as changeset: 2574:15ecbc9640a2
Attachment #401398 - Attachment is obsolete: true
Attached patch API rename after review (obsolete) — Splinter Review
Renamed StackFrame.id to StackFrame.scriptID. (Please push this for me)
Attachment #403995 - Flags: superreview?
Attachment #403995 - Flags: review?
Attached patch fixing assert (obsolete) — Splinter Review
This fixes the assert in Sampler.cpp on line 596 for script call stacks NULL_OR_MARKED(e->fakename()); The fakename is in a union that is overwritted by the script id.
Attachment #404028 - Flags: superreview?
Attachment #404028 - Flags: review?
Did you mean to ask for a review for these patches? If you, you generally should ask a specific person for a review, rather than just flagging it "review?" I'll do the review on these for now (and push if OK), just FYI for next time
Comment on attachment 403995 [details] [diff] [review] API rename after review pushed as changeset: 2661:de8dea4d1d13
Attachment #403995 - Attachment is obsolete: true
Attachment #403995 - Flags: superreview?
Attachment #403995 - Flags: review?
Comment on attachment 404028 [details] [diff] [review] fixing assert pushed as changeset: 2661:de8dea4d1d13
Attachment #404028 - Attachment is obsolete: true
Attachment #404028 - Flags: superreview?
Attachment #404028 - Flags: review?
Priority: -- → P3
Target Milestone: --- → flash10.1
Status: UNCONFIRMED → NEW
Ever confirmed: true
Priority: P3 → P4
Attached patch GC fix (obsolete) — Splinter Review
GC reaps objects without notifying the sampler. That's because the GC is not set active when objects are reaped in the SetStackEnter() call.
Attachment #406424 - Flags: superreview?(stejohns)
Attachment #406424 - Flags: superreview?(stejohns) → superreview-
Comment on attachment 406424 [details] [diff] [review] GC fix This looks pretty harmless and safe to me, but I'm not qualified to review this code section -- removing myself from review request. Lars/Tommy really need to review this.
Attachment #406424 - Flags: superreview- → superreview?(treilly)
Attachment #406424 - Flags: superreview?(treilly)
Attachment #406424 - Flags: superreview?(lhansen)
Attachment #406424 - Flags: review?(treilly)
Comment on attachment 406424 [details] [diff] [review] GC fix I believe the fix is correct. We'll wait for Tommy, then think about landing it.
Attachment #406424 - Flags: superreview?(lhansen) → superreview+
Attachment #406424 - Flags: review?(treilly) → review+
I'll land it when I have a chance, within the next day or so.
Assignee: nobody → lhansen
Status: NEW → ASSIGNED
Whiteboard: Has patch
Attached patch patch (obsolete) — Splinter Review
The presweep callbacks can explicitly add GC work items and a mark is necessary after they are called. There's no need to flush barriers as the the presweep callbacks can't drive marking or trigger write barriers as the barrier is disabled.
Attachment #407969 - Flags: superreview?(lhansen)
Attached patch patch (obsolete) — Splinter Review
Fixed the sampler, now it disables itself when stack overflows while marking.
Attachment #407969 - Attachment is obsolete: true
Attachment #407979 - Flags: superreview?(lhansen)
Attachment #407969 - Flags: superreview?(lhansen)
Comment on attachment 407979 [details] [diff] [review] patch Sure, let's try it. I will push it.
Attachment #407979 - Flags: superreview?(lhansen) → superreview+
Attachment #406424 - Attachment is obsolete: true
Comment on attachment 406424 [details] [diff] [review] GC fix redux changeset: 2858:c56c51ed52a0
Comment on attachment 407979 [details] [diff] [review] patch redux changeset: 2858:c56c51ed52a0
Attachment #407979 - Attachment is obsolete: true
Assignee: lhansen → nobody
Target Milestone: flash10.1 → flash10.2
This is a mass change. Every comment has "assigned-to-new" in it. I didn't look through the bugs, so I'm sorry if I change a bug which shouldn't be changed. But I guess these bugs are just bugs that were once assigned and people forgot to change the Status back when unassigning.
Status: ASSIGNED → NEW
can we close this one? only one non-obsolete patch is outstanding and it's R+. Someone needs to rebase/push.
Depends on: 645018
Retargeting for landing by Steven in Anza.
Flags: flashplayer-qrb+
Flags: flashplayer-injection-
Flags: flashplayer-bug-
Target Milestone: Q3 11 - Serrano → Q4 11 - Anza
Tom, rebase, land, and close in Brannan.
Summary: implement performance and memory sampler hooks for external scripting languages → Implement performance and memory sampler hooks for external scripting languages
Whiteboard: Has patch → has-patch
Target Milestone: Q4 11 - Anza → Q1 12 - Brannan
Assignee: nobody → treilly
Flags: flashplayer-needsbackport-
changeset: 2288:0d9774c9f7ac user: Tommy Reilly <treilly@adobe.com> date: Fri Jul 31 10:43:12 2009 -0400 summary: implement performance and memory sampler hooks for external scripting languages (r=stejohns,me,ed)
Status: NEW → RESOLVED
Closed: 14 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: