Skip to content

Commit 642e1d7

Browse files
committed
[process] add RefreshBootTimeCache function
This commit adds the RefreshBootTimeCache function, allowing users to manually refresh the cached boot time if they are using the `enableBootTimeCache` feature.
1 parent e230f52 commit 642e1d7

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

process/process.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -178,6 +178,12 @@ func EnableBootTimeCache(enable bool) {
178178
enableBootTimeCache = enable
179179
}
180180

181+
// RefreshBootTimeCache manually refreshes the cached BootTime value.
182+
func RefreshBootTimeCache(ctx context.Context) error {
183+
_, err := common.BootTimeWithContext(ctx, false)
184+
return err
185+
}
186+
181187
// Pids returns a slice of process ID list which are running now.
182188
func Pids() ([]int32, error) {
183189
return PidsWithContext(context.Background())

0 commit comments

Comments
 (0)