OSDN Git Service

android-x86/system-extras.git
4 years agoMerge "simpleperf: add --use-devfreq-counters option."
Yabin Cui [Tue, 20 Aug 2019 23:45:11 +0000 (23:45 +0000)]
Merge "simpleperf: add --use-devfreq-counters option."

4 years agoMerge "simpleperf: Add ETMDecoder."
Yabin Cui [Tue, 20 Aug 2019 23:08:37 +0000 (23:08 +0000)]
Merge "simpleperf: Add ETMDecoder."

4 years agosimpleperf: add --use-devfreq-counters option.
Yabin Cui [Mon, 12 Aug 2019 23:53:46 +0000 (16:53 -0700)]
simpleperf: add --use-devfreq-counters option.

On devices like pixel 3, there are 7 hardware counters in cpu pmu.
But 4 of them are used by devfreq to monitor memory latency.
In case we need more than 3 counters, add an option to let devfreq
release counters.

Also add a warning of using this option if it seems we need more
counters.

Bug: none
Test: run simpleperf_unit_test.
Change-Id: I9a13716a8b64c8e0fc03a79b0c11dd29da169c56

4 years agosimpleperf: Add ETMDecoder.
Yabin Cui [Fri, 9 Aug 2019 01:15:14 +0000 (18:15 -0700)]
simpleperf: Add ETMDecoder.

It contains below changes:
1. Add ETMDecoder, which uses OpenCSD library to decode etm data.
2. Fix trace ids in AuxTraceInfoRecord to match those in etm data.
3. Dump build ids for all binaries in record cmd, to find them in
   etm decoding.
4. Add options in dump cmd to dump etm data.
5. Add a test line in dump cmd test to check that instruction range
elements are decoded and dumped.

Bug: 135204414
Test: run simpleperf_unit_test.

Change-Id: Iad1a1dac3dd9aaed4416ff2c19029c676d610783

4 years agoMerge "simpleperf: update building prebuilts."
Yabin Cui [Tue, 20 Aug 2019 20:23:09 +0000 (20:23 +0000)]
Merge "simpleperf: update building prebuilts."

4 years agosimpleperf: update building prebuilts.
Yabin Cui [Tue, 20 Aug 2019 17:32:56 +0000 (10:32 -0700)]
simpleperf: update building prebuilts.

1. add simpleperf_scripts in simpleperf dist build.
2. remove simpleperf in sdk,win_sdk dist build.

Bug: none
Test: run build/soong/soong_ui.bash --make-mode
Test: MODULES-IN-system-extras-simpleperf dist
Test: TARGET_PRODUCT=aosp_arm64 simpleperf
Change-Id: Ica63c106b67d3ec7400c0f7148fd78f65d6d16c3

4 years agoMerge "simpleperf: update simpleperf prebuilts to build 5806936."
Yabin Cui [Mon, 19 Aug 2019 19:24:11 +0000 (19:24 +0000)]
Merge "simpleperf: update simpleperf prebuilts to build 5806936."

4 years agosimpleperf: update simpleperf prebuilts to build 5806936.
Yabin Cui [Fri, 16 Aug 2019 18:00:22 +0000 (11:00 -0700)]
simpleperf: update simpleperf prebuilts to build 5806936.

Taken from branch aosp-simpleperf-release.

Bug: none
Test: run test.py on Android master/Q/P/O/N.

Change-Id: Ib527b0ba17f8c583359e157198b5b93fdac88c45

4 years agoMerge "simpleperf: Update apks for testing ApiProfiler."
Yabin Cui [Fri, 16 Aug 2019 17:52:36 +0000 (17:52 +0000)]
Merge "simpleperf: Update apks for testing ApiProfiler."

4 years agosimpleperf: Update apks for testing ApiProfiler.
Yabin Cui [Fri, 16 Aug 2019 17:48:54 +0000 (10:48 -0700)]
simpleperf: Update apks for testing ApiProfiler.

The previous apks has error in sdk version setting, thus
fail to install on master.

Bug: none
Test: run test.py TestApiProfiler.* on master/Q/P/O/N.
Change-Id: I6ef7eabcc0602147b0aa31dc9b3d5bac616e1e83

4 years agoMerge "Add new traces."
Christopher Ferris [Thu, 15 Aug 2019 14:17:49 +0000 (14:17 +0000)]
Merge "Add new traces."

4 years agoAdd new traces.
Christopher Ferris [Wed, 14 Aug 2019 22:10:13 +0000 (15:10 -0700)]
Add new traces.

Updates included:
- Adding traces from a few games and one top app (Angry Birds2, Candy Crush,
  Pubg, Google Photos).
- Change the dumps directory to traces to use a better name.
- Add new traces to TraceBenchmark.cpp.
- Add a TRACES file that includes information about how the trace files
  were collected.

Test: Unit tests pass.
Test: Ran the trace benchmarks.

