Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/silversquirl/cpuinfo-zig
Zig library to get CPU information
https://github.com/silversquirl/cpuinfo-zig
Last synced: 22 days ago
JSON representation
Zig library to get CPU information
- Host: GitHub
- URL: https://github.com/silversquirl/cpuinfo-zig
- Owner: silversquirl
- Created: 2021-11-18T14:55:49.000Z (almost 3 years ago)
- Default Branch: main
- Last Pushed: 2024-07-19T17:09:48.000Z (4 months ago)
- Last Synced: 2024-07-19T22:15:41.005Z (4 months ago)
- Language: Zig
- Size: 9.77 KB
- Stars: 0
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# cpuinfo
This is a small Zig library for getting CPU information on Linux and Windows machines.
It can report the CPU's name, number of logical cores (aka CPU threads), and approximate maximum clock speed.## Usage
```zig
const cpuinfo = @import("cpuinfo");// Get CPU information
const info = try cpuinfo.get(allocator);
defer info.deinit(allocator);// Print out in a human-readable format
std.debug.print("{}\n", .{info});// Print out in a custom format
std.debug.print("{s}; {d} threads @ {d}MHz\n", .{info.name, info.count, info.max_mhz});
```## Known issues
- Does not properly handle asymmetrical CPU topologies