Ejemplo n.º 1
0
        private ulong GetCPUTime()
        {
            var numberOfExecutedInstructions = checked ((ulong)TlibGetExecutedInstructions());

            if (numberOfExecutedInstructions > 0)
            {
                var elapsed = TimeInterval.FromCPUCycles(numberOfExecutedInstructions, PerformanceInMips, out var residuum);
                TlibResetExecutedInstructions(checked ((int)residuum));
                machine.HandleTimeProgress(elapsed);
            }
            return(clint.TimerValue);
        }
Ejemplo n.º 2
0
        private ulong GetCPUTime()
        {
            if (timeProvider == null)
            {
                this.Log(LogLevel.Warning, "Trying to read time from CPU, but no time provider is registered.");
                return(0);
            }

            var numberOfExecutedInstructions = TlibGetExecutedInstructions();

            if (numberOfExecutedInstructions > 0)
            {
                var elapsed = TimeInterval.FromCPUCycles(numberOfExecutedInstructions, PerformanceInMips, out var residuum);
                TlibResetExecutedInstructions(residuum);
                machine.HandleTimeProgress(elapsed);
            }
            return(timeProvider.TimerValue);
        }