mirror of
https://github.com/golang/sys.git
synced 2026-01-29 07:02:06 +03:00
unix: add linux cachestat system call
The cachestat system call is an alternative to mincore that offers more
extensive page cache statistics, aiming to enhance scalability. It was added
on Linux 6.5.
Fixes golang/go#61917
Change-Id: If1b6b96f859dd6bf09f1a0c048abfa743a42c540
GitHub-Last-Rev: d18fbb9c48
GitHub-Pull-Request: golang/sys#176
Reviewed-on: https://go-review.googlesource.com/c/sys/+/533242
Reviewed-by: Ian Lance Taylor <iant@google.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
This commit is contained in:
committed by
Gopher Robot
parent
8ccaaf02a4
commit
1d9f0b6d88
@@ -461,6 +461,20 @@ struct my_can_bittiming_const {
|
||||
|
||||
struct riscv_hwprobe {};
|
||||
#endif
|
||||
|
||||
// copied from /usr/include/uapi/linux/mman.h
|
||||
struct cachestat_range {
|
||||
__u64 off;
|
||||
__u64 len;
|
||||
};
|
||||
|
||||
struct cachestat {
|
||||
__u64 nr_cache;
|
||||
__u64 nr_dirty;
|
||||
__u64 nr_writeback;
|
||||
__u64 nr_evicted;
|
||||
__u64 nr_recently_evicted;
|
||||
};
|
||||
*/
|
||||
import "C"
|
||||
|
||||
@@ -5813,3 +5827,6 @@ const (
|
||||
type SchedAttr C.struct_sched_attr
|
||||
|
||||
const SizeofSchedAttr = C.sizeof_struct_sched_attr
|
||||
|
||||
type Cachestat_t C.struct_cachestat
|
||||
type CachestatRange C.struct_cachestat_range
|
||||
|
||||
@@ -2482,3 +2482,5 @@ func SchedGetAttr(pid int, flags uint) (*SchedAttr, error) {
|
||||
}
|
||||
return attr, nil
|
||||
}
|
||||
|
||||
//sys Cachestat(fd uint, crange *CachestatRange, cstat *Cachestat_t, flags uint) (err error)
|
||||
|
||||
@@ -2195,3 +2195,13 @@ func schedGetattr(pid int, attr *SchedAttr, size uint, flags uint) (err error) {
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
||||
|
||||
func Cachestat(fd uint, crange *CachestatRange, cstat *Cachestat_t, flags uint) (err error) {
|
||||
_, _, e1 := Syscall6(SYS_CACHESTAT, uintptr(fd), uintptr(unsafe.Pointer(crange)), uintptr(unsafe.Pointer(cstat)), uintptr(flags), 0, 0)
|
||||
if e1 != 0 {
|
||||
err = errnoErr(e1)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
@@ -5883,3 +5883,15 @@ type SchedAttr struct {
|
||||
}
|
||||
|
||||
const SizeofSchedAttr = 0x38
|
||||
|
||||
type Cachestat_t struct {
|
||||
Cache uint64
|
||||
Dirty uint64
|
||||
Writeback uint64
|
||||
Evicted uint64
|
||||
Recently_evicted uint64
|
||||
}
|
||||
type CachestatRange struct {
|
||||
Off uint64
|
||||
Len uint64
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user