Change-Id: I8d60db23cf78dd31977bb81d29749c06e1df354d

5 years agoMerge "Fix test broken by PSS to RSS change."
Christopher Ferris [Fri, 9 Aug 2019 15:36:07 +0000 (15:36 +0000)]
Merge "Fix test broken by PSS to RSS change."

5 years agoMerge "simpleperf: add --aux-buffer-size in record cmd."
Yabin Cui [Fri, 9 Aug 2019 00:36:16 +0000 (00:36 +0000)]
Merge "simpleperf: add --aux-buffer-size in record cmd."

5 years agoFix test broken by PSS to RSS change.
Christopher Ferris [Thu, 8 Aug 2019 22:07:36 +0000 (15:07 -0700)]
Fix test broken by PSS to RSS change.

Also, make the tests isolated and remove the suffix on the unit
test executable.

Bug: 138394907

Test: Unit tests pass now.
Change-Id: Iefe0e1738a2c9eda5cc220c55dfd91e4ff0e5a5f

5 years agosimpleperf: add --aux-buffer-size in record cmd.
Yabin Cui [Sat, 3 Aug 2019 00:12:28 +0000 (17:12 -0700)]
simpleperf: add --aux-buffer-size in record cmd.

Bug: 135204414
Test: run simpleperf_unit_test.
Change-Id: I6baee8a2b178a374e446e0da4792eb9287bba6b1

5 years agoMerge "simpleperf: add AuxRecord and AUXTRACE feature section."
Treehugger Robot [Thu, 8 Aug 2019 19:58:25 +0000 (19:58 +0000)]
Merge "simpleperf: add AuxRecord and AUXTRACE feature section."

5 years agosimpleperf: add AuxRecord and AUXTRACE feature section.
Yabin Cui [Fri, 2 Aug 2019 18:35:38 +0000 (11:35 -0700)]
simpleperf: add AuxRecord and AUXTRACE feature section.

In the kernel, each time generating a block of etm data, it also
generates a PERF_RECORD_AUX record. An Aux record contains a timestamp
showing when a block of etm data is generated. It can be used to
synchronize etm data with other records (like mmap and comm records).

So we want to parse etm data each time seeing an Aux record (as in dump
cmd). It needs to know etm data locations in perf.data without reading
the whole file. To fulfill that, this CL also adds AUXTRACE feature section,
in the same format as in linux perf.

Also dump AUX records and their corresponding etm data in dump cmd.

Bug: 135204414
Test: run simpleperf_unit_test.
Test: run `simpleperf record -e cs-etm xxx` && `perf report -D --stdio`.

Change-Id: Ifae716a10fefe0f3d4822a0214384b40ada9da45

5 years agoMerge "Change from PSS to RSS."
Christopher Ferris [Thu, 8 Aug 2019 01:25:23 +0000 (01:25 +0000)]
Merge "Change from PSS to RSS."

5 years agoChange from PSS to RSS.
Christopher Ferris [Wed, 7 Aug 2019 21:31:25 +0000 (14:31 -0700)]
Change from PSS to RSS.

In practice, PSS and RSS should be the same for this test, but what
we are really measuring is RSS, so display it as such.

Bug: 138394907

Test: Ran memory_replay32/64 and verified that new RSS is the same as
Test: old version that used PSS.
Change-Id: Ida92e4551f5b58729cd699bc9a296d324483daae

5 years agoMerge "simpleperf: fix report_html.py."
Yabin Cui [Sat, 3 Aug 2019 00:06:01 +0000 (00:06 +0000)]
Merge "simpleperf: fix report_html.py."

5 years agosimpleperf: fix report_html.py.
Yabin Cui [Fri, 2 Aug 2019 23:31:40 +0000 (16:31 -0700)]
simpleperf: fix report_html.py.

report_html.py removes threads having too small percentage
of samples. But it doesn't remove processes having no threads,
which makes showing flamegraph broken.

Bug: none
Test: run test.py TestReportHtml.test_no_empty_process.
Change-Id: I3d568c98f0426a8ebbc9760dbc3c2bd25eda4c67

5 years agoMerge "libfscrypt: Remove an unused variable"
Treehugger Robot [Fri, 2 Aug 2019 23:05:22 +0000 (23:05 +0000)]
Merge "libfscrypt: Remove an unused variable"

5 years agolibfscrypt: Remove an unused variable
Vic Yang [Fri, 2 Aug 2019 20:40:51 +0000 (13:40 -0700)]
libfscrypt: Remove an unused variable

This is the only object in .bss in libfscrypt and it's unused, so it's
costing us 4KB for nothing.  Remove it.

Bug: 138856262
Test: objdump -h libfscrypt.so. Check .bss is gone.
Change-Id: Iac5eff45e28453f09d380c10a1818eb53ed2fe48

5 years agoMerge "simpleperf: support recording etm data in perf.data."
Treehugger Robot [Thu, 1 Aug 2019 19:51:50 +0000 (19:51 +0000)]
Merge "simpleperf: support recording etm data in perf.data."

