New issue
Advanced search Search tips

Issue 916263 link

Starred by 2 users

Issue metadata

Status: Untriaged
Owner:
Cc:
EstimatedDays: ----
NextAction: ----
OS: Android
Pri: 2
Type: Feature



Sign in to add a comment

Collect code coverage information from the field

Project Member Reported by alexilin@chromium.org, Dec 18

Issue description

Detect code that is very rarely or never executed on user devices. Put this code in a special section of the binary that wouldn't be loaded into the memory.

Required steps:
1. Implement the sampling
2. Set up the finch experiment
3. Upload data for further analysis
4. Server-side processing
5. Apply the result for code ordering
 
Project Member

Comment 1 by bugdroid1@chromium.org, Jan 8

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/d4f4b34f77dca866ddc8df95e69f344e3fd197bb

commit d4f4b34f77dca866ddc8df95e69f344e3fd197bb
Author: Alexandr Ilin <alexilin@chromium.org>
Date: Tue Jan 08 15:34:09 2019

android: Reached code sampling profiler.

Reached code profiler periodically interrupts threads in all Chrome processes
and stores process counter values as array of offsets. Later, this array may be
dumped to the disk or uploaded to a server for further analysis.

In order to collect samples this CL does following:
- Registers a signal handler early in the process creation. This handler writes
the current pc value into array. A signal handler is a process-global attribute
shared by all threads so every thread is able to handle a signal.
- Sets up an interval timer (via timer_create()) measuring CPU time consumed by
the calling process. This timer periodically calls SendSignalToAllThreads() on
a dedicated thread.
- SendSignalToAllThreads() has a cached list of all thread ids belonging
to the current process obtained by parsing /proc/self/task directory. It sends
a signal to all listed threads via tgkill() and periodically updates this list.

This allows to collect ~6000 samples per seconds from all threads.

This CL is based on lizeb@ work: https://crrev.com/c/1171233

Bug: 916263
Change-Id: I661ca6d65be694053458e2a6afa1dab62fd9812c
Reviewed-on: https://chromium-review.googlesource.com/c/1319597
Commit-Queue: Alexandr Ilin <alexilin@chromium.org>
Reviewed-by: Daniel Cheng <dcheng@chromium.org>
Reviewed-by: Yaron Friedman <yfriedman@chromium.org>
Reviewed-by: ssid <ssid@chromium.org>
Reviewed-by: Egor Pasko <pasko@chromium.org>
Cr-Commit-Position: refs/heads/master@{#620731}
[modify] https://crrev.com/d4f4b34f77dca866ddc8df95e69f344e3fd197bb/base/BUILD.gn
[add] https://crrev.com/d4f4b34f77dca866ddc8df95e69f344e3fd197bb/base/android/reached_code_profiler.cc
[add] https://crrev.com/d4f4b34f77dca866ddc8df95e69f344e3fd197bb/base/android/reached_code_profiler.h
[add] https://crrev.com/d4f4b34f77dca866ddc8df95e69f344e3fd197bb/base/android/reached_code_profiler_stub.cc
[modify] https://crrev.com/d4f4b34f77dca866ddc8df95e69f344e3fd197bb/base/linux_util.cc
[modify] https://crrev.com/d4f4b34f77dca866ddc8df95e69f344e3fd197bb/base/linux_util.h
[modify] https://crrev.com/d4f4b34f77dca866ddc8df95e69f344e3fd197bb/components/tracing/common/tracing_sampler_profiler.cc
[modify] https://crrev.com/d4f4b34f77dca866ddc8df95e69f344e3fd197bb/content/app/android/library_loader_hooks.cc

Project Member

Comment 2 by bugdroid1@chromium.org, Jan 9

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/5eea3793c1dc0531a5a20ad7ddaf2af68ab54953

commit 5eea3793c1dc0531a5a20ad7ddaf2af68ab54953
Author: Jinsong Fan <fanjinsong@sogou-inc.com>
Date: Wed Jan 09 23:15:35 2019

Fix check failed in InitReachedCodeProfilerAtStartup

The content::LibraryLoaded is common code path for Chrome and Android WebView,
so WebView will crash for check failed in InitReachedCodeProfilerAtStartup.
The CL adds check for InitReachedCodeProfilerAtStartup in LibraryLoaded.

Bug: 916263, 920142
Change-Id: I27260f8dd257635b54ee0a044bdc1ef801a7487e
Reviewed-on: https://chromium-review.googlesource.com/c/1402309
Commit-Queue: Alexandr Ilin <alexilin@chromium.org>
Reviewed-by: Yaron Friedman <yfriedman@chromium.org>
Reviewed-by: Alexandr Ilin <alexilin@chromium.org>
Cr-Commit-Position: refs/heads/master@{#621363}
[modify] https://crrev.com/5eea3793c1dc0531a5a20ad7ddaf2af68ab54953/content/app/android/library_loader_hooks.cc

Sign in to add a comment