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

361 Коммитов

Автор SHA1 Сообщение Дата
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
Nicholas Nethercote 37a83290da Bug 1351523 - Reorder profiler_get_start_params() arguments. r=mstange.
profiler_start() and nsProfilerStartParams() both have features before filters.
This patch makes profiler_get_start_params() follow suit.
2017-03-29 13:22:29 +11:00
Nicholas Nethercote e105cad299 Bug 1346132 (part 2) - Remove set_stderr_callback(). r=mstange.
It's a very general mechanism for replacing the implementation of
printf_stderr().

It's primarily used by the profiler, sparingly, and not in an important way.
Worse, it prevents us from using MOZ_LOG in the profiler, which is something I
want. Because if any code that locks gPSMutex also calls MOZ_LOG, that then
calls printf_stderr(), which calls profiler_log(), which locks gPSMutex, which
deadlocks.

The only other use of set_stderr_callback() is for the ultra-hacky,
for-local-use-only copy_stderr_to_file() function, which was added for B2G
debugging and is no longer necessary.

This patch removes set_stderr_callback() altogether.

--HG--
extra : rebase_source : d31ecb482fe5899f62dc56a38e87d91f9271bab0
2017-03-16 08:17:56 +11:00
Markus Stange c1e6abcc0a Bug 1321907 - Remove mIsProfilerActive. r=njn
Replace it with profiler_is_active() in one place, and simply remove it in the
other places. These other places are:
 - Around the call to profiler_OOP_exit_profile: profiler_OOP_exit_profile
   itself already checks whether the profiler is running and does nothing if
   it's not.
 - When handling the 'profiler-subprocess-gather' notification. This
   notification is sent by the profiler because it's interested in the
   profile, so there's little reason to reject it.
 - In RecvProfile: If the child process sent us a profile, it did so in
   response to a GatherProfile request, so chances are that we're still
   interested in that response.

These changes may get us a little closer to a state where you can call
getProfileDataAsync, stop the profiler before the content process profiles
have all come in, and then still receive a response with all the profiles.
At the moment, stopping the profiler will abort the profile gathering process,
but that seems more like an accident and less like the behavior you'd want.

MozReview-Commit-ID: 2tRXC70BztJ

--HG--
extra : rebase_source : 3b2f6f51d75d5f0d439e1a815d84164a5a763603
2017-03-22 21:45:10 -04:00
Markus Stange 2a4fe61200 Bug 1321907 - Move cross process profiler controlling code from ContentParent and PluginModuleParent into a new class called CrossProcessProfilerController. r=mconley,njn
MozReview-Commit-ID: HY2iWHlDaEy

--HG--
extra : rebase_source : a91e7b40ea2dbd6d75c2d1a62c359d7ea983fe3c
2017-03-22 21:44:59 -04:00
Markus Stange 730b4fc829 Bug 1339897 - Rename PROFILER_LABEL_PRINTF to PROFILER_LABEL_DYNAMIC and make it really cheap. r=Ehsan,njn
Instead of copying and concatenating strings into an mDest buffer in
SamplerStackFramePrintfRAII, require callers to keep the string buffer alive
for the duration of the current scope, and store the pointer to the annotation
string in the ProfileEntry. During stackwalking, concatenate the label and the
annotation (separated by a space) and store the resulting string in the
profile buffer.

MozReview-Commit-ID: GEjcLrhhdvb

--HG--
extra : rebase_source : 683749421ee2122805a249cf413e882ee5f33331
2017-03-22 19:37:33 -04:00
Markus Stange 5d618f99af Bug 1329111 - Record shared library architecture on Mac. r=glandium,njn
This is interesting information on Mac because some system libraries come in
two 64 bit versions: a regular one, and one that contains Haswell-specific
instructions. The former 'architecture' is called x86_64 and the latter is
called x86_64h (h for Haswell).

We set arch to the empty string on non-Mac platforms. It's not all that
interesting on those platforms because there will be only one architecture
in the binary at the given path, unlike on Mac where you can have fat
binaries with multiple architectures.

MozReview-Commit-ID: Dgnslv0D3Ug

--HG--
extra : rebase_source : cf1fcfc1635d373eaeea35aad2f73b235097c748
2017-03-13 17:51:41 -04:00
Markus Stange 4be87b17a8 Bug 1329111 - Supply SharedLibraryInfo with the absolute module path and debug path on all platforms. r=marco
MozReview-Commit-ID: 9R3ecPxGoMr

--HG--
extra : rebase_source : 3cc2af0e5c2b40f349f9e77e06731188d9af07ea
2017-03-14 18:26:50 -04:00
Markus Stange 0048861a6b Bug 1329111 - Rename SharedLibraryInfo::mName to mModuleName, and consistently cut off the path on all platforms. r=marco
MozReview-Commit-ID: 8gqqVjTjy1Z

--HG--
extra : rebase_source : 646340086cd46fe023495bfca140e859c98a5205
2017-03-14 17:07:43 -04:00
Sebastian Hengst 8b715d46ad Backed out changeset ff2306d8e07f (bug 1329111) for lacking a semicolon in devtools/server/performance/profiler.js. r=backout 2017-03-16 20:00:34 +01:00
Sebastian Hengst 224e25992e Backed out changeset 2656a5fa88a2 (bug 1329111) 2017-03-16 19:59:53 +01:00
Sebastian Hengst 01760e033d Backed out changeset 54d438799138 (bug 1329111) 2017-03-16 19:59:48 +01:00
Markus Stange 5fdbdd6b74 Bug 1329111 - Record shared library architecture on Mac. r=glandium,njn
This is interesting information on Mac because some system libraries come in
two 64 bit versions: a regular one, and one that contains Haswell-specific
instructions. The former 'architecture' is called x86_64 and the latter is
called x86_64h (h for Haswell).

We set arch to the empty string on non-Mac platforms. It's not all that
interesting on those platforms because there will be only one architecture
in the binary at the given path, unlike on Mac where you can have fat
binaries with multiple architectures.

MozReview-Commit-ID: Dgnslv0D3Ug

--HG--
extra : rebase_source : cf1fcfc1635d373eaeea35aad2f73b235097c748
2017-03-13 17:51:41 -04:00
Markus Stange 13cdaa1908 Bug 1329111 - Supply SharedLibraryInfo with the absolute module path and debug path on all platforms. r=marco
MozReview-Commit-ID: 9R3ecPxGoMr

--HG--
extra : rebase_source : 3cc2af0e5c2b40f349f9e77e06731188d9af07ea
2017-03-14 18:26:50 -04:00
Markus Stange c76fa9b925 Bug 1329111 - Rename SharedLibraryInfo::mName to mModuleName, and consistently cut off the path on all platforms. r=marco
MozReview-Commit-ID: 8gqqVjTjy1Z

--HG--
extra : rebase_source : 646340086cd46fe023495bfca140e859c98a5205
2017-03-14 17:07:43 -04:00
Nicholas Nethercote 1b01d89d14 Bug 1347348 (part 4) - Fix comments in GeckoProfiler.h. r=mstange.
Specifically:

- Improve the documentation on all the profiler_*() functions, esp. about what
  they do when the profiler is inactive.

- Fix numerous spelling mistakes.

- Wrap all comment lines at 80 chars.

- Change /**/ comments to // comments throughout.

--HG--
extra : rebase_source : 17f766301416806764413cea7f949c42e7721ab9
2017-03-07 16:54:58 +11:00
Nicholas Nethercote 0414a346c4 Bug 1347348 (part 1) - Don't export ProfilerBacktrace.h. r=mstange.
ProfilerBacktrace.h doesn't need to be visible outside the profiler because
the ProfilerBacktrace type is only used in pointers outside the profiler and
the existing forward declaration in GeckoProfiler.h suffices for that.

--HG--
rename : tools/profiler/public/ProfilerBacktrace.h => tools/profiler/core/ProfilerBacktrace.h
extra : rebase_source : 50752626fbd6948de26e193956ed7b82b41b1830
2017-03-07 16:54:50 +11:00
Nicholas Nethercote 8876b32323 Bug 1345262 (part 5) - Fix how JS sampling is started/stopped by the profiler. r=mstange,djvj.
Currently, JS sampling has major problems.

- JS sampling is enabled for all JS threads from the thread that runs
  locked_profiler_start() -- currently only the main thread -- but the JS
  engine can't handle enabling from off-thread, and asserts. This makes
  profiling workers impossible in a debug build.

- No JS thread will be JS sampled unless enableJSSampling() is called, but that
  only happens in locked_profiler_start(). That means any worker threads
  created while the profiler is active won't be JS sampled.

- Only the thread that runs locked_profiler_stop() -- currently only the main
  thread -- ever calls disableJSSampling(). This means that worker threads that
  start being JS sampled never stop being JS sampled.

This patch fixes these three problems in the following ways.

- locked_profiler_start() now sets a flag in PseudoStack that indicates
  JS sampling is desired, but doesn't directly enable it. Instead, the JS
  thread polls that flag and enables JS sampling itself when it sees the flag
  is set. The polling is done by the interrupt callback. There was already a
  flag of this sort (mJSSampling) but the new one is better.

  This required adding a call to profiler_js_operation_callback() to the
  InterruptCallback() in XPCJSContext.cpp. (In comparison, the
  InterruptCallback() in dom/workers/RuntimeService.cpp already had such a
  call.)

- RegisterCurrentThread() now requests JS sampling of a JS thread when the
  profiler is active, the thread is being profiled, and JS sampling is enabled.

- locked_profiler_stop() now calls stopJSSampling() on all live threads.

The patch makes the following smaller changes as well.

- Renames profiler_js_operation_callback() as profiler_js_interrupt_callback(),
  because "interrupt callback" is the standard name (viz.
  JS_AddInterruptCallback()).

- Calls js::RegisterContextProfilingEventMarker() with nullptr when stopping
  JS sampling, so that ProfilerJSEventMarker won't fire unnecessarily.

- Some minor formatting changes.

--HG--
extra : rebase_source : 372f94c963a9e5b2493389892499b1ca205ebc2f
2017-03-10 09:04:23 +11:00
Nicholas Nethercote ce17b32bef Bug 1345262 (part 4) - Remove and inline PseudoStack::{clearContext,flushSamplerOnJSShutdown}(). r=mstange.
They each have a single call site, and this code makes makes more sense in
platform.cpp than as PseudoStack methods because it's mostly dealing with gPS.

--HG--
extra : rebase_source : 84d8c7d8989f0e02b238d591ece2be110cbbcb1a
2017-03-10 08:33:33 +11:00
Nicholas Nethercote 5703ff4afb Bug 1345262 (part 3) - Split PseudoStack::sampleContext() in two. r=mstange.
It does almost entirely different things depending on whether we are setting or
clearing the context.

--HG--
extra : rebase_source : 356445957968e1d055f4b717c65476fa765d8bd5
2017-03-09 17:06:39 +11:00
Nicholas Nethercote d8023679e3 Bug 1345262 (part 2) - Add profiler_{set,clear}_js_context(). r=mstange.
PseudoContext::sampleContext() is always called immediately after
profiler_get_pseudo_stack(). This patch introduces profiler_set_js_context()
and profiler_clear_js_context(), which replace the profiler_get_pseudo_stack()
+ sampleContext() pairs. This takes us a step closer to not having to export
PseudoStack outside the profiler.

--HG--
extra : rebase_source : 8558d1600eafd395cc696d31f3d21fb52a1a74b0
2017-03-09 17:06:35 +11:00
Nicholas Nethercote 8c96fbb044 Bug 1345262 (part 1) - Remove unnecessary assertion. r=jseward.
Bug 1341255 changed PseudoStack::mStack to a js::ProfileEntry[], so we don't
need this assertion any more.

--HG--
extra : rebase_source : 7fcb5218db56b5a9409d81ff67d653e9db37414e
2017-03-07 16:54:54 +11:00
Nicholas Nethercote d4cea5f1de Bug 1346356 (part 4) - Clean up notification in the profiler. r=mstange.
This patch does the following.

- Introduces NotifyObservers() for the simple notification cases in
  platform.cpp.

- Removes profiler_lock() and profiler_unlock() because they do notifications
  that the profiler add-on no longer listens for.

--HG--
extra : rebase_source : 77a1868ba494dea314702bbdf9478a1da36c9efb
2017-03-14 10:03:33 +11:00
Nicholas Nethercote d5457902e2 Bug 1342306 (part 3) - Properly synchronize the global state in platform*.cpp. r=mstange.
This patch properly synchronizes all the global state in platform*.cpp, which
gets us a long way towards implementing bug 1330184.

- Most of the global state goes in a new class, ProfilerState, with a single
  instance, gPS. All accesses to gPS are protected by gPSMutex. All functions
  that access ProfilerState require a token proving that gPS is locked; this
  makes things much clearer.

  gRegisteredThreadsMutex is removed because it is subsumed by gPSMutex.

- gVerbosity, however, does not go in ProfilerState. It stays separate, and
  gains its own mutex, gVerbosityMutex.

