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

133 Коммитов

Автор SHA1 Сообщение Дата
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
Julian Seward 11b9557938 Bug 1328385 - Replace the profile entry tag with an enum. r=kvijayan.
--HG--
extra : rebase_source : 4e8de98fc4e89a772e8fdc2261e0ebb8d30e2642
2017-02-07 16:47:28 +01:00
Nicholas Nethercote 46b88ab7a6 Bug 1336326 (part 3) - Remove SamplerRegistry. r=mstange.
We only have one global Sampler, gSampler, and so SamplerRegistry is just an
unnecessary and obfuscating wrapper around it.

--HG--
extra : rebase_source : b675c414d0081dab2cd7dac864ffdff5070afe7d
2017-02-03 13:18:02 +11:00
Nicholas Nethercote 7302f2a052 Bug 1336326 (part 2) - Make sRegisteredThreadsMutex a StaticMutex. r=mstange.
StaticMutexes don't need to be created or destroyed, which avoids the need for
checking if they still exist.

This patch also adds locking to a few functions that lacked it. Every access to
sRegisteredThreads is now protected appropriately.

--HG--
extra : rebase_source : 2ea1d7372652ddd532e6e98c167be0997df33f07
2017-02-03 13:11:34 +11:00
Nicholas Nethercote e68e4a6f44 Bug 1336326 (part 1) - Remove Sampler::GetRegisteredThreads(). r=mstange.
Sampler::sRegisteredThreadsMutex is public. Might as well make
Sampler::sRegisteredThreads public too. This allows the getter to be removed,
and makes the code a little easier to read.

--HG--
extra : rebase_source : 4ff3ba92c9d74ae1b10a2be227ca15f61d15bee2
2017-02-03 11:27:14 +11:00
Shih-Chiang Chien e452abf554 Bug 1336004 - add missing header file for TaskTracer. r=cyu
MozReview-Commit-ID: 11cMTxBWCRl

--HG--
extra : rebase_source : d8fb52e1b4d81f72fbb674a19b983a0e376fabde
2017-02-02 12:00:58 +08:00
Julian Seward 62b845c331 Bug 1328916 - Remove ProfilerSaveSignalHandler and transitively reachable code. r=mstange.
--HG--
extra : rebase_source : c4b95dcf205d4df81e22d4b08947d55ab4fac8ca
2017-02-02 10:04:02 +01:00
Julian Seward 95cd90edee Bug 1329150 - Remove ENABLE_ARM_LR_SAVING and its code. r=mstange.
--HG--
extra : rebase_source : 14c459cbfa061a885221d2d89a98f98d721679c2
2017-02-02 08:29:18 +01:00
Nicholas Nethercote bd934d48e6 Bug 1335595 (part 5) - Remove ThreadResponsiveness::mThreadInfo. r=mstange.
ThreadInfo contains a ThreadResponsiveness, and then ThreadResponsiveness has a
pointer back to its containing ThreadInfo, which is gross.

The back pointer is only needed for Update(), and it's easy to pass in the
necessary info instead via a new method UpdateThreadResponsiveness().

This change also means ThreadInfo::GetThread() can be removed.

--HG--
extra : rebase_source : 46ebeb142e8c678be204b106713147738bcbc4a4
2017-02-02 11:07:13 +11:00
Nicholas Nethercote 9373d7166c Bug 1335595 (part 4) - Merge ThreadProfile into ThreadInfo. r=mstange.
ThreadInfo and ThreadProfile are hopelessly intertwined.

- ThreadInfo has an owning pointer to ThreadProfile. ThreadProfile has a raw
  back pointer to ThreadInfo. A reference to one is as good as a reference to
  the other, and references to one frequently reach into the other.

