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>
3 files changed