Also, the tracking of the current profiler state is streamlined. Previously it
was tracked via:

- stack_key_initialized, gInitCount, gSampler, gIsProfiling, gIsActive, and
  gIsPaused.

Now it is tracked via:

- gPS, gPS->sActivity, and gPS->mIsPaused.

This means that the Sampler class is no longer necessary, and the patch removes
it.

Other changes of note made by the patch are as follows.

- It removes ThreadInfo::{mMutex,GetMutex}. This mutex was only used in two
  places, and both these are now protected by gPSMutex.

- It tweaks the LOG calls. All the main functions (init(), shutdown(), start(),
  stop()) now do consistent BEGIN/END logging, and a couple of other low-value
  incidental LOG calls have been removed.

- It adds a lot of release assertions requiring that gPS be initialized (e.g.
  profiler_init() has been called but profiler_shutdown() has not).

- It uses alphabetical order for everything involving profiler feature names.

- It removes Platform{Start,Stop}() and SamplerThread::{Start,Stop}Sampler().
  These are no longer necessary now that SamplerThread::sInstance has been
  replaced with ProfilerState::mSamplerThread which allows more direct access
  to the current SamplerThread instance.

- It removes PseudoStack::mPrivacyMode. This was derived from the "privacy"
  feature, and we now use gPS->mFeaturePrivacy directly, which is simpler.
  It also replaces profiler_in_privacy_mode() with
  profiler_is_active_and_not_in_privacy_mode(), which avoids an unnecessary
  lock/unlock of gPSMutex on a moderately hot path.

Finally, the new code does more locking than the old one. A number of operation
The following operations now lock a mutex when they previously didn't; the
following are ones that are significant, according to some ad hoc profiling.

- profiler_tracing()
- profiler_is_active()
- profiler_is_active_and_not_in_privacy_mode()
- profiler_add_marker()
- profiler_feature_active()
- SamplerThread::Run() [when the profiler is paused]

All up this roughly doubles the amount of mutex locking done by the profiler.
It's probably possible to avoid this increase by allowing careful unlocked
access to three of the fields in ProfilerState (mActivityGeneration,
mFeaturePrivacy, mStartTime), but this should only be done as a follow-up if
the extra locking is found to be a problem.

--HG--
extra : rebase_source : c2e41231f131b3e9ccd23ddf43626b54ccc77b7b
2017-03-08 12:40:39 +11:00
Nicholas Nethercote f16f2400e4 Bug 1340161 - Fix PseudoStack handling when profiler threads are marked with SetPendingDelete(). r=jseward.
Instead of nulling ThreadInfo::mPseudoStack, the patch changes things so that
ownership of the PseudoStack is transferred to the ThreadInfo. This avoids
crashes in some cases.

The patch also makes ThreadInfo::mPseudoStack a NotNull<>.

--HG--
extra : rebase_source : 95ace8886092ebe17ac0f4431c8c0936946c1f44
2017-03-08 11:37:00 +11:00
Nicholas Nethercote 548ee91cb0 Bug 1342306 (part 2a) - Fix a comment that part 2 made out-of-date. r=me.
DONTBUILD because it's a comment-only change.
2017-03-06 12:53:37 +11:00
Nicholas Nethercote 51df94092b Bug 1342306 (part 2) - Avoid profiler_time() calls deep in profiler streaming code. r=mstange.
Because profiler_time() is going to need the global lock when I add it, and the
lock will already be held when streaming is happening, so it'll cause the
thread to deadlock itself.

Unfortunately this requires adding an |aStartTime| parameter to a lot of
functions, but this is the least worst way I can think of handling it.

This also removes the need for one of the profiler_time() functions, which the
patch removes.
2017-02-27 13:52:58 +11:00
Nicholas Nethercote 085c9b47e4 Bug 1328378 (part 6) - Eliminate SyncProfile. r=mstange.
It's now a very thin wrapper around ThreadInfo, and so can be removed.

The patch also has the bonus of setting mIsMainThread correctly for the
ThreadInfos that used to be SyncProfiles (i.e. the ones created in
profiler_get_backtrace()). As far as I can tell this has only one very minor
effect, because that field is only used for those objects to determine how
ThreadResponsiveness::Update() dispatches its runnables.

--HG--
extra : rebase_source : 39318dba51316dc473321d6e4215e5b950a4d41d
2017-02-27 12:56:42 +11:00
Nicholas Nethercote ec3c7ad3a1 Bug 1328378 (part 5) - Simplify ProfileBuffer handling. r=mstange.
Currently ThreadInfo objects all share gBuffer, while SyncProfile objects each
get their own ProfileBuffer.

This patch removes ThreadInfo::mBuffer to reduce this difference, taking us a
step towards eliminating SyncProfile.

To support this, the patch:

- passes in a buffer as an additional argument in a bunch of places where the
  buffer used to be obtained from a ThreadInfo;

- adds an mBuffer field to ProfilerBacktrace;

- changes ThreadInfo::SetProfile() to SetHasProfile();

- removes ThreadInfo::{addTag,StoredMarker,bufferGeneration}(), all of which
  just redirected to ThreadInfo anyway;

- changes ProfileBuffer so it's no longer refcounted, which is unnecessary now
  that gBuffer and ProfilerBacktrace::mBuffer don't have multiple references,
  which makes their lifetimes obvious.

The patch also removes some ThreadInfo& args in functions in platform.cpp, in
places where that ThreadInfo is available within the accompanying TickSampler*
arg.

--HG--
extra : rebase_source : 7e6cb370866d3f3fd657c6aa66d3c3eb3d83a4b1
2017-02-27 12:34:59 +11:00
Julian Seward 4cd04ecc8a Bug 1341255 - Profiler tidyups: remove StackEntry, rename ProfileEntry to ProfileBufferEntry (part 1: remove StackEntry). r=n.nethercote.
--HG--
extra : rebase_source : 6418946b1ebeb82abdccdb10a03380a40c00da21
2017-02-23 23:04:13 +01:00
Nicholas Nethercote af10e0c45c Bug 1340928 (part 16) - Clean up profiler env var handling. r=mstange.
This patch does the following.

- Uses "entries" consistently for the name of the value that is obtained from
  MOZ_PROFILER_ENTRIES and is the first argument to profiler_start(). (I.e. not
  "entry" or "entrySize".)

- Removes variables (e.g. PROFILER_HELP) holding env var names and uses the
  names (e.g. "MOZ_PROFILER_HELP") directly. Some of the names are already used
  directly and I think the slight repetition isn't harmful. It's unlikely that
  we'd want to change these names the way we might need to change a numeric
  value, and they're perfectly descriptive.

