|
Create CounterHolder, a new type that holds a collection of partitioned counters:
- A derived type (i.e. ServiceContext) must extend CounterHolder, highlighting that it can be augmented with partitioned counters.
- Counters can then be added to the derived type using a new API, which is very similar to that used for declaring decorations.
- For simplicity, all counters are the same type (64-bit unsigned integer) and are initialized at zero.
- The declared counters will be partitioned based on the number of virtual cores, which is decided at runtime, and packed into as few cache-lines as possible.
- Counters can be defined in any compilation unit, however, their lifetime is bound to the parent object (e.g. ServiceContext) and may be packed into the same cache-line with counters from other compilation units.
Internally, CounterHolder uses Counter to manage individual counters (see SERVER-85877). Also, this is primarily designed for service-level counters (e.g. those on ServiceContext).
|