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

fix: #29349

---------

Signed-off-by: longjiquan <jiquan.long@zilliz.com>
This commit is contained in:
Jiquan Long 2024-01-07 20:09:49 +08:00 committed by GitHub
parent 4b3de64733
commit a3bae80b59
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

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