5 years agoMerge "Simpleperf: Add max_chain_length to pprof_proto_generator.py"
Treehugger Robot [Tue, 30 Jul 2019 16:09:50 +0000 (16:09 +0000)]
Merge "Simpleperf: Add max_chain_length to pprof_proto_generator.py"

5 years agoSimpleperf: Add max_chain_length to pprof_proto_generator.py
Andreas Gampe [Mon, 29 Jul 2019 16:56:12 +0000 (09:56 -0700)]
Simpleperf: Add max_chain_length to pprof_proto_generator.py

Add an option to truncate very long callchains.

Test: m
Test: manual
Change-Id: I6892597f58bf6a8381b455c8f288b29f00a75f70

5 years agosimpleperf: support recording etm data in perf.data.
Yabin Cui [Thu, 25 Jul 2019 22:12:58 +0000 (15:12 -0700)]
simpleperf: support recording etm data in perf.data.

1. In event_fd.cpp, add functions to create aux buffer and read etm
data.
2. In record.h, Add AuxTraceRecord.
2. In RecordReadThread.cpp, wrap etm data into AuxTraceRecords.
3. Add logic to read and write AuxTraceRecords in perf.data.
4. Show recorded etm data size after recording.

Bug: 135204414
Test: run simpleperf_unit_test.
Change-Id: I3b20fe8f3c786f130f38e34962ca9f86a31fc584

5 years agoMerge "Simpleperf: Restrict callchain depth in inferno"
Treehugger Robot [Wed, 24 Jul 2019 15:43:32 +0000 (15:43 +0000)]
Merge "Simpleperf: Restrict callchain depth in inferno"

5 years agoSimpleperf: Restrict callchain depth in inferno
Andreas Gampe [Tue, 23 Jul 2019 20:19:23 +0000 (13:19 -0700)]
Simpleperf: Restrict callchain depth in inferno

Add an option to restrict the callchain depth in inferno, so as
to cope with deep stack that otherwise lead to a python stack
overflow.

Use a large value as a stand-in for unlimited. Try to capture
stack overflow and add a message to try the parameter.

Test: manual
Change-Id: I411b4210ad7ddb8c418a8142b0392df192111e06

5 years agoMerge "simpleperf: fix filters in pprof_proto_generator.py."
Yabin Cui [Tue, 23 Jul 2019 18:08:52 +0000 (18:08 +0000)]
Merge "simpleperf: fix filters in pprof_proto_generator.py."

5 years agoMerge "simpleperf: add --log option in app_profiler.py."
Yabin Cui [Tue, 23 Jul 2019 18:07:40 +0000 (18:07 +0000)]
Merge "simpleperf: add --log option in app_profiler.py."

5 years agosimpleperf: add --log option in app_profiler.py.
Yabin Cui [Mon, 22 Jul 2019 19:33:47 +0000 (12:33 -0700)]
simpleperf: add --log option in app_profiler.py.

The default log output of app_profiler.py is too verbose. So add
--log option to adjust it, and omit debug outputs by default.

Bug: 138112297
Test: run app_profiler.py manually.
Change-Id: I9f08d3eeb890347a1017b5b39832dc2cc3a9e2af

5 years agosimpleperf: fix filters in pprof_proto_generator.py.
Yabin Cui [Mon, 22 Jul 2019 18:39:36 +0000 (11:39 -0700)]
simpleperf: fix filters in pprof_proto_generator.py.

Bug: 138107481
Test: run test.py TestPprof*.
Change-Id: I3344c4252ca469845e3844c0f2de447f293c38d1

5 years agoMerge "simpleperf: set scoped arch and event types in RecordFileReader."
Yabin Cui [Fri, 19 Jul 2019 18:49:57 +0000 (18:49 +0000)]
Merge "simpleperf: set scoped arch and event types in RecordFileReader."

5 years agoMerge "simpleperf: add PERF_RECORD_AUXTRACE_INFO record."
Yabin Cui [Fri, 19 Jul 2019 18:49:36 +0000 (18:49 +0000)]
Merge "simpleperf: add PERF_RECORD_AUXTRACE_INFO record."

5 years agosimpleperf: add PERF_RECORD_AUXTRACE_INFO record.
Yabin Cui [Wed, 17 Jul 2019 23:59:48 +0000 (16:59 -0700)]
simpleperf: add PERF_RECORD_AUXTRACE_INFO record.

PERF_RECORD_AUXTRACE_INFO is used to record etm configurations on device.
Make its content the same as in linux perf.

Bug: 135204414
Test: run simpleperf_unit_test.
Change-Id: I5d32cbe22acbc690d2ba47473ff344241982a0c3

5 years agosimpleperf: set scoped arch and event types in RecordFileReader.
Yabin Cui [Fri, 19 Jul 2019 00:27:48 +0000 (17:27 -0700)]
simpleperf: set scoped arch and event types in RecordFileReader.

