mirror of
https://github.com/cubefs/cubefs.git
synced 2026-08-02 02:00:56 +00:00
feat(client): print cache size in stat file #23068759
Signed-off-by: clinx <chenlin1@oppo.com>
This commit is contained in:
parent
19b1bf9319
commit
79562f9cd0
@ -15,6 +15,7 @@
|
||||
package fs
|
||||
|
||||
import (
|
||||
"bufio"
|
||||
"context"
|
||||
"fmt"
|
||||
"net/http"
|
||||
@ -39,6 +40,7 @@ import (
|
||||
"github.com/cubefs/cubefs/util/auditlog"
|
||||
"github.com/cubefs/cubefs/util/errors"
|
||||
"github.com/cubefs/cubefs/util/log"
|
||||
"github.com/cubefs/cubefs/util/stat"
|
||||
"github.com/cubefs/cubefs/util/ump"
|
||||
)
|
||||
|
||||
@ -320,7 +322,9 @@ func NewSuper(opt *proto.MountOptions) (s *Super, err error) {
|
||||
|
||||
log.LogInfof("NewSuper: cluster(%v) volname(%v) icacheExpiration(%v) LookupValidDuration(%v) AttrValidDuration(%v) state(%v) cacheDpStorageClass(%v)",
|
||||
s.cluster, s.volname, inodeExpiration, LookupValidDuration, AttrValidDuration, s.state, s.cacheDpStorageClass)
|
||||
|
||||
stat.PrintModuleStat = func(writer *bufio.Writer) {
|
||||
fmt.Fprintf(writer, "ic:%d dc:%d nodecache:%d dircache:%d", s.ic.lruList.Len(), s.dc.lruList.Len(), len(s.nodeCache), s.mw.DirCacheLen())
|
||||
}
|
||||
go s.loopSyncMeta()
|
||||
|
||||
return s, nil
|
||||
|
||||
@ -338,6 +338,10 @@ func (mw *MetaWrapper) Owner() string {
|
||||
return mw.owner
|
||||
}
|
||||
|
||||
func (mw *MetaWrapper) DirCacheLen() int {
|
||||
return len(mw.dirCache)
|
||||
}
|
||||
|
||||
func (mw *MetaWrapper) enableTx(mask proto.TxOpMask) bool {
|
||||
return mw.EnableTransaction != proto.TxPause && mw.EnableTransaction&mask > 0
|
||||
}
|
||||
|
||||
@ -53,6 +53,10 @@ var re = regexp.MustCompile(`\([0-9]*\)`)
|
||||
|
||||
type ShiftedFile []os.FileInfo
|
||||
|
||||
type ModuleGlobalStat func(*bufio.Writer)
|
||||
|
||||
var PrintModuleStat ModuleGlobalStat
|
||||
|
||||
func (f ShiftedFile) Less(i, j int) bool {
|
||||
return f[i].ModTime().Before(f[j].ModTime())
|
||||
}
|
||||
@ -250,7 +254,9 @@ func WriteStat() error {
|
||||
} else {
|
||||
fmt.Fprintf(ioStream, "Mem Allocated(kB): VIRT %-10d RES %-10d\n", virt, res)
|
||||
}
|
||||
|
||||
if PrintModuleStat != nil {
|
||||
PrintModuleStat(ioStream)
|
||||
}
|
||||
fmt.Fprintf(ioStream, "%-42s|%10s|%8s|%8s|%8s|%8s|%8s|%8s|%8s|\n",
|
||||
"", "TOTAL", "FAILED", "AVG(ms)", "MAX(ms)", "MIN(ms)",
|
||||
">"+strconv.Itoa(int(gSt.timeOutUs[0])/1000)+"ms",
|
||||
|
||||
Loading…
Reference in New Issue
Block a user