summaryrefslogtreecommitdiff
path: root/rs/java/android/renderscript/ProgramVertexFixedFunction.java
diff options
context:
space:
mode:
authorMike Ma <yanmin@google.com>2018-11-08 18:09:43 -0800
committerMike Ma <yanmin@google.com>2018-11-09 11:21:23 -0800
commitfa2534351f67a794d1bfe6a93e1786a3b72c6a34 (patch)
treec8b637cc38e3baff653f164b88d47e86d47203b9 /rs/java/android/renderscript/ProgramVertexFixedFunction.java
parent151046ad9fcea1c9195ad24d03a00b6bb943f7c8 (diff)
An efficient proc file reader
A less resource hogging reader for reading proc files in string format. It is singleton and thread-safe, so all downstream clients share the same instance to avoid duplicate allocation. It reads the entire proc file all at once (to mimimize the impact to the kernel) into a reusable char[] buffer (to prevent frequent GC). A read lock is automatically held for the client when a valid file iterator is returned. Client MUST call close() to unlock it or take advantage of try-with-resources. The reader keeps an error counter. It rejects further requests if it has accumulated 5 errors, to prevent log spam. The reader also has a 500ms cache, which can be bypassed with a parameter. Bug: 111216804 Test: atest FrameworksCoreTests:com.android.internal.os.KernelCpuProcStringReaderTest Change-Id: Ifa5213a5c7baf95d62f74486815030d9aa54ca28
Diffstat (limited to 'rs/java/android/renderscript/ProgramVertexFixedFunction.java')
0 files changed, 0 insertions, 0 deletions