directory name fix
This commit is contained in:
1 parent
b862e21b99
commit
190079e84a
108 files changed
+1609
-261
No files matched your search
+43
@@ -0,0 +1,43 @@
|
||||
---
|
||||
title: "@NOTimothyLottes If you do the multiply in uint128_t and then right-shift by 64 places, the compiler should do the right thing."
|
||||
type: archive
|
||||
source: twitter
|
||||
source_url: "https://x.com/FUZxxl/status/2060885487858880689"
|
||||
author: "Robert Clausecker"
|
||||
handle: FUZxxl
|
||||
post_id: "2060885487858880689"
|
||||
date: 2026-05-31
|
||||
archived: 2026-08-23
|
||||
draft: true
|
||||
tags:
|
||||
- archive
|
||||
- twitter
|
||||
- NOTimothyLottes
|
||||
description: "@NOTimothyLottes If you do the multiply in uint128_t and then right-shift by 64 places, the compiler should do the right thing."
|
||||
in_reply_to: ""
|
||||
parent_post_id: "2060730425929080874"
|
||||
---
|
||||
|
||||
## Source
|
||||
|
||||
- URL: https://x.com/FUZxxl/status/2060885487858880689
|
||||
- Author: Robert Clausecker (@FUZxxl)
|
||||
- Posted: 2026-05-31 00:46:04
|
||||
|
||||
## Branch
|
||||
|
||||
**1/**
|
||||
|
||||
@NOTimothyLottes If you do the multiply in uint128_t and then right-shift by 64 places, the compiler should do the right thing.
|
||||
|
||||
**2/**
|
||||
|
||||
@FUZxxl “Should” is exactly why I prefer the actual instruction instrinsics or just inline asm (which is what I use on C CPU land)
|
||||
|
||||
**3/**
|
||||
|
||||
@NOTimothyLottes Have fun with a solution that the compiler optimises worse and that is not portable.
|
||||
|
||||
## Related
|
||||
|
||||
- Spine: [[archive/threads/NOTimothyLottes/2026-05-30-renovating-cpu-clock-code]]
|
||||
@@ -0,0 +1,41 @@
|
||||
---
|
||||
title: "Renovating CPU clock code."
|
||||
type: archive
|
||||
source: twitter
|
||||
source_url: "https://x.com/NOTimothyLottes/status/2060730425929080874"
|
||||
author: "NOTimothyLottes"
|
||||
handle: NOTimothyLottes
|
||||
post_id: "2060730425929080874"
|
||||
date: 2026-05-30
|
||||
archived: 2026-08-23
|
||||
draft: true
|
||||
tags:
|
||||
- archive
|
||||
- twitter
|
||||
- NOTimothyLottes
|
||||
description: "Renovating CPU clock code."
|
||||
in_reply_to: ""
|
||||
---
|
||||
|
||||
## Source
|
||||
|
||||
- URL: https://x.com/NOTimothyLottes/status/2060730425929080874
|
||||
- Author: NOTimothyLottes (@NOTimothyLottes)
|
||||
- Posted: 2026-05-30 14:29:54
|
||||
|
||||
## Thread
|
||||
|
||||
**1/**
|
||||
|
||||
Renovating CPU clock code. I'm assuming x86-64 TSC is always >= 1 GHz so that conversion of clock counter diff to nanoseconds is simply a MUL instruction fetching the RDX high 64-bit result (of the 128-bit computed). But figuring out how to do the inline asm was a pain.
|
||||
|
||||

|
||||
Branches: [[archive/threads/NOTimothyLottes/2026-05-30-renovating-cpu-clock-code/2026-05-31-FUZxxl-if-you-do-the-multiply-in-uint128-t-and-then]]
|
||||
|
||||
**2/**
|
||||
|
||||
Looks like NtQuerySystemInformation() with SystemHypervisorSharedPageInformation (aka 0xc5) gives 64-bit scalar for TSC that converts time to units of 10 MHz. So the smart way is to work in units of TSC, then do a subtraction of TSC terms, then MULHI to get {ms, us, or ns} time
|
||||
|
||||
**3/**
|
||||
|
||||
https://gist.github.com/pmttavara/6f06fc5c7679c07375483b06bb77430c - A great reference for getting TSC scaling multipliers on Linux and Windows
|
||||
Reference in new issue
Block a user