diff options
author | Mike Ma <yanmin@google.com> | 2018-09-18 10:32:34 -0700 |
---|---|---|
committer | Mike Ma <yanmin@google.com> | 2018-09-18 22:14:26 +0000 |
commit | 9dcf7e342fd7f05c7a59f4eaec2627db81a19c83 (patch) | |
tree | 5894578401c047e2e87f2e1b9dc0e58263a4726c /rs/java/android/renderscript/ProgramFragmentFixedFunction.java | |
parent | 4c888c779c678a0e3253c064044d3326caa52bb3 (diff) |
More robust read mechanism in KernelCpuProcReader
KernelCpuProcReader used FileChannel to dump bytes into a large enough
ByteBuffer. However, FileChannel#read stops as soon as there is nothing
left to read. Since the kernel may not deliver all parts of a proc file
simultaneously, previous read mechanism would possibly read only a
portion of the proc file. The impact is that KernelUidCpuFreqTimeReader
gets an incomplete UID list.
New mechanism uses a loop to turn non-blocking FileChannel#read into a
blocking operation. It does not return until hitting EOF. The reason
not to use Files#readAllBytes is that we want to reuse the byte[].
Bug: 111805985
Test: atest KernelCpuProcReaderTest
Test: compared KernelCpuProcReader#readBytes against Files#readAllBytes
locally
Change-Id: If0d2b6742489632e22c8fec34c627851cda875f2
Diffstat (limited to 'rs/java/android/renderscript/ProgramFragmentFixedFunction.java')
0 files changed, 0 insertions, 0 deletions