racct: Improve handling of the pcpu resource
The previous scheme would inflate the CPU consumption of short-lived
processes. For containers (e.g., processes, jails), the total pcpu
usage was computed as a sum of the pcpu usage of all constituent
threads, which makes little sense for a decaying average.
Instead, aggregate wallclock time of all on-CPU threads and compute the
pcpu resource as a decaying average as the sum. This gives much more
reasonable and accurate values in various simple tests.
PR: 235556
Reviewed by: markj
MFC after: 1 month
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D30878