Closed Bug 853358 Opened 11 years ago Closed 11 years ago

Add plugin profiling support

Categories

(Core :: Gecko Profiler, defect)

x86
macOS
defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla23

People

(Reporter: BenWa, Assigned: BenWa)

References

Details

Attachments

(1 file, 5 obsolete files)

Currently when we want to do multi-process profiling we contact and signal each process manually and run a script to combine the profiling. It should be easy to use an IPC message to do this ourselves.
Attached patch patch (obsolete) — Splinter Review
Asking ehsan for profiler changes, benjamin for plugins.
Assignee: nobody → bgirard
Status: NEW → ASSIGNED
Attachment #727571 - Flags: review?(benjamin)
Attachment #727571 - Flags: review?(ehsan)
Comment on attachment 727571 [details] [diff] [review]
patch

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

::: dom/plugins/ipc/PluginModuleParent.cpp
@@ +1738,5 @@
> +PluginProfilerObserver::Observe(nsISupports *aSubject,
> +                                const char *aTopic,
> +                                const PRUnichar *aData)
> +{
> +    ProfileSaveEvent* pse = (ProfileSaveEvent*)aSubject;

No, you cannot guarantee that this will be safe since anyone can send this notification.  Please add an XPCOM interface and implement it properly.

::: tools/profiler/GeckoProfilerImpl.h
@@ +295,5 @@
>    }
>    stack->addMarker(aMarker);
>  }
>  
> +class ProfileSaveEvent MOZ_FINAL : public nsISupports {

Please move this to TableTicker.cpp.

::: tools/profiler/TableTicker.cpp
@@ +167,5 @@
> +  JSAObjectBuilder* mBuilder;
> +  JSCustomArray* mThreads;
> +};
> +
> +void subprocess_callback(const char* aProfile, void* aClosure)

Nit: SubProcessCallback

@@ +207,5 @@
> +  closure.mThreads = threads;
> +
> +  nsCOMPtr<nsIObserverService> os = mozilla::services::GetObserverService();
> +  if (os) {
> +    os->NotifyObservers(new ProfileSaveEvent(subprocess_callback, &closure), "profiler-subprocess", nullptr);

ProfileSaveEvent is an XPCOM class, so you should hold on to it in a local nsRefPtr.  Otherwise, if an Observe implementation puts it into an nsCOMPtr, for example, the object will be destroyed prematurely when that nsCOMPtr is destroyed (since Release gets called which gets the refcount to 0.)
Attachment #727571 - Flags: review?(ehsan) → review-
Attached patch patch (obsolete) — Splinter Review
Attachment #727571 - Attachment is obsolete: true
Attachment #727571 - Flags: review?(benjamin)
Attachment #729556 - Flags: review?(ehsan)
Comment on attachment 729556 [details] [diff] [review]
patch

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

Can you please ask somebody else to look at the plugin changes?  I'll try to get to this review some time this week but that may not be very likely.  Sorry. :(
Comment on attachment 729556 [details] [diff] [review]
patch

Yes, I just wanted to let you get a first pass before asking for the plugin bits to be reviewed.
Attachment #729556 - Flags: review?(benjamin)
Comment on attachment 729556 [details] [diff] [review]
patch

I wonder if it wouldn't make more sense to write the profile to a temporary file. But either way, r=me on the plugin bits
Attachment #729556 - Flags: review?(benjamin) → review+
(In reply to Benjamin Smedberg  [:bsmedberg] from comment #6)
> Comment on attachment 729556 [details] [diff] [review]
> patch
> 
> I wonder if it wouldn't make more sense to write the profile to a temporary
> file.

Have the plugin process write it's data to a file and have the parent process load it back up? It feels like that would be more flaky.
Comment on attachment 729556 [details] [diff] [review]
patch

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

::: tools/profiler/Makefile.in
@@ +47,5 @@
>    platform.cpp \
>    nsProfilerFactory.cpp \
>    nsProfiler.cpp \
>    TableTicker.cpp \
> +	SaveProfileTask.cpp \

Nit: use spaces please.
Attachment #729556 - Flags: review?(ehsan) → review+
Attached patch patch rebased (obsolete) — Splinter Review
Attachment #729556 - Attachment is obsolete: true
Attachment #735365 - Flags: review+
Attached patch patch rebased + warning fix (obsolete) — Splinter Review
Attachment #735365 - Attachment is obsolete: true
(patch queue had a bad patch inside of it):
https://tbpl.mozilla.org/?tree=Try&rev=0f89c96118c1
Attached patch patch rebased again (obsolete) — Splinter Review
non trivial rebase again:
https://tbpl.mozilla.org/?tree=Try&rev=c90e6080f55a
Attachment #735401 - Attachment is obsolete: true
Attachment #741150 - Flags: review+
Comment on attachment 741427 [details] [diff] [review]
patch rebased again

I never got review on the plugin part.
Attachment #741427 - Flags: review?(benjamin)
Comment on attachment 741427 [details] [diff] [review]
patch rebased again

Didn't see that I already got review.
Attachment #741427 - Flags: review?(benjamin)
https://hg.mozilla.org/mozilla-central/rev/c759d3eb1118
Status: ASSIGNED → RESOLVED
Closed: 11 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla23
Depends on: 866239
Depends on: 920909
Blocks: 921301
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: