Commit Graph
113 Commits
Author SHA1 Message Date
Michael Layzell d1ec419fb4 Bug 1386751 - Split CollectCodeLocation into CollectWasmFrame and CollectPseudoEntry, r=njn
MozReview-Commit-ID: 4LNuJQtm95K
2017-08-16 11:44:00 -04:00
Michael Layzell 45ccfd6e2c Bug 1384766 - Reduce expected frame count for GeckoProfiler.SuspendAndSample. r=njn. 2017-08-14 11:11:57 +10:00
Sebastian Hengst 9f3107668e Backed out changeset d461adfd884e (bug 1365309) 2017-08-11 09:29:03 +02:00
Michael Layzell 12f75fc1fe Bug 1365309 - Part 3: Reduce expected frame count for GeckoProfiler.SuspendAndSample, r=njn
This is necessary as with FramePointerStackWalk if the current frame is in glibc
when we suspend the target thread we sometimes can't collect more than one
native frame as there are no frame pointers.

We'll still collect at least one entry, so this check relaxes the assertion.

MozReview-Commit-ID: IbatTQwDti1
2017-08-10 15:55:12 -04:00
Wes Kocher 8b4ccdffcf Merge m-c to autoland, a=merge
MozReview-Commit-ID: F1X8wKqbkg
2017-07-25 19:16:09 -07:00
Nicholas Nethercote 0e161d798a Bug 1380286 (attempt 2) - Introduce ProfilerStackCollector. r=mstange. 2017-07-25 16:47:14 +10:00
Markus Stange babfc91655 Bug 1382910 - Add profiler_ensure_started. r=njn
MozReview-Commit-ID: LBLlOLXqCwK
2017-07-24 16:48:15 -04:00
Carsten "Tomcat" Book 8f55d543f3 Backed out changeset 3923ce220df3 (bug 1380286) for hazard failures 2017-07-25 08:44:13 +02:00
Nicholas Nethercote 651e69ad04 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.
2017-07-17 10:18:50 +10:00
Nicholas Nethercote 8970534745 Bug 1379933 (part 4) - Start all ProfilerBuffer methods with an upper case letter. r=mstange. 2017-07-13 11:05:31 +10:00
Nicholas Nethercote 8d846b4fa5 Bug 1379933 (part 3) - Start all ProfilerBufferEntry methods with an upper case letter. r=mstange.
Also, hasKind() can be removed.
2017-07-13 11:05:29 +10:00
Nicholas Nethercote ff88750116 Bug 1379933 (part 2) - Improve ProfileBuffer's handling of labels and dynamic strings. r=mstange.
When a sample with a label and a dynamic string is written to the
ProfileBuffer, the profiler currently joins them together (up to a max length
of 512, omitting any that exceed this) and then writes a CodeLocation entry
with an empty string followed by a sequence of EmbeddedString entries. When
parsing those entries, we allow a length up to 8192, but that limit is never
reached due to the prior limit of 512.

This patch makes the following changes.

- Removes the joining at write time. Labels and dynamic strings are now written
  separately into the ProfileBuffer. The 512 limit still applies, but just for
  dynamic strings; dynamic strings longer than that are replaced with "(too
  long)". (Labels also always take up one entry, because they only require a
  single pointer, because they are always static strings.) The joining is
  now done when the ProfileBuffer is parsed, and the max length for the joined
  string is still 512; any strings exceeding 512 at that point are truncated,
  rather than omitted. (This also happens to be outside the profier's critical
  section.)

- Renames CodeLocation as Label and EmbeddedString as DynamicStringFragment.
  This makes the ProfileBuffer entry names better match the names used in
  GeckoProfiler.h.

- Moves AddDynamicCodeLocation(), now called addDynamicStringEntry(), into
  ProfileBuffer.

- Adds some testing of long and overly-long dynamic strings to the GTest.
2017-07-13 11:05:27 +10:00
Rajesh Kathiriya bfb3762076 Bug 1374670 - Enabled the ESLint no-tabs rule across mozilla-central r=standard8
MozReview-Commit-ID: RT5QTipaOW
2017-07-04 21:30:18 +05:30
Sylvestre Ledru 9d4a84d778 Bug 1378712 - Remove all trailing whitespaces r=Ehsan
MozReview-Commit-ID: Kdz2xtTF9EG
2017-07-06 14:00:35 +02:00
Nicholas Nethercote 8ac79516a9 Bug 1378055 (part 6) - Use "entry", not "tag" when talking about ProfileBufferEntry objects. r=mstange.
The patch also changes ProfileBuffer::processEmbeddedString() to take the
readAheadPos, instead of recomputing it.
2017-07-04 16:53:21 +10:00
Nicholas Nethercote de960763f0 Bug 1378055 (part 3) - Overhaul names used within ProfilerBufferEntry.cpp. r=mstange.
- It's common for unions to be named |u|, because this makes it obvious that
  it's a union when you access it, which is good. This patch introduces that
  for the union in ProfilerBufferEntry. (This required move the union setting in
  each constructor from the initializer list to the constructor body.)

- Each union variant had the prefix "mTag". But that's a bad name, because
  |mKind| is actually the tag. So this patch removes the "Tag".

- |mTagData| was a poor name for the |const char*| variant, so this patch
  renames it |mString|.

- The patch moves |mKind| before |u|, because that's the normal way that tagged
  unions are done.
2017-07-04 16:51:21 +10:00
Bill McCloskey ce42826bdf Bug 1372405 - Provide names for all runnables in the tree (r=froydnj)
MozReview-Commit-ID: DKR6ROiHRS7
2017-06-26 14:19:58 -07:00
Nicholas Nethercote a58025002f 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.
2017-06-22 17:08:53 +10:00
Nicholas Nethercote 4a9adbea0f 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.
2017-06-22 13:40:21 +10:00
Nicholas Nethercote 55c693e8f9 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.
2017-06-22 06:26:16 +10:00
Nicholas Nethercote 58acc728d6 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...
2017-06-21 20:50:07 +10:00
Carsten "Tomcat" Book 238bf154d5 Backed out changeset 4f6302a98ae4 (bug 1372405) 2017-06-21 13:59:26 +02:00
Bill McCloskey 67e8af4720 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 bbe9441993 Backed out changeset 9846de3bd954 (bug 1372405) 2017-06-20 08:27:02 +02:00
Bill McCloskey f69608368b 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 fac3f5d781 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.
2017-06-19 13:32:32 +10:00
Nicholas Nethercote 0f9a531d87 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 8c86dd49e3 Bug 1373436 (part 1) - Use UniquePtr more for ProfileBuffer and ProfilerBacktrace . r=mstange. 2017-06-16 09:43:16 +10:00
Nicholas Nethercote 9ae0762bf5 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.
2017-06-07 12:33:19 +10:00
Sylvestre Ledru 51d13efef0 hg logBug 1366882 - fix resource leaks CID 1401664 1401662 1401661 r=njn
MozReview-Commit-ID: FAhSIfsV2aP
2017-05-24 20:09:25 +02:00
Nicholas Nethercote 3d524ccd32 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 71cd78e038 Bug 1347274 (part 4) - Improve the profiler's gtest. r=mstange.
Two improvements.

- More testing of markers by introducing and using a ProfilerMarkerPayload
  subclass that keeps track of how many instances have been created, streamed,
  and destroyed. This change would have caught the defect that was in the first
  landing of part 3 of this bug.

- More testing of JSON output, to check for various substrings that are
  expected to be present.
2017-06-01 19:54:56 +10:00
Carsten "Tomcat" Book 4eaaf2f144 merge mozilla-inbound to mozilla-central a=merge 2017-05-31 11:28:43 +02:00
Markus Stange 7f01640df3 Bug 1330184 - Add some GeckoProfiler tests that call functions on a background thread. r=njn
MozReview-Commit-ID: 9fMPyQ909PW
2017-05-30 17:48:19 -04:00
Nicholas Nethercote e6089b3411 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
Nicholas Nethercote 3839a83445 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.
2017-05-26 14:54:33 +10:00
Nicholas Nethercote a7e5660c91 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 7ff73e9647 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 026c5d44f3 Bug 1360322 - 3. Only build LUL on supported architectures; r=mstange
Only build LUL and its tests on ARM, x86, and x86_64, because only those
architectures are currently supported by LUL.
2017-05-03 11:36:18 -04:00
Dan Banner ac1988770e Bug 1360293 - Enable the Mozilla ESlint recommended rules for tools/. r=jryans
MozReview-Commit-ID: JMcgZ9taEV5
2017-05-01 11:38:39 +01:00
Nicholas Nethercote 34968a40ec 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 3dbdcca05c 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.
2017-04-27 07:36:19 +10:00
Nicholas Nethercote 135bba3f1f 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.
2017-04-27 07:36:15 +10:00
Nicholas Nethercote 518b61128f 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.
2017-04-18 15:40:24 +10:00
Markus Stange 09dea9f2ae Bug 1346592 - When stopping the profiler, mark all ThreadInfos as not being profiled. r=njn
This also renames HasProfile() to IsBeingProfiled().

MozReview-Commit-ID: 70RGHNbyZG3
2017-04-17 22:46:54 -04:00
Iris Hsiao 25bc12c9fe Backed out changeset 1b277ae21ba5 (bug 1346592)
CLOSED TREE
2017-04-18 11:05:12 +08:00
Markus Stange ef0f911e91 Bug 1346592 - When stopping the profiler, mark all ThreadInfos as not being profiled. r=njn
This also renames HasProfile() to IsBeingProfiled().

MozReview-Commit-ID: 70RGHNbyZG3
2017-04-16 13:41:32 -04:00
Markus Stange ba76a2c8b6 Bug 1321617 - Add a test for profiler_stream_json_for_this_process. r=njn
MozReview-Commit-ID: A5Iu3dQFvHK
2017-04-12 16:48:16 -04:00
Nicholas Nethercote ba7067bd91 Bug 1355807 - Fix condition guarding stopJSSampling() calls. r=jseward.
PseudoStack requires that startJSSampling() and stopJSSampling() calls be
interleaved. But currently the conditions guarding those calls don't match:
startJSSampling() is guarded by ShouldProfileThread(), and stopJSSampling() is
guarded by HasProfile().

It's possible for HasProfile() to be true when ShouldProfileThread() is not
true -- e.g. profile many threads, then restart and profile fewer threads, and
we end up with live threads that have a profile but aren't being profiled right
now -- which leads to assertion failures in stopJSSampling().

This patch makes the stopJSSampling() condition use ShouldProfileThread(), just
like the startJSSampling() condition, which fixes the assertion failure.
2017-04-13 09:34:42 +10:00
Nicholas Nethercote b0bf7ac49e Bug 1353630 (part 5) - Allocate PseudoStack within ThreadInfo's constructor. r=jseward. 2017-04-06 09:40:28 +10:00