Assembly CPU frequency measuring algorithm

Intel CPUs after Core Duo support two Model-Specific registers called IA32_MPERF and IA32_APERF. MPERF counts at the maximum frequency the CPU supports, while APERF counts at the actual current frequency. The actual frequency is given by: You can read them with this flow ; read MPERF mov ecx, 0xe7 rdmsr mov mperf_var_lo, eax mov mperf_var_hi, … Read more

Flutter Countdown Timer

Here is an example using Timer.periodic : Countdown starts from 10 to 0 on button click : import ‘dart:async’; […] Timer _timer; int _start = 10; void startTimer() { const oneSec = const Duration(seconds: 1); _timer = new Timer.periodic( oneSec, (Timer timer) { if (_start == 0) { setState(() { timer.cancel(); }); } else { … Read more