internal TimeCheckPointThreshold(long thresholdMillis, SystemNanoClock clock) : base("time threshold") { this._timeMillisThreshold = thresholdMillis; this._clock = clock; // The random start offset means database in a cluster will not all check-point at the same time. long randomStartOffset = thresholdMillis > 0 ? ThreadLocalRandom.current().nextLong(thresholdMillis) : 0; this._lastCheckPointTimeNanos = clock.Nanos() + TimeUnit.MILLISECONDS.toNanos(randomStartOffset); }
public TransactionExecutionStatistic(KernelTransactionImplementation tx, SystemNanoClock clock, long startTimeMillis) { long nowMillis = clock.Millis(); long nowNanos = clock.Nanos(); KernelTransactionImplementation.Statistics statistics = tx.GetStatistics(); this._waitTimeMillis = NANOSECONDS.toMillis(statistics.GetWaitingTimeNanos(nowNanos)); this._heapAllocatedBytes = NullIfNegative(statistics.HeapAllocatedBytes()); this._directAllocatedBytes = NullIfNegative(statistics.DirectAllocatedBytes()); this._cpuTimeMillis = NullIfNegative(statistics.CpuTimeMillis()); this._pageFaults = statistics.TotalTransactionPageCacheFaults(); this._pageHits = statistics.TotalTransactionPageCacheHits(); this._elapsedTimeMillis = nowMillis - startTimeMillis; this._idleTimeMillis = this._cpuTimeMillis != null ? _elapsedTimeMillis - this._cpuTimeMillis - _waitTimeMillis : null; }