- Changes the "MOZ_PROFILING_FEATURES" string in the weird Android-only startup
  code to be "MOZ_PROFILER_FEATURES", for consistency.

- Renames gUnwindInterval and gProfileEntries as gEnvVarInterval and
  gEnvVarEntries to make it clearer that they come from environment variables,
  but otherwise are parallel to gInterval and gEntries.

- Puts entries before intervals in most places, to match the profiler_start()
  argument order.

- Changes profiler_usage() so that (a) it always prints, no matter the
  verbosity, (b) it exits at its end, and (c) doesn't double-print "Profiler: "
  at the start of each line.

--HG--
extra : rebase_source : e5a0b1c48e390ada894c746f050f08ff5c241066
2017-02-23 14:26:46 +11:00
Nicholas Nethercote 348841f745 Bug 1340928 (part 12) - Remove profiler_get_gatherer(). r=mstange.
profiler_get_gatherer() exposes ProfileGatherer to the outside world in a way
that makes future changes difficult.

This patch:

- Removes ProfileGatherer.h from the list of headers exported from the
  profiler.

- Removes nsIProfiler.profileGatherer and nsProfiler::GetProfileGatherer().

- Replaces profiler_get_gatherer() with three new functions that provide
  minimal but sufficient access to ProfileGatherer:
  profiler_will_gather_OOP_profile(), profiler_gathered_OOP_profile(), and
  profiler_OOP_exit_profile().

  These functions provide access to the ProfileGatherer in a similar fashion to
  the pre-existing functions profiler_get_profile_jsobject_async() and
  profiler_save_profile_to_file_async()

This significantly reduces the size of the profiler's API surface.

--HG--
rename : tools/profiler/public/ProfileGatherer.h => tools/profiler/gecko/ProfileGatherer.h
extra : rebase_source : d8e06a1133d4098c3a214858d3ff2c4bdcd9f1f2
2017-02-22 10:19:53 +11:00
Nicholas Nethercote a84399b3b5 Bug 1340928 (part 3) - Remove Sampler from ProfileGatherer. r=mstange.
It's only being used in a boolean fashion, so this patch replaces it with a
boolean.

--HG--
extra : rebase_source : 91152dff81107070fa49b3984e1b6759e0cd6d20
2017-02-15 14:44:12 +11:00
Nicholas Nethercote cafb84d8e8 Bug 1339695 (part 8) - Clean up platform detection throughout the profiler. r=mstange.
Currently we use the SPS_* macros in some places, but also use other ones like
__arm__ and ANDROID and XP_{WIN,MAC,LINUX}. This patch makes the profiler
consistently use the SPS_* macros and removes the V8_HOST_ARCH_* macros.

The patch also does the following.

- Cleans up some header inclusions, e.g. including pthread.h directly in the
  files that use it, and removing some unneeded android/log.h inclusions.

- Removes an unused branch in SetSampleContext() -- we don't support ARM on
  anything other than Android, and glibc 2.3 is ancient.

- Doesn't use SPS_* in PseudoStack.h because that would require exporting
  PlatformMacros.h, which doesn't seem worthwhile.

Some things that aid the understanding of this patch.

- XP_LINUX and LINUX are both defined for Linux *and* Android.

- x86/Android is the only supported platform that doesn't define
  HAVE_NATIVE_UNWIND.

- Every platform that defines USE_LUL_STACKWALK also defines
  HAVE_NATIVE_UNWIND.

--HG--
extra : rebase_source : 561b708f9434cabd9c0e00d4f4bfdd53f7008670
2017-02-18 00:56:21 +11:00
Marco Castelluccio 3aec408e65 Bug 1330833 - Add the new "modules" (DLLs) ping type. r=Dexter,mstange,jorendorff, data-review=bsmedberg 2017-02-18 14:17:30 +00:00
Wes Kocher 4fb32a5a83 Backed out 2 changesets (bug 1330833) for windows 64 xpcshell failures a=backout
Backed out changeset 466565fa382a (bug 1330833)
Backed out changeset 927194e7769d (bug 1330833)

MozReview-Commit-ID: GB4KsH29xYC
2017-02-16 17:20:54 -08:00
Marco Castelluccio fb547d31c7 Bug 1330833 - Add the new "modules" (DLLs) ping type. r=Dexter,mstange,jorendorff, data-review=bsmedberg 2017-02-16 17:09:32 +00:00
Nicholas Nethercote ab80c09137 Bug 1339327 (part 7) - Rename some things in platform-linux.cc. r=mstange.
The new names are more consistent, and I find them clearer.

The patch also inlines and removes the horribly-named ProfilerSignalThread()
function.
2017-02-15 14:26:23 +11:00
Nicholas Nethercote 334f89c567 Bug 1339327 (part 5) - Rename some profiler functions related to sleeping. r=mstange.
The new names make it clearer that these actions apply to just one thread.

- profiler_sleep_start() --> profiler_thread_sleep()
- profiler_sleep_end()   --> profiler_thread_wake()
- profiler_is_sleeping() --> profiler_thread_is_sleeping()
- GeckoProfilerSleepRAII --> GeckoProfilerThreadSleepRAII
- GeckoProfilerWakeRAII  --> GeckoProfilerThreadWakeRAII
2017-02-15 14:26:23 +11:00
Nicholas Nethercote 9c05f8c8ed Bug 1338957 (part 3) - Simplify sleep handling in PseudoStack. r=mstange.
Sleep handling is currently done with two counters (mSleepId, mSleepIdObserved)
and a boolean (mSleeping). This patch replaces it with a single tri-state
variable (mSleep), which is enough to replicate the functionality.

The patch also clearly documents how this variable is accessed from multiple
threads and the potential inaccuracies that can result from races.
2017-02-13 17:22:44 +11:00
Nicholas Nethercote b623b482a6 Bug 1338957 (part 1) - Reformat PseudoStack.h. r=mstange.
This patch:

- Reformats PseudoStack.h to more closely follow Mozilla style.

- Rewrites some comments to make them more readable, e.g. by properly
  delimiting sentences with upper-case letters and full stops.

- Replaces sMin() with std::min(), because <algorithm> no longer causes
  problems.

- Reorders PseudoStack so that all the data members are at the end, which makes
  them easier to see.
