sweet: new diagnostics framework

This new framework does several things. Primarily, it consolidates the
management of diagnostics files (profiles and traces). It's designed
to be flexible enough for the myriad needs of different benchmarks.

It has a concept of "committed" and "uncommitted" diagnostic files.
This will be particularly important for servers, where we may have to
truncate diagnostic data being gathered from an HTTP endpoint.
Uncommitted diagnostics are discarded at the end of the benchmark.

Meanwhile, the concept of a committed diagnostic also lets us
consolidate the profile merging logic. With this new framework, you
simply ask for multiple files of the same diagnostic type, and when
everything is committed at the end, it will do any necessary profile
merging.

For diagnostics fetched over HTTP in particular, this new framework
lets us fix a significant drawback to runtime trace collection.
Previously, we had to collect traces in many small increments (we used
1 second), which makes the resulting traces basically unusable. As of
Go 1.23, traces can be truncated, but the framework had no ability to
collect a truncatable diagnostic. With this CL, HTTP collection
understands which diagnostics types can be truncated, and switches to
collecting a single long-running diagnostic and cutting it off at the
end of the benchmark.

We'll push this through each benchmark and then remove the old
framework.

Change-Id: Ic9a189123f248aea13f92ef8961e9873c7cf9a6d
Reviewed-on: https://go-review.googlesource.com/c/benchmarks/+/600062
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
5 files changed