To record on device and report on host, simpleperf keeps arch type
and event types in perf.data. Currently, RecordFileReader needs
its users to read and set the arch type and event types properly.

This patch changes to let RecordFileReader set arch type and
event types. It avoids repeating the effort in users of
RecordFileReader.

Bug: none
Test: run simpleperf_unit_test.
Test: run simpleperf record on device, and report it on host.
Change-Id: Ief637ca6e2c3acfbf74b6447ef7ff0679439ca1d

5 years agoMerge "simpleperf: don't expose libunwindstack in OfflineUnwinder.h."
Yabin Cui [Thu, 18 Jul 2019 19:29:19 +0000 (19:29 +0000)]
Merge "simpleperf: don't expose libunwindstack in OfflineUnwinder.h."

5 years agosimpleperf: don't expose libunwindstack in OfflineUnwinder.h.
Yabin Cui [Thu, 18 Jul 2019 17:43:32 +0000 (10:43 -0700)]
simpleperf: don't expose libunwindstack in OfflineUnwinder.h.

It is to build etm decode library happen to include
OfflineUnwinder.h, but don't link with libunwindstack.

Bug: 135204414
Test: run simpleperf_unit_test.
Change-Id: I924498e7315b50ff44f85445f23c4be342bd39bd

5 years agoMerge "simpleperf: fix raw event names."
Yabin Cui [Wed, 17 Jul 2019 20:51:45 +0000 (20:51 +0000)]
Merge "simpleperf: fix raw event names."

5 years agoMerge "simpleperf: add cs-etm event type."
Yabin Cui [Wed, 17 Jul 2019 20:21:14 +0000 (20:21 +0000)]
Merge "simpleperf: add cs-etm event type."

5 years agoMerge "simpleperf: add rate comment for new raw events."
Yabin Cui [Wed, 17 Jul 2019 19:55:00 +0000 (19:55 +0000)]
Merge "simpleperf: add rate comment for new raw events."

5 years agoMerge "Remove perfprofd feature."
Treehugger Robot [Wed, 17 Jul 2019 19:53:37 +0000 (19:53 +0000)]
Merge "Remove perfprofd feature."

5 years agosimpleperf: add cs-etm event type.
Yabin Cui [Fri, 12 Jul 2019 20:09:15 +0000 (13:09 -0700)]
simpleperf: add cs-etm event type.

cs-etm event type is used to select etm instruction tracing.
It can be show in simpleperf list cmd, and used by
`simpleperf record -e cs-etm`.

Changes receiving etm data from the kernel will be added
in later CLs.

Bug: 135204414
Test: run simpleperf_unit_test.
Change-Id: I431b5521dc23519ff8e154d50458ec0aa9ac65cd

5 years agosimpleperf: fix raw event names.
Yabin Cui [Wed, 17 Jul 2019 17:53:01 +0000 (10:53 -0700)]
simpleperf: fix raw event names.

Bug: 137044139
Test: run simpleperf list.
Change-Id: If87690f767e8f37d137a7d53d0c3ffb0c07c4adf

5 years agosimpleperf: add rate comment for new raw events.
Yabin Cui [Mon, 15 Jul 2019 17:39:15 +0000 (10:39 -0700)]
simpleperf: add rate comment for new raw events.

After the patch, simpleperf shows rate comments for new raw events:

$ simpleperf stat --group raw-l1d-cache-refill-rd,raw-l1d-cache-rd sleep 1
Performance counter statistics:

     98,519  raw-l1d-cache-refill-rd   # 2.226422% level 1 cache refill rate, read  (100%)
  4,424,993  raw-l1d-cache-rd          #                                            (100%

Bug: 137044139
Test: run simpleperf_unit_test.
Test: run simpleperf manually.
Change-Id: Ic71ee7326451e62feefb26feb0471fa3a72a173f

5 years agoRemove perfprofd feature.
Elliott Hughes [Wed, 17 Jul 2019 15:19:03 +0000 (08:19 -0700)]
Remove perfprofd feature.

perfprofd is dead and gone.

Test: treehugger
Change-Id: Ia3edd46db30427e0e3b280c92bb89d3f6d71aa48

5 years agoMerge "Remove perfprofd."
Elliott Hughes [Tue, 16 Jul 2019 22:59:21 +0000 (22:59 +0000)]
Merge "Remove perfprofd."

5 years agoMerge "libext4_utils: remove unused deps"
Treehugger Robot [Mon, 15 Jul 2019 18:27:06 +0000 (18:27 +0000)]
Merge "libext4_utils: remove unused deps"

5 years agoMerge "simpleperf: add event numbers listed in ARM 8.4 manual."
Yabin Cui [Fri, 12 Jul 2019 21:55:44 +0000 (21:55 +0000)]
Merge "simpleperf: add event numbers listed in ARM 8.4 manual."

