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

1356 Коммитов

Автор SHA1 Сообщение Дата
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 e742d137c7 Bug 1374975 - Fix incorrect arguments to NotifyProfilerStarted. r=mstange.
--HG--
extra : rebase_source : e9f5b60c6126c9a6295616e9ab0e815a65a28c1a
2017-06-21 20:32:51 +10:00
Carsten "Tomcat" Book 8a1350b5a6 Backed out changeset 4f6302a98ae4 (bug 1372405)
--HG--
extra : rebase_source : 41632f3158e88e692809731394a683d065a73dfb
2017-06-21 13:59:26 +02:00
Julian Seward 7eda9d1a96 Bug 1374248 - LUL: remove stack scanning. r=njn.
This removes LUL's ability to recover frames by the heuristic mechanism of
stack scanning.  Stack scanning is a last-ditch way to try to recover the
unwind when all other methods (metadata-based, frame-pointer chasing) have
failed, by scanning back up the stack and looking for the first word that
could plausibly be a return address.  It often mis-identifies return addresses
because it has no way to distinguish live ones from dead ones that have not
been overwritten, and very often causes the unwind to fail as a result.

In any case LUL's stack scanning ability has actually been switched off (by
the parameters passed to LUL::Unwind) for some considerable time now, so this
change should make no observable difference to behaviour.  Specific changes:

In LUL::Unwind():

* Removes formal parameters |scannedFramesAcquired| and |scannedFramesAllowed|

* Removes code that does stack scanning

* Simplifies control flow in the main unwind loop, so that loop now
  has the easier-to-follow structure

  while (true) {
    // preliminary stuff

    if (CFI data available for current PC) {
       do CFI step;
       continue;
    }

    if (FP chasing possible for current PC) {
       do FP step;
       continue;
    }

    // give up
    break;
  }

* Moves two #ifdefs upwards to enclose the comments pertaining to them, as
  well as the code.  This makes the top level structure easier to follow.  The
  corresponding #endifs are likewise commented with the condition.

From class LULStats, removes |mScanned|.

Removes PriMap::MaybeIsReturnPoint() entirely.  This is a heuristic helper
only used by stack scanning.

In all, 395 lines of code are removed, according to hg diff --stat.

--HG--
extra : rebase_source : 5ffa73c64923149a58df3228cf940cb539f8f707
2017-06-19 16:21:59 +02:00
Bill McCloskey 6b3e84ed5f Bug 1372405 - Provide names for all runnables in the tree (r=froydnj)
MozReview-Commit-ID: DKR6ROiHRS7
2017-06-20 21:44:11 -07:00
Carsten "Tomcat" Book ea1b86680c Backed out changeset 9846de3bd954 (bug 1372405)
--HG--
extra : rebase_source : 5d4a48e8ec394c329994689d938d2a6e9b2752b0
2017-06-20 08:27:02 +02:00
Bill McCloskey 4592152411 Bug 1372405 - Provide names for all runnables in the tree (r=froydnj)
MozReview-Commit-ID: DKR6ROiHRS7
2017-06-19 22:25:47 -07:00
Nicholas Nethercote c078fc6036 Bug 1374127 (part 7) - Remove Registers' constructor. r=mstange.
We rely partly on the constructor to set Registers, and partly on subsequent
assignments. This patch changes things so we rely entirely on subsequent
assignments, for consistency.

--HG--
extra : rebase_source : ca69186f5755003e710985bfb40c90072067305c
2017-06-20 08:45:43 +10:00
Nicholas Nethercote cc6bc3e49b Bug 1374127 (part 6) - Rename FillInRegs(), and introduce a similar function for Windows to avoid repetition. r=mstange.
--HG--
extra : rebase_source : 5dcc319804661858e8d58b41d1f8b8f452d80c2b
2017-06-20 08:45:43 +10:00
Nicholas Nethercote 5e6717e1af Bug 1374127 (part 5) - Remove SyncPopulate's argument. r=mstange.
We can use a static ucontext_t on Linux for synchronous samples instead of
declaring one on the stack in profiler_get_backtrace(). This neatens
SyncPopulate()'s signature.

SyncPopulate() is also only used when HAVE_NATIVE_UNWIND is defined, so the
patch guards the definitions.

--HG--
extra : rebase_source : b71e6d76f24b37bc236ac8f4359d401b1551e2de
2017-06-20 08:45:43 +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 feb7783eed Bug 1374127 (part 1) - Add `using namespace mozilla;` to ProfilerMarkerPayload.cpp. r=mstange.
--HG--
extra : rebase_source : 37961947dbc0151903dabcda2d5fa00c99a1a333
2017-06-16 12:46:10 +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 8fccd59ba6 Bug 1373436 (part 3) - Use UniquePtr more with ProfilerMarkerPayload. r=mstange. 2017-06-16 10:51:05 +10:00
Nicholas Nethercote 442ac55216 Bug 1373436 (part 2) - Use a UniquePtr for CorePS::mLul. r=mstange. 2017-06-16 10:30:35 +10:00
Nicholas Nethercote 8d89035364 Bug 1373436 (part 1) - Use UniquePtr more for ProfileBuffer and ProfilerBacktrace . r=mstange. 2017-06-16 09:43:16 +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
Nicholas Nethercote 61516fe3a0 Bug 1373154 (part 2, attempt 2) - Don't call AllocPlatformData() in profiler_get_backtrace(). r=mstange.
We already have a PlatformData for the thread in its ThreadInfo.

--HG--
extra : rebase_source : 4b7a4f70c3b38f38928bfa7d10b6362ac2cc3ed6
2017-06-19 09:38:11 +10:00
Nicholas Nethercote 16b88972ff Bug 1373154 (part 1, attempt 2) - Add more comments about the profiler's critical section. r=me.
--HG--
extra : rebase_source : 16d1ba39fa04e1df82231c347fffe49251cf9f33
2017-06-19 09:09:46 +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
Markus Stange 61580a8992 Bug 1365400 - Add nsIProfiler::GetAllFeatures. r=njn
MozReview-Commit-ID: EfjiUYvfIgM

--HG--
extra : rebase_source : a690e0a451c31fe644ac3843f96afc1e6a2b42f0
2017-06-14 00:20:35 -04:00
Phil Ringnalda 8f1db3dfce Backed out 3 changesets (bug 1373154) for Windows devtools timeouts
Backed out changeset ca4e62117e6a (bug 1373154)
Backed out changeset 0e89b1564ea4 (bug 1373154)
Backed out changeset 48767f3f315f (bug 1373154)

MozReview-Commit-ID: 3DhUjEjXVmn
2017-06-15 21:22:57 -07:00
Bill McCloskey 0767e31489 Bug 1372736 - Avoid using AbstractThread for non-media MozPromises (r=bkelly)
MozReview-Commit-ID: BBi0pK4DXxf
2017-06-15 20:16:25 -07:00
Nicholas Nethercote 8179018d28 Bug 1373154 (part 3) - 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 : 61f4bf75ff5a2c331e8e39dcbb2bf3563606ebb0
2017-06-16 08:29:19 +10:00
Nicholas Nethercote 4b3df390dc Bug 1373154 (part 2) - Don't call AllocPlatformData() in profiler_get_backtrace(). r=mstange.
We already have a PlatformData for the thread in its ThreadInfo.

--HG--
extra : rebase_source : 2b943889be2afafdf6c166661ec607c3df0e9b6b
2017-06-15 22:02:08 +10:00
Nicholas Nethercote d0c2d996a1 Bug 1373154 (part 1) - Remove TickSample::mTimeStamp. r=mstange.
We can just TimeStamp::Now() directly when needed.

--HG--
extra : rebase_source : 94653b716da43c43c41cff20a26dc58ec15d1de5
2017-06-15 22:01:10 +10:00
Nicholas Nethercote e7083443e9 Bug 1372864 - Change CheckResponsivenessTask::mMonitor to a Mutex. r=mstange.
A mutex is good enough.

--HG--
extra : rebase_source : af7494cd308f67a3599e18f8740cbb36da2f0fac
2017-06-14 21:06:41 +10:00
Michael Layzell e51690c5b9 Bug 1357829 - Part 4: Remove TickController, r=njn
MozReview-Commit-ID: 2IHa6ybR9ug
2017-06-14 12:27:52 -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
Bill McCloskey c85ab6308c Bug 1366072 - Change promises to take nsISerialEventTarget instead of AbstractThread (r=jwwang)
MozReview-Commit-ID: 4azUhSB6whu
2017-06-13 14:51:01 -07: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
Tom Tromey 3b237f38d8 Bug 1370786 - use UniquePtr for SecMap in LUL; r=froydnj
This avoids a memory leak.

MozReview-Commit-ID: LmZdWd6ym56

--HG--
extra : rebase_source : 5bc8a267160565153a833487453f17771ceab917
2017-06-07 11:40:24 -06:00
Sylvestre Ledru 1ccd7fd032 hg logBug 1366882 - fix resource leaks CID 1401664 1401662 1401661 r=njn
MozReview-Commit-ID: FAhSIfsV2aP

--HG--
extra : rebase_source : 1cda0ef8e20b970b7c47e20fa690412998cab7a7
2017-05-24 20:09:25 +02:00
Carsten "Tomcat" Book 87a9dfd869 Merge mozilla-central to autoland 2017-06-07 13:49:00 +02:00
Nicholas Nethercote 4c0ca14a86 Bug 1368915 (part 5) - Introduce MAX_JS_FRAMES. r=mstange.
--HG--
extra : rebase_source : 478043cf6e347f2eeb368cf0bcd90f7aa0c73c4e
2017-06-02 09:41:58 +10:00
Nicholas Nethercote 26d1e36a3d Bug 1368915 (part 4) - Clean up NativeStack. r=mstange.
This patch puts the arrays inside NativeStack, gives NativeStack a constructor,
and renames its fields using "mFoo" form.

The patch also moves MAX_NATIVE_FRAMES from the LUL-only code and applies it
globally. This increases the max native frame count from 256 to 1024 on the
LUL platforms, which makes things consistent with other platforms.

--HG--
extra : rebase_source : 0854ab37d101e090ea05cba7cb6d296450f8dfdc
2017-06-02 09:41:55 +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 d74c3bc157 Bug 1368915 (part 2) - Remove unnecessary mozilla:: qualifiers in plaform.cpp. r=mstange.
--HG--
extra : rebase_source : 9d88c5f5d8ee7d8bb825a92d5e22fb2c06d60d51
2017-06-02 09:41:48 +10:00
Nicholas Nethercote 53299e2c4a Bug 1368915 (part 1) - Rename a parameter of locked_register_thread(). r=mstange.
--HG--
extra : rebase_source : 6bd4cb02d0758a13b2938055052770a206893651
2017-05-31 15:14:50 +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 1b418b1c18 Bug 1369644 - Remove use of |volatile| from ProfileEntry. r=mstange,shu,jseward,froydnj.
These annotations aren't doing anything useful. The important thing with
the PseudoStack is that, during pushes, the stack pointer incrementing happens
after the new entry is written, and this is ensured by the stack pointer being
Atomic.

The patch also improves the comments on PseudoStack.

--HG--
extra : rebase_source : 100f8a5e4b750c15fac66175550c4c284a141f16
2017-06-02 17:16:56 +10:00
Markus Stange 5d74644e26 Bug 1370673 - Discard exit profiles when the profiler is stopped. r=njn
MozReview-Commit-ID: DOJt32A1Em8

--HG--
extra : rebase_source : a364e501696fc2e04107fdb3c3e1605d80e2c3ae
2017-06-06 23:12:01 -04: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 7d540d96fd Bug 1369276 (part 1) - Fix category handling in AddPseudoEntry. r=shu.
The category handling code at the end of AddPseudoEntry has two problems.

- The assertion checks |category| for the IS_CPP_ENTRY flag. This represents a
  confusion between the entry's |category| and its |flags|. They're both stored
  in a single uint32_t, but are conceptually different types. So the assertion
  is vacuously satisfied.

  Furthermore, there's no clear way to fix the assertion -- it doesn't make
  sense to check the entry's flags for IS_CPP_ENTRY, because this code can
  clearly take C++ or JS entries. So the patch just removes the assertion.

- The category is compared to zero. This also doesn't make sense, because zero
  isn't a valid category. The patch removes this comparison.

--HG--
extra : rebase_source : 16a7248ffb90ccd90e6102d597fb5bdff706312e
2017-05-31 15:03:55 +10:00