Skip to main content

ProgressTracker

  • Namespace: PPDS.Dataverse.Progress
  • Assembly: PPDS.Dataverse
  • Kind: Class

Summary

Thread-safe progress tracker for bulk operations. Provides accurate rate calculation with both overall and instantaneous rates.

Members

Constructors

ProgressTracker(long totalCount, int rollingWindowSeconds)

ProgressTracker(long totalCount, int rollingWindowSeconds)

Initializes a new instance of the PPDS.Dataverse.Progress.ProgressTracker class.

  • Param totalCount: The total number of records to process.

  • Param rollingWindowSeconds: The duration of the rolling window for instantaneous rate calculation. Default is 30 seconds.

Methods

GetSnapshot

ProgressSnapshot GetSnapshot()

Gets a snapshot of the current progress state. This method is thread-safe.

  • Returns: An immutable snapshot of progress metrics.

RecordProgress

void RecordProgress(int successCount, int failureCount)

Records progress for a batch of records. This method is thread-safe and can be called from multiple threads.

  • Param successCount: Number of records that succeeded in this batch.

  • Param failureCount: Number of records that failed in this batch. Default is 0.

Reset

void Reset()

Resets the tracker to its initial state.

Properties

Failed

long Failed { get; }

Gets the current count of failed records.

Processed

long Processed { get; }

Gets the current count of processed records (succeeded + failed).

Succeeded

long Succeeded { get; }

Gets the current count of successfully processed records.

TotalCount

long TotalCount { get; }

Gets the total count of records to process.