Closed
Bug 927979
Opened 11 years ago
Closed 11 years ago
Register the gecko thread correctly in the profiler for FxMetro
Categories
(Core :: Gecko Profiler, defect)
Tracking
()
RESOLVED
FIXED
mozilla27
People
(Reporter: kats, Assigned: jimm)
References
Details
Attachments
(2 files, 1 obsolete file)
3.70 KB,
patch
|
BenWa
:
review+
|
Details | Diff | Splinter Review |
653 bytes,
patch
|
BenWa
:
review+
|
Details | Diff | Splinter Review |
See https://bugzilla.mozilla.org/show_bug.cgi?id=886555#c20 as well as the next few comments. To get more useful profiles on Metro we need to register the gecko thread with the profiler correctly, which currently doesn't happen.
Assignee | ||
Comment 1•11 years ago
|
||
(In reply to Benoit Girard (:BenWa) from comment #24)
> I think kats is going to handle it. But we need to add these calls when the
> thread is started and ended:
> http://mxr.mozilla.org/mozilla-central/source/tools/profiler/GeckoProfiler.
> h#162
>
> Ideally for metro the main content thread would still be called 'GeckoMain'
> since that threads is treated differently. But right now the profiler
> assumes that the thread that calls profiler_init is the GeckoMain thread so
> we'd have to break this assumption. This is only important so higher level
> features like bug 918825 will work on metro, we could punt on that.
Sounds like we'll need:
1) the profiler will need a fix to break the relationship between 'GeckoMain' and the thread that calls profiler_init.
2) the real gecko thread in metro will need to register as 'GeckoMain'.
3) Looks like the compositor thread also needs to be registered.
On 1, maybe for metro we can simply ifdef this bit of code to use a different name -
http://mxr.mozilla.org/mozilla-central/source/tools/profiler/platform.cpp#392
Comment 2•11 years ago
|
||
Does metro ship a different XUL binary then desktop firefox? If not we can't pre-process ifdef there.
Comment 3•11 years ago
|
||
(In reply to comment #2)
> Does metro ship a different XUL binary then desktop firefox?
No.
Assignee | ||
Comment 4•11 years ago
|
||
(In reply to Benoit Girard (:BenWa) from comment #2)
> Does metro ship a different XUL binary then desktop firefox? If not we can't
> pre-process ifdef there.
Ah yes, sorry, sometimes I forget that we share everything. I bet we can use XRE_GetWindowsEnvironment() instead.
Assignee | ||
Comment 5•11 years ago
|
||
Assignee: nobody → jmathies
Attachment #819101 -
Flags: review?(bgirard)
Comment 6•11 years ago
|
||
Comment on attachment 819101 [details] [diff] [review]
patch
Review of attachment 819101 [details] [diff] [review]:
-----------------------------------------------------------------
I'd like for GeckoMain to always be considered the main thread even on Metro otherwise we're going to see more problems.
::: tools/profiler/platform.cpp
@@ +392,5 @@
>
> +#ifdef XP_WIN
> + if (XRE_GetWindowsEnvironment() == WindowsEnvironmentType_Metro) {
> + // We'll register GeckoMain once its gets created down in winrt widget.
> + Sampler::RegisterCurrentThread("Application Thread", stack, true, stackTop);
You're still setting this to be the main thread. true/false and perhaps modify the register thread to have GeckoMain imply that it's the main thread?
@@ +394,5 @@
> + if (XRE_GetWindowsEnvironment() == WindowsEnvironmentType_Metro) {
> + // We'll register GeckoMain once its gets created down in winrt widget.
> + Sampler::RegisterCurrentThread("Application Thread", stack, true, stackTop);
> + } else {
> + Sampler::RegisterCurrentThread("GeckoMain", stack, true, stackTop);
This should be shared with the non ifdef path
::: widget/windows/winrt/MetroApp.cpp
@@ +112,5 @@
> // Shut down xpcom
> XRE_metroShutdown();
> +
> + // Unhook this thread from the profiler
> + profiler_unregister_thread();
LGTM as long as there's no early return in between the context here.
Attachment #819101 -
Flags: review?(bgirard) → review-
Assignee | ||
Comment 7•11 years ago
|
||
> > +#ifdef XP_WIN
> > + if (XRE_GetWindowsEnvironment() == WindowsEnvironmentType_Metro) {
> > + // We'll register GeckoMain once its gets created down in winrt widget.
> > + Sampler::RegisterCurrentThread("Application Thread", stack, true, stackTop);
>
> You're still setting this to be the main thread. true/false and perhaps
> modify the register thread to have GeckoMain imply that it's the main thread?
Ah I see, I was thinking 'GeckoMain' was the token that identified the main thread. I see I need to pass a param to the sampler register function.
Comment 8•11 years ago
|
||
Honestly you could just remove the bool from the signature and infer it based on the name. That would probably be better.
Assignee | ||
Comment 9•11 years ago
|
||
Attachment #819101 -
Attachment is obsolete: true
Comment 10•11 years ago
|
||
Comment on attachment 819898 [details] [diff] [review]
patch v.2
Review of attachment 819898 [details] [diff] [review]:
-----------------------------------------------------------------
Drive-by review. LGTM.
::: tools/profiler/platform.cpp
@@ +378,5 @@
> +bool is_main_thread_name(const char* aName) {
> + if (aName) {
> + return false;
> + }
> + return !strcmp(aName, gGeckoThreadName);
nit: I don't like how this reads 'if it does not string compare' feels like it implies the opposite, I rather == 0.
Attachment #819898 -
Flags: review+
Assignee | ||
Comment 11•11 years ago
|
||
(In reply to Benoit Girard (:BenWa) from comment #10)
> Comment on attachment 819898 [details] [diff] [review]
> patch v.2
>
> Review of attachment 819898 [details] [diff] [review]:
> -----------------------------------------------------------------
>
> Drive-by review. LGTM.
>
> ::: tools/profiler/platform.cpp
> @@ +378,5 @@
> > +bool is_main_thread_name(const char* aName) {
> > + if (aName) {
> > + return false;
> > + }
> > + return !strcmp(aName, gGeckoThreadName);
>
> nit: I don't like how this reads 'if it does not string compare' feels like
> it implies the opposite, I rather == 0.
I debated using that form when I wrote it, mozilla's coding rules won out but I didn't like it either. I'm fine with this change.
Thanks for the review.
Comment 12•11 years ago
|
||
I use it for pointers but I try avoiding it when I expect the value 0 but use the proper style for pointer cehcks. I know it's a bit fuzzy =\. I override the style guide if readability is effected.
Assignee | ||
Comment 13•11 years ago
|
||
Status: NEW → RESOLVED
Closed: 11 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla27
Assignee | ||
Comment 15•11 years ago
|
||
Bah! Simple patch to fix a silly mistake.
Attachment #825465 -
Flags: review?
Assignee | ||
Updated•11 years ago
|
Attachment #825465 -
Flags: review? → review?(bgirard)
Assignee | ||
Comment 16•11 years ago
|
||
One additional problem I'm having here. When we register the main thread late like we do in metro, you don't get other threads in the profile. I've checked and they are registering, but the profile doesn't seem to pick them up. The only thread I see is GeckoMain.
Updated•11 years ago
|
Attachment #825465 -
Flags: review?(bgirard) → review+
Comment 17•11 years ago
|
||
(In reply to Jim Mathies [:jimm] from comment #16)
> One additional problem I'm having here. When we register the main thread
> late like we do in metro, you don't get other threads in the profile. I've
> checked and they are registering, but the profile doesn't seem to pick them
> up. The only thread I see is GeckoMain.
You want to make sure that in Sampler::RegisterCurrentThread they end up in sRegisteredThreads. This will also call TableTicker::RegisterThread which will check if we have this thread currently selected an allocate a ThreadProfile for it. Then in the sampling inside Thread::Run they should be read from sRegisteredThreads.
If you don't have 'profiler.threads' set to true then of course only the main thread will be profiled.
Assignee | ||
Comment 18•11 years ago
|
||
https://hg.mozilla.org/integration/fx-team/rev/1d65a43d4ed0
Thanks, will get this going again today and check over all the prefs.
Updated•10 years ago
|
OS: Windows 8 Metro → Windows 8.1
You need to log in
before you can comment on or make changes to this bug.
Description
•