mirror of
https://git.FreeBSD.org/src.git
synced 2024-10-18 02:19:39 +00:00
vfs cache: add sysctl vfs.cache.param.hitpct
Sponsored by: Rubicon Communications, LLC ("Netgate")
(cherry picked from commit 0a48720722
)
This commit is contained in:
parent
b7f6841e00
commit
72f8b18b8d
@ -984,6 +984,26 @@ SYSCTL_PROC(_vfs_cache, OID_AUTO, nchstats, CTLTYPE_OPAQUE | CTLFLAG_RD |
|
||||
CTLFLAG_MPSAFE, 0, 0, sysctl_nchstats, "LU",
|
||||
"VFS cache effectiveness statistics");
|
||||
|
||||
static int
|
||||
sysctl_hitpct(SYSCTL_HANDLER_ARGS)
|
||||
{
|
||||
long poshits, neghits, miss, total;
|
||||
long pct;
|
||||
|
||||
poshits = counter_u64_fetch(numposhits);
|
||||
neghits = counter_u64_fetch(numneghits);
|
||||
miss = counter_u64_fetch(nummiss);
|
||||
total = poshits + neghits + miss;
|
||||
|
||||
pct = 0;
|
||||
if (total != 0)
|
||||
pct = ((poshits + neghits) * 100) / total;
|
||||
return (sysctl_handle_int(oidp, 0, pct, req));
|
||||
}
|
||||
SYSCTL_PROC(_vfs_cache_stats, OID_AUTO, hitpct,
|
||||
CTLTYPE_INT | CTLFLAG_MPSAFE | CTLFLAG_RD, NULL, 0, sysctl_hitpct,
|
||||
"I", "Percentage of hits");
|
||||
|
||||
static void
|
||||
cache_recalc_neg_min(void)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user