Startup profiling should start before loading libxul
Categories
(Core :: Gecko Profiler, enhancement, P2)
Tracking
()
| Tracking | Status | |
|---|---|---|
| firefox69 | --- | fixed |
People
(Reporter: florian, Assigned: mozbugz)
References
(Blocks 3 open bugs)
Details
Attachments
(14 files, 2 obsolete files)
|
47 bytes,
text/x-phabricator-request
|
Details | Review | |
|
47 bytes,
text/x-phabricator-request
|
Details | Review | |
|
47 bytes,
text/x-phabricator-request
|
Details | Review | |
|
47 bytes,
text/x-phabricator-request
|
Details | Review | |
|
47 bytes,
text/x-phabricator-request
|
Details | Review | |
|
47 bytes,
text/x-phabricator-request
|
Details | Review | |
|
47 bytes,
text/x-phabricator-request
|
Details | Review | |
|
47 bytes,
text/x-phabricator-request
|
Details | Review | |
|
47 bytes,
text/x-phabricator-request
|
Details | Review | |
|
47 bytes,
text/x-phabricator-request
|
Details | Review | |
|
47 bytes,
text/x-phabricator-request
|
Details | Review | |
|
47 bytes,
text/x-phabricator-request
|
Details | Review | |
|
47 bytes,
text/x-phabricator-request
|
Details | Review | |
|
47 bytes,
text/x-phabricator-request
|
Details | Review |
Updated•7 years ago
|
Comment 1•7 years ago
|
||
Comment 2•7 years ago
|
||
Updated•7 years ago
|
| Assignee | ||
Comment 3•7 years ago
|
||
Thank you Nazim for starting on this and discussing options.
I'm now working on it. Still early days, doing preparatory work locally: Fixing #includes, moving away from XUL data structs, etc.; bugs to be filed...
I'll probably head towards Jim's suggested 2nd path: A standalone minimal profiler on which we can add more functionality through abstract interfaces and/or code injection. (Keeping in mind other wanted optimizations and features in case they can be better handled in a separate library, e.g.: bug 1518949.)
| Assignee | ||
Comment 4•7 years ago
|
||
MozProfiler will not be built by default (yet).
Add 'ac_add_options --enable-mozprofiler' in mozconfig to enable it on Linux,
Mac, and Windows.
| Assignee | ||
Comment 5•7 years ago
|
||
Almost-straight copy of a subset of files from tools/profiler to
mozglue/mozprofiler.
Some minor changes first:
- MOZ_GECKO_PROFILER -> MOZ_MOZPROFILER; so thanks to the previous patch we
won't even try to build this not-yet-buildable module. - Reduced moz.build to only mention actually-copied files.
- Headers in 'public' prefixed with "Moz" (to distinguish them from their
originals, in case they later get #included from the same units). - Also copied profiling categories from js/src/vm/GeckoProfiler.cpp to
ProfilingCategory.cpp, and copied js/src/vm/ProfilingStack.cpp, and their
respective headers -- as they are needed for a significant part of
the profiler API, and are not strictly js-specific.
Depends on D31922
| Assignee | ||
Comment 6•7 years ago
|
||
Almost-mechanical changes include:
- Removed unneeded/incompatible #includes and functions (any JS- or XPCOM-
related). - Use std::string for strings and nsIDs.
- Use hand-rolled AddRef&Release's for ref-counted classes -- could not use
mfbt/RefCounted.h because of bug 1536656. - Added some platform-specific polyfills, e.g.: MicrosecondsSince1970().
- Only record the main thread by default.
This now builds (with --enable-mozprofiler), but is not usable yet.
Depends on D31923
| Assignee | ||
Comment 7•7 years ago
|
||
By default, mozglue code will use OS-provided allocators, but this can lead to
issues if/when objects are allocated one way but destroyed another way (e.g.,
because they were transferred to/from outside code.)
To fix this, a new header core/CppMemory.h must be #included by every
compilation unit, so that all local built objects will use Mozilla allocators.
MozProfiler should now be usable; tests and more improvements to follow.
Depends on D31924
| Assignee | ||
Comment 8•7 years ago
|
||
Simple test program that exercises the most important APIs of MozProfiler.
(Including checking that macros work even when MozProfiler is not enabled.)
Depends on D31925
| Assignee | ||
Comment 9•7 years ago
|
||
Depends on D31926
| Assignee | ||
Comment 10•7 years ago
|
||
Notice the extra 'MOZ' in the env-var names.
This is to control MozProfiler separately from the Gecko Profiler.
Depends on D31927
| Assignee | ||
Comment 11•7 years ago
|
||
E.g., AUTO_PROFILER_INIT -> AUTO_MOZPROFILER_INIT.
This will allow #including MozProfiler.h anywhere as needed, without clashing
with Gecko Profiler macros.
Depends on D31928
| Assignee | ||
Comment 12•7 years ago
|
||
This prevents potential name clashes between the two profilers.
Depends on D31929
| Assignee | ||
Comment 13•7 years ago
|
||
Running identical (but separate) InitializeWin64ProfilerHooks in both profilers
confuses the DLL interceptor and the 2nd one crashes because of unexpected
opcodes introduced by the 1st one.
Depends on D31930
| Assignee | ||
Comment 14•7 years ago
|
||
If MOZ_MOZPROFILER_STARTUP and MOZ_PROFILER_STARTUP are set, this will integrate
a pre-XPCOM startup profile into the main profile.
It is stored as separate threads, which will appear as a new track under the
main process.
Only adding threads from MozProfiler means a better integration with Gecko
Profiler profiles, and is more efficient: Less code, and a smaller memory
footprint.
Depends on D31931
| Assignee | ||
Comment 15•7 years ago
|
||
Start using MozProfiler in Firefox main(), before&after XPCOM runs.
Also added a MozProfiler label around Gecko Profiler init/shutdown (so that
samples may be ignored if user is only interested in non-XPCOM profiling).
Main process name changed to "MozGeckoMain", so as not to confuse the
front-end.
Depends on D31932
| Assignee | ||
Comment 16•7 years ago
|
||
Depends on D31933
Updated•7 years ago
|
Updated•7 years ago
|
Updated•7 years ago
|
Updated•7 years ago
|
Updated•7 years ago
|
Updated•7 years ago
|
Updated•7 years ago
|
Updated•7 years ago
|
Updated•7 years ago
|
Updated•7 years ago
|
Updated•7 years ago
|
Updated•7 years ago
|
Updated•7 years ago
|
Updated•7 years ago
|
Updated•7 years ago
|
Updated•7 years ago
|
Updated•7 years ago
|
Updated•7 years ago
|
Updated•7 years ago
|
Updated•7 years ago
|
Updated•7 years ago
|
Updated•7 years ago
|
Updated•7 years ago
|
Updated•7 years ago
|
Updated•7 years ago
|
Updated•7 years ago
|
| Assignee | ||
Comment 17•7 years ago
|
||
Added baseprofiler to mozglue/moz.build, so it will be built.
However all cpp files are dependent on MOZ_BASE_PROFILER, which is currently
not #defined by default (in public/BaseProfiler.h).
Depends on D31923
Updated•7 years ago
|
Updated•7 years ago
|
Updated•7 years ago
|
Comment 18•7 years ago
|
||
Comment 19•7 years ago
|
||
Backed out 12 changesets (Bug 1492121) for platform.cpp and TestBaseProfiler.cpp related bustages
Push with failures: https://treeherder.mozilla.org/#/jobs?repo=autoland&fromchange=26c117fc572d8cace9694a3b08979b5963354234&tochange=4494c0e5d35d3b297842c45d11dcc8f02c210944&selectedJob=249882229
Backout link: https://hg.mozilla.org/integration/autoland/rev/4494c0e5d35d3b297842c45d11dcc8f02c210944
Failures logs:
https://treeherder.mozilla.org/logviewer.html#/jobs?job_id=249882229&repo=autoland&lineNumber=6092
[task 2019-06-04T08:51:41.483Z] 08:51:41 INFO - make[4]: Entering directory '/builds/worker/workspace/build/src/obj-firefox/mozglue/baseprofiler'
[task 2019-06-04T08:51:41.486Z] 08:51:41 INFO - /builds/worker/workspace/build/src/sccache/sccache /builds/worker/workspace/build/src/gcc/bin/g++ -o Unified_cpp_mozglue_baseprofiler0.o -c -I/builds/worker/workspace/build/src/obj-firefox/dist/stl_wrappers -I/builds/worker/workspace/build/src/obj-firefox/dist/system_wrappers -include /builds/worker/workspace/build/src/config/gcc_hidden.h -DDEBUG=1 -DIMPL_MFBT -DMOZ_VTUNE_INSTRUMENTATION -DMOZ_HAS_MOZGLUE -DIMPL_MFBT -I/builds/worker/workspace/build/src/mozglue/baseprofiler -I/builds/worker/workspace/build/src/obj-firefox/mozglue/baseprofiler -I/builds/worker/workspace/build/src/mozglue/baseprofiler/core -I/builds/worker/workspace/build/src/mozglue/linker -I/builds/worker/workspace/build/src/obj-firefox/dist/include -I/builds/worker/workspace/build/src/obj-firefox/dist/include/nspr -I/builds/worker/workspace/build/src/obj-firefox/dist/include/nss -fPIC -DMOZILLA_CLIENT -include /builds/worker/workspace/build/src/obj-firefox/mozilla-config.h -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 -fstack-protector-strong -Wall -Wempty-body -Wignored-qualifiers -Woverloaded-virtual -Wpointer-arith -Wsign-compare -Wtype-limits -Wunreachable-code -Wwrite-strings -Wno-invalid-offsetof -Wduplicated-cond -Wno-error=maybe-uninitialized -Wno-error=deprecated-declarations -Wno-error=array-bounds -Wno-error=coverage-mismatch -Wno-error=free-nonheap-object -Wformat -D_GLIBCXX_USE_CXX11_ABI=0 -fno-sized-deallocation -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 -fstack-protector-strong -fno-exceptions -fno-strict-aliasing -fno-rtti -ffunction-sections -fdata-sections -fno-exceptions -fno-math-errno -pthread -pipe -g -freorder-blocks -Os -fno-omit-frame-pointer -funwind-tables -Werror -Wno-error=shadow -Wno-ignored-qualifiers -MD -MP -MF .deps/Unified_cpp_mozglue_baseprofiler0.o.pp /builds/worker/workspace/build/src/obj-firefox/mozglue/baseprofiler/Unified_cpp_mozglue_baseprofiler0.cpp
[task 2019-06-04T08:51:41.486Z] 08:51:41 INFO - In file included from /builds/worker/workspace/build/src/obj-firefox/mozglue/baseprofiler/Unified_cpp_mozglue_baseprofiler0.cpp:101:0:
[task 2019-06-04T08:51:41.487Z] 08:51:41 INFO - /builds/worker/workspace/build/src/mozglue/baseprofiler/core/platform.cpp: In function 'void mozilla::baseprofiler::profiler_ensure_started(uint32_t, double, uint32_t, const char**, uint32_t, const mozilla::Maybe<double>&)':
[task 2019-06-04T08:51:41.487Z] 08:51:41 ERROR - /builds/worker/workspace/build/src/mozglue/baseprofiler/core/platform.cpp:2682:8: error: variable 'startedProfiler' set but not used [-Werror=unused-but-set-variable]
[task 2019-06-04T08:51:41.487Z] 08:51:41 INFO - bool startedProfiler = false;
[task 2019-06-04T08:51:41.487Z] 08:51:41 INFO - ^~~~~~~~~~~~~~~
[task 2019-06-04T08:51:41.487Z] 08:51:41 INFO - cc1plus: all warnings being treated as errors
[task 2019-06-04T08:51:41.487Z] 08:51:41 INFO - /builds/worker/workspace/build/src/config/rules.mk:810: recipe for target 'Unified_cpp_mozglue_baseprofiler0.o' failed
[task 2019-06-04T08:51:41.487Z] 08:51:41 ERROR - make[4]: *** [Unified_cpp_mozglue_baseprofiler0.o] Error 1
[task 2019-06-04T08:51:41.487Z] 08:51:41 INFO - make[4]: Leaving directory '/builds/worker/workspace/build/src/obj-firefox/mozglue/baseprofiler'
[task 2019-06-04T08:51:41.487Z] 08:51:41 INFO - /builds/worker/workspace/build/src/config/recurse.mk:74: recipe for target 'mozglue/baseprofiler/target' failed
[task 2019-06-04T08:51:41.487Z] 08:51:41 ERROR - make[3]: *** [mozglue/baseprofiler/target] Error 2
[task 2019-06-04T08:51:41.487Z] 08:51:41 INFO - make[3]: *** Waiting for unfinished jobs....
[task 2019-06-04T08:51:41.488Z] 08:51:41 INFO - make[4]: Entering directory '/builds/worker/workspace/build/src/obj-firefox/media/libjpeg'
[task 2019-06-04T08:51:41.491Z] 08:51:41 INFO - media/libjpeg/jcapimin.o
https://treeherder.mozilla.org/logviewer.html#/jobs?job_id=249882141&repo=autoland&lineNumber=36379
[task 2019-06-04T08:51:48.500Z] 08:51:48 INFO - make[4]: Leaving directory '/builds/worker/workspace/build/src/obj-firefox/mozglue/tests/interceptor'
[task 2019-06-04T08:51:48.500Z] 08:51:48 INFO - make[4]: Entering directory '/builds/worker/workspace/build/src/obj-firefox/mozglue/tests'
[task 2019-06-04T08:51:48.501Z] 08:51:48 INFO - /builds/worker/workspace/build/src/sccache/sccache /builds/worker/workspace/build/src/clang/bin/x86_64-w64-mingw32-clang++ -mwindows -o TestBaseProfiler.o -c -DDEBUG=1 -DMOZ_HAS_MOZGLUE -I/builds/worker/workspace/build/src/mozglue/tests -I/builds/worker/workspace/build/src/obj-firefox/mozglue/tests -I/builds/worker/workspace/build/src/obj-firefox/dist/include -I/builds/worker/workspace/build/src/obj-firefox/dist/include/testing -I/builds/worker/workspace/build/src/obj-firefox/dist/include/nspr -I/builds/worker/workspace/build/src/obj-firefox/dist/include/nss -DMOZILLA_CLIENT -include /builds/worker/workspace/build/src/obj-firefox/mozilla-config.h -Qunused-arguments -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 -Qunused-arguments -Wall -Wbitfield-enum-conversion -Wempty-body -Wignored-qualifiers -Woverloaded-virtual -Wpointer-arith -Wshadow-field-in-constructor-modified -Wsign-compare -Wtype-limits -Wunreachable-code -Wunreachable-code-return -Wwrite-strings -Wno-invalid-offsetof -Wclass-varargs -Wfloat-overflow-conversion -Wfloat-zero-conversion -Wloop-analysis -Wc++1z-compat -Wc++2a-compat -Wcomma -Wimplicit-fallthrough -Wstring-conversion -Wtautological-overlap-compare -Wtautological-unsigned-enum-zero-compare -Wtautological-unsigned-zero-compare -Wno-inline-new-delete -Wno-error=deprecated-declarations -Wno-error=array-bounds -Wno-error=backend-plugin -Wno-error=return-std-move -Wno-error=atomic-alignment -Wno-unknown-pragmas -Wno-unused-function -Wno-conversion-null -Wno-switch -Wno-enum-compare -Wno-gnu-zero-variadic-macro-arguments -Wno-unknown-warning-option -Wno-return-type-c-linkage -fno-sized-deallocation -fms-extensions -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 -fno-exceptions -fno-strict-aliasing -mms-bitfields -Wno-incompatible-ms-struct -fno-rtti -ffunction-sections -fdata-sections -Wa,-mbig-obj -fno-exceptions -fno-math-errno -pipe -g -gcodeview -O1 -fno-omit-frame-pointer -funwind-tables -MD -MP -MF .deps/TestBaseProfiler.o.pp /builds/worker/workspace/build/src/mozglue/tests/TestBaseProfiler.cpp
[task 2019-06-04T08:51:48.501Z] 08:51:48 ERROR - /builds/worker/workspace/build/src/mozglue/tests/TestBaseProfiler.cpp:20:4: error:
[task 2019-06-04T08:51:48.501Z] 08:51:48 INFO - # error
[task 2019-06-04T08:51:48.501Z] 08:51:48 INFO - ^
[task 2019-06-04T08:51:48.501Z] 08:51:48 INFO - 1 error generated.
[task 2019-06-04T08:51:48.501Z] 08:51:48 INFO - /builds/worker/workspace/build/src/config/rules.mk:810: recipe for target 'TestBaseProfiler.o' failed
[task 2019-06-04T08:51:48.501Z] 08:51:48 ERROR - make[4]: *** [TestBaseProfiler.o] Error 1
[task 2019-06-04T08:51:48.501Z] 08:51:48 INFO - make[4]: Leaving directory '/builds/worker/workspace/build/src/obj-firefox/mozglue/tests'
[task 2019-06-04T08:51:48.501Z] 08:51:48 INFO - make[4]: *** Waiting for unfinished jobs....
| Assignee | ||
Comment 20•7 years ago
|
||
Looks like I didn't pick enough build jobs in my Try... Thanks Bodgan, will follow up.
| Assignee | ||
Comment 21•7 years ago
|
||
Another failure in 'pkg':
https://treeherder.mozilla.org/logviewer.html#/jobs?job_id=249882250&repo=autoland&lineNumber=87673
[task 2019-06-04T08:51:52.994Z] The error occurred while processing the following file:
[task 2019-06-04T08:51:52.994Z]
[task 2019-06-04T08:51:52.995Z] /builds/worker/workspace/sm-package/mozjs-69.0a1.0/mozglue/moz.build
[task 2019-06-04T08:51:52.995Z]
[task 2019-06-04T08:51:52.995Z] The underlying problem is we referenced a path that does not exist. That path is:
[task 2019-06-04T08:51:52.995Z]
[task 2019-06-04T08:51:52.995Z] /builds/worker/workspace/sm-package/mozjs-69.0a1.0/mozglue/baseprofiler/moz.build
So I'll need to add mozglue/baseprofiler in there. (Can't see a way not to, as mozglue/moz.build now unconditionally refers to it.)
| Assignee | ||
Comment 22•7 years ago
|
||
Added mozglue/mozprofiler to js/src/make-source-package.sh, because
mozglue/moz.build will refer to it unconditionally.
Note that if MOZ_GECKO_PROFILER and MOZ_BASE_PROFILER are not defined, no
actual code will be generated.
Depends on D31923
Updated•7 years ago
|
Updated•7 years ago
|
Comment 23•7 years ago
|
||
Comment 24•7 years ago
|
||
Backed out 13 changesets (Bug 1492121) for valgrind bustage
Failure log: https://treeherder.mozilla.org/logviewer.html#/jobs?job_id=250270901&repo=autoland&lineNumber=40901
Backout: https://hg.mozilla.org/integration/autoland/rev/d57670df353e6d6ca69d88f7415a011c2db43b5d
| Assignee | ||
Comment 25•7 years ago
|
||
Thanks Noemi. I thought I had done an "everything" try from ./mach try chooser but it seems it doesn't actually do everything 😒
| Assignee | ||
Comment 26•7 years ago
|
||
Valgrind report:
TEST-UNEXPECTED-FAIL | valgrind-test | 192 bytes in 3 blocks are definitely lost at malloc / dl_open_worker / _dl_catch_error / _dl_open
==2561== 192 bytes in 3 blocks are definitely lost in loss record 348 of 399
==2561== at 0x4C2B240: malloc+112 (vg_replace_malloc.c:298)
==2561== by 0x4012919: dl_open_worker+1977 (dl-open.c:457)
==2561== by 0x400DD55: _dl_catch_error+101 (dl-error.c:178)
==2561== by 0x4011CC9: _dl_open+185 (dl-open.c:633)
==2561== by 0x5051F65: dlopen_doit+101 (dlopen.c:67)
==2561== by 0x400DD55: _dl_catch_error+101 (dl-error.c:178)
==2561== by 0x50522EB: _dlerror_run+123 (dlerror.c:164)
==2561== by 0x5051EE0: dlopen@@GLIBC_2.2.5+48 (dlopen.c:88)
==2561== by 0x1148FC: GetLibHandle (xpcom/glue/standalone/nsXPCOMGlue.cpp:86)
==2561== by 0x1148FC: ReadDependentCB (xpcom/glue/standalone/nsXPCOMGlue.cpp:136)
==2561== by 0x1148FC: XPCOMGlueLoad (xpcom/glue/standalone/nsXPCOMGlue.cpp:306)
==2561== by 0x1148FC: mozilla::GetBootstrap(char const*, mozilla::LibLoadingStrategy)+572 (xpcom/glue/standalone/nsXPCOMGlue.cpp:374)
==2561== by 0x114213: InitXPCOMGlue(mozilla::LibLoadingStrategy)+131 (browser/app/nsBrowserApp.cpp:223)
==2561== by 0x113E6B: main+219 (browser/app/nsBrowserApp.cpp:284)
Nothing due directly to this patch, so it is likely a dlopen issue.
Depends on D31932
Comment 27•7 years ago
|
||
Comment 28•7 years ago
|
||
| bugherder | ||
https://hg.mozilla.org/mozilla-central/rev/64fe00416593
https://hg.mozilla.org/mozilla-central/rev/1a63bc8f0afd
https://hg.mozilla.org/mozilla-central/rev/838a84ef85f8
https://hg.mozilla.org/mozilla-central/rev/d0be75b5f773
https://hg.mozilla.org/mozilla-central/rev/3a7f3ab482b1
https://hg.mozilla.org/mozilla-central/rev/4d72e64503c8
https://hg.mozilla.org/mozilla-central/rev/842723642da6
https://hg.mozilla.org/mozilla-central/rev/b4c77fd9b97d
https://hg.mozilla.org/mozilla-central/rev/a4c102433761
https://hg.mozilla.org/mozilla-central/rev/a679e252817a
https://hg.mozilla.org/mozilla-central/rev/ebe23063def2
https://hg.mozilla.org/mozilla-central/rev/0cbffc5bb535
https://hg.mozilla.org/mozilla-central/rev/ebfca0243df2
https://hg.mozilla.org/mozilla-central/rev/0b97aaf0efce
Description
•