✅ The verified answer to this question is available below. Our community-reviewed solutions help you understand the material better.
public class TimingDecorator : IJob
{
private readonly IJob _inner;
private readonly IMetrics _m;
public TimingDecorator(IJob j, IMetrics m) => (_inner, _m) = (j, m);
public void Run()
{
var sw = Stopwatch.StartNew();
_inner.Run();
_m.Record("job_ms", sw.ElapsedMilliseconds);
}
}
Що додає TimingDecorator?