5 years agolibext4_utils: remove unused deps
Steven Moreland [Fri, 12 Jul 2019 00:19:38 +0000 (17:19 -0700)]
libext4_utils: remove unused deps

Bug: 137311188
Test: library still builds
Change-Id: Iee71887bc0f969c349369b7d70c981c3f89ce23a

5 years agosimpleperf: add event numbers listed in ARM 8.4 manual.
Yabin Cui [Thu, 11 Jul 2019 19:23:05 +0000 (12:23 -0700)]
simpleperf: add event numbers listed in ARM 8.4 manual.

Also don't report error when testing if a raw event is supported.
Also print raw numbers even if we think they are not supported to
avoid false negative.

Bug: 137044139
Test: run simpleperf list.
Test: run simpleperf_unit_test.
Change-Id: I8799ae2a8892c76c9ac7d7a2b38544e9ca8ba533

5 years agoRemove perfprofd.
Elliott Hughes [Wed, 10 Jul 2019 19:35:15 +0000 (12:35 -0700)]
Remove perfprofd.

This isn't finished, and no-one's working on finishing it.

Test: N/A
Change-Id: If52aa7f7dba8991f53bf432c0c3bc59c7a3cd2ca

5 years agoMerge "Wrap getenv and append euid to GCOV_PREFIX"
Pirama Arumuga Nainar [Tue, 9 Jul 2019 15:32:48 +0000 (15:32 +0000)]
Merge "Wrap getenv and append euid to GCOV_PREFIX"

5 years agoWrap getenv and append euid to GCOV_PREFIX
Pirama Arumuga Nainar [Tue, 2 Jul 2019 05:13:10 +0000 (22:13 -0700)]
Wrap getenv and append euid to GCOV_PREFIX

The coverage runtime creates coverage files with permissions 0644 and
intermediate directories with 0755.  This causes conflicts and
permissions issues when multiple processes create/access the same file
or directory under $GCOV_PREFIX.  Some processes also call umask, which
further complicates things.

It is possible to handle all of these in the coverage runtime library
but a foolproof alternative is to have a separate coverage directory per
effective userid (euid) by customizing GCOV_PREFIX.

This change adds a wrapper to getenv which appends the euid of the
current process for the "GCOV_PREFIX" environment variable.

Test: Verify that coverage files are written to
/data/misc/trace/<euid>/proc/... instead of /data/misc/trace/proc/...

Change-Id: I6be1e748618d84697c354516ab1c734fb33ab5f4

5 years agoMerge "Fix cf_x86_phone-userdebug_coverage build"
Dimitry Ivanov [Fri, 28 Jun 2019 16:18:31 +0000 (16:18 +0000)]
Merge "Fix cf_x86_phone-userdebug_coverage build"

5 years agoFix cf_x86_phone-userdebug_coverage build
dimitry [Fri, 28 Jun 2019 09:24:09 +0000 (11:24 +0200)]
Fix cf_x86_phone-userdebug_coverage build

coverage builds depend on libprofile-extras* libraries
for natively bridged architectures.

Bug: http://b/136237669
Test: make EMMA_INSTRUMENT=true EMMA_INSTRUMENT_FRAMEWORK=true NATIVE_COVERAGE=true COVERAGE_PATHS="*" SKIP_BOOT_JARS_CHECK=true platform_tests
Change-Id: I400afe7696378c0bfb2b93e7dc85bdcaa62bf9f3

5 years agoMerge "squashfs_utils: Declare required modules."
Tao Bao [Tue, 25 Jun 2019 17:57:43 +0000 (17:57 +0000)]
Merge "squashfs_utils: Declare required modules."

5 years agoMerge "lpmake: Add a flag to force building a complete, empty super.img."
David Anderson [Tue, 25 Jun 2019 16:52:43 +0000 (16:52 +0000)]
Merge "lpmake: Add a flag to force building a complete, empty super.img."

5 years agosquashfs_utils: Declare required modules.
Tao Bao [Fri, 21 Jun 2019 21:47:10 +0000 (14:47 -0700)]
squashfs_utils: Declare required modules.

mksquashfsimage.sh depends on mksquashfs and img2simg.

Test: TreeHugger
Change-Id: Iac4efef68f87528c3601417829a934cc1b53b15d

5 years agoMerge "Call public create function."
Christopher Ferris [Wed, 12 Jun 2019 16:10:10 +0000 (16:10 +0000)]
Merge "Call public create function."

5 years agoCall public create function.
Christopher Ferris [Tue, 28 May 2019 23:17:54 +0000 (16:17 -0700)]
Call public create function.

Test: Ran unit tests.
Change-Id: I8a017c4225f6141b109be059313dd1322c69fbdd

5 years agoMerge "Opt adbd and init out of property-watcher thread"
Treehugger Robot [Thu, 6 Jun 2019 18:02:10 +0000 (18:02 +0000)]
Merge "Opt adbd and init out of property-watcher thread"

5 years agoMerge "simpleperf: work around a simpleperf bug on Android Q."
Yabin Cui [Thu, 6 Jun 2019 17:41:15 +0000 (17:41 +0000)]
Merge "simpleperf: work around a simpleperf bug on Android Q."

5 years agoMerge "TraceBenchmark: Defend against bad data"
Treehugger Robot [Thu, 6 Jun 2019 16:26:00 +0000 (16:26 +0000)]
Merge "TraceBenchmark: Defend against bad data"

5 years agoTraceBenchmark: Defend against bad data
Greg Kaiser [Thu, 6 Jun 2019 13:33:20 +0000 (06:33 -0700)]
TraceBenchmark: Defend against bad data

In the unlikely event of bad data from the file, we make sure it's
not able to write into stack memory by giving a buffer size to
our sscanf() format string.

Test: TreeHugger
Change-Id: Ie3722c39def58f53305073cbadb8fd3a2081cc6a

5 years agosimpleperf: work around a simpleperf bug on Android Q.
Yabin Cui [Tue, 4 Jun 2019 23:04:44 +0000 (16:04 -0700)]
simpleperf: work around a simpleperf bug on Android Q.

There is a bug in simpleperf shipped on Android Q, which was fixed in
aosp/971783. It may make simpleperf crash when profiling through Java app
api. So work around it in the Java app api.

Bug: none
Test: run test.py --repeat 100 TestApiProfiler*

Change-Id: Iec5ff9fd9b9a1e522a0b212d44032c386e500d93

5 years agoMerge "Update code and add a way to benchmark traces."
Christopher Ferris [Thu, 6 Jun 2019 00:56:09 +0000 (00:56 +0000)]
Merge "Update code and add a way to benchmark traces."

5 years agoOpt adbd and init out of property-watcher thread
Pirama Arumuga Nainar [Wed, 5 Jun 2019 23:39:04 +0000 (16:39 -0700)]
Opt adbd and init out of property-watcher thread

Bug: http://b/116873221
Bug: http://b/134177005

adbd calls selinux_android_setcon() which will fail if there are
multiple threads in the process.  The reason for boot failures with
coverage-enabled init and property-watcher thread is not clear yet.

Test: cuttlefish with coverage for init and adbd boots.
Change-Id: I0c44e76cc59d12b963e4d5b862683ead2f816cdc

5 years agoUpdate code and add a way to benchmark traces.
Christopher Ferris [Thu, 25 Apr 2019 20:19:02 +0000 (13:19 -0700)]
Update code and add a way to benchmark traces.

The benchmarker treats the trace like a single thread trace.

Bug: 129743239

Test: Ran benchmarks and verified there are no error and numbers seem sane.
Test: Verified locking to a cpu works.
Change-Id: I598d014ff65569271b45ec6567db1c39b26d4e2d

5 years agoMerge changes Id8f0ceab,Ie969311c
Pirama Arumuga Nainar [Wed, 5 Jun 2019 21:39:42 +0000 (21:39 +0000)]
Merge changes Id8f0ceab,Ie969311c

* changes:
  Refactor property-watch optout logic
  Do init_profile_extras constructor tasks only once

5 years agoRefactor property-watch optout logic
Pirama Arumuga Nainar [Tue, 4 Jun 2019 22:33:45 +0000 (15:33 -0700)]
Refactor property-watch optout logic

Bug: http://b/116873221

Refactor the processes without property-watch thread into a list.

Test: Build cuttlefish with coverage
Change-Id: Id8f0ceab133b961219b1cf77ae02b00eba4cfaf5

5 years agoDo init_profile_extras constructor tasks only once
Pirama Arumuga Nainar [Mon, 3 Jun 2019 17:56:35 +0000 (10:56 -0700)]
Do init_profile_extras constructor tasks only once

Bug: http://b/116873221

Currently, every coverage-enabled binary (the main executable or shared
library) in the process executes the init_profile_extras constructor
leading to redundant initialization.

Instead, add a weak global value that gets set once so following
constructors don't set a signal handler or create a pthread.  It's ok to
do this before the constructor succeeds because if pthread creation or
signal handler registration failed once, they are unlikely to succeed
the second time.

This is thread-safe since constructor initialization is single-threaded.
The one possibility for a race - the process doesn't have any
coverage-enabled library, and multiple threads dlopen() coverage-enabled
shared libraries - seems quite unlikely.

Test: Verify that only one extra thread is created for a daemon (adbd).
Change-Id: Ie969311c2ddac147497c870b5c365b4617b3c60a

5 years agoMerge "simpleperf: add --no-cut-samples in record cmd."
Yabin Cui [Wed, 5 Jun 2019 19:52:55 +0000 (19:52 +0000)]
Merge "simpleperf: add --no-cut-samples in record cmd."

