Skip to content

feat: timing + throughput metrics on Report (#144, #91)#244

Merged
Chris-Wolfgang merged 2 commits into
mainfrom
feature/report-timing
Jun 24, 2026
Merged

feat: timing + throughput metrics on Report (#144, #91)#244
Chris-Wolfgang merged 2 commits into
mainfrom
feature/report-timing

Conversation

@Chris-Wolfgang

Copy link
Copy Markdown
Owner

Adds timing and throughput metrics to Report. Closes #144 and #91.

MINOR (additive public API). The library is already released as v0.13.1, so this rolls into the next release as 0.14.0.

Report — new members (snapshot semantics)

Producer-set (init): StartedAt, Elapsed, TotalItemCount.
Computed (derived from the snapshot, always internally consistent):

  • ItemsPerSecond = CurrentItemCount / Elapsed
  • PercentComplete — [0,100] when total known (clamped), else null
  • EstimatedRemaining — projected from throughput when total known, null for unknown-size/infinite sources

Per #144's open question, timing is a snapshot captured at construction (consistent with CurrentItemCount), not a live-updating value.

Base classes — automatic timing

ExtractorBase / LoaderBase / TransformerBase capture the start time on the first processed item and expose protected StartedAt + Elapsed (monotonic via Stopwatch.GetTimestamp(), cross-TFM). Derived CreateProgressReport implementations can surface them with zero per-package boilerplate — which was the core motivation in #144 (every downstream report was reinventing "how long has this run").

Notes

  • Internal IsExternalInit polyfill so the new init setters compile on net462/472/48/481 + netstandard2.0.
  • TotalItemCount validates >= 0.
  • PublicAPI.Shipped.txt regenerated (headless).
  • Verified: full Release build clean across all TFMs (0 warnings); 231 tests pass (15 new Report tests + 2 base-class timing tests).

Part of: #154

Report (snapshot semantics) gains:
- StartedAt, Elapsed, TotalItemCount (init) — set by the producer.
- ItemsPerSecond, PercentComplete, EstimatedRemaining — computed from the
  snapshot inputs so each report is internally consistent. Null/zero when
  the total is unknown (infinite/unknown-size sources).

ExtractorBase / LoaderBase / TransformerBase auto-capture the start time and
expose protected StartedAt + Elapsed (monotonic via Stopwatch.GetTimestamp,
cross-TFM) on the first processed item, so derived CreateProgressReport
implementations can surface them with no per-package boilerplate.

Adds an internal IsExternalInit polyfill so the new init setters compile on
net462/472/48/481 and netstandard2.0. MINOR (additive public API).
PublicAPI.Shipped.txt regenerated. Verified: full Release build clean across
all TFMs (0 warnings); 231 tests pass.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
…age gate)

The timing instrumentation (StartedAt/Elapsed/EnsureStarted) was added to all
three base classes but only exercised on the extractor, dropping LoaderBase
(88.8%) and TransformerBase (89%) under the 90% per-class coverage gate.
Adds TimedLoader / TimedTransformer doubles with before/after StartedAt+Elapsed
assertions, bringing all three base classes to 100% line coverage. 235 tests pass.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add Elapsed (and start timestamp) to Report base class

1 participant