2017-02-13 16:36:25 +11:00
Nicholas Nethercote 52ef6d2984 Bug 1337189 (part 6b) - Move declarations of gSampler. r=mstange.
--HG--
extra : rebase_source : 03ec3604f8e54aa501142cf218c4673504caf34a
2017-02-07 17:27:54 +11:00
Nicholas Nethercote 4b5d7166d9 Bug 1337189 (part 3) - Remove profiler_responsiveness. r=mstange.
All it does is set sLastTracerEvent, which is never read.

--HG--
extra : rebase_source : 13182caaa8d6e38967c7b667992a9d64029e38d7
2017-02-07 14:15:10 +11:00
Nicholas Nethercote f130ae80cb Bug 1337189 (part 2) - Add more threadedness assertions and comments to the profiler. r=mstange.
This patch adds NS_IsMainThread() assertions to all main-thread-only
profiler_*() functions that currently lack them, and adds comments to those
that run on multiple threads. As a result, it's now clear for every
profiler_*() function which threads it runs on.

--HG--
extra : rebase_source : 9a1b00f040a7bfc477ceee701ad6af165b468f4e
2017-02-06 14:31:38 +11:00
Nicholas Nethercote b59f5ef845 Bug 1126576 (part 1) - Remove refcounting from PseudoStack. r=mstange.
PseudoStack lifetimes are predictable because they match thread lifetimes.
There is no need for refcounting.

This patch:

- Removes the refcounting, along with StackOwningThreadInfo.

- Makes PseudoStack's ctor and dtor public, and removes the Create() method.

- Changes popAndMaybeDelete() to pop().

- Removes PseudoStack::isEmpty(), which is dead.

- Adds various comments to make clear how things now work.

--HG--
extra : rebase_source : 3a135fcf137997a6fbc09b408ff28ee846217e63
2017-02-03 10:34:35 +11:00
Nicholas Nethercote d6624d0e50 Bug 816598 - Add a memory reporter for the Gecko Profiler. r=mstange,jseward.
It's fairly straightforward, and measures the important parts of:

- Sampler, PseudoStack, ProfileBuffer, ThreadInfo.

- LUL, PriMap, SecMap

Coverage isn't perfect, but it gets the major things I found via DMD on Linux.

Example output in about:memory:

├──151.21 MB (49.73%) -- profiler
│  ├──141.49 MB (46.53%) ── lul
│  └────9.72 MB (03.20%) ── sampler

--HG--
extra : rebase_source : 67d2ada42aead43f68f5100a08204a1d1f1cfceb
2017-01-30 12:37:26 +11:00
Nicholas Nethercote b33fc679ac Bug 1334466 (part 2) - Merge Sampler and GeckoSampler. r=mstange.
There's no point having them as separate classes. This removes the need for
some virtual functions, too.

--HG--
extra : rebase_source : b2607ba2431ae043b6e015f4f435b0d660b02d71
2017-01-25 14:34:25 +11:00
Nicholas Nethercote 9fcc3d9c39 Bug 1328365 (part 2) - Rename ProfileGatherer::mTicker as mSampler. r=mstange.
It's a better name, given that the type is |GeckoSampler*|.

--HG--
extra : rebase_source : aaeb9d0c34f8650c2e034e334825c7e8d7c1e832
2017-01-25 16:09:06 +11:00
Nicholas Nethercote fd25b06c81 Bug 1328365 (part 1) - Replace tlsTicker with gSampler. r=mstange.
There is a single GeckoSampler and it is currently only accessed on the main
thread, so it's silly to use TLS for it; a normal global variable is better.

This patch also adds main thread assertions to a number of the profiler_*()
functions. Even though bug 1330184 may get rid of some of them, right now they
are a useful as both a sanity check and documentation.

--HG--
extra : rebase_source : 7613eb3cc8089b31180365f6463c81f4556c7b66
2017-01-25 16:00:47 +11:00
Nicholas Nethercote cb7d796cb1 Bug 1333296 (part 3) - Remove SPS mentions in tools/profiler. r=mstange.
--HG--
extra : rebase_source : d4ee3eccbffc86ea902be2b80a159fb84445c027
2017-01-24 14:18:50 +11:00
Nicholas Nethercote 22b6d342d7 Bug 1333296 (part 1) - Rename MOZ_ENABLE_PROFILER_SPS as MOZ_GECKO_PROFILER. r=mstange,glandium.
--HG--
extra : rebase_source : 223f3a17f009645369be503392cc1f0cea7f19a1
2017-01-24 14:15:12 +11:00
Nicholas Nethercote 82d4c11201 Bug 1332577 (part 9) - Remove all mozilla_sampler_*() functions. r=mstange.
There are lots of profiler_*() functions that simply call onto equivalent or
nearly-equivalent mozilla_sampler_*() functions. This patch removes the
unnecessary indirection by removing the mozilla_sampler_*() functions.

The most important changes:

- In platform.cpp, all the mozilla_sampler_*() definitions are renamed as
  profiler_*().

- In GeckoProfiler.h, the new PROFILER_FUNC{,_VOID} macros provide a neat way
  to declare the functions that must be present whether the profiler is enabled
  or not.

- In GeckoProfiler.h, all the mozilla_sampler_*() declarations are removed, as
  are all the profiler_*() definitions that corresponded to a
  mozilla_sampler_*() function.

Other things of note:

- profiler_log(const char* str) is now defined in platform.cpp, instead of in
  GeckoProfiler.h, for consistency with all the other profiler_*() functions.
  Likewise with profiler_js_operation_callback() and
  profiler_in_privacy_mode().

- ProfilerBacktraceDestructor::operator() is treated slightly different to all
  the profiler_*() functions.

- Both variants of profiler_tracing() got some early-return conditions moved
  into them from GeckoProfiler.h.

- There were some cases where the profiler_*() and mozilla_sampler_*() name
  didn't quite match. Specifically:

  * mozilla_sampler_get_profile_data() and profiler_get_profiler_jsobject():
    name mismatch. Kept the latter.

  * mozilla_sampler_get_profile_data_async() and
    profiler_get_profile_jsobject_async(): name mismatch. Kept the latter.

  * mozilla_sampler_register_thread() and profiler_register_thread(): return
    type mismatch. Changed to void.

  * mozilla_sampler_frame_number() and profiler_set_frame_number(): name
    mismatch. Kept the latter.

  * mozilla_sampler_save_profile_to_file() and
    profile_sampler_save_profile_to_file(): the former was 'extern "C"' so it
    could be called from a debugger easily. The latter now is 'extern "C"'.

- profiler_get_buffer_info() didn't fit the patterns handled by
  PROFILER_FUNC{,VOID}, so the patch makes it call onto the new function
  profiler_get_buffer_info_helper(), which does fit the pattern.

