History log of /art/runtime/jit/profile_saver.h
Revision Date Author Comments
c600eaa1089342db81ac1869437199efc1f6053b 18-May-2016 Mathieu Chartier <mathieuc@google.com> Add methods with samples during launch to profile

For the snapshot taken after application launch we look at all of
the methods with one or more samples.

Launch time:
books: 1933ms -> 1457ms (33% speedup).
plus: 1361ms -> 1260ms (8% speedup)
music: 3085ms -> 2963ms (4% speedup)
maps: 1583ms -> 1390ms (14% speedup)

Oat sizes:
books: 10871424 -> 13365888 (+23%)
plus: 17715624 -> 19493288 (+13%)
music: 17076864 -> 18289280 (+7%)
maps: 32264832 -> 35787392 (+12%)

Bug: 28750506

Change-Id: I3a955dc74b41a96911254ac5087de77bea2267c7
5fbb0fe0625a1f76aa33cd78ccf1a17b00d8f6d1 29-Apr-2016 Calin Juravle <calin@google.com> Adjust ProfileSaver strategy

Change to a notification based strategy (instead of polling):
- the JIT notifies the ProfileSaver everytime it attempts a compilation
or generate (in a task) a ProfileInfo object for the method
- once a certain number of hot methods notification are received,
ProfileSaver wakes up the thread to do the analysis
- a wake up does not equal to I/O since the during processing we might
realized that's actually not enough new data.
- ProfileSaver throtles the request and ensures it doesn't do the
processing more often than kMinSavePeriodNs.

The new strategy avoids waking the thread unnecessary during extended
idle periods when we don't JIT.

Bug: 26815940

Change-Id: I24cb15daead5c5a5395ae6f5f79549e39e2f3011
e5de54cfab5f14ba0b8ff25d8d60901c7021943f 20-Apr-2016 Calin Juravle <calin@google.com> Split profile recording from jit compilation

We still use ProfileInfo objects to record profile information. That
gives us the flexibility to add the inline caches in the future and the
convenience of the already implemented GC.

If UseJIT is false and SaveProfilingInfo true, we will only record the
ProfileInfo and never launch compilation tasks.

Bug: 27916886
Change-Id: I6e4768dc5d58f2f85f947b276b4244aa11ce3fca
20ae79370a14c17dfb037914995d6430774fe492 18-Apr-2016 Calin Juravle <calin@google.com> Fix tracking foreign dex files

Apps which share the same VM will have different application data
directories. We used to store only the first one registered and miss
subsequent registrations.

Bug: 28012567
Change-Id: I27c2aa2efa938b072be7c73bb778db82f80fcf1e
0cdaa6cdbeadceaee3a1acc641e7cc2548e125d9 30-Mar-2016 Calin Juravle <calin@google.com> Fix and tune ProfileSaver

- the statement to mark the profile saved was not guarded by the right
condition.
- increase the backoff to 2x and maximum period time to 10 minutes.

As part of this change also
- fix typos
- remove uneeded warning
- add more VLOGs for easier debuging in the future

Bug: 27914456

Change-Id: I877c3256aa96d727ac4f443dc6e1f2bdb33c56c6
85f7bf3bbfa17d65ff77e3e826b5f7aff45838a9 18-Mar-2016 Calin Juravle <calin@google.com> Improve ProfileSaver to cache data and do minimal I/O

This CLs introducing caching to further optimize the I/O performed by
the ProfileSaver. The cache stats are also recorded.

Resolved classes are captured and cached after 2 seconds but written
later during application lifetime.

Methods are also cached and the write got smarter to avoid
reading/writing them if it's not needed.

On non scientific experiments the size of the cache reaches just a few
hundreds uint16_t values kept in set, so its impact is minimal.

In terms of how much data we write. In the same non scientific
experiments this reduces the total bytes written by at least 2-3x. In
the first few minutes of after the boot gmscore writes ~3KB (down from
9kb) and quicksearchlauncher writes ~20KB (down from 40KB).

Bug: 27600652

Change-Id: I3a4e7051ccf04ac8fbd5896d328692db773e979d
c15e566b36170237f01ccefc12129c1578a02140 17-Mar-2016 Calin Juravle <calin@google.com> Improve resolved classes saving strategy

If we already have a non empty profile file it means that we already
saved once the resolved classes. So there's no need to hurry up and
start the profile saver eagerly after 2s.

Bug: 27600652
Change-Id: I92ac5869bf68c8d6cbac8fc1503fe3c4930241b4
c19c1c2e1def1f4f5ab5fd9e71b1a6f76d42988f 09-Mar-2016 Calin Juravle <calin@google.com> Add ProfileSaver stats and dump them during SigQuit

