Граф коммитов

361 Коммитов

Автор SHA1 Сообщение Дата
Jan Beich 41d0350039 Bug 1460147 - Unbreak platforms without GeckoProfiler after bug 1457323. r=mstange
MozReview-Commit-ID: 5gqME25bjOi

--HG--
extra : rebase_source : 35f2add747a4be79e69f1f98014531ff3932645a
2018-05-09 03:14:32 +00:00
Randell Jesup 734a1bb77d Bug 1457323: Add network markers to Content processes, add redirects and improve markers r=mstange
Markers exist in Master and each Content process has markers for it's own
loads.  Note that there may be a time delay between content and master.
2018-05-08 15:50:39 -04:00
Randell Jesup 77b8bbfbe2 Bug 1453387: Add network load status reports to gecko-profiler markers r=mstange 2018-04-19 23:32:17 -04:00
Markus Stange 2d93796161 Bug 1444430 - Add a ProfilerScreenshots class which can be used to submit DataSourceSurfaces to the profiler. r=jrmuizel
ProfilerScreenshots encodes these surfaces to JPG data URLs, and submits them
as profiler markers. The encoding is done on a separate thread.

MozReview-Commit-ID: 7CKDBqUsLny

--HG--
extra : rebase_source : 45b608544b4ddf8502302cf974ca4e8b306de64e
2018-03-26 23:08:33 -04:00
Markus Stange de5088e49a Bug 1444430 - Add a profiler feature called "screenshots". r=njn
MozReview-Commit-ID: 8blNvvliuog

--HG--
extra : rebase_source : 5465eb074f3988f9f3de9e00e1c42ce7897112c9
2018-04-12 15:21:40 -04:00
Markus Stange 8ef4dd52e6 Bug 1453786 - Remove unnecessary MOZ_GECKO_PROFILER #ifdefs in GeckoProfiler.h. r=njn
These lines of code are within the #else section of the #ifndef MOZ_GECKO_PROFILER
at the top of the file, so MOZ_GECKO_PROFILER is always defined for them.

MozReview-Commit-ID: IxRYexzZH0G

--HG--
extra : rebase_source : 302e5515323a63f145eed75a2b66a04fbde052e5
2018-04-12 16:27:25 -04:00
Markus Stange 7b785f663d Bug 1439014 - Add a profiler feature to enable JIT optimization tracking. r=njn,sfink
MozReview-Commit-ID: LDxiLVp7e9v

--HG--
extra : rebase_source : efefa814a050f06217de30704976048eeacc3caa
extra : intermediate-source : b58a6dce6a4e46ccfdbed363c67e2fa79043086b
extra : source : 6d91d0cc7d61af160b2ccd340adf23cb41389eed
2018-02-17 19:38:14 -05:00
arthur.iakab 5beb4527ab Backed out 2 changesets (bug 1439014) for failing mochitest chrome and test verify on tools/profiler/tests/chrome/test_profile_with_trackopts.html
Backed out changeset 57426696adaf (bug 1439014)
Backed out changeset a13074f87bb0 (bug 1439014)
2018-03-27 06:48:42 +03:00
Markus Stange 42fcb730e2 Bug 1439014 - Add a profiler feature to enable JIT optimization tracking. r=njn,sfink
MozReview-Commit-ID: LDxiLVp7e9v

--HG--
extra : rebase_source : b6d0ba745de702a88310278fd9ec0cd56205f463
extra : intermediate-source : b58a6dce6a4e46ccfdbed363c67e2fa79043086b
extra : source : 6d91d0cc7d61af160b2ccd340adf23cb41389eed
2018-02-17 19:38:14 -05:00
arthur.iakab bb69fe14b5 Backed out 2 changesets (bug 1439014) for failing mochitest chrome and test verify on tools/profiler/tests/chrome/test_profile_with_trackopts.html on a CLOSED TREE
Backed out changeset 226c8c740c34 (bug 1439014)
Backed out changeset 84c9b5ab7de9 (bug 1439014)
2018-03-27 02:16:17 +03:00
Markus Stange 6f36cc5745 Bug 1439014 - Add a profiler feature to enable JIT optimization tracking. r=njn,sfink
MozReview-Commit-ID: LDxiLVp7e9v

--HG--
extra : rebase_source : b6d0ba745de702a88310278fd9ec0cd56205f463
extra : intermediate-source : b58a6dce6a4e46ccfdbed363c67e2fa79043086b
extra : source : 6d91d0cc7d61af160b2ccd340adf23cb41389eed
2018-02-17 19:38:14 -05:00
arthur.iakab bfec308dac Backed out 2 changesets (bug 1439014) for failing chrome failures and test verify tests on tools/profiler/tests/chrome/test_profile_with_trackopts.htm on a CLOSED TREE
Backed out changeset f01eb749b3f9 (bug 1439014)
Backed out changeset 6d264bbb2669 (bug 1439014)
2018-03-26 23:26:15 +03:00
Markus Stange dd133bbe22 Bug 1439014 - Add a profiler feature to enable JIT optimization tracking. r=njn,sfink
MozReview-Commit-ID: LDxiLVp7e9v

--HG--
extra : rebase_source : b6d0ba745de702a88310278fd9ec0cd56205f463
extra : intermediate-source : b58a6dce6a4e46ccfdbed363c67e2fa79043086b
extra : source : 6d91d0cc7d61af160b2ccd340adf23cb41389eed
2018-02-17 19:38:14 -05:00
Xidorn Quan 8031c0838a Bug 1444296 part 2 - Have a separate marker for styles to present stats. r=mstange
MozReview-Commit-ID: FXYnFXDvajw

--HG--
extra : rebase_source : e6b10e1df7d1815afb704b4e6eea812c2affa7fb
extra : source : 1e8a29eb9c2966f458d8019feb9f91323dc4d94a
2018-03-15 11:59:22 +11:00
Greg Tatum 4f7596f26a Bug 1425605 - Add the start/end mark names to performance.measure profiler markers; r=baku,mstange
MozReview-Commit-ID: I8DzSlSi124

--HG--
extra : rebase_source : 5062bf33824284df7346dae15595f8e1e479bc40
2018-03-08 16:36:53 -06:00
Jashank Jeremy 5e7e2c2a06 Bug 1438120 - Fix non-MOZ_GECKO_PROFILER build by adding the missing AUTO_PROFILER_LABEL_FAST declaration. r=mstange
--HG--
extra : amend_source : ba4360be040c3d765f380d3c92e6fabf0cdfd436
2018-02-15 22:27:33 -05:00
Markus Stange e92440806d Bug 785440 - Add AUTO_PROFILER_LABEL_FAST. r=njn
This gets the pseudostack from the JSContext instead of using TLS, and only
pushes a pseudo stack frame if the profiler is active.

MozReview-Commit-ID: IzT4py9H8su

--HG--
extra : rebase_source : 9962455d59e3f8b85a347f4203ac619e654fcb7c
extra : source : f15e6874f6c14f7a5e5b0cb63acd0a95ad34db4e
2018-01-05 14:37:42 +01:00
Markus Stange 7a2c359a92 Bug 785440 - Move profiler_is_active() implementation (and RacyFeatures) into GeckoProfiler.h. r=njn
MozReview-Commit-ID: D8y5RK2t6N4

--HG--
extra : rebase_source : 50513145561a1123c47741cb845e9b4adcf104a0
extra : intermediate-source : 85c8d7e4a5eb1616d36d4ec7916e3b077da3b236
extra : source : 5dda2adf525363b32844ea8162235fae3b54d17d
2017-08-02 14:39:55 -04:00
Markus Stange 125c79a8ce Bug 1431179 - Remove the API to obtain the time of the first sample during profile streaming. r=mystor
MozReview-Commit-ID: KfZLNIAx4gy

--HG--
extra : rebase_source : 6b1a2dc19955a3a19877403f36d9dad551a9dc8a
extra : source : 6a241d9b3d1adf1afa72aab53ef8e15ece75fe90
2018-01-26 15:30:55 -05:00
Markus Stange 49d6d03730 Bug 1348959 - Remove wraparound indexing in ProfileBuffer. r=djvj,mystor,njn
MozReview-Commit-ID: LeBFSRE6GXR

--HG--
extra : rebase_source : c46c0cd0dd543a367f72000e3cae65260a25b365
extra : source : 0f2e9dd7d45551d40944e4219e5a9eb92d54b2c4
2018-02-06 00:25:30 -05:00
Markus Stange 519cb27db8 Bug 1348959 - Make profiler_get_buffer_info() return information in a struct instead of using outparams. r=mystor,njn
MozReview-Commit-ID: 1iJ05NxOdou

--HG--
extra : rebase_source : 1c4e654340630b0f21c165b41b8fc1be30743c48
extra : source : 64b1a4108f6c3319cfc74c1246bdd2e895e93e1a
2018-01-18 17:54:57 -05:00
Markus Stange 656fd03724 Bug 1348959 - Make ProfileBuffer fields uint32_t. r=mystor,njn
MozReview-Commit-ID: veIGhEQyK5

--HG--
extra : rebase_source : 2c1853f666afd300ff82a2717f1a7caf9a19cf98
extra : source : e3d8bdc726d6045f69f3c3efa4e91c499a418428
2018-01-18 17:54:33 -05:00
Nika Layzell f5c4dc1b8f Bug 1430850 - Part 3: Expose profiler_add_marker_for_thread to add a marker for a specific thread, r=mstange
MozReview-Commit-ID: 2nyp98oBKHk
2018-01-16 14:07:28 -05:00
Alexandre Poirot f572e41c43 Bug 1423890 - Add markers for background hangs r=dthayer,mstange
MozReview-Commit-ID: 484UZEbbd12

