Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[host]: add EnableBootTimeCache function #1579

Merged
merged 1 commit into from
Jan 14, 2024

Conversation

shirou
Copy link
Owner

@shirou shirou commented Jan 10, 2024

This PR introduce host.EnableBootTimeCache to enable caching about BootTime. This may fix some of issues about CPU usage and performance.

% go test -bench . -benchmem
goos: linux
goarch: amd64
pkg: github.com/shirou/gopsutil/v3/host
cpu: AMD Ryzen 7 5800HS with Radeon Graphics
BenchmarkBootTimeWithCache-4            470418906                2.446 ns/op           0 B/op          0 allocs/op
BenchmarkBootTimeWithoutCache-4            55986             20535 ns/op            9920 B/op         24 allocs/op

@shirou shirou marked this pull request as ready for review January 10, 2024 15:56
@shirou shirou merged commit 9627f19 into master Jan 14, 2024
37 checks passed
@shirou shirou deleted the feature/enable_cache_on_host_boottime branch January 14, 2024 09:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant