Skip to content

Commit

Permalink
fix: change interval to ms and fix cpu out print
Browse files Browse the repository at this point in the history
  • Loading branch information
ZhouYixun committed Jan 8, 2023
1 parent 5de785e commit 2ac49bf
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 4 deletions.
4 changes: 2 additions & 2 deletions cmd/perfmon/process.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ var processPerfmonCmd = &cobra.Command{
}
sig := make(chan os.Signal, 1)
signal.Notify(sig, os.Interrupt, os.Kill)
timer := time.Tick(time.Duration(interval * int(time.Second)))
timer := time.Tick(time.Duration(interval * int(time.Millisecond)))
done := false
for !done {
select {
Expand Down Expand Up @@ -71,7 +71,7 @@ func initProcessPerfmon() {
processPerfmonCmd.Flags().StringVarP(&appName, "name", "n", "", "application name")
processPerfmonCmd.MarkFlagRequired("name")
processPerfmonCmd.Flags().StringVarP(&serial, "serial", "s", "", "device serial")
processPerfmonCmd.Flags().IntVarP(&interval, "interval", "i", 1, "data refresh time")
processPerfmonCmd.Flags().IntVarP(&interval, "interval", "i", 1000, "data refresh time")
processPerfmonCmd.Flags().BoolVarP(&isJson, "json", "j", false, "convert to JSON string")
processPerfmonCmd.Flags().BoolVarP(&isFormat, "format", "f", false, "convert to JSON string and format")
}
4 changes: 2 additions & 2 deletions cmd/perfmon/system.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ var systemPerfmonCmd = &cobra.Command{
sig := make(chan os.Signal, 1)
signal.Notify(sig, os.Interrupt, os.Kill)

timer := time.Tick(time.Duration(interval * int(time.Second)))
timer := time.Tick(time.Duration(interval * int(time.Millisecond)))
done := false
for !done {
select {
Expand All @@ -56,7 +56,7 @@ var systemPerfmonCmd = &cobra.Command{
func initSystemPerfmon() {
perfmonRootCMD.AddCommand(systemPerfmonCmd)
systemPerfmonCmd.Flags().StringVarP(&serial, "serial", "s", "", "device serial")
systemPerfmonCmd.Flags().IntVarP(&interval, "interval", "i", 1, "data refresh time")
systemPerfmonCmd.Flags().IntVarP(&interval, "interval", "i", 1000, "data refresh time")
systemPerfmonCmd.Flags().BoolVarP(&isJson, "json", "j", false, "convert to JSON string")
systemPerfmonCmd.Flags().BoolVarP(&isFormat, "format", "f", false, "convert to JSON string and format")
}
1 change: 1 addition & 0 deletions src/entity/system.go
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,7 @@ Memory:
escBrightWhite, v.Guest, escReset,
)
}
result += "\n"
}

if len(stats.NetworkInfo) > 0 {
Expand Down

0 comments on commit 2ac49bf

Please sign in to comment.