enhance: print total memory when milvus starts (#29351) (#29353)

issue: #29349 
pr: #29351

---------

Signed-off-by: longjiquan <jiquan.long@zilliz.com>
pull/29355/head
Jiquan Long 2023-12-21 11:12:39 +08:00 committed by GitHub
parent 747934eb2b
commit 225002c354
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 10 additions and 0 deletions

View File

@ -11,6 +11,7 @@ import (
"go.uber.org/zap"
"github.com/milvus-io/milvus/pkg/log"
"github.com/milvus-io/milvus/pkg/util/hardware"
"github.com/milvus-io/milvus/pkg/util/metricsinfo"
)
@ -36,6 +37,7 @@ func (c *run) execute(args []string, flags *flag.FlagSet) {
c.printBanner(flags.Output())
c.injectVariablesToEnv()
c.printHardwareInfo(flags.Output())
lock, err := createPidFile(flags.Output(), filename, runtimeDir)
if err != nil {
panic(err)
@ -59,6 +61,14 @@ func (c *run) printBanner(w io.Writer) {
fmt.Fprintln(w)
}
func (c *run) printHardwareInfo(w io.Writer) {
totalMem := hardware.GetMemoryCount()
usedMem := hardware.GetUsedMemoryCount()
fmt.Fprintf(w, "TotalMem: %d\n", totalMem)
fmt.Fprintf(w, "UsedMem: %d\n", usedMem)
fmt.Fprintln(w)
}
func (c *run) injectVariablesToEnv() {
// inject in need