--HG--
extra : rebase_source : f739ce23944205cb88e8ea40289c8de6f07d1034
2017-12-07 02:35:36 -08:00
Nika Layzell a7666fd8fe Bug 1418048 - Add a callback-based Send API to async returning IPDL methods, r=billm
Currently if you write an async IPDL method which has a return value, we expose
a SendXXX method which returns a MozPromise. This MozPromise can then be
->Then-ed to run code when it is resolved or rejected.

Unfortunately, using this API loses ordering guarantees which IPDL provides.
MozPromise::Then takes an event target, which the resolve runnable is dispatched
to. This means that the resolve callback's code doesn't have any ordering
guarantees relative to the processing of other IPC messages coming over the same
protocol.

This adds a new overload to SendXXX with two additional arguments, a lambda
callback which is called if the call succeeds, and a lambda callback which is
called if the call fails. These will be called in order with other IPC messages
sent over the same protocol.

MozReview-Commit-ID: FZHJJaSDoZy
2017-11-20 17:55:32 -05:00
Tristan Bourvon b15e4b2827 Bug 1412648 - Initialize some uninitialized fields in tools/profiler/. r=mstange 2017-10-31 11:20:12 +01:00
Nicholas Nethercote 3842370ed8 Bug 1405541 (attempt 2) - Split AUTO_PROFILER_LABEL_DYNAMIC into three macros. r=mstange.
It's easy to mess up the scoping so that (a) the label is pushed and then
immediately popped, and/or (b) the string doesn't live long enough. It's also
easy to do a utf16-to-utf8 conversion unnecessarily when the profiler is
inactive. This patch splits that macro into three new ones that are harder to
mess up.

- AUTO_PROFILER_LABEL_DYNAMIC_CSTR: same as current.
- AUTO_PROFILER_LABEL_DYNAMIC_NSCSTRING: for nsCStrings.
- AUTO_PROFILER_LABEL_DYNAMIC_LOSSY_NSSTRING: for nsStrings.

--HG--
extra : rebase_source : 3e2bbec4737b696e1c86579ae54be4cb3186c100
2017-10-13 16:12:57 +11:00
Nicholas Nethercote bbfec72b95 Bug 1406296 (part 3) - Remove the profiler's "gpu" feature. r=mstange,jrmuizel.
This allows a bunch of additional stuff to be removed: ContextStateTracker,
ContextStateTrackerOGL, and GPUMarkerPayload.

--HG--
extra : rebase_source : 879045a9f9ac31ca0beb596964c6c3ef30283a53
2017-10-06 17:35:44 +11:00
Nicholas Nethercote 4bedc03a3d Bug 1406296 (part 2) - Remove the profiler's "layersdump" feature. r=mstange.
Because it just doesn't control any behaviour within the profiler, and it just
duplicates gfxPrefs::LayersDumpTexture().

With this gone, PROFILER_FEATURE_ACTIVE can also be removed.

--HG--
extra : rebase_source : d6718894b8a9332cf73729ea6b7bd2de348817bd
2017-10-06 17:34:22 +11:00
Nicholas Nethercote 706daca552 Bug 1406296 (part 1) - Remove the profiler's "displaylistdump" feature. r=mstange.
It's not useful.

--HG--
extra : rebase_source : b18244b6f1e28b29f1f71a4cca55781316e2cdc5
2017-10-06 17:33:30 +11:00
Sebastian Hengst 051f888cef Backed out changeset 759a43ebc6bf (bug 1405541) for asserting in devtools/client/performance/test/browser_perf-console-record-03.js on Windows 7. r=backout
--HG--
extra : amend_source : 3df3e75c561cbc42db104ec1a6f6026ef021e3c7
2017-10-11 13:15:26 +02:00
Nicholas Nethercote add7e65972 Bug 1405541 - Split AUTO_PROFILER_LABEL_DYNAMIC into three macros. r=mstange.
It's easy to mess up the scoping so that (a) the label is pushed and then
immediately popped, and/or (b) the string doesn't live long enough. It's also
easy to do a utf16-to-utf8 conversion unnecessarily when the profiler is
inactive.

This patch splits that macro into three new ones that are harder to mess up.

- AUTO_PROFILER_LABEL_DYNAMIC_CSTR: same as current.
- AUTO_PROFILER_LABEL_DYNAMIC_NSCSTRING: for nsCStrings.
- AUTO_PROFILER_LABEL_DYNAMIC_LOSSY_NSSTRING: for nsStrings.

--HG--
extra : rebase_source : 53c8b43b6a1be06d00618a133e28bf95c46a3ba3
2017-10-11 13:03:34 +02:00
Phil Ringnalda bd5ca8f40d Backed out changeset 901a16fec9fc (bug 1405541) for Windows assertion failures
MozReview-Commit-ID: DRGWXU4Tbfk
2017-10-10 23:28:33 -07:00
Nicholas Nethercote b23fb68ae3 Bug 1405541 - Split AUTO_PROFILER_LABEL_DYNAMIC into three macros. r=mstange.
It's easy to mess up the scoping so that (a) the label is pushed and then
immediately popped, and/or (b) the string doesn't live long enough. It's also
easy to do a utf16-to-utf8 conversion unnecessarily when the profiler is
inactive.

This patch splits that macro into three new ones that are harder to mess up.

- AUTO_PROFILER_LABEL_DYNAMIC_CSTR: same as current.
- AUTO_PROFILER_LABEL_DYNAMIC_NSCSTRING: for nsCStrings.
- AUTO_PROFILER_LABEL_DYNAMIC_LOSSY_NSSTRING: for nsStrings.

--HG--
extra : rebase_source : 59f77df0124249bfd11fee3585420a17b4201d37
2017-10-04 13:44:24 +11:00
Nicholas Nethercote 8a68e6fb83 Bug 1403868 (part 4) - Reduce tools/profiler/public/*.h to almost nothing in non-MOZ_GECKO_PROFILER builds. r=mstange.
Currently the Gecko Profiler defines a moderate amount of stuff when
MOZ_GECKO_PROFILER is undefined. It also #includes various headers, including
JS ones. This is making it difficult to separate Gecko's media stack for
inclusion in Servo.

This patch greatly simplifies how things are exposed. The starting point is:

- GeckoProfiler.h can be #included unconditionally;

- everything else from the profiler must be guarded by MOZ_GECKO_PROFILER.

In practice this introduces way too many #ifdefs, so the patch loosens it by
adding no-op macros for a number of the most common operations.

The net result is that #ifdefs and macros are used a bit more, but almost
nothing is exposed in non-MOZ_GECKO_PROFILER builds (including
ProfilerMarkerPayload.h and GeckoProfiler.h), and understanding what is exposed
is much simpler than before.

Note also that in BHR, ThreadStackHelper is now entirely absent in
non-MOZ_GECKO_PROFILER builds.
2017-10-04 09:11:18 +11:00
Nicholas Nethercote 74e64bcaa2 Bug 1403868 (part 3) - Rename the profiler's RAII macros. r=mstange.
--HG--
extra : rebase_source : 468a76da39dbc18c5eb9136553d73ca3cec080cf
2017-10-03 19:48:34 +11:00
Nicholas Nethercote cbc9fbb2bf Bug 1403868 (part 2) - Tweak profiler_tracing(). r=mstange.
This patch does the following.

- Makes the TracingKind argument non-optional.

- Puts the UniqueProfilerBacktrace argument last in the second variant.

- Reorders AutoProfilerTracing to match the order of the profiler_tracing()
  declarations.

--HG--
extra : rebase_source : 8e9acdaf777c642cd854570771a3f96da6d524d1
2017-10-03 19:48:10 +11:00
Nicholas Nethercote 93c60b0d95 Bug 1403868 (part 1) - Remove argument from AutoProfilerInit(). r=mstange.
We can use |this| instead, as is already done in AutoProfilerRegisterThread().

--HG--
extra : rebase_source : c79716443cb8483f078d1d3d6a87d25a8d3d5445
2017-10-03 19:47:44 +11:00
Nicholas Nethercote c1b8117cfd Bug 1401421 - Remove profiler_get_backtrace_noalloc. r=mstange.
Bug 1385953 removed MemProfiler, which was its only user.

--HG--
extra : rebase_source : 87ecf6aec67f4bf073e08ea5f2b2fa9734451e8c
2017-09-20 11:46:26 +10:00
Eric Rahm a33f11e0f5 Bug 1391803 - Use nsStringFwd.h for forward declaring string classes. r=froydnj
We should not be declaring forward declarations for nsString classes directly,
instead we should use nsStringFwd.h. This will make changing the underlying
types easier.

--HG--
extra : rebase_source : b2c7554e8632f078167ff2f609392e63a136c299
2017-08-16 16:48:52 -07:00
Michael Layzell b854c24623 Bug 1388818 - Remove old profiler_suspend_and_sample_thread, r=njn
MozReview-Commit-ID: 4kjGbNi3c7g
2017-08-16 11:44:07 -04:00
Michael Layzell bb9d607029 Bug 1386751 - Split CollectCodeLocation into CollectWasmFrame and CollectPseudoEntry, r=njn
MozReview-Commit-ID: 4LNuJQtm95K
2017-08-16 11:44:00 -04:00
Kan-Ru Chen 87a450cad1 Bug 1386495 - Add timeStamp to DOMEventMarkerPayload. r=mstange,smaug
MozReview-Commit-ID: B3b4laxMqQM

--HG--
extra : rebase_source : 80e41c2f9d921ddd93d41c348594895046c7af8f
2017-08-03 15:42:42 +08:00
Markus Stange 803835a8f1 Bug 1384688 - Add an aIsShuttingDown argument to profiler_get_profile() and to profiler_stream_json_for_this_process(). r=njn
When set to true, the resulting profile will have a non-null meta.shutdownTime
field which is set to current time.
Non-shutdown profiles also get that field, but it's null for them.

MozReview-Commit-ID: 1vpmhBR8rC6

--HG--
extra : rebase_source : b026088053c30acd287f0dc3afa7ddf14093ec27
2017-07-31 14:23:13 -04:00
Sebastian Hengst c4e0fbd639 Backed out changeset e9d92bc3be81 (bug 1384688) 2017-07-31 20:09:57 +02:00
Markus Stange 607fc637d3 Bug 1384688 - Add an aIsShuttingDown argument to profiler_get_profile() and to profiler_stream_json_for_this_process(). r=njn
When set to true, the resulting profile will have a non-null meta.shutdownTime
field which is set to current time.
Non-shutdown profiles also get that field, but it's null for them.

MozReview-Commit-ID: 1vpmhBR8rC6

--HG--
extra : rebase_source : 38573ff847ee7e2ac5df9c82564dd6495cc1636f
2017-07-31 13:11:19 -04:00
Markus Stange 4036fdd6b0 Bug 1384693 - Let callers of profiler_stream_json_for_this_process obtain the time of the first sample in the buffer. r=njn
MozReview-Commit-ID: IRFq1F3dWIk

--HG--
extra : rebase_source : d4454baf4b4eaf8f185b96a59e40ace5f6702bcc
2017-07-27 15:04:59 -04:00
Wes Kocher f19f28adfd Merge m-c to autoland, a=merge
MozReview-Commit-ID: F1X8wKqbkg
2017-07-25 19:16:09 -07:00
Carsten "Tomcat" Book bdf7db3d13 Merge mozilla-central to mozilla-inbound
--HG--
rename : dom/tests/mochitest/chrome/test_window_getAppLocales.html => dom/tests/mochitest/chrome/test_window_getRegionalPrefsLocales.html
rename : mobile/android/app/src/main/res/drawable/as_contextmenu_divider.xml => mobile/android/app/src/main/res/drawable/as_contextmenu_divider_helper.xml
rename : testing/tools/autotry/autotry.py => tools/tryselect/selectors/syntax.py
extra : rebase_source : d74c74a654cd977d35e35de2768ada4ebe659ae4
2017-07-25 14:38:43 +02:00
Nicholas Nethercote 37c96fc477 Bug 1380286 (attempt 2) - Introduce ProfilerStackCollector. r=mstange.
--HG--
extra : rebase_source : 7eac82fa5f01f48f239a804ff9d8d662cd1c44aa
2017-07-25 16:47:14 +10:00
Kan-Ru Chen 5454b4c576 Bug 1382990 - Change the DOMEventMarkerPayload field name 'type' to 'eventType' to avoid conflicts. r=mstange
MozReview-Commit-ID: BX9nLoCybbG

--HG--
extra : rebase_source : 996326a32fdb58ff6f13b9532e73710851899627
2017-07-21 17:41:51 +08:00
Markus Stange bdcac7a378 Bug 1382910 - Update the profiler state in the child process once PProfiler is connected. r=njn
This handles the case where the profiler state changes in the parent process
between the initial launch of the child process and the time at which the
PProfiler connection is established.

MozReview-Commit-ID: 5SQme5M7P30

--HG--
extra : rebase_source : 301d5541ff5c05a9540e45f1b57c13fb37d5d6fa
2017-07-24 16:33:50 -04:00
Markus Stange c1e5917d06 Bug 1382910 - Add profiler_ensure_started. r=njn
MozReview-Commit-ID: LBLlOLXqCwK

--HG--
extra : rebase_source : c3810fdd0805f5fadfd789118b1154435da0a62d
2017-07-24 16:48:15 -04:00
Markus Stange 5ecaa17d34 Bug 1382910 - Propagate the current profiler state to a newly-launched child process using environment variables. r=njn
This also fixes the bug where we would always profile child processes if the
parent process had been launched with MOZ_PROFILER_STARTUP=1, regardless of
whether the profiler was still running in the parent process.

MozReview-Commit-ID: LkIpYmKJOJ1

--HG--
extra : rebase_source : 49b38bc58ded91ecc2e2fce08bcb4f2d20a13b92
2017-07-24 18:16:33 -04:00
Carsten "Tomcat" Book 965777ef3a Backed out changeset 3923ce220df3 (bug 1380286) for hazard failures 2017-07-25 08:44:13 +02:00
Nicholas Nethercote 6041274802 Bug 1380286 - Introduce ProfilerStackCollector. r=mstange.
This allows code outside the profiler to get fully interleaved stack traces
containing frames from the pseudo-stack, native stack, and JS stack.

--HG--
extra : rebase_source : e21b64e86ffec83a0052947afad1793f3fd62d00
2017-07-17 10:18:50 +10:00
Wes Kocher b4fca1d196 Backed out 4 changesets (bug 1365309) for frequent xpcshell timeouts after 5400 seconds a=backout CLOSED TREE
Backed out changeset 9fc4c6aabd8e (bug 1365309)
Backed out changeset 56850220bd77 (bug 1365309)
Backed out changeset 48f5e0597242 (bug 1365309)
Backed out changeset 39ed96d7b263 (bug 1365309)

MozReview-Commit-ID: 3V0eTL8qeYb
2017-07-12 16:35:14 -07:00
Michael Layzell c4e8a040c2 Bug 1374888 - Maintain a live shared libraries list in gecko on macOS, r=mstange
MozReview-Commit-ID: 5QvrWujquIq
2017-07-12 13:53:56 -04:00
Michael Layzell b34e7c42ec Bug 1365309 - Part 1: Move LUL to a separate lock, and initialize it outside of both the profiler and BHR lock on the BHR thread, r=njn
Currently LUL is a member of CorePS, meaning that it is guarded by the PSMutex.
This mutex is grabbed by the main thread at random points during the execution
of the program. This is unfortunate, as initializing LUL can take a long
time (>1s on my local machine), and we definitely don't want to be blocking the
main thread waiting for it.

In addition, in the BHR case, we used to be grabbing LUL when we got our first
hang, while both the PSMutex and the BHR monitor were being held. This meant
that the main thread could make no progress during LUL initializaion, as the BHR
monitor is grabbed by the main thread on every spin of the event loop.

This patch moves that initialization to be behind a completely separate lock,
and makes BHR initialize it on the background thread before acquiring the BHR
lock, meaning that no locks other than the one guarding LUL should be held
during its initialization.

MozReview-Commit-ID: GwNYQaEAqJ1
2017-07-12 13:13:07 -04:00
Sebastian Hengst 702df96bfc Backed out changeset b297e31320fd (bug 1374888) for mass-asserting, e.g. in dom/base/test/test_setInterval_from_start.html. r=backout on a CLOSED TREE
--HG--
extra : amend_source : 55b47f131608cac63c8bb0530a20b8b21f549471
2017-07-11 21:10:43 +02:00
Michael Layzell 5347ef82fe Bug 1374888 - Maintain a live shared libraries list in gecko on macOS, r=mstange
MozReview-Commit-ID: 5QvrWujquIq
2017-07-11 13:49:23 -04:00
Nicholas Nethercote 26f8199a36 Bug 1375776 (part 5) - Pass in a TimeStamp to LayerTranslationMarkerPayload(). r=mstange.
This makes it more like all the other payload classes.

--HG--
extra : rebase_source : dd30741f487158ace8f9c0427a5c4b00f051ff7b
2017-06-23 16:24:21 +10:00
Nicholas Nethercote 5d446671a8 Bug 1375776 (part 4) - Allow ProfilerMarkerPayload.h to be #included unconditionally. r=mstange.
This requires:

- Moving the constructors of ProfilerMarkerPayload and its subclasses into the
  .h file so they are visible even when ProfilerMarkerPayload.cpp isn't
  compiled.

- Similarly, using a macro to make StreamPayload() a crashing no-op when the
  profiler isn't enabled. (It is never called in that case.)

--HG--
extra : rebase_source : 7aad2fdb1bd4e49782024dba6664e8f992771520
2017-06-23 16:24:15 +10:00
Nicholas Nethercote d4e5f6709b Bug 1375776 (part 3) - Improve destructor of ProfilerMarkerPayload and its subclasses. r=mstange.
No point having all these explicit empty destructors.

Also, we can avoid IOMarkerPayload's constructor by using a UniqueFreePtr.

--HG--
extra : rebase_source : 0a2a5aecb66a2990c9188354c861f67633ed2fee
2017-06-23 15:58:11 +10:00
Nicholas Nethercote ca8b2377bc Bug 1375776 (part 2) - Combine the two TracingMarkerPayload constructors. r=mstange.
--HG--
extra : rebase_source : 60ce2839cfebffbd2071b5821041fabc34c1ffe2
2017-06-23 14:29:03 +10:00
Michael Layzell 2eb92d98f1 Backout Bug 1365309 for test failures on a CLOSED TREE
MozReview-Commit-ID: 143ac9l7Goq
2017-07-04 17:31:13 -04:00
Michael Layzell b24bf46af6 Bug 1377344 - Record the name of the currently running Runnable on thread hangs for BHR, r=njn, r=froydnj
MozReview-Commit-ID: IYRHh6jiTeo
2017-07-04 15:16:19 -04:00
Michael Layzell 1fda892d36 Bug 1365309 - Part 1: Move LUL to a separate lock, and initialize it outside of both the profiler and BHR lock on the BHR thread, r=njn
Currently LUL is a member of CorePS, meaning that it is guarded by the PSMutex.
This mutex is grabbed by the main thread at random points during the execution
of the program. This is unfortunate, as initializing LUL can take a long
time (>1s on my local machine), and we definitely don't want to be blocking the
main thread waiting for it.

In addition, in the BHR case, we used to be grabbing LUL when we got our first
hang, while both the PSMutex and the BHR monitor were being held. This meant
that the main thread could make no progress during LUL initializaion, as the BHR
monitor is grabbed by the main thread on every spin of the event loop.

This patch moves that initialization to be behind a completely separate lock,
and makes BHR initialize it on the background thread before acquiring the BHR
lock, meaning that no locks other than the one guarding LUL should be held
during its initialization.

MozReview-Commit-ID: GwNYQaEAqJ1
2017-07-04 13:19:26 -04:00
Nicholas Nethercote 06487be99c Bug 1376993 (part 1) - Improve comment on profiler_add_marker(). r=mstange.
--HG--
extra : rebase_source : 5713b8aa59866f14fb90d114f6828b2ae6e5f093
2017-06-28 16:43:04 -07:00
Nicholas Nethercote 58786e1ea7 Bug 1375392 - Tweak the PROFILER_LABEL* macros. r=mstange.
This patch makes the following changes to the macros.

- Removes PROFILER_LABEL_FUNC. It's only suitable for use in functions outside
  classes, due to PROFILER_FUNCTION_NAME not getting class names, and it was
  mostly misused.

- Removes PROFILER_FUNCTION_NAME. It's no longer used, and __func__ is
  universally available now anyway.

- Combines the first two string literal arguments of PROFILER_LABEL and
  PROFILER_LABEL_DYNAMIC into a single argument. There was no good reason for
  them to be separate, and it forced a '::' in the label, which isn't always
  appropriate. Also, the meaning of the "name_space" argument was interpreted
  in an interesting variety of ways.

- Adds an "AUTO_" prefix to PROFILER_LABEL and PROFILER_LABEL_DYNAMIC, to make
  it clearer they construct RAII objects rather than just being function calls.
  (I myself have screwed up the scoping because of this in the past.)

- Fills in the 'js::ProfileEntry::Category::' qualifier within the macro, so
  the caller doesn't need to. This makes a *lot* more of the uses fit onto a
  single line.

The patch also makes the following changes to the macro uses (beyond those
required by the changes described above).

- Fixes a bunch of labels that had gotten out of sync with the name of the
  class and/or function that encloses them.

- Removes a useless PROFILER_LABEL use within a trivial scope in
  EventStateManager::DispatchMouseOrPointerEvent(). It clearly wasn't serving
  any useful purpose. It also serves as extra evidence that the AUTO_ prefix is
  a good idea.

- Tweaks DecodePool::SyncRunIf{Preferred,Possible} so that the labelling is
  done within them, instead of at their callsites, because that's a more
  standard way of doing things.

--HG--
extra : rebase_source : 318d1bc6fc1425a94aacbf489dd46e4f83211de4
2017-06-22 17:08:53 +10:00
Nicholas Nethercote 033f83145c Bug 1375387 - Reorder and section-ify GeckoProfiler.h. r=mstange.
This patch gives some structure and order to the profiler's API.

It also renames AutoProfilerRegister as AutoProfilerRegisterThread, to match
profiler_register_thread().
2017-06-22 14:28:47 +10:00
Nicholas Nethercote 915a56fb41 Bug 1375299 (part 2) - Remove PROFILER_MARKER. r=mstange.
PROFILER_MARKER is now just a trivial wrapper for profiler_add_marker(). This
patch removes it.

--HG--
extra : rebase_source : 9858f34763bb343757896a91ab7ad8bd8e56b076
2017-06-22 13:40:21 +10:00
Nicholas Nethercote 4b364cf3f3 Bug 1375299 (part 1) - Reduce usage of MOZ_GECKO_PROFILER. r=mstange.
This patch reduces the differences between builds where the profiler is enabled
and those where the profiler is disabled. It does this by removing numerous
MOZ_GECKO_PROFILER checks.

These changes have the following consequences.

- Various functions and classes are now defined in all builds, and so can be
  used unconditionally: profiler_add_marker(), profiler_set_js_context(),
  profiler_clear_js_context(), profiler_get_pseudo_stack(), AutoProfilerLabel.
  (They are effectively no-ops in non-profiler builds, of course.)

- The no-op versions of PROFILER_* are now gone. The remaining versions are
  almost no-ops when the profiler isn't built.

--HG--
extra : rebase_source : 8fb5e8757600210c2f77865694d25162f0b7698a
2017-06-22 06:26:16 +10:00
Nicholas Nethercote 784f6f2ee9 Bug 1374908 - Remove --enable-systrace. r=glandium.
This option causes MOZ_USE_SYSTRACE to be defined. The only use of that is in
GeckoProfiler.h where it causes the PROFILER_PLATFORM_TRACING macro to set
android::ScopedTrace. But android::ScopedTrace was defined in widget/gonk/
which was recently removed, so this won't work any more.

Furthermore, all that android::ScopedTrace did was to do a pair of
atrace_{begin,end}() calls, which doesn't seem that useful.
2017-06-21 14:06:22 +10:00
Nicholas Nethercote 4183270eec Bug 1375275 (part 3) - Remove profiler_log(). r=mstange.
It's a wafer thin wrapper around profiler_tracing() and it's only used three
times. Let's just remove it.

Note also that those three uses are the only places where TRACING_EVENT is
used. I wonder if they're really needed...

--HG--
extra : rebase_source : ac70b4c77c4592d96957a8e6249597eafc822fd4
2017-06-21 20:50:07 +10:00
Nicholas Nethercote dc54dc76f0 Bug 1375275 (part 2) - Remove TracingMarkerPayload::Get{Category,Kind}(). r=mstange.
--HG--
extra : rebase_source : 28b648baf294e61dcca70b4157dd023096057abc
2017-06-21 20:41:36 +10:00
Nicholas Nethercote a2e768a6ee Bug 1375275 (part 1) - Remove PROFILER_GET_BACKTRACE_ENTRIES. r=mstange.
It doesn't need to be exported.

--HG--
extra : rebase_source : 8732e0894082d8377ddae31619fffc3b91f3b6a7
2017-06-21 20:33:00 +10:00
Nicholas Nethercote 376df7b9bd Bug 1374127 (part 4) - Clean up GeckoProfiler.h a bit. r=mstange.
The patch:

- Removes some unnecessary forward declarations.

- Moves some macros to more logical locations.

- Improves and removes some comments.

--HG--
extra : rebase_source : 23f1de029bbe4a37d2cc1ebe1df76e9a6aa1b335
2017-06-20 08:45:41 +10:00
Nicholas Nethercote f8bf8ca8f0 Bug 1374127 (part 3) - Reorder macros in GeckoProfiler.h. r=mstange.
It's bugged me for some time that the comments explaining what all the
PROFILER_* macros do are on the empty definitions that are used when the
profiler is disabled. This patch switches the order.

--HG--
extra : rebase_source : d783aa996f91b305cbebd678e6652d6bc939fb98
2017-06-19 13:34:32 +10:00
Nicholas Nethercote 453b6f2d11 Bug 1374127 (part 2) - Clean up ProfilerMarkerPayload. r=mstange.
This patch does the following.

- Renames some ProfilerMarkerPayload subclasses so they all of the form
  "FooMarkerPayload", to make the subclass relationship clearer.
  (ProfilerMarkerTracing -- now TracingMarkerPayload -- was the worst
  offender.)

- Removes ProfilerMarkerImagePayload and TouchDataPayload, neither of which are
  used.

- Changes streamCommonProps() to StreamCommonProps().

- Does some minor style and comment fixes in ProfilerMarkerPayload.h.

--HG--
extra : rebase_source : dd732905e96da83bcbf124c70b20011c661fc332
2017-06-19 13:32:32 +10:00
Nicholas Nethercote 5d3808c6e5 Bug 1373436 (part 4) - Use UniquePtr with profile_add_marker(). r=mstange.
Once the |aPayload| argument to profile_add_marker() became a UniquePtr the
default value of nullptr caused compilation difficulties that could only be
fixed by #including ProfilerMarkerPayload.h into lots of additional places
(because the UniquePtr<T> instantiation required the T to be fully defined). To
get around this I just split profile_add_marker() into two functions, one with
1 argument and one with 2 arguments.

The patch also removes the definition of PROFILER_MARKER_PAYLOAD in the case
where MOZ_GECKO_PROFILER isn't defined. A comment explains why.
2017-06-16 12:26:26 +10:00
Nicholas Nethercote d529284168 Bug 1373154 (part 3, attempt 2) - Overhaul TickSample and things around it. r=mstange.
Bug 1357829 added a third kind of sample, in addition to the existing
"periodic" and "synchronous" samples. This patch cleans things up around that
change. In particular, it cleans up TickSample, which is a mess of semi-related
things.

The patch does the following.

- It removes everything from TickSample except the register values and renames
  TickSample as Registers. Almost all the removed stuff is available in
  ThreadInfo anyway, and the patch adds a ThreadInfo argument to various
  functions. (Doing it this way wasn't possible until recently because a
  ThreadInfo wasn't available in profiler_get_backtrace() until recently.)

  One non-obvious consequence: in synchronous samples we used to use a value of
  0 for the stackTop. Because synchronous samples now use ThreadInfo directly,
  they are able to use the proper stack top value from ThreadInfo::mStackTop.
  This will presumably only improve the quality of the stack traces.

- It splits Tick() in two and renames the halves DoPeriodicSample() and
  DoSyncSample().

- It reorders arguments in some functions so that ProfileBuffer (the output) is
  always last, and inputs are passed in roughly the order they are obtained.

- It adds a comment at the top of platform.cpp explaining the three kinds of
  sample.

- It renames a couple of other things.

--HG--
extra : rebase_source : 4f1e69c605102354dd56ef7af5ebade201e1d106
2017-06-19 09:38:15 +10:00
Markus Stange 9653029d65 Bug 1365400 - Add all profiler features to the enum list, and a test. r=kmag,njn
The source of truth for this list is in the PROFILER_FOR_EACH_FEATURE macro.

MozReview-Commit-ID: 13qppZKVi1r

--HG--
extra : rebase_source : 8f1ffdada1f73d2659ca9ed676be2fd3783e27f6
2017-06-16 14:52:30 -04:00
Michael Layzell 3e295cfe16 Bug 1357829 - Part 3: Remove profiler_get_stack_top, r=njn
MozReview-Commit-ID: C4DvuOvYSrs
2017-06-14 12:27:51 -04:00
Michael Layzell 029576f19d Bug 1357829 - Part 1: Expose profiler_suspend_and_sample_thread, r=njn
This patch performs a refactoring to the internals of the profiler in order to
expose a function, profiler_suspend_and_sample_thread, which can be called from a
background thread to suspend, sample the native stack, and then resume the
target passed-in thread.

The interface was designed to expose as few internals of the profiler as
possible, exposing only a single callback which accepts the list of program
counters and stack pointers collected during the backtrace.

A method `profiler_current_thread_id` was also added to get the thread_id of the
current thread, which can then be passed by another thread into
profiler_suspend_sample_thread to sample the stack of that thread.

This is implemented in two parts:

1) Splitting SamplerThread into two classes: Sampler, and SamplerThread.

Sampler was created to extract the core logic from SamplerThread which manages
unix signals on android and linux, as well as suspends the target thread on all
platforms. SamplerThread was then modified to subclass this type, adding the
extra methods and fields required for the creation and management of the actual
Sampler Thread.

Some work was done to ensure that the methods on Sampler would not require
ActivePS to be present, as we intend to sample threads when the profiler is not
active for the Background Hang Reporter.

2) Moving the Tick() logic into the TickController interface.

A TickController interface was added to platform which has 2 methods: Tick and
Backtrace. The Tick method replaces the previous Tick() static method, allowing
it to be overridden by a different consumer of SuspendAndSampleAndResumeThread,
while the Backtrace() method replaces the previous MergeStacksIntoProfile
method, allowing it to be overridden by different consumers of
DoNativeBacktrace.

This interface object is then used to wrap implementation specific data, such as
the ProfilerBuffer, and is threaded through the SuspendAndSampleAndResumeThread
and DoNativeBacktrace methods.

This change added 2 virtual calls to the SamplerThread's critical section, which
I believe should be a small enough overhead that it will not affect profiling
performance. These virtual calls could be avoided using templating, but I
decided that doing so would be unnecessary.

MozReview-Commit-ID: AT48xb2asgV
2017-06-14 12:27:48 -04:00
Nicholas Nethercote aab625999f Bug 1370329 (part 2) - Add support for profiler labels in mozglue. r=mstange,glandium.
Profiler labels can't currently be used in mozglue, because the profiler's code
is in libxul, and mozglue cannot depend on libxul.

This patch addresses this by basically duplicating AutoProfilerLabel in
mozglue. libxul passes two callback functions to mozglue to do the actual
pushing/popping of labels.

It's an annoying amount of machinery, but it is unavoidable if we want to use
profiler labels within mozglue.

--HG--
extra : rebase_source : 4bcb6fb0f050bba42c23d92d01f9c56611f8518f
2017-06-07 12:36:26 +10:00
Nicholas Nethercote 0be77baa96 Bug 1370329 (part 1) - Clean up the profiler's RAII classes. r=mstange.
This patch does the following renamings, which increase consistency.

- GeckoProfilerInitRAII -> AutoProfilerInit
- GeckoProfilerThread{Sleep,Wake}RAII -> AutoProfilerThread{Sleep,Wake}
- GeckoProfilerTracingRAII -> AutoProfilerTracing
- AutoProfilerRegister -> AutoProfilerRegisterThread
- ProfilerStackFrameRAII -> AutoProfilerLabel
- nsJSUtils::mProfilerRAII -> nsJSUtils::mAutoProfilerLabel

Plus a few other minor ones (e.g. local variables).

The patch also add MOZ_GUARD_OBJECT macros to all the profiler RAII classes
that lack them, and does some minor whitespace reformatting.

--HG--
extra : rebase_source : 47e298fdd6f6b4af70e3357ec0b7b0580c0d0f50
2017-06-07 12:33:19 +10:00
Nicholas Nethercote 90133cc8f9 Bug 1368915 (part 3) - Rename aStartTime parameters as aProcessStartTime where appropriate. r=mstange.
This increases naming consistency. The remaining aStartTime parameters within
the profiler refer to a different start time than the process start time.

--HG--
extra : rebase_source : 0a07c54288f31af5a15518180b00fe59b587f784
2017-06-02 09:41:51 +10:00
Nicholas Nethercote ede22c7534 Bug 1369612 - Remove ProfilerStackFrameDynamicRAII and profiler_call_{enter,exit}. r=mstange.
ProfilerStackFrameRAII and ProfilerStackFrameDynamicRAII are very similar; the
latter lets a dynamic string be specified as well (and lacks the
MOZ_GUARD_OBJECT stuff, for no good reason).

This patch does the following.

- Removes ProfilerStackFrameDynamicRAII, and adds a dynamic string to
  ProfilerStackFrameRAII. It also reorders the constructor's arguments to match
  the field ordering of ProfileEntry. There aren't many usage sites so these
  changes don't affect many places.

- With that done, there is only a single callsite for each of
  profiler_call_enter() and profiler_call_exit(), so the patch also inlines and
  removes them.
2017-06-02 15:38:20 +10:00
Nicholas Nethercote 2b5f064d4e Bug 1369276 (part 2) - Convert ProfileEntry::Flags to Kind. r=shu.
There are three flags in ProfileEntry::Flags, which suggests there are 2**3 = 8
combinations. But there are only actually 4 valid combinations.

This patch converts the three flags to a single "kind" enum, which makes things
clearer. Note also that the patch moves the condition at the start of
AddPseudoEntry() to its callsite, for consistency with the earlier JS_OSR entry
kind check.

--HG--
extra : rebase_source : 0950769ee1530291860ef3be47d240df5939e871
2017-06-02 12:46:09 +10:00
Nicholas Nethercote 3d29a20915 Bug 1347274 (part 3, attempt 2) - Make some hot profiler functions lockless. r=mstange. 2017-06-01 13:33:22 +10:00
Kan-Ru Chen 69d4811faa Bug 1368031 - Fix PProfiler::GatherProfile r=mstange
MozReview-Commit-ID: YzJ9UA6Rj6
2017-06-01 15:57:21 +08:00
Nicholas Nethercote 3056033889 Bug 1347274 (part 1, attempt 2) - Rename some profiler parameters. r=mstange.
--HG--
extra : rebase_source : 395a45c494573da9281f27fbd7826f7ea5c12e10
2017-06-01 10:21:58 +10:00
Carsten "Tomcat" Book 1a0d9545b9 merge mozilla-inbound to mozilla-central a=merge 2017-05-31 11:28:43 +02:00
Markus Stange e2336b07a8 Bug 1330185 - Use a top-level PProfiler protocol to control the profiler in other processes. r=billm,njn
MozReview-Commit-ID: EROfGuYQ6a0

--HG--
extra : rebase_source : be0aa1b9c7963882e8e7d47964f2da5b670ab10a
extra : intermediate-source : e6f368f2d8741f2a9655b288d49b59fbbd6b90b7
extra : source : 51cdc2541486d5ddf2d385ec0459a9ec38b8775b
2017-05-30 15:06:14 -04:00
Nicholas Nethercote a062b9be51 Bug 1366650 (part 2) - In GeckoProfiler, do all pseudo-stack accesses via the PseudoStack class, instead of via raw array manipulation. r=mstange,shu.
- The profiler gives the JS engine a reference to the pseudo-stack via
  SetContextProfiilngStack(). That function now takes a |PseudoStack*| instead
  of a |ProfileEntry*| and pointer to the stack pointer.

- PseudoStack now has a |kMaxEntries| field, which is easier to work with than
  |mozilla::ArrayLength(entries)|.

- AddressOfStackPointer() is no longer needed.

- The patch also neatens up the push operations significantly. PseudoStack now
  has pushCppFrame() and pushJsFrame(), which nicely encapsulate the two main
  cases. These delegate to the updated initCppFrame() and initJsFrame()
  functions in ProfileEntry.

- Renames max_stck in testProfileStrings.cpp as peakStackPointer, which is a
  clearer name.

- Removes a couple of checks from testProfileStrings.cpp. These checks made
  sense when the pseudo-stack was accessed via raw manipulation, but are not
  applicable now because we can't artificially limit the maximum stack size so
  easily.
2017-05-26 09:51:31 +10:00
Nicholas Nethercote 0840bb61c6 Bug 1366650 (part 1) - Move PseudoStack into SpiderMonkey. r=mstange,shu.
This includes renaming its fields to match SpiderMonkey naming conventions
instead of Gecko naming conventions.

This patch is just about moving the code. The next patch will change
SpiderMonkey to actually use PseudoStack directly.

--HG--
extra : rebase_source : 27e77ddf950201eb6bdba60003218056442cf7ab
2017-05-26 09:37:28 +10:00
Nicholas Nethercote caf0e9ec84 Bug 1367654 (part 2) - In GeckoProfiler.h, rename Sampler* as Profiler*. r=mstange.
Because everything else in this file is called ProfilerFoo or PROFILER_FOO.

--HG--
extra : rebase_source : ddab03809d321d4a301f309750e9cf55a528d467
2017-05-26 14:54:33 +10:00
Phil Ringnalda 6368ef89e2 Backed out 5 changesets (bug 1330185, bug 1330184) for leaking an nsTArray_base from the plugin process on Win8
Backed out changeset e6f368f2d874 (bug 1330185)
Backed out changeset 2b8d50fcb20f (bug 1330184)
Backed out changeset dbe452a9eebb (bug 1330184)
Backed out changeset e13b9e798e16 (bug 1330184)
Backed out changeset 52489c7eadaf (bug 1330184)

MozReview-Commit-ID: 8L20BZ5E3t2
2017-05-22 19:45:35 -07:00
Markus Stange 9bf6b534a2 Bug 1330185 - Use a top-level PProfiler protocol to control the profiler in other processes. r=njn, r=billm
MozReview-Commit-ID: EROfGuYQ6a0

--HG--
extra : rebase_source : 3495ccc7700703cc587f571dfc12e46a682c29a2
extra : source : 51cdc2541486d5ddf2d385ec0459a9ec38b8775b
2017-05-22 13:47:02 -04:00
Nicholas Nethercote d1e495344b Bug 1365854 - Remove FRAME_LABEL_COPY. r=mstange,shu.
ProfileEntry has |string|, which can be static or dynamic, and |dynamicString|.
If |string| is dynamic, the FRAME_LABEL_COPY flag must be set, and it will be
copied into profiler output.

But there is only one place that uses dynamic |string| values, in SpiderMonkey.
And that place doesn't use |dynamicString|. So this patch changes that place to
use an empty |string| and put the old dynamic |string| value in
|dynamicString|. This in turn removes the need for FRAME_LABEL_COPY.

One minor wrinkle is that when |dynamicString| is used the old code put a space
between |string| and |dynamicString|. The new code omits the space if |string|
is empty.

The patch also renames ProfileEntry::string as ProfileEntry::label_, which
better matches how it's used, and ProfileEntry::dynamicString as
ProfileEntry::dynamicString_ so the getter can be renamed dynamicString().
2017-05-18 17:17:46 +10:00
Markus Stange 42b5d166ec Back out bug 1330184 and bug 1330185 because of test failures.
MozReview-Commit-ID: ILD4mevlSU6
2017-05-21 15:11:15 -04:00
Markus Stange b5fdcd479d Bug 1330185 - Use a top-level PProfiler protocol to control the profiler in other processes. r=njn, r=billm
MozReview-Commit-ID: EROfGuYQ6a0

--HG--
extra : rebase_source : de266bda4fc2d6532ff45a6d548b13cd0b4f7206
extra : histedit_source : ad5c4e140c068f17c51d5085fd88ac691e50ab4f
2017-05-21 14:06:50 -04:00
Nicholas Nethercote 7d44af05e2 Bug 1365824 - Remove STORE_SEQUENCER. r=froydnj.
It's a software memory barrier, and not a very strong one. If the values it is
protecting are Atomic, that provides a stronger hardware memory barrier.

This patch removes it, and changes one of the values it was protecting from
|volatile| to Atomic. (The other value it was protecting was already Atomic.)
2017-05-18 13:24:13 +10:00
Iris Hsiao 02cae69058 Backed out 4 changesets (bug 1357829) for build bustage in xpcshell\selftest.py on windows 8 x64 opt. a=backout
Backed out changeset 8ea202bb1103 (bug 1357829)
Backed out changeset cebe4d7abeda (bug 1357829)
Backed out changeset 378d473c9619 (bug 1357829)
Backed out changeset 86ebe868d443 (bug 1357829)
2017-05-19 11:27:38 +08:00
Michael Layzell e62bfa945f Bug 1357829 - Part 3: Remove profiler_get_stack_top, r=njn
MozReview-Commit-ID: C4DvuOvYSrs
2017-05-18 13:56:20 -04:00
Michael Layzell dd07e2a56b Bug 1357829 - Part 1: Expose profiler_suspend_and_sample_thread, r=njn
This patch performs a refactoring to the internals of the profiler in order to
expose a function, profiler_suspend_and_sample_thread, which can be called from a
background thread to suspend, sample the native stack, and then resume the
target passed-in thread.

The interface was designed to expose as few internals of the profiler as
possible, exposing only a single callback which accepts the list of program
counters and stack pointers collected during the backtrace.

A method `profiler_current_thread_id` was also added to get the thread_id of the
current thread, which can then be passed by another thread into
profiler_suspend_sample_thread to sample the stack of that thread.

This is implemented in two parts:

1) Splitting SamplerThread into two classes: Sampler, and SamplerThread.

Sampler was created to extract the core logic from SamplerThread which manages
unix signals on android and linux, as well as suspends the target thread on all
platforms. SamplerThread was then modified to subclass this type, adding the
extra methods and fields required for the creation and management of the actual
Sampler Thread.

Some work was done to ensure that the methods on Sampler would not require
ActivePS to be present, as we intend to sample threads when the profiler is not
active for the Background Hang Reporter.

2) Moving the Tick() logic into the TickController interface.

A TickController interface was added to platform which has 2 methods: Tick and
Backtrace. The Tick method replaces the previous Tick() static method, allowing
it to be overridden by a different consumer of SuspendAndSampleAndResumeThread,
while the Backtrace() method replaces the previous MergeStacksIntoProfile
method, allowing it to be overridden by different consumers of
DoNativeBacktrace.

This interface object is then used to wrap implementation specific data, such as
the ProfilerBuffer, and is threaded through the SuspendAndSampleAndResumeThread
and DoNativeBacktrace methods.

This change added 2 virtual calls to the SamplerThread's critical section, which
I believe should be a small enough overhead that it will not affect profiling
performance. These virtual calls could be avoided using templating, but I
decided that doing so would be unnecessary.

MozReview-Commit-ID: AT48xb2asgV
2017-05-18 13:56:20 -04:00
Jan Beich 05df348a87 Bug 1365269 - Unbreak non-GeckoProfiler platforms after bug 1362894. r=njn
MozReview-Commit-ID: GzctdvqE3ln

--HG--
extra : rebase_source : 850cc12d2d9db0964dd53014a103202f4afd1fbf
2017-05-16 14:43:27 +00:00
Nicholas Nethercote add1b59694 Bug 1362894 - Make profiler_call_{enter,exit} |inline|. r=mstange.
Bug 1359000 moved these functions from GeckoProfiler.h to platform.cpp, which
allowed a lot of follow-up simplifications. But it hurt performance.

This patch moves them back to GeckoProfiler.h and makes them |inline| again.
This required adding a second TLS pointer, sPseudoStack. Comments in the patch
explain why.

--HG--
extra : rebase_source : 4198e32b9e251f4014bce890936f4f85dabeb8ab
2017-05-10 20:13:21 +10:00
Ehsan Akhgari 8a04849cee Bug 1362814 - Part 2: Move GeckoProfilerReporter to its own header; r=mstange
This allows us to get rid of the nsIMemoryReporter.h inclusion in GeckoProfiler.h.
That brings XPCOM string headers with it.
2017-05-12 02:35:09 -04:00
Ehsan Akhgari 9fc6c978e3 Bug 1362814 - Part 1: Remove an unneeded inclusion from GeckoProfiler.h; r=mstange 2017-05-12 02:35:09 -04:00
Carsten "Tomcat" Book 76ca853e3e Merge mozilla-central to mozilla-inbound 2017-05-09 14:40:11 +02:00
Steve Fink 7ef280069e Bug 1322560 - Record minor GC timings in profiles, r=jonco, mccr8, mstange
--HG--
extra : rebase_source : 073eceb4216b0505f8cbce0947e3e5091626ead1
2017-04-25 13:24:34 -07:00
Steve Fink 4b00aab714 Bug 1322560 - Inject detailed GC timing info into profiles, r=mstange
--HG--
extra : rebase_source : fdd7f21bbb783ee759d3b0b614264d078fa2213f
extra : source : 5fe280e53d4f474f5f16ff834e0b9cf55745d746
2017-05-02 16:13:49 -07:00
Nicholas Nethercote 5d0d883f35 Bug 1361009 - Remove MOZ_WIDGET_GONK from the profiler. r=jseward.
This removes the need for PROFILER_LIKELY_MEMORY_CONSTRAINED.

The patch also removes PROFILE_JAVA, USE_FAULTY_LIB, CONFIG_CASE_1,
CONFIG_CASE_2 and replaces all their uses with GP_OS_linux or GP_OS_android.

Finally, the patch removes a bogus |defined(GP_OS_darwin)| condition in
platform-linux-lul.cpp.

--HG--
extra : rebase_source : 77d1c625d65ddf551ab8cd4b962ae48c1a54466c
2017-05-08 07:09:33 +10:00
Sebastian Hengst 52fa659b28 Backed out changeset aefe9ec739e1 (bug 1362814) for Windows bustage in nsStringFwd.h. r=backout 2017-05-08 00:03:51 +02:00
Ehsan Akhgari e004b8d2aa Bug 1362814 - Part 0: Remove an unneeded inclusion from GeckoProfiler.h 2017-05-07 17:17:21 -04:00
Nicholas Nethercote ea25e62e3c Bug 1360471 (part 4) - Use a bitfield to represent profiler features. r=mstange.
Currently the profiler mostly uses an array of strings to represent which
features are available and in use. This patch changes the profiler core to use
a uint32_t bitfield, which is a much simpler and faster representation.
(nsProfiler and the profiler add-on still use the array of strings, alas.) The
new ProfilerFeature type defines the values in the bitfield.

One side-effect of this change is that profiler_feature_active() now can be
used to query all features. Previously it was just a subset.

Another side-effect is that profiler_get_available_features() no longer incorrectly
indicates support for Java and stack-walking when they aren't supported. (The
handling of task tracer support is unchanged, because the old code handled it
correctly.)
2017-05-01 14:23:34 +10:00
Nicholas Nethercote cc78872f8c Bug 1360471 (part 3) - Rename various "thread name filters" identifiers as "filters". r=mstange.
The new names are more concise and matches common usage elsewhere (e.g.
profiler_start() arguments).

This patch is similar to bug 1358074 part 5.
2017-05-01 13:42:53 +10:00
Nicholas Nethercote ebe44f1856 Bug 1360471 (part 2) - Rename profiler_get_features() as profiler_get_available_features(). r=mstange.
It clarifies that it's not just the features chosen in profiler_start().
2017-05-01 12:07:17 +10:00
Jim Chen 7041014748 Bug 1360322 - 2. Add initial AArch64 support to Gecko profiler; r=mstange
Add enough AArch64-specific code for the Gecko profiler to build.
2017-05-03 11:36:18 -04:00
Michael Layzell 58464c1919 Bug 1346415 - Use FramePointerStackWalk for less deadlocking when stackwalking on x86, r=njn
MozReview-Commit-ID: CAHarvGSuTY
2017-05-01 13:40:37 -04:00
Nicholas Nethercote 31a9d19faa Bug 1360442 - Fix up macros in GeckoProfiler.h. r=mstange.
- Use PROFILER_ consistently as the prefix for macros in this file. (As opposed
  to PROFILE_ or SAMPLE_ or SAMPLER_ or MOZ_ or PLATFORM_ or no prefix.)

- Split overly long macros across multiple lines.

- Fix some macro indenting.
2017-04-28 15:57:03 +10:00
Nicholas Nethercote 93b0b152aa Bug 1123754 (part 2) - Move ProfilerMarker into ProfilerMarker.h. r=mstange.
ProfilerMarker is simple enough that it's best to fully define it in
ProfilerMarker.h, without introducing a ProfilerMarker.cpp.

This requires moving STORE_SEQUENCER() into its own header, StoreSequencer.h.

As a result, the following types are no longer visible outside the profiler:
ProfilerMarker, ProfilerLinkedList, ProfilerMarkerLinkedList,
ProfilerSignalSafeLinkedList. (PseudoStack.h now contains the PseudoStack class
and nothing else.)

The patch also makes the following non-obvious changes.

- It changes ProfilerMarker::{mMarkerName,mPayload} to unique pointers, which
  removes the need for an explicit ~ProfilerMarker().

- It removes ProfilerMarker::GetMarkerName(), because that method is only used
  within ProfilerMarker itself.

--HG--
extra : rebase_source : 22bdfb1c9c30751253ed66352d7edd51d308152d
2017-04-27 07:36:22 +10:00
Nicholas Nethercote 273ec65c56 Bug 1123754 (part 1) - Rename ProfilerMarkers.{h,cpp} as ProfilerMarkerPayload.{h,cpp}. r=mstange.
Because ProfilerMarkerPayload is the main type defined in these files, and
because the next patch is going to introduce ProfilerMarker.{h,cpp}, which
would be confusingly similar to the old names.

--HG--
rename : tools/profiler/core/ProfilerMarkers.cpp => tools/profiler/core/ProfilerMarkerPayload.cpp
rename : tools/profiler/public/ProfilerMarkers.h => tools/profiler/public/ProfilerMarkerPayload.h
extra : rebase_source : df22a2ab3867650348ae78fe959ff0366aff230b
2017-04-27 07:36:19 +10:00
Nicholas Nethercote 4e6950332a Bug 1359000 (part 7) - Move mContext and mJSSampling from RacyThreadInfo to ThreadInfo. r=mstange.
None of the accesses to these fields occur in hot operations, so it's
reasonable to do them with gPSMutex held. As a result, mJSSampling doesn't need
to be Atomic<>, and mContext's lack of Atomic-ness is no longer a cause for
concern.

This required adding an extra field, mJSContext, to TickSample.

--HG--
extra : rebase_source : 1485de5e493cef655233507248006574d0ab6ebd
2017-04-27 07:36:17 +10:00
Nicholas Nethercote 93d021e19b Bug 1359000 (part 6) - Split off RacyThreadInfo from PseudoStack. r=mstange.
PseudoStack is misnamed: it contains the pseudo-stack plus other stuff that is
accessed via TLS.

This patch moves the non-pseudo-stack parts of PseudoStack into a new type
called RacyThreadInfo, which is a subclass of PseudoStack. The patch also
capitalizes the first letter of the names of methods that it moves.

This means that PseudoStack is now accurately named. Also non-pseudo-stack
parts are now no longer visible outside the profiler, which is nice.

--HG--
extra : rebase_source : c110acfb6d2a1527ed33cc073fab3fb188851b22
2017-04-27 07:36:15 +10:00
Nicholas Nethercote 9471adc672 Bug 1359000 (part 4) - De-inline profiler_call_{enter,exit}. r=mstange.
This possibly incurs an extra function call (depends on exactly how much inling
the compiler does). But it helps enormously with subsequent refactorings,
because PseudoStack (and related types) don't need to be visible in
GeckoProfiler.h, which is exported outside the profiler.

--HG--
extra : rebase_source : f2dc5952d7444dfe12e627e86e6d37632b283107
2017-04-27 07:36:11 +10:00
Nicholas Nethercote e2606aa433 Bug 1359000 (part 1) - Remove unused method PseudoStack::push. r=mstange.
--HG--
extra : rebase_source : efff90c7b1de25035a1e9cccf5a8c6027c7a54d9
2017-04-24 09:41:31 +10:00
Carsten "Tomcat" Book e1e203f1f5 Merge mozilla-central to autoland 2017-04-27 16:36:41 +02:00
Greg Tatum 778111225d Bug 1357849 - Instrument performance.measure with markers; r=baku,mstange
MozReview-Commit-ID: KQcQgxYyEYi

--HG--
extra : rebase_source : bc26048ca4317d11ab22a5a54064fa2c031a9fdc
2017-04-24 10:15:11 -05:00
Carsten "Tomcat" Book 8f4e4ca99b merge mozilla-inbound to mozilla-central a=merge 2017-04-26 08:41:31 +02:00
Nicholas Nethercote c28a0c41b5 Bug 1358074 (part 3, attempt 2) - Don't measure process creation time on every profiler_start() call. r=mstange.
--HG--
extra : rebase_source : 588969b00e56cd7b65904a8d0baf712ea1b57ca5
2017-04-21 13:23:34 +10:00
Nicholas Nethercote 2c0ca9635a Bug 1358074 (part 2, attempt 2) - Unexport and rename ProfilerState. r=mstange.
--HG--
extra : rebase_source : 5b3e049f24d7d4f2e45989e9ee7f05c0258b1280
2017-04-21 13:23:34 +10:00
Tom Tromey 66313f92eb Bug 1349655 - remove sig_safe_t in favor of mozilla::Atomic<uint32_t>; r=djvj,njn
Remove the definition of sig_safe_t, which is only used by PseudoStack,
and replace the uses with mozilla::Atomic<uint32_t>.

MozReview-Commit-ID: GcPd9R94Vci

--HG--
extra : rebase_source : dcc05a219d59ffdc0486ef2e7118d888c6a93fda
2017-03-22 13:57:31 -06:00
Markus Stange aeb36a2713 Bug 1358360 - Correctly fill in SharedLibrary fields for the main executable. r=jseward
MozReview-Commit-ID: 3ZJ8FB2Zjs8

--HG--
extra : rebase_source : 1119844c78c0d60d97edccf2511df9660a7a6427
2017-04-21 14:30:18 -04:00
Jan Beich 30bcfaccb9 Bug 1362598 - Always define ProfilerFeature as there's no stub. r=mstange
MozReview-Commit-ID: Bsj6dFwF1h0

--HG--
extra : rebase_source : 694086b532889e0c820ebd5d37dda778735dea97
2017-05-05 23:29:58 +00:00
Nicholas Nethercote 625d4520a7 Bug 1357298 - Remove the 'layers.frame-counter' option. r=mstange,mattwoodrow.
This option turns on a frame counter that is shown in the top left corner via a
QR code. It was designed to be used in video recordings of B2G phones.

It no longer seems useful, so this patch removes it.
* * *
Bug 1357298 - Remove all traces of frame numbers and power from the profiler output. r=mstange.

--HG--
extra : rebase_source : 0ce87963ce375df64bb8d80ef2b5d40ea507bc7c
2017-04-18 15:40:24 +10:00
Markus Stange dcfba9f179 Bug 1321617 - Call profiler_stream_json_for_this_process in ProfileGatherer::Finish() and get rid of the 'profile-subprocess' notification indirection. r=njn
MozReview-Commit-ID: CnE0SJBsfDN

--HG--
extra : rebase_source : 59f4201d3d8b8fb0d5bc7743f9dafd60789d916a
extra : histedit_source : 5b8b9b26ac87d22d118891868a8a07fe225e85b2
2017-04-12 16:40:03 -04:00
Markus Stange 0fc86487fd Bug 1321617 - Don't store profiles on the CPPC; pass them right to the ProfileGatherer. r=njn
MozReview-Commit-ID: 6gaP8Ltm7ms

--HG--
extra : rebase_source : c91f87f096286f8914553a26d692ea99ec9369c5
extra : histedit_source : 0fd9f4a9bf8b9f8f0acaaab30640a5e2f462148b
2017-04-08 21:54:16 -04:00
Markus Stange 59446b4f09 Bug 1321617 - Tell the CrossProcessProfilerController whether a profile is a response to a GatherProfile request or whether it was sent because the process was exiting. r=mconley
MozReview-Commit-ID: BLkaeZqtRhv

--HG--
extra : rebase_source : b0271115a66afbf54d98b5bad61165f815f5bd8c
extra : histedit_source : 299cccc9cc8c06de4d61686ff49d2b0e7649da78
2017-04-12 16:44:31 -04:00
Julian Seward 553b8e9b10 Bug 1354546 - Make LUL read CFI from the main executable on x86_64-Linux. r=n.nethercote.
LUL doesn't read CFI from the main executable on x86_64-linux, and possibly
other Linux variants, because SharedLibraryInfo::GetInfoForSelf() doesn't
produce a name for the main executable object, even though it does notice the
mapping.

This causes noticeable unwind breakage because the main executable on Linux
contains various wrapper functions pertaining to memory allocation and locking,
such as

  moz_xmalloc, moz_xcalloc, moz_xrealloc
  mozilla::detail::MutexImpl::lock, mozilla::detail::MutexImpl::unlock

and is generally observable on x86_64-Linux as unwinding failures out of
functions with addresses around 0x40xxxx, since that's the traditional load
address for the main executable.

This patch modifies the Linux implementation of GetInfoForSelf() so as to
harvest the main executable's name from /proc/self/maps.  This is then added
into the information acquired from dl_iterate_phdr.  As a result
GetInfoForSelf() does correctly report the executable name, so LUL reads Dwarf
unwind info from it, and the abovementioned unwinding failures disappear.

--HG--
extra : rebase_source : 267c6d7c3967a4d29f8ff0b4a91d339a6625085d
2017-04-12 07:56:58 +02:00
Nicholas Nethercote df889bc9f6 Bug 1350967 (part 2) - Remove profiler_get_profile_jsobject_async() and profiler_save_profile_to_file_async(). r=mstange.
The state management is better done within nsProfiler::GetProfileDataAsync()
and nsProfiler::DumpProfileToFileAsync(). (The latter function is new in this
patch.)

This fixes a deadlock.

Other notes:

- The patch moves ProfileGatherer from ProfilerState to nsProfiler. This is
  nice because the former is shared between threads but the latter is main
  thread only. (This is how the deadlock is avoided.)

- ProfilerStateMutex and PSLockRef are no longer required in platform.h. Those
  types and variables are now only used in platform.cpp and platform-*.cpp.

- ProfilerGatherer now calls profiler_get_profile() instead of ToJSON(). Which
  means that ToJSON() now has a single caller, so the patch inlines it at the
  callsite and removes it.

- profiler_save_profile_to_file_async() dispatched a Runnable to the main
  thread. But this wasn't necessary, because it always ran on the main thread
  itself. So the new function nsProfiler::DumpProfileToFileAsync() doesn't do
  that.

- profiler_will_gather_OOP_profile(), profiler_gathered_OOP_profile(), and
  profiler_OOP_exit_profile() are all moved into nsProfiler as well. This
  removes the need for the horrible fake lock in
  profiler_will_gather_OOP_profile(), hooray!
2017-03-29 15:48:13 +11:00
Nicholas Nethercote 445b5b7145 Bug 1350967 (part 1) - Remove profiler_get_profile_jsobject. r=mstange.
The conversion to a JSObject is better done within
nsProfiler::GetProfileData().

--HG--
extra : rebase_source : 4a0ba97d99681fca96f2d26b609bafe188095787
2017-03-29 14:02:37 +11:00
Nicholas Nethercote c29e97d66d Bug 1351963 (part 8) - Simplify PseudoStack ownership. r=jseward.
Currently each live thread has a PseudoStack that is owned by tlsPseudoStack,
and a ThreadInfo that has a non-owning pointer to the same PseudoStack.
Then, if the profile is active when the thread dies, ownership of the
PseudoStack is transferred to the ThreadInfo.

This patch simplifies the ownership rules. Every ThreadInfo now always owns its
PseudoStack and is responsible for destroying it. tlsPseudoStack is a
non-owning pointer, and so must be cleared when a PseudoStack is destroyed.
This simplifies the code in a few places.

--HG--
extra : rebase_source : 1012b6590380091d60eff98b4e0c5b1ba946cc7e
2017-03-31 11:01:50 +11:00
Nicholas Nethercote f76f4f4892 Bug 1351963 (part 5) - Improve TickSample. r=jseward.
This patch does the following.

- Splits TickSample's constructor in two, one for the periodic sample case, and
  one for the synchronous sample case, and initializes more stuff in them. (The
  two constructors aren't that different right now, but they will become more
  different when I remove TickSample::mThreadInfo.)

- Makes all the constructor-filled fields in TickSample |const|.

- Reorders the fields so that the constructor-filled ones are before the ones
  that get filled in later.

- Omits mContext on Mac via conditional compilation, to make the omission
  clearer.

--HG--
extra : rebase_source : f3e392c4cf777df5b9f39577af82615890137018
2017-03-31 10:35:54 +11:00
Markus Stange fcdd5dbd1f Bug 1351920 - Remove the nsCString&& version of PROFILER_LABEL_DYNAMIC because it makes misleading promises about performance. r=njn
MozReview-Commit-ID: I4y5xnFyfUj

--HG--
extra : rebase_source : 8cd3d9fc90df1cb7ff6199cf0a5b1cf3319bebe0
2017-03-29 21:47:51 -04:00
Markus Stange 353da4ad55 Bug 1351920 - Check privacy mode during sampling, not during PROFILER_LABEL_DYNAMIC. r=njn
When the profiler is running in privacy mode, we don't want to include dynamic
strings from PROFILER_LABEL_DYNAMIC to end up in the profile.
Rather than checking this every time we enter a scope marked with
PROFILER_LABEL_DYNAMIC, with this patch we will push the dynamic string into
the pseudo stack entry regardless, and then check the privacy mode during
sampling and ignore the dynamic string as necessary.
This way we can avoid taking the profiler state lock in PROFILER_LABEL_DYNAMIC
and also save a branch.

MozReview-Commit-ID: 5dXrtMuFJ5r

--HG--
extra : rebase_source : 1c2057e7ced332d9001137b5b280feab77a712e5
2017-03-30 12:41:04 -04:00
Nicholas Nethercote 2a3ba6e9fa Bug 1351528 (part 2) - Rename TracingMetadata as TracingKind. r=mstange.
"Metadata" regularly confuses me, because it suggests something complicated
rather than a simple enum.

This change also has the benefit of removing inconsistent capitalization
("Metadata" vs. "MetaData").

--HG--
extra : rebase_source : b651e124142c8d93139d22dae1c993c899be4d7a
2017-03-29 13:56:14 +11:00
Nicholas Nethercote 4285c8907d Bug 1351528 (part 1) - Streamline TracingMetadata. r=mstange.
This patch:

- Removes TRACING_EVENT_BACKTRACE, which is unused.

- Removes TRACING_DEFAULT and replaces all its uses with TRACING_EVENT, because
  there is no difference in how those two are used.

- Removes TRACING_TIMESTAMP, which is unused and also doesn't do anything
  different to TRACING_EVENT.

--HG--
extra : rebase_source : 69af1c53aa918798d8050e6b9d1a2658a0902af5
2017-03-29 13:52:47 +11:00