Guest User

Untitled

a guest
Jan 21st, 2019
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.36 KB | None | 0 0
  1. fn cycles() -> i64 {
  2. unsafe {
  3. use core::arch::x86_64::_rdtsc;
  4. _rdtsc()
  5. }
  6. }
  7.  
  8. fn main() {
  9. let start = cycles();
  10. let mut sum = 0;
  11. for x in 0..1000 {
  12. if x % 3 == 0 {
  13. sum += x;
  14. } else if x % 5 == 0 {
  15. sum += x;
  16. }
  17. }
  18. let end = cycles();
  19. println!("Duration: {} cycles", end - start);
  20. }
Add Comment
Please, Sign In to add comment