Skip to content

Commit

Permalink
enhance: print total memory when milvus starts (#29351)
Browse files Browse the repository at this point in the history
fix: #29349

---------

Signed-off-by: longjiquan <jiquan.long@zilliz.com>
  • Loading branch information
longjiquan authored Jan 7, 2024
1 parent 4b3de64 commit a3bae80
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions cmd/milvus/run.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
)

Expand All @@ -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)
Expand All @@ -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

Expand Down

0 comments on commit a3bae80

Please sign in to comment.