Bug: 27516906
Change-Id: I7d2b1091c3523805ef0f87df42feed1098678aad
c90bc92bc577020ff4d3caced4cee1cdf41fa5de 24-Feb-2016 Calin Juravle <calin@google.com> Record foreign dex files loaded by the app in the profile

A foreign dex file is a file which is not owned by the app
(it's not part of its code paths or its private data directory).

When such a dex file is loaded by the app, the runtime will record
a marker in a dedicated profile folder (foreing_dex_profile_path).
The marker is just a file named after the canonical location of the
dex file where '/' is replaced by '@'.

The markers will be used by the system server system server to
decide if the apk should be fully or profile guide compiled.

Bug: 27334750
Bug: 26080105

(cherry picked from commit 86a9ebe4197e963249ffbbaa1830da97ed642fa5)

Change-Id: I8be1fd4d854fa1e23c3c1054c9c083ad7b27317b
86a9ebe4197e963249ffbbaa1830da97ed642fa5 24-Feb-2016 Calin Juravle <calin@google.com> Record foreign dex files loaded by the app in the profile

A foreign dex file is a file which is not owned by the app
(it's not part of its code paths or its private data directory).

When such a dex file is loaded by the app, the runtime will record
a marker in a dedicated profile folder (foreing_dex_profile_path).
The marker is just a file named after the canonical location of the
dex file where '/' is replaced by '@'.

The markers will be used by the system server system server to
decide if the apk should be fully or profile guide compiled.

Bug: 27334750
Bug: 26080105
Change-Id: If4fa8208be4e2f6f0b748b8a5417c4ae9c2d5df6
c5dd319c574f67d11a71f1b60ac6c34bfe93b750 10-Dec-2015 Mathieu Chartier <mathieuc@google.com> Add and use loaded class profiling

Class profiling is a way to keep track of which classes are resolved.
From here the compiler can use this information to generate a smaller
app image.

TODO: Add tests for profile stuff.

Bug: 22858531

(cherry picked from commit 8913fc1a27df8cf3b37fd99e94d87f290591328e)

Change-Id: Ifcd09230cbdc266305bc1247e0d31e7920eb353e
8913fc1a27df8cf3b37fd99e94d87f290591328e 10-Dec-2015 Mathieu Chartier <mathieuc@google.com> Add and use loaded class profiling

Class profiling is a way to keep track of which classes are resolved.
From here the compiler can use this information to generate a smaller
app image.

TODO: Add tests for profile stuff.

Bug: 22858531

Change-Id: I91ccd686394cc2517512f66abb0e277f3d26d4da
b4eddd21c364c51b6fc5c439cda6958ae255dcd5 14-Jan-2016 Calin Juravle <calin@google.com> Add profile support for apps with shared runtime.

- extend ProfileSaver to track different dex locations to different
profile files.
- allow repeated calls to Runtime::RegisterAppInfo() which will
register a new pair <profile_file, locations_to_track> with the profile
saver.

Bug: 26080105
Change-Id: I58c4587d5f462c557411ad7126a00c29cd7db3a6
998c21661b5074c293cae818d0ab7c44dcda3a66 21-Dec-2015 Calin Juravle <calin@google.com> Perform profile file analysis in dex2oat

Dex2oat can accept now multiple profile files to drive a profile based
compilation. --profile-file and --reference-profile-file speficy a pair
of profile files which will be evaluated for significant differences
before starting the compilation. If the difference is insignificant
(according to some internal metric) the compilation is skipped and a
message is logged.

Multiple pairs of --profile-file and --reference-profile-file can be
specified. This effectively enables multi user support since profiles
for different users will be kept separately.

--reference-profile-file can be left out, case in which the decision is
solely based on --profile-file. If both flags are present, then their
repetition should form unique pairs.

If the compilation is performed and --reference-profile-file is given
then its data is merged with the data from the corresponding --profile-
file and saved back to the file.

If no profile flags are given, dex2oat proceeds as before and compiles
the dex files unconditionally.

As part of this change
- merge ProfileCompilationInfo and OfflineProfilingInfo under the same
object. There was no use to keep them separate anymore.
- SaveProfilingInfo now merges the data with what was in
the file before instead of overwriting it.

Bug: 26080105

Change-Id: Ia8c8b55587d468bca5179f78941854285426234d
4d77b6a511659f26fdc711e23825ffa6e7feed7a 01-Dec-2015 Calin Juravle <calin@google.com> Save profile information in a separate thread.

Previously we would save the profiling information only when the app
was sent to background. This missed on an important number of updates
on the jit code cache and it didn't work for background processes.

Bug: 26080105

Change-Id: I84075629870e69b3ed372f00f4806af1e9391e0f