clf

Crates.ioclf
lib.rsclf
version0.1.9
sourcesrc
created_at2021-06-16 10:36:05.444114
updated_at2024-06-09 02:54:16.525007
descriptionflush the cpu cache line by __builtin_clear_cache()
homepage
repositoryhttps://github.com/aki-akaguma/clf
max_upload_size
id410793
size27,308
(aki-akaguma)

documentation

README

clf

crate Docs Rust Version Apache2/MIT licensed Test ubu Test mac Test win

Flush the cpu cache line by __builtin_clear_cache()

This crate can be used when you do benchmarks that are not dependent on the cpu cache.

Supports

  • gcc and clang
  • gnu and musl
  • x86_64, aarch64, mips64el, powerpc64le ... etc
  • minimum support rustc 1.56.1 (59eed8a2a 2021-11-01)

Bugs

  • armv7-unknown-linux-musleabihf: can not compile
  • x86_64-pc-windows-msvc: can not compile

Examples

Easy to use:

let a = vec![1, 2, 3, 4, 5, 6, 7, 8, 9];
clf::cache_line_flush_with_slice(&a);

or

let a = vec![1, 2, 3, 4, 5, 6, 7, 8, 9];
let begin_ptr = a.as_ptr();
let end_ptr = unsafe { begin_ptr.add(a.len()) };
clf::cache_line_flush_with_ptr(begin_ptr, end_ptr);

References

CPU cache

Changelogs

This crate's changelog here.

License

This project is licensed under either of

at your option.

Commit count: 26

cargo fmt