summaryrefslogtreecommitdiff
path: root/libs/binder/IPCThreadState.cpp
diff options
context:
space:
mode:
author Connor O'Brien <connoro@google.com> 2020-01-31 18:51:56 -0800
committer Connor O'Brien <connoro@google.com> 2020-02-11 20:43:43 +0000
commit2a716a401bd6c929f37475b9718cb6edfd33975a (patch)
tree8f0ada0eac67797d521226cb12b2ed8a6ee2265e /libs/binder/IPCThreadState.cpp
parentf2a15e8742cf33e37e6c96f4731c298c6749bb68 (diff)
libtimeinstate: add functions to read only recently-updated stats
Add getUidsUpdatedCpuFreqTimes and getUidsUpdatedConcurrentTimes, which skip reading stats for UIDs that haven't been updated since before a time passed in by their caller, and pass a new lastUpdate time back to the caller. This is implemented by querying a new map that holds the most recent update time for each new UID. This approach has a potential race when a UID is updated after we have already read its stats, but before we finish iterating through the rest of the BPF map. By not skipping UIDs updated up to 1s before lastUpdate, we improve the chance that such an update will be picked up the next time getUidsUpdated*Times is called. Though this doesn't completely eliminate the risk of a race, the consequences of the race aren't that severe - we could undercount some runtimes by ~seconds at worst, and only until the affected UID runs again. Extend existing tests to check that these new functions behave like the existing getUids*Times functions when passed a last update time of 0, and add new testcases to exercise the case where a nonzero last update time is used. Test: libtimeinstate_test passes Bug: 138317993 Change-Id: I06ddf8bd7ab7812d067f3a1f5b2fbedeae016bfc Signed-off-by: Connor O'Brien <connoro@google.com>
Diffstat (limited to 'libs/binder/IPCThreadState.cpp')
0 files changed, 0 insertions, 0 deletions