LINE(8)

πŸ’– LINE(8) β€” the line page, but make it cute πŸ’–

okay bestie, so you opened the line man page from LMBENCH and honestly? it's giving "tiny tool, huge main character energy". let's get into it ✨


🌸 NAME 🌸

line β€” cache line size πŸŽ€


✨ SYNOPSIS ✨

line [ -M <len> ] [ -W <warmups> ] [ -N <repetitions> ]

πŸ¦‹ DESCRIPTION πŸ¦‹

so line is out here trying to figure out the cache line size in bytes of the largest cache that's smaller than len bytes. that's the whole mission. that's the vibe. πŸ’…

how does it do it tho? okay so it builds these pointer chains that hit the first word on each cache line on a page β€” and it meanders randomly through, like, all the lines in a page before it hops over to the next page. very "wandering the mall with no destination" of it πŸ›οΈ

then it measures the average memory latency across a whole bunch of line sizes, starting at a line size of one word. and the moment it spots an increase in average latency that's significantly larger than the latency for the smaller line size β€” boom β€” it's like "found it" and assumes that's the line size. πŸ”₯

and bestie, the reason this works is genuinely so clever, let me explain 🧠✨: for line sizes that are smaller than the true line size, at least two line cache lines fit inside the space of one true cache line. so that cache line gets accessed twice β€” first access = expensive cache miss 😭, second access = cache hit πŸ₯³. but once the line cache line is equal to the true cache line size? every single access is a cache miss. no hits. none. periodt. πŸ’€


πŸ’€ BUGS πŸ’€

line is an experimental benchmark, no cap. but ngl, it seems to work well on most systems 🫢

🌈 SEE ALSO 🌈

lmbench(8), tlb(8), cache(8), par_mem(8).


πŸ‘‘ AUTHOR πŸ‘‘

Carl Staelin and Larry McVoy

Comments, suggestions, and bug reports are always welcome. πŸ₯ΊπŸ’Œ (like genuinely, they said it, not me)


k that's the whole page babes, go measure some cache lines, ily πŸŽ€πŸ’–

(c)2000 Carl Staelin and Larry McVoy $Date$ β€” yeah that's the copyright + version tag, right there in the footer where it belongs, slay ⭐