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

Refresh boot time #1616

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions host/host.go
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,12 @@ func EnableBootTimeCache(enable bool) {
enableBootTimeCache = enable
}

// RefreshBootTimeCache manually refreshes the cached BootTime value.
func RefreshBootTimeCache(ctx context.Context) error {
_, err := common.BootTimeWithContext(ctx, false)
return err
}

func Info() (*InfoStat, error) {
return InfoWithContext(context.Background())
}
Expand Down
6 changes: 6 additions & 0 deletions process/process.go
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,12 @@
enableBootTimeCache = enable
}

// RefreshBootTimeCache manually refreshes the cached BootTime value.
func RefreshBootTimeCache(ctx context.Context) error {
_, err := common.BootTimeWithContext(ctx, false)

Check failure on line 183 in process/process.go

View workflow job for this annotation

GitHub Actions / test_v3_module (1.21.8, macos-14)

undefined: common.BootTimeWithContext

Check failure on line 183 in process/process.go

View workflow job for this annotation

GitHub Actions / test_v3_module (1.21.8, macos-13)

undefined: common.BootTimeWithContext

Check failure on line 183 in process/process.go

View workflow job for this annotation

GitHub Actions / test_v3_module (1.21.8, macos-12)

undefined: common.BootTimeWithContext

Check failure on line 183 in process/process.go

View workflow job for this annotation

GitHub Actions / test_v3_module (1.21.8, macos-11)

undefined: common.BootTimeWithContext

Check failure on line 183 in process/process.go

View workflow job for this annotation

GitHub Actions / test_v3_module (1.22.1, macos-12)

undefined: common.BootTimeWithContext

Check failure on line 183 in process/process.go

View workflow job for this annotation

GitHub Actions / test_v3_module (1.22.1, macos-14)

undefined: common.BootTimeWithContext

Check failure on line 183 in process/process.go

View workflow job for this annotation

GitHub Actions / test_v3_module (1.22.1, macos-13)

undefined: common.BootTimeWithContext

Check failure on line 183 in process/process.go

View workflow job for this annotation

GitHub Actions / test_v3_module (1.22.1, macos-11)

undefined: common.BootTimeWithContext

Check failure on line 183 in process/process.go

View workflow job for this annotation

GitHub Actions / test_v3_module (1.22.1, windows-2019)

undefined: common.BootTimeWithContext

Check failure on line 183 in process/process.go

View workflow job for this annotation

GitHub Actions / build_test_v3 (1.21.8)

undefined: common.BootTimeWithContext

Check failure on line 183 in process/process.go

View workflow job for this annotation

GitHub Actions / test_v3_module (1.22.1, windows-2022)

undefined: common.BootTimeWithContext

Check failure on line 183 in process/process.go

View workflow job for this annotation

GitHub Actions / test_v3_module (1.21.8, windows-2022)

undefined: common.BootTimeWithContext

Check failure on line 183 in process/process.go

View workflow job for this annotation

GitHub Actions / test_v3_module (1.21.8, windows-2019)

undefined: common.BootTimeWithContext

Check failure on line 183 in process/process.go

View workflow job for this annotation

GitHub Actions / build_test_v3 (1.22.1)

undefined: common.BootTimeWithContext
return err
}

// Pids returns a slice of process ID list which are running now.
func Pids() ([]int32, error) {
return PidsWithContext(context.Background())
Expand Down
Loading