Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(346)

Issue 99343002: Disable timing from chrome://profiler on Android. (Closed)

Created:
7 years ago by qsr
Modified:
6 years, 5 months ago
CC:
chromium-reviews, erikwright+watch_chromium.org
Visibility:
Public.

Description

Disable timing from chrome://profiler on Android. On Android, on a arm CPU, TimeTicks::Now() is taking 900ns (20 times what it takes on a desktop x86 CPU). The bigger user of TimeTicks::Now() is tracked_objects::TrackedTime, and this impacts the overall performance of Chrome on this platform. This CL adds compile line flags that allows to disable tracked_objects::TrackedTime. It also disable tracked_objects::TrackedTime by default on Android. BUG=315070 Committed: https://src.chromium.org/viewvc/chrome?view=rev&revision=240092

Patch Set 1 #

Patch Set 2 : Change flag location #

Patch Set 3 : Fix compilation #

Total comments: 4

Patch Set 4 : Follow review #

Total comments: 17

Patch Set 5 : Follow review #

Total comments: 4

Patch Set 6 : Follow review #

Total comments: 4

Patch Set 7 : Follow review #

Total comments: 6

Patch Set 8 : Follow review #

Patch Set 9 : Fix uninitialized command line/ #

Unified diffs Side-by-side diffs Delta from patch set Stats (+44 lines, -2 lines) Patch
M base/base_switches.h View 1 2 3 4 5 1 chunk +3 lines, -1 line 0 comments Download
M base/base_switches.cc View 1 2 3 4 1 chunk +8 lines, -0 lines 0 comments Download
M base/tracked_objects.cc View 1 2 3 4 5 6 7 8 3 chunks +25 lines, -1 line 0 comments Download
M content/browser/android/content_startup_flags.cc View 1 2 3 4 2 chunks +7 lines, -0 lines 0 comments Download
M content/browser/renderer_host/render_process_host_impl.cc View 1 2 3 4 5 1 chunk +1 line, -0 lines 0 comments Download

Messages

Total messages: 39 (0 generated)
qsr
Hi Jar, Mark, This CL is disabling the timing in chrome://profiler by default on Android. ...
7 years ago (2013-12-02 15:42:17 UTC) #1
jar (doing other things)
https://codereview.chromium.org/99343002/diff/40001/base/base_switches.h File base/base_switches.h (right): https://codereview.chromium.org/99343002/diff/40001/base/base_switches.h#newcode29 base/base_switches.h:29: extern const char kEnableProfilerTiming[]; nit: Rather than defining two ...
7 years ago (2013-12-02 19:01:50 UTC) #2
qsr
https://codereview.chromium.org/99343002/diff/40001/base/base_switches.h File base/base_switches.h (right): https://codereview.chromium.org/99343002/diff/40001/base/base_switches.h#newcode29 base/base_switches.h:29: extern const char kEnableProfilerTiming[]; On 2013/12/02 19:01:50, jar wrote: ...
7 years ago (2013-12-03 11:33:44 UTC) #3
qsr
gentle ping?
7 years ago (2013-12-05 23:00:22 UTC) #4
jar (doing other things)
https://codereview.chromium.org/99343002/diff/60001/base/profiler/tracked_time.cc File base/profiler/tracked_time.cc (right): https://codereview.chromium.org/99343002/diff/60001/base/profiler/tracked_time.cc#newcode24 base/profiler/tracked_time.cc:24: switches::kProfilerTiming) == "0"; You can indeed change the name ...
7 years ago (2013-12-05 23:51:06 UTC) #5
Mark Mentovai
Jim probably wants to look again too, but if you don’t hear back from him, ...
7 years ago (2013-12-05 23:54:04 UTC) #6
Mark Mentovai
Oh, well, there’s Jim. This is just a note on something he mentioned. https://codereview.chromium.org/99343002/diff/60001/base/profiler/tracked_time.cc File ...
7 years ago (2013-12-05 23:56:05 UTC) #7
qsr
https://codereview.chromium.org/99343002/diff/60001/base/base_switches.h File base/base_switches.h (right): https://codereview.chromium.org/99343002/diff/60001/base/base_switches.h#newcode26 base/base_switches.h:26: // Configure whether profiler will contain timing information. This ...
7 years ago (2013-12-06 14:29:42 UTC) #8
qsr
+sievers@chromium.org for OWNERS
7 years ago (2013-12-06 14:30:02 UTC) #9
jar (doing other things)
LGTM (I've opted out of base ownership... so Mark may need to bless this). https://codereview.chromium.org/99343002/diff/80001/base/base_switches.h ...
7 years ago (2013-12-06 18:19:23 UTC) #10
Mark Mentovai
LGTM
7 years ago (2013-12-06 18:49:27 UTC) #11
no sievers
https://codereview.chromium.org/99343002/diff/80001/base/profiler/tracked_time.cc File base/profiler/tracked_time.cc (right): https://codereview.chromium.org/99343002/diff/80001/base/profiler/tracked_time.cc#newcode79 base/profiler/tracked_time.cc:79: return TrackedTime(); What functionally does this break exactly? Seems ...
7 years ago (2013-12-06 20:13:54 UTC) #12
no sievers
On 2013/12/06 20:13:54, sievers wrote: > https://codereview.chromium.org/99343002/diff/80001/base/profiler/tracked_time.cc > File base/profiler/tracked_time.cc (right): > > https://codereview.chromium.org/99343002/diff/80001/base/profiler/tracked_time.cc#newcode79 > ...
7 years ago (2013-12-06 20:14:17 UTC) #13
jar (doing other things)
https://codereview.chromium.org/99343002/diff/80001/base/profiler/tracked_time.cc File base/profiler/tracked_time.cc (right): https://codereview.chromium.org/99343002/diff/80001/base/profiler/tracked_time.cc#newcode79 base/profiler/tracked_time.cc:79: return TrackedTime(); On 2013/12/06 20:13:54, sievers wrote: > What ...
7 years ago (2013-12-06 21:57:39 UTC) #14
no sievers
On 2013/12/06 21:57:39, jar wrote: > https://codereview.chromium.org/99343002/diff/80001/base/profiler/tracked_time.cc > File base/profiler/tracked_time.cc (right): > > https://codereview.chromium.org/99343002/diff/80001/base/profiler/tracked_time.cc#newcode79 > ...
7 years ago (2013-12-06 22:04:53 UTC) #15
Mark Mentovai
sievers wrote: > Does it make sense to change the caller of the function instead? ...
7 years ago (2013-12-06 22:10:34 UTC) #16
qsr
PTAL https://codereview.chromium.org/99343002/diff/80001/base/base_switches.h File base/base_switches.h (right): https://codereview.chromium.org/99343002/diff/80001/base/base_switches.h#newcode26 base/base_switches.h:26: extern const char kTraceToConsole[]; On 2013/12/06 18:19:23, jar ...
7 years ago (2013-12-09 12:27:02 UTC) #17
Mark Mentovai
LGTM https://codereview.chromium.org/99343002/diff/100001/base/tracked_objects.cc File base/tracked_objects.cc (right): https://codereview.chromium.org/99343002/diff/100001/base/tracked_objects.cc#newcode57 base/tracked_objects.cc:57: enum ProfilerTimingState { You can move this whole ...
7 years ago (2013-12-09 14:18:32 UTC) #18
qsr
https://codereview.chromium.org/99343002/diff/100001/base/tracked_objects.cc File base/tracked_objects.cc (right): https://codereview.chromium.org/99343002/diff/100001/base/tracked_objects.cc#newcode57 base/tracked_objects.cc:57: enum ProfilerTimingState { On 2013/12/09 14:18:32, Mark Mentovai wrote: ...
7 years ago (2013-12-09 14:48:32 UTC) #19
Mark Mentovai
LGTM
7 years ago (2013-12-09 14:56:19 UTC) #20
no sievers
lgtm for android https://codereview.chromium.org/99343002/diff/60001/base/profiler/tracked_time.cc File base/profiler/tracked_time.cc (right): https://codereview.chromium.org/99343002/diff/60001/base/profiler/tracked_time.cc#newcode24 base/profiler/tracked_time.cc:24: switches::kProfilerTiming) == "0"; On 2013/12/05 23:51:06, ...
7 years ago (2013-12-09 18:59:28 UTC) #21
Mark Mentovai
LazyInstance and Singleton do have that optimization, but they still have a barrier. Ben’s comment ...
7 years ago (2013-12-09 19:38:18 UTC) #22
no sievers
https://codereview.chromium.org/99343002/diff/120001/base/tracked_objects.cc File base/tracked_objects.cc (right): https://codereview.chromium.org/99343002/diff/120001/base/tracked_objects.cc#newcode57 base/tracked_objects.cc:57: enum { missing static
7 years ago (2013-12-09 20:10:23 UTC) #23
jar (doing other things)
https://codereview.chromium.org/99343002/diff/120001/base/tracked_objects.cc File base/tracked_objects.cc (right): https://codereview.chromium.org/99343002/diff/120001/base/tracked_objects.cc#newcode61 base/tracked_objects.cc:61: } g_timing_enabled = UNDEFINED_TIMING; It probably *should* be a ...
7 years ago (2013-12-09 20:31:33 UTC) #24
Mark Mentovai
https://codereview.chromium.org/99343002/diff/120001/base/tracked_objects.cc File base/tracked_objects.cc (right): https://codereview.chromium.org/99343002/diff/120001/base/tracked_objects.cc#newcode61 base/tracked_objects.cc:61: } g_timing_enabled = UNDEFINED_TIMING; jar wrote: > It probably ...
7 years ago (2013-12-09 20:42:39 UTC) #25
jar (doing other things)
https://codereview.chromium.org/99343002/diff/120001/base/tracked_objects.cc File base/tracked_objects.cc (right): https://codereview.chromium.org/99343002/diff/120001/base/tracked_objects.cc#newcode61 base/tracked_objects.cc:61: } g_timing_enabled = UNDEFINED_TIMING; On 2013/12/09 20:42:39, Mark Mentovai ...
7 years ago (2013-12-09 20:47:55 UTC) #26
qsr
On 2013/12/09 19:38:18, Mark Mentovai wrote: > LazyInstance and Singleton do have that optimization, but ...
7 years ago (2013-12-11 09:10:32 UTC) #27
qsr
https://codereview.chromium.org/99343002/diff/120001/base/tracked_objects.cc File base/tracked_objects.cc (right): https://codereview.chromium.org/99343002/diff/120001/base/tracked_objects.cc#newcode57 base/tracked_objects.cc:57: enum { On 2013/12/09 20:10:23, sievers wrote: > missing ...
7 years ago (2013-12-11 09:11:19 UTC) #28
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/qsr@chromium.org/99343002/140001
7 years ago (2013-12-11 09:11:46 UTC) #29
commit-bot: I haz the power
Retried try job too often on mac_rel for step(s) nacl_integration http://build.chromium.org/p/tryserver.chromium/buildstatus?builder=mac_rel&number=200171
7 years ago (2013-12-11 09:54:36 UTC) #30
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/qsr@chromium.org/99343002/160001
7 years ago (2013-12-11 10:02:49 UTC) #31
commit-bot: I haz the power
Change committed as 240092
7 years ago (2013-12-11 12:49:19 UTC) #32
jar (doing other things)
Question: You noted that TimeTicks::Now() can take 900ns, or 0.9 microseconds, and suggested this is ...
6 years, 5 months ago (2014-07-14 21:55:23 UTC) #33
qsr
On 2014/07/14 21:55:23, jar wrote: > Question: You noted that TimeTicks::Now() can take 900ns, or ...
6 years, 5 months ago (2014-07-15 08:16:08 UTC) #34
no sievers
On 2014/07/15 08:16:08, qsr wrote: > On 2014/07/14 21:55:23, jar wrote: > > Question: You ...
6 years, 5 months ago (2014-07-15 18:29:12 UTC) #35
qsr
On Tue, Jul 15, 2014 at 8:29 PM, <sievers@chromium.org> wrote: > On 2014/07/15 08:16:08, qsr ...
6 years, 5 months ago (2014-07-16 09:20:28 UTC) #36
chromium-reviews
On Wed, Jul 16, 2014 at 11:20 AM, Benjamin Lerman <qsr@chromium.org> wrote: > On Tue, ...
6 years, 5 months ago (2014-07-16 10:02:53 UTC) #37
epennerAtGoogle
Just an extra two cents: In the PostTask micro-benchmark, we can see that task overhead ...
6 years, 5 months ago (2014-07-17 02:19:25 UTC) #38
jar (doing other things)
6 years, 5 months ago (2014-07-17 16:50:10 UTC) #39
Message was sent while issue was closed.
On 2014/07/17 02:19:25, epennerAtGoogle wrote:
> Just an extra two cents:
> 
> In the PostTask micro-benchmark, we can see that task overhead (in Chrome's
code
> - there is more in the kernel) is about 25us per task. There is at least 60
> tasks per frame IIRC, so that's 1.5ms, or ~10% of one CPU spent on task
overhead
> (at 60Hz). If I recall, the entire profiler takes about 4-5us per task, which
> would be about 0.3ms or 2% of one CPU core, however only the timers are
disabled
> so we are currently saving ~1% - similar to load time it seems.
> 
> I don't have an opinion on whether it it should be behind a flag, but is there
> any reason to leave it enabled but yet with no timers? It seems like all or
> nothing makes more sense?

I agree that probably all-or-nothing makes sense.  

That said, it is plausible that we are running too many tasks, that are too
short, and *that* is the problem.  

Hence my suggestion seems vastly different from the current direction.

You can shoot the messenger (profiler) and make it impossible to see performance
problems (like this one!), or you can look to see what tasks are firing so
often, but doing so little work, that task overhead becomes significant.  This
is indeed one of the things that a profiler identifies.

To explore this avenue... before you completely disable the profiler... visit
about:profiler.... the default sort-order is by count (which will highlight the
tasks that must surely dominate this).... you should look at all tasks that have
an average run time of under 1 ms (bad news... the partial neutering of the
profiler gives all tasks 0 time....)... but you can at least explore the first 5
or 6 tasks, which dominate the task-count by several orders of magnitude!!!!

That visitation (suggested above) is merely anecdotal.  Visit Google's profiler
dashboard page, and select the profiler summary for All Android... and you'll
get the more general picture.  Sort by Count, and sadly, you'll see that the
usage won't fall off quite as fast.  Select only browser processes, and then
there is an order of magnitude fall off in the top 10 tasks.  Sadly, due to the
timer castration induced by this CL, you can't see which tasks do so little that
the task-overhead is dominant... so we probably have to examine them all (or
turn back on the profiler timing so we can do performance optimization!!).

I suspect the answer will quickly emerge that for 1 or 2 types of tasks, we
should NOT be using tasks!!! We should optimize away the task infrastructure in
those SPECIAL cases, use a shared queue, restricted by a global lock, and
aggregate the multitude of tasks into a single task that services NUMEROUS
entries in the queue.


Summary: Please don't remove the profiler. It is the tool that shows you how to
optimize.  It was written to be super efficient, and when *it* becomes a
problem, then we need to fix the task that is being dominated by overhead!

Powered by Google App Engine
This is Rietveld 408576698