--HG--
extra : rebase_source : fa1817854ade81e8a3027907d1476ff2563f1cc2
2017-01-20 15:05:16 +11:00
Nicholas Nethercote 12647a7223 Bug 1332577 (part 7) - Rename mozilla_get_pseudo_stack() as profiler_get_pseudo_stack(). r=mstange.
This makes it consistent with other profiler functions.

--HG--
extra : rebase_source : 1e52acdc448691b8859bb147a0c70b198b432fe2
2017-01-20 15:07:05 +11:00
Nicholas Nethercote 12530089df Bug 1332577 (part 6) - Move some function definitions in GeckoProfiler.h. r=mstange.
This patch moves the definitions of profiler_call_{entry,exit}() up so that
forward declarations aren't necessary. It also removes an unnecessary second
declaration of mozilla_sampler_add_marker().

--HG--
extra : rebase_source : 254fa7b6400770f5af7bac9559eb1c8a3be77231
2017-01-20 14:29:20 +11:00
Nicholas Nethercote 07ed817efc Bug 1332577 (part 4) - Inline and remove GeckoProfilerTypes.h. r=mstange.
It's only included once, so there's no point having a separate file.

--HG--
extra : rebase_source : b81fb0b90adeb16e81cb6f52d847a2a28c516fed
2017-01-20 10:14:01 +11:00
Nicholas Nethercote b549639a20 Bug 1332577 (part 3) - Inline and remove GeckoProfilerImpl.h. r=mstange.
It's only included once, so there's no point having a separate file.

--HG--
extra : rebase_source : b8bd266e3e792b350c16a3d59d125430ff1b42db
2017-01-20 09:54:56 +11:00
Nicholas Nethercote e0bd6662d5 Bug 1332577 (part 2) - Inline and remove GeckoProfilerFunc.h. r=mstange.
It's only included once, so there's no point having a separate file.

--HG--
extra : rebase_source : 486b7c40ffe2b185efb145ba6e0e0c784e0299f5
2017-01-19 17:44:17 +11:00
Nicholas Nethercote 11ca48a8ae Bug 1332577 (part 1) - Remove PROFILER_MAIN_THREAD_* macros. r=mstange.
The comment suggests these are performance-critical specializations. But (a)
they look very similar to all the other macros, i.e. have no obvious
specialization, and (b) they are unused.

--HG--
extra : rebase_source : d9a0088bfc9154336f56a536320b270fd993ff10
2017-01-19 16:37:02 +11:00
Nicholas Nethercote 7f3476781b Bug 1328373 (part 2) - Remove mozilla_sampler_get_responsiveness declaration. r=mstange.
It's unused.

--HG--
extra : rebase_source : 6e1e0f896f10367bb538c8e5839e2ac36174230c
2017-01-19 08:07:51 +11:00
Nicholas Nethercote 5fa7607c99 Bug 1328373 (part 1) - Remove mozilla_sampler_save. r=mstange.
It's unused.

--HG--
extra : rebase_source : ae05fc3bb205833e86f542ad2eba36de4d71b3b4
2017-01-19 08:07:50 +11:00
Nicholas Nethercote a0ab21e630 Bug 1328369 - Remove tlsStackTop and set_tls_stack_top. r=mstange.
They are unused.

--HG--
extra : rebase_source : 1dd53c26f07c828102b3c12122d22bb1b0e74f3f
2017-01-19 08:07:23 +11:00
Nicholas Nethercote 4a820fa2dd Bug 1317771 (part 1) - Remove SPS_STANDALONE. r=mstange.
This patch removes all the |#ifndef SPS_STANDALONE| guards.

--HG--
extra : rebase_source : af03e38e521d7ef0c3c920209cc8330a40d9b007
2017-01-19 08:06:59 +11:00
Jan Beich 9e123aa5bd Bug 1329467 - Drop non-SPS version of AutoProfilerRegister. r=mstange
MozReview-Commit-ID: 9lZLPAi5ZZT

--HG--
extra : rebase_source : 4dc3e2926b80308d9a7ec2e23b505518c9e10b02
2017-01-09 23:03:22 +00:00
Jan Beich ab093993b7 Bug 1329467 - Move remaining *RAII classes from GeckoProfiler under mozilla namespace. r=mstange
MozReview-Commit-ID: I8qqGDLJkgo

--HG--
extra : rebase_source : eeda752a75c050e5f88851d7401a462d86c24b80
2017-01-09 22:11:58 +00:00
Jan Beich 4676a59c08 Bug 1329467 - Revert bug 1151829 to unbreak non-SPS build after bug 1322553. r=mstange
MozReview-Commit-ID: 14QL0Unr84G

--HG--
extra : rebase_source : 0b0cd50d4c08bfc1d16f648a40c21ce56a72af5f
2017-01-09 21:46:56 +00:00
Carsten "Tomcat" Book 89882dc5f4 merge mozilla-inbound to mozilla-central a=merge 2017-01-10 12:11:31 +01:00
Nathan Froyd e4b0546d8d Bug 1329634 - actually call profiler_tracing in GeckoProfilerTracingRAII constructor; r=mstange 2017-01-09 18:50:53 -05:00
Jan Beich b492741091 Bug 1329291 - Unbreak build on non-SPS platforms after bug 1142197. r=froydnj
MozReview-Commit-ID: LIfC5mj8uzL

--HG--
extra : rebase_source : 5290d461c6bba0d26b7ff1dbbc42964af8dcb8cc
2017-01-08 03:03:39 +00:00
Jan Beich f77c4a415c Bug 1329466 - Unbreak build on non-SPS platforms after bug 1323100. r=mstange
MozReview-Commit-ID: Af1CuVYSNCj

--HG--
extra : rebase_source : ac6c76674785912a24081e7140df33ec0c2789e1
2017-01-08 03:04:48 +00:00
Nathan Froyd 9f924cc32c Bug 1322553 - part 1 - add a non-backtrace-taking constructor for GeckoProfilerTracingRAII; r=mstange
Sometimes there's no backtrace available, but you still want to denote
an interesting event.
2017-01-07 15:56:49 -05:00
Ryan VanderMeulen 1e6f972917 Merge inbound to m-c. a=merge 2017-01-07 11:22:47 -05:00
Markus Stange 4bdc4ca0fb Bug 1323100 - Register most of the remaining threadfunc threads with the profiler. r=froydnj
As far as I can tell, this covers all the remaining threads which we start
using PR_CreateThread, except the ones that are created inside NSPR or NSS,
and except for the Shutdown Watchdog thread in nsTerminator.cpp and the
CacheIO thread. The Shutdown Watchdog thread stays alive past leak detection
during shutdown (by design), so we'd report leaks if we profiled it. The
CacheIO thread seems to stay alive past shutdown leak detection sometimes as
well.