5 years agoMerge "Match src paths with aidl package name"
Dan Willemsen [Wed, 5 Jun 2019 16:05:08 +0000 (16:05 +0000)]
Merge "Match src paths with aidl package name"

5 years agosimpleperf: add --no-cut-samples in record cmd.
Yabin Cui [Tue, 4 Jun 2019 18:30:40 +0000 (11:30 -0700)]
simpleperf: add --no-cut-samples in record cmd.

Bug: 134300436
Test: run simpleperf_unit_test.
Test: run simpleperf manually.
Change-Id: I6b8b5ea22002240be61998d8829c182fe1137a30

5 years agoMerge "simpleperf: check content in build_id_list."
Yabin Cui [Tue, 4 Jun 2019 17:04:07 +0000 (17:04 +0000)]
Merge "simpleperf: check content in build_id_list."

5 years agosimpleperf: check content in build_id_list.
Yabin Cui [Fri, 31 May 2019 22:30:17 +0000 (15:30 -0700)]
simpleperf: check content in build_id_list.

The content in build_id_list may not match files exist in symfs dir,
(like due to interrupted tests).
So in simpleperf binary, do build id check for files in build_id_list.
Also check if files exist in NativeLibDownloader.

Bug: 134164477
Test: run simpleperf_unit_test.
Test: run test.py TestNativeLibDownloader*
Change-Id: Ida435d17d4fead2ba3a14c7766ecaf7cf12448b2

5 years agoMerge "simpleperf: dump mmap records for dex files extracted in JITDebugReader."
Yabin Cui [Fri, 31 May 2019 21:14:54 +0000 (21:14 +0000)]
Merge "simpleperf: dump mmap records for dex files extracted in JITDebugReader."

5 years agosimpleperf: dump mmap records for dex files extracted in JITDebugReader.
Yabin Cui [Fri, 31 May 2019 17:39:56 +0000 (10:39 -0700)]
simpleperf: dump mmap records for dex files extracted in JITDebugReader.

On Android Q, ART extracts dex files in apk files directly into memory,
and names it using prctl(). The kernel doesn't generate a new mmap record
for it. So if simpleperf is started before the app, it can't receive
the correct mmap info of dex files extracted into memory. Thus making
missing symbols and broken callchains.

So work around this by dumping the mmap info in JITDebugReader.

Bug: 134081613
Test: run simpleperf manually.
Test: run simpleperf_unit_test.
Test: run test.py TestCppDemoJniCall.test_smoke.

Change-Id: I995573309816c84729e82e58148890a76725ae36

5 years agoMerge "Do not create property_watch_loop thread for zygote"
Treehugger Robot [Thu, 30 May 2019 18:16:01 +0000 (18:16 +0000)]
Merge "Do not create property_watch_loop thread for zygote"

5 years agoMerge "simpleperf: update simpleperf prebuilts to build 5611423."
Treehugger Robot [Wed, 29 May 2019 22:02:06 +0000 (22:02 +0000)]
Merge "simpleperf: update simpleperf prebuilts to build 5611423."

5 years agoDo not create property_watch_loop thread for zygote
Pirama Arumuga Nainar [Wed, 29 May 2019 21:18:18 +0000 (14:18 -0700)]
Do not create property_watch_loop thread for zygote

Bug: http://b/116873221
Bug: http://b/133872559

Do not create thread running property_watch_loop for zygote (which is
essentially /system/bin/app_process invoked with a specific argument to
start the zygote).

The reason this is needed is because when the zygote forks system_server
or an app, it waits for all threads to stop.  But the thread created
here doesn't know that it has to stop.  So zygote gets stuck waiting and
the device doesn't boot.

This check is only needed for the platform, but can be done on any
version after Android L, when getprogname() was added.

Test: cuttlefish with coverage enabled can boot.
Change-Id: I65aa603a88bf8da1f14b5c4ada3adf3776f33275

5 years agosimpleperf: update simpleperf prebuilts to build 5611423.
Yabin Cui [Wed, 29 May 2019 17:35:46 +0000 (10:35 -0700)]
simpleperf: update simpleperf prebuilts to build 5611423.

Taken from branch aosp-simpleperf-release.

Also do below changes:
1. remove the workaround of always using 32bit simpleperf.exe,
since 64bit simpleperf.exe works now.

2. stop testing once a test fails. If not stopped, the failed test
data may be removed by following tests, making it harder to debug.

Bug: none
Test: run test.py on linux.

Change-Id: I764b7707ae81d124673b2c2d203911f3761a2239

5 years agoMerge "Simpleperf: fix a reference error in lambda function."
Yabin Cui [Tue, 28 May 2019 20:43:16 +0000 (20:43 +0000)]
Merge "Simpleperf: fix a reference error in lambda function."

5 years agoSimpleperf: fix a reference error in lambda function.
Yabin Cui [Tue, 28 May 2019 18:54:07 +0000 (11:54 -0700)]
Simpleperf: fix a reference error in lambda function.