- An exception is SyncProfile, a sub-class of ThreadProfile, which instead has
  an owning pointer to its ThreadInfo. (This makes the SyncProfile's destructor
  dubious, because it deletes the ThreadInfo, which could conceivably re-call
  into SyncProfile's destructor.)

- ThreadProfile also has copies of five ThreadInfo fields (mThreadId,
  mIsMainThread, mPlatformData, mStackTop, mPseudoStack) even though it also
  has direct ThreadInfo access via the back pointer.

The only good reason for having the two classes separate is that some
ThreadInfo objects have a null ThreadProfile pointer. But this doesn't justify
the entanglement.

So this patch merges ThreadProfile into ThreadInfo. It visually separates the
methods and fields related to profiles to partially preserve the original
meaning of the split. The new ThreadInfo::hasProfile() method replaces
ThreadInfo::Profile() as the indicator of whether a ThreadInfo has associated
profile data.

Notable points of simplification:

- The five duplicated fields are no longer duplicated.

- NewSyncProfile(), RegisterThread() no longer create ThreadProfile objects.

- ~SyncProfile() becomes trivial.

- ThreadInfo::SetPendingDelete() is simpler.

- Overall it removes ~80 lines of code.

Much of the rest is just plumbing changes.

--HG--
extra : rebase_source : 2e8c4cc46aa15943ffdc1fa19d9c829587267ee9
2017-02-02 11:07:13 +11:00
Nicholas Nethercote 8b717f8d56 Bug 1335595 (part 3) - Remove ThreadProfile::AsSyncProfile(). r=mstange.
It's unused.

--HG--
extra : rebase_source : fb855811ff1d807707fd1b605b747cff1b6d6be3
2017-02-02 11:07:12 +11:00
Nicholas Nethercote afd35b70c0 Bug 1335595 (part 2) - Remove useless null checks in Sampler::InplaceTick(). r=mstange.
|sample| is non-null at all callsites. The function derefs |sampler| before
doing any of the null checks, anyway.

--HG--
extra : rebase_source : 5c3c917009310ade1faaf985ac866a4a98fe6abc
2017-02-01 15:41:29 +11:00
Nicholas Nethercote f542865603 Bug 1335595 (part 1) - Remove the profiler's ASSERT macro. r=mstange.
MOZ_ASSERT is the standard macro.

--HG--
extra : rebase_source : 8aa9b96b82ff4b7ec2de4ec5c62aeb23aafea85f
2017-02-01 15:40:55 +11:00
Nicholas Nethercote dfbacc4a42 Bug 1334466 (part 5) - Remove PlatformData::profiled_pthread_. r=mstange.
It's unused.

--HG--
extra : rebase_source : a755202318cf8abceefd1d29326380f3bc2746b7
2017-01-28 01:07:01 +11:00
Nicholas Nethercote d1afdf0d74 Bug 1334466 (part 4) - Remove Sampler::profiling_. r=mstange.
Because it's always true.

--HG--
extra : rebase_source : b77cccb79989e6e93f003609baab34ca588e455e
2017-01-28 00:58:55 +11:00
Nicholas Nethercote 9c6ed67ad7 Bug 1334466 (part 3) - Rename GeckoSampler.cpp as Sampler.cpp. r=mstange.
The patch also moves some Sampler methods from platform.cpp to Sampler.cpp. Now
all Sampler methods are in Sampler.cpp except for a small number of
platform-specific ones, which are in platform-*.cpp.

--HG--
rename : tools/profiler/core/GeckoSampler.cpp => tools/profiler/core/Sampler.cpp
extra : rebase_source : a13862dccfcb1c78567cc9eb22e92b8410d2e544
2017-01-28 00:57:52 +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 0a42d0f79c Bug 1334466 (part 1) - Merge Sampler constructors and destructors. r=mstange.
They're defined separately for each platform, but the definitions are almost
identical and can be commoned up.

--HG--
extra : rebase_source : 67b7f88410db1951a20f03f6c156aa6b35a3ee20
2017-01-28 00:52:57 +11:00
Nicholas Nethercote e584767774 Bug 1333655 - Improve the profiler's Thread class. r=mstange.
It's a clumsy cross-platform abstraction. GetCurrentId() and tid_t are the only
genuinely cross-platform things in it, and the patch keeps those in place.

The remaining methods are not implemented on all platforms (none are
implemented on Linux) and the fields are all used on either Mac or Windows, but
not both. So the patch moves the relevant Thread method implementations and
fields into the existing SamplerThread classes. There is sufficiently little
overlap between the two SamplerThread classes that there is no point sharing a
base class between them. This avoids the need for virtual functions, and
simplifies thread naming on Mac.

The patch also changes some of the existing code to use Gecko style, e.g.
|mFoo| instead of |foo_| for class fields.
2017-01-25 14:34:25 +11:00
Nicholas Nethercote 234a671f05 Bug 1328365 (part 3) - Remove GeckoSampler::sActiveSampler. r=mstange.
This variable is set in GeckoSampler's destructor and cleared in GeckoSampler's
destructor, which means it's just another handle to the GeckoSampler singleton,
which means it duplicates gSampler.

This patch replaces its uses with gSampler uses. This exposes various places
where GeckoSampler is being accessed off the main thread, which I have marked
with XXX comments.

--HG--
extra : rebase_source : 3c2d012b4d38d353022f384c31a528096a462711
2017-01-27 16:25:23 +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 45bf8c43bb Bug 1329684 (part 2) - Remove OS::msPerSecond, which is unused. r=mstange.
--HG--
extra : rebase_source : 5c0fcac9c52e8c9b0022002cbbdcaef33982a682
2017-01-25 14:33:34 +11:00
Nicholas Nethercote 6eb4bf69b1 Bug 1329684 (part 1) - Remove GeckoMutex, ::Mutex and ::MutexAutoLock from the profiler. r=mstange.
Note that the comment on ::Mutex said that it should support recursive locking,
but GeckoMutex was implemented using mozilla::Mutex which does *not* support
recursive locking.

The patch also removes OS::CreateMutex(), because it's only used twice and
doesn't make the code more concise.

--HG--
extra : rebase_source : 81f324cb3856ea5329d8b6edb457c8ec44395c56
2017-01-25 14:33:32 +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 997c2d8b00 Bug 1333296 (part 2) - Change "SPS:" mentions in logging code. r=mstange.
--HG--
extra : rebase_source : 2cb0718e120a2d0f988a7456d6fbf5946ce2e3a6
2017-01-24 14:17:13 +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 47ba5aca68 Bug 1332577 (part 8) - Rename moz_profiler_*() as profiler_*(). r=mstange.
This makes them consistent with other profiler functions.

--HG--
extra : rebase_source : bfdd878f4ca9cab50f0fa769b3cd1a4cdae18575
2017-01-21 08:45:49 +11:00
Nicholas Nethercote a6815f5654 Bug 1332577 (part 5) - Fix indentation in platform.cpp. r=mstange.
The patch fixes some 4 space indents and tab indents.

--HG--
extra : rebase_source : aeef635fe85c6b68e055346d6602382316ae51c9
2017-01-20 14:20:11 +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 eee9038a2f Bug 1317771 (part 2) - Remove SPS_STANDALONE. r=mstange.
This patch removes all the |#ifdef SPS_STANDALONE| blocks.

--HG--
extra : rebase_source : 0ccb72987e6b951360c6b9905ab47c61f59282c0
2017-01-19 08:07:00 +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
Nicholas Nethercote d7d1bbbb95 Bug 1331571 - Remove Intel Power Gadget integration from the compiler. r=mstange.
Nobody has ever used this, and measuring power consumption while running a
sampling profiler at 1000 Hz isn't a good idea.

--HG--
extra : rebase_source : b84255a08bfea07b90bedc1f24086695143d5c8e
2017-01-19 08:05:47 +11:00
Luke Wagner 094950cd37 Bug 1330150 - Don't abandon sample if native stack walk fails (r=ehsan)
MozReview-Commit-ID: CyPPGEGX8R2
2017-01-12 17:40:20 -06:00
Eric Rahm 87cfbc1b65 Bug 1322735 - Remove MOZ_STACKWALKING define. r=glandium
With frame pointer omission disabled we should always have usable stacks on Windows. This allows us to remove the MOZ_STACKWALKING define as it will always be enabled.

MozReview-Commit-ID: 54xs3Hf1r4P

--HG--
extra : rebase_source : dfaf13fb4c2185985f4f074c338ccf1fef8f3c94
2016-12-20 15:11:36 -08:00
Phil Ringnalda 1c2d0d367f Backed out 3 changesets (bug 1322735) for ASan leaks and xpcshell/selftest.py failures
CLOSED TREE

Backed out changeset 01cfc71ce542 (bug 1322735)
Backed out changeset 84c729c41230 (bug 1322735)
Backed out changeset b419aaefae95 (bug 1322735)
2017-01-10 20:17:34 -08:00
Eric Rahm 2e195de610 Bug 1322735 - Remove MOZ_STACKWALKING define. r=glandium
With frame pointer omission disabled we should always have usable stacks on Windows. This allows us to remove the MOZ_STACKWALKING define as it will always be enabled.

MozReview-Commit-ID: 54xs3Hf1r4P

--HG--
extra : rebase_source : 5fe27cdeeb464d81fbedc8c02ac187658bd759e7
2016-12-20 15:11:36 -08:00
Nathan Froyd 977ac8192b Bug 1328370 - remove GeckoSampler::mPrimaryThreadProfile; r=mstange
The only interesting setter of this field is
GeckoSampler::GetPrimaryThreadProfile, which is unused.  Once that
function is removed, mPrimaryThreadProfile is set to null in
GeckoSampler's constructor and never changed or referenced.
2017-01-06 09:21:01 -05: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
Nathan Froyd 0dab5bba8e Bug 1322863 - part 3 - manage Sampler::PlatformData with UniquePtr; r=mstange
Smart pointers are better than raw pointers, and this makes clients of
PlatformData slightly simpler because they don't have to manage
destruction themselves: the new UniquePtr-derived type handles all of
that for us.
2017-01-06 09:21:01 -05:00
Nathan Froyd 5767fcd327 Bug 1322863 - part 2 - make ThreadInfo manage mProfile with UniquePtr; r=mstange
Smart pointers are better than raw pointers.  This change also has the
benefit of removing the manual memory management in ~GeckoSampler and
locating all the memory management in ThreadInfo, where it belongs.
2017-01-06 09:21:01 -05:00
Nathan Froyd 9a1517cd65 Bug 1322863 - part 1 - make ThreadInfo::mName a UniqueFreePtr; r=mstange
Smart pointers are better than raw pointers.
2017-01-06 09:21:01 -05:00
Steve Fink bb5723d671 Bug 1326134 - Report whether javascript.options.asyncstack is active, r=fitzgen
--HG--
extra : rebase_source : dce39aa1d4c1c3ae264beb3bd6ea2866b6d960b7
2016-12-28 17:33:12 -08:00
Steve Fink 3949f5f1e8 Bug 1326134 - Report DEBUG builds in profiles, r=mstange
--HG--
extra : rebase_source : 6b63ad187df9f1591e30397e017c69277d014697
2016-12-28 17:20:42 -08:00
Steve Fink 8ccd756578 Bug 1326134 - Report whether GC poisoning is enabled in profiles, r=jonco
--HG--
extra : rebase_source : 8b64acda00627b1ab9c8ba3666dc0dc4e51819d9
2016-12-28 17:12:23 -08:00
Nathan Froyd e618b8d55a Bug 1328408 - make Sampler::GetRegisteredThreads not copy the registered threads list; r=mstange
We call GetRegisteredThreads repeatedly on the sampler thread whenever
the profiler is active; there's no reason to have it churn memory.
2017-01-05 15:55:47 -05:00
Nathan Froyd fea256a2e2 Bug 1328636 - move Sampler::{Register,Unregister}CurrentThread into common code; r=mstange
We have an abstraction over the current thread ID already, so we can use
that to get the current thread id and eliminate this bit of
cut-and-paste programming.
2017-01-05 15:41:09 -05: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
Ting-Yu Chou 8a91298c2f Bug 1322465 part 12 - Use explicit/MOZ_IMPLICIT for the unary constructors in tools/. r=Ehsan
MozReview-Commit-ID: 5fp6E1T7HrW

--HG--
extra : rebase_source : 0fda130fa69d6c0a7e7f3d1838a22c4b5f6459b0
2016-12-16 16:36:44 +08:00
Nathan Froyd a2f6acca0f Bug 1323024 - remove OS X 10.6 shared library support from the profiler; r=mstange
We don't support OS X versions below 10.6 nowadays.
2016-12-03 23:51:39 -05:00