This adds a AutoProfilerRegister stack class for easy registering and
unregistering. There are a few places where we still call
profiler_register_thread() and profiler_unregister_thread() manually, either
because registration happens conditionally, or because there is a variable that
gets put on the stack before the AutoProfilerRegister (e.g. a dynamically
generated thread name). AutoProfilerRegister needs to be the first object on
the stack because it uses its own `this` pointer as the stack top address.

MozReview-Commit-ID: 3vwhS55Yzt

--HG--
extra : rebase_source : 56dd27282e7bd09a7e7dc7ca09ccfe3a0198e7af
2017-01-05 16:34:26 +01:00
Wes Kocher 26a1ba5c14 Backed out 27 changesets (bug 1323100) for clipboard leaktest failures a=backout
Backed out changeset 84fb749698ab (bug 1323100)
Backed out changeset d6d25e8bd001 (bug 1323100)
Backed out changeset 1b0855bb0c38 (bug 1323100)
Backed out changeset b6953e3f5739 (bug 1323100)
Backed out changeset 5572f3b63215 (bug 1323100)
Backed out changeset 12fb4c533659 (bug 1323100)
Backed out changeset c36524e4e919 (bug 1323100)
Backed out changeset 1e3b3eddbe26 (bug 1323100)
Backed out changeset 061110f1ae12 (bug 1323100)
Backed out changeset 413dbd31725b (bug 1323100)
Backed out changeset 06550f7eca62 (bug 1323100)
Backed out changeset 940933b13b36 (bug 1323100)
Backed out changeset a6d75c1cd724 (bug 1323100)
Backed out changeset 681cacbbaa3b (bug 1323100)
Backed out changeset 3d53787293f6 (bug 1323100)
Backed out changeset c0340dfe4766 (bug 1323100)
Backed out changeset 9f554991549d (bug 1323100)
Backed out changeset 757539e7039a (bug 1323100)
Backed out changeset a3c9b45aa917 (bug 1323100)
Backed out changeset 23d69df98a66 (bug 1323100)
Backed out changeset 1297ded6a01d (bug 1323100)
Backed out changeset f4235b97257f (bug 1323100)
Backed out changeset 93419cb4f29f (bug 1323100)
Backed out changeset 865d1b81c804 (bug 1323100)
Backed out changeset 54acf4ef8e84 (bug 1323100)
Backed out changeset 88d17bcd8205 (bug 1323100)
Backed out changeset 0c466e5e8933 (bug 1323100)
2016-12-29 16:28:36 -08:00
Markus Stange 2319d2881d Bug 1324941 - Add a profiler label and a profiler marker for DOMEvent dispatch. r=smaug
MozReview-Commit-ID: 9nyftWPKRVe

--HG--
extra : rebase_source : 0ef900fa5c7749dd5bcec32da6b37aad91f0a518
2016-12-23 12:44:35 +01:00
Markus Stange 48513de60f Bug 1323100 - Register most of the remaining threadfunc threads with the profiler. r=froydnj
As far as I can tell, this covers all the remaining threads which we start
using PR_CreateThread, except the ones that are created inside NSPR or NSS.

This adds a AutoProfilerRegister stack class for easy registering and
unregistering. There are a few places where we still call
profiler_register_thread() and profiler_unregister_thread() manually, either
because registration happens conditionally, or because there is a variable that
gets put on the stack before the AutoProfilerRegister (e.g. a dynamically
generated thread name). AutoProfilerRegister needs to be the first object on
the stack because it uses its own `this` pointer as the stack top address.

MozReview-Commit-ID: 3vwhS55Yzt

--HG--
extra : rebase_source : dffab11abf7d4b57fa54475fd22e71b84375cd7b
2016-12-29 22:32:52 +01:00
Nathan Froyd 4039d9589a Bug 1142197 - manage ProfilerBacktrace with UniquePtr; r=mstange
Smart pointers are better than raw pointers.
2017-01-06 09:21:01 -05:00
Thinker K.F. Li 6a49d378ba Bug 1287392 - Part 4: Expose a file writer API for GeckoProfiler. r=mstange 2016-11-19 02:48:00 +08:00
Tom Schuster 774a8bf34d Bug 1302163 - Change code to use SprintfLiteral instead of snprintf. r=ehsan 2016-10-04 17:57:51 +02:00
Tom Tromey 1b3a828426 Bug 1067547 - add more uses of MOZ_COUNT_CTOR to tools/profiler; r=bsmedberg
MozReview-Commit-ID: 5Gf5OkydkL0

--HG--
extra : rebase_source : a32eabd5c8d051370b0f52e1b8edf8029da95a6d
2016-09-26 11:05:44 -06:00
Aaron Klotz f2f2b539f2 Bug 1301167: Add a GeckoProfilerWakeRAII interface to the profiler; r=BenWa
MozReview-Commit-ID: KGn9qF7fZAs
2016-09-07 14:28:50 -06:00
Jan de Mooij 0ad12515f4 Bug 1292892 part 1 - Stop using JSRuntime outside SpiderMonkey. r=bz,terrence,fitzgen,kanru 2016-08-11 14:39:22 +02:00
Nicholas Nethercote a913f99107 Bug 1285554 - Remove remnants of widget/qt. r=dougt,mshal.
Because bug 1282866 removed Qt support but missed a bunch of things.
* * *
Bug 1285554 - more

--HG--
extra : rebase_source : c48d2485f1fdf1c961e08d91651bbca41e3a1a53
2016-07-12 09:16:45 +10:00
Chris Peterson 2b3b60f7b1 Bug 1277155 - Part 1: Remove snprintf() polyfills for VS2013 in Sprintf.h and #defines. r=froydnj r=mhowell 2016-06-27 20:45:03 -07:00
Nathan Froyd 6b5caaf0b7 Bug 1270928 - part 1 - use UniquePtr in PROFILER_MARKER_PAYLOAD; r=BenWa
We'd like to get rid of nsAutoPtr usage, and this header doesn't even
#include nsAutoPtr.h.
2016-05-09 10:04:50 -04:00
Eric Rahm 7a9e99d2c6 Bug 1251787 - Remove remaining references to MOZILLA_XPCOMRT_API from tools. r=mstange 2016-02-27 11:12:08 -08:00
Chris H-C 843e04bb32 Bug 1238121 - Properly guard Profiler's RAII classes r=BenWa f=mystor
We can't use GuardObjects easily on the printf variant as va_list args and
default args can't play together.
2016-01-28 09:19:00 +01:00
Wes Kocher 23122402f7 Backed out changeset 65624d4c4a65 (bug 1238121) to hopefully fix the intermittent hazard failures
--HG--
extra : commitid : 6SsEbxXjwKq
2016-01-29 10:14:34 -08:00
Chris H-C dfbec1cede Bug 1238121 - Properly guard Profiler's RAII classes. r=BenWa, f=mystor
We can't use GuardObjects easily on the printf variant as va_list args and default args can't play together.