loop is a local variable, but the lambda function is used outside
its scope.

Bug: none
Test: test.py TestApiProfiler.*.
Change-Id: Ib09019706da001596af340b3909aef355f48cfb8

5 years agolpmake: Add a flag to force building a complete, empty super.img.
David Anderson [Fri, 24 May 2019 19:19:22 +0000 (12:19 -0700)]
lpmake: Add a flag to force building a complete, empty super.img.

Normally lpmake without images is used to generate super_empty.img, but
it is useful to also generate a fully sparse super_empty for flashing in
the bootloader. This patch adds a --force-full-image flag to provide this.

Bug: N/A
Test: lpmake --force-full-image
Change-Id: Ica55a7b35f6e1a0282e5a9305f1a3e4b5028755b

5 years agoMerge "lpdump: Add an option to print the metadata size to stdout."
David Anderson [Thu, 23 May 2019 21:59:35 +0000 (21:59 +0000)]
Merge "lpdump: Add an option to print the metadata size to stdout."

5 years agolpdump: Add an option to print the metadata size to stdout.
David Anderson [Wed, 22 May 2019 21:31:06 +0000 (14:31 -0700)]
lpdump: Add an option to print the metadata size to stdout.

This also adds --is-super-empty if the caller knows the file is a
super_empty.img, which helps suppress spurious output.

Bug: 117997386
Test: lpdump --is-super-empty --dump-metadata-size super_empty.img
Change-Id: I5999442c097c0ef1d6a70e844993b2164f3b091d

5 years agoMerge "Track libziparchive API change."
Elliott Hughes [Thu, 23 May 2019 17:55:27 +0000 (17:55 +0000)]
Merge "Track libziparchive API change."

5 years agoTrack libziparchive API change.
Elliott Hughes [Thu, 23 May 2019 01:59:29 +0000 (18:59 -0700)]
Track libziparchive API change.

libziparchive can now provide a std::string directly.

Bug: http://b/129068177
Test: treehugger
Change-Id: Id804a804f4aea037fac7898a2be5a0aacecb8b41

5 years agoMerge "Prefix sysprop for flushing coverage with 'debug.'"
Treehugger Robot [Wed, 22 May 2019 20:46:30 +0000 (20:46 +0000)]
Merge "Prefix sysprop for flushing coverage with 'debug.'"

5 years agoMerge "simpleperf: add --aggregate-by-thread-name in report_html.py."
Yabin Cui [Wed, 22 May 2019 18:21:38 +0000 (18:21 +0000)]
Merge "simpleperf: add --aggregate-by-thread-name in report_html.py."

5 years agoMerge "simpleperf: add --show_art_frames in pprof_proto_generatory.py."
Yabin Cui [Wed, 22 May 2019 18:21:06 +0000 (18:21 +0000)]
Merge "simpleperf: add --show_art_frames in pprof_proto_generatory.py."

5 years agoPrefix sysprop for flushing coverage with 'debug.'
Pirama Arumuga Nainar [Wed, 22 May 2019 17:04:50 +0000 (10:04 -0700)]
Prefix sysprop for flushing coverage with 'debug.'

Bug: http://b/133322197

Fix selinux denials when reading the coverage.flush sysprop by prefixing
it with 'debug.'.  Sysprops starting with 'debug.' are readable by all
processes when ro.debuggable is set.

Test: Build cuttlefish with coverage and verify that selinux denials for
sysprop reads no longer happen.

Change-Id: I76bef0a658ce881cc81e2d2d4947bef966060376

5 years agoMerge "simpleperf: split doc."
Yabin Cui [Tue, 21 May 2019 19:11:14 +0000 (19:11 +0000)]
Merge "simpleperf: split doc."

5 years agosimpleperf: add --aggregate-by-thread-name in report_html.py.
Yabin Cui [Fri, 17 May 2019 18:20:06 +0000 (11:20 -0700)]
simpleperf: add --aggregate-by-thread-name in report_html.py.

It is helpful for showing multiple perf.data generated for the
same app.

Bug: 132371980
Test: run test.py TestReportHtml*.

Change-Id: I48fe0c96249f617358f2efc51fc190d88af792df

5 years agosimpleperf: add --show_art_frames in pprof_proto_generatory.py.
Yabin Cui [Fri, 17 May 2019 18:45:16 +0000 (11:45 -0700)]
simpleperf: add --show_art_frames in pprof_proto_generatory.py.

Bug: 132816644
Test: run test.py TestPprofProtoGenerator*.
Change-Id: I6f9b82ce71f7bd45ed196dc77b5cfac5a1fce251

5 years agosimpleperf: split doc.
Yabin Cui [Thu, 16 May 2019 23:33:16 +0000 (16:33 -0700)]
simpleperf: split doc.

Bug: 132910352
Test: use remarkable to verify links.
Change-Id: I049df2c8ed23da1780b1a9e6df04375f5c3b3c12