--HG--
extra : rebase_source : 418252aa8d1dcae56decd5ff99246d34578b9003
2016-01-28 09:19:00 -05:00
Tom Tromey 5412728905 Bug 757969 - use __thread in ThreadLocal; r=froydnj 2016-01-22 10:33:44 -07:00
Andrea Marchesini caa2f9b456 Bug 1231378 - part 4 - Fix uninitialized members of classes in netwerk/widget/storage/uriloader/memory/tools, r=smaug 2016-01-12 18:16:59 +00:00
Carsten "Tomcat" Book 3589aeeb8a Backed out changeset d6b0ffe1a7b3 (bug 1231378) 2016-01-12 15:48:54 +01:00
Andrea Marchesini 2609a149da Bug 1231378 - part 4 - Fix uninitialized members of classes in netwerk/widget/storage/uriloader/memory/tools, r=smaug 2016-01-12 13:57:37 +00:00
Benoit Girard 8caf284e45 Bug 1233835 - Fix TaskTracer double init assert. r=mconley
--HG--
extra : rebase_source : 4e734a428bf22863e5ee6fa44191752c9a8cec77
2015-12-18 16:12:47 -05:00
Mike Conley 51d7f5de3d Bug 1193838 - Allow ProfileGatherer to gather profiles from exiting processes. r=BenWa
--HG--
extra : commitid : IhyN838vNVU
extra : rebase_source : a91c87e3f9a087cd789bdb678651ab351357092a
2015-08-18 14:57:35 -04:00
Mike Conley 9811d5b26c Bug 1193838 - Expose ProfileGatherer as an nsISupports through nsIProfiler for process parent actors. r=BenWa
We need to let ContentParent and PluginModuleParent get a reference to the ProfileGatherer
during the window of time that we're profiling so that if they start to die (the actor is
starting to go away), they have a gatherer they can send their last profile data to.

--HG--
extra : commitid : LkcpDsiXmp0
extra : rebase_source : d1c9e6e7640ff759cef25920e2bc17c0484544bd
2015-08-12 14:20:26 -04:00
Mike Conley 0069816212 Bug 1193838 - Make ProfileGatherer exist during the lifetime of a GeckoSampler. r=BenWa
--HG--
extra : commitid : GutYRbuADgV
extra : rebase_source : dc291977bb7ef43a024e26c83abb47b75a82b841
2015-12-01 13:01:27 -05:00
Mike Conley 6439f951dc Bug 1103094 - Add accessor for nsIProfilerStartParams to nsIProfiler. r=BenWa
--HG--
extra : commitid : LMGmwgJA3uM
extra : rebase_source : 8d44cc8166996fb31ff4e256a5e050ad45c06611
2015-08-11 14:26:09 -04:00
Jeff Muizelaar 1a0db79ef4 Bug 989499 - Part 1: Add a way to get the stack top. r=BenWa
--HG--
extra : commitid : FeZ1v6oPxGh
2014-03-28 16:18:24 -04:00
Nathan Froyd 01583602a9 Bug 1207245 - part 6 - rename nsRefPtr<T> to RefPtr<T>; r=ehsan; a=Tomcat
The bulk of this commit was generated with a script, executed at the top
level of a typical source code checkout.  The only non-machine-generated
part was modifying MFBT's moz.build to reflect the new naming.

CLOSED TREE makes big refactorings like this a piece of cake.

 # The main substitution.
find . -name '*.cpp' -o -name '*.cc' -o -name '*.h' -o -name '*.mm' -o -name '*.idl'| \
    xargs perl -p -i -e '
 s/nsRefPtr\.h/RefPtr\.h/g; # handle includes
 s/nsRefPtr ?</RefPtr</g;   # handle declarations and variables
'

 # Handle a special friend declaration in gfx/layers/AtomicRefCountedWithFinalize.h.
perl -p -i -e 's/::nsRefPtr;/::RefPtr;/' gfx/layers/AtomicRefCountedWithFinalize.h

 # Handle nsRefPtr.h itself, a couple places that define constructors
 # from nsRefPtr, and code generators specially.  We do this here, rather
 # than indiscriminantly s/nsRefPtr/RefPtr/, because that would rename
 # things like nsRefPtrHashtable.
perl -p -i -e 's/nsRefPtr/RefPtr/g' \
     mfbt/nsRefPtr.h \
     xpcom/glue/nsCOMPtr.h \
     xpcom/base/OwningNonNull.h \
     ipc/ipdl/ipdl/lower.py \
     ipc/ipdl/ipdl/builtin.py \
     dom/bindings/Codegen.py \
     python/lldbutils/lldbutils/utils.py

 # In our indiscriminate substitution above, we renamed
 # nsRefPtrGetterAddRefs, the class behind getter_AddRefs.  Fix that up.
find . -name '*.cpp' -o -name '*.h' -o -name '*.idl' | \
    xargs perl -p -i -e 's/nsRefPtrGetterAddRefs/RefPtrGetterAddRefs/g'

if [ -d .git ]; then
    git mv mfbt/nsRefPtr.h mfbt/RefPtr.h
else
    hg mv mfbt/nsRefPtr.h mfbt/RefPtr.h
fi

--HG--
rename : mfbt/nsRefPtr.h => mfbt/RefPtr.h
2015-10-18 01:24:48 -04:00
Nick Fitzgerald 8098307c50 Bug 1204584 - Ensure that entries created by AutoSPSEntry propogate their category information; r=djvj
This commit renames ProfileEntry::set{Js,Cpp}Frame methods to
ProfileEntry::init{Js,Cpp}Frame to highlight the fact that they are intended to
initialize the entry, and that setting other flags should happen after one of
these calls.
2015-09-19 11:19:07 +02:00
Kan-Ru Chen b4ef7f369b Bug 1123237 - Part 6. A new API to get backtrace without allocating memory in profiler. r=mstange
Based on patch from Ting-Yuan Huang <laszio.bugzilla@gmail.com>
2015-09-16 10:31:11 +08:00