Skip to content
This repository was archived by the owner on Mar 25, 2025. It is now read-only.

Commit 8ea94b0

Browse files
timestamp change to milli
1 parent 3368188 commit 8ea94b0

2 files changed

Lines changed: 10 additions & 10 deletions

File tree

src/perfmonUtil/process.go

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -202,7 +202,7 @@ func getStatusOnPid(client *adb.Device, pid string) (status *entity.ProcessStatu
202202
status.NonVoluntaryCtxtSwitches = value
203203
}
204204
}
205-
status.TimeStamp = time.Now().Unix()
205+
status.TimeStamp = time.Now().UnixMilli()
206206
return status, err1
207207
}
208208

@@ -335,7 +335,7 @@ func newProcessStat(statStr string) (*entity.ProcessStat, error) {
335335
}
336336
}
337337
}
338-
processStat.TimeStamp = time.Now().Unix()
338+
processStat.TimeStamp = time.Now().UnixMilli()
339339
return processStat, nil
340340
}
341341

@@ -426,7 +426,7 @@ func getThreads(client *adb.Device) *entity.ProcessInfo {
426426
}
427427
processInfo.ThreadInfo = &entity.ProcTreadsInfo{
428428
Threads: threads,
429-
TimeStamp: status.TimeStamp,
429+
TimeStamp: time.Now().UnixMilli(),
430430
}
431431

432432
processInfo.Pid = appPid
@@ -499,7 +499,7 @@ func getProcCpu(client *adb.Device) *entity.ProcessInfo {
499499

500500
processInfo.CPUInfo = &entity.ProcCpuInfo{
501501
CpuUtilization: getProcCpuUsage(stat),
502-
TimeStamp: stat.TimeStamp,
502+
TimeStamp: time.Now().UnixMilli(),
503503
}
504504
processInfo.Pid = appPid
505505
processInfo.Name = appPackageName
@@ -537,7 +537,7 @@ func getProcMem(client *adb.Device) *entity.ProcessInfo {
537537
PhyRSS: stat.Rss,
538538
VmSize: stat.Vsize,
539539
TotalPSS: pss,
540-
TimeStamp: time.Now().Unix(),
540+
TimeStamp: time.Now().UnixMilli(),
541541
}
542542
processInfo.Pid = appPid
543543
processInfo.Name = appPackageName
@@ -584,7 +584,7 @@ func getProcessFPSByGFXInfo(client *adb.Device, pid string) (result entity.ProcF
584584
} else {
585585
result.FPS = frameCount * 60 / (frameCount + vsyncCount)
586586
}
587-
result.TimeStamp = time.Now().Unix()
587+
result.TimeStamp = time.Now().UnixMilli()
588588
return
589589
}
590590

@@ -662,7 +662,7 @@ func getProcessFPSBySurfaceFlinger(client *adb.Device, pkg string) (result entit
662662
return
663663
}
664664
result.FPS = (int)(float64(le) * 1000 / (sum(t, le)))
665-
result.TimeStamp = time.Now().Unix()
665+
result.TimeStamp = time.Now().UnixMilli()
666666
return
667667
}
668668

src/perfmonUtil/system.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ func GetSystemNetwork(client *adb.Device, perfOptions entity.PerfOption, perfmon
108108

109109
func getMemInfo(client *adb.Device, stats *entity.SystemInfo) (err error) {
110110
lines, err := client.OpenShell("cat /proc/meminfo")
111-
stats.MemInfo.TimeStamp = time.Now().Unix()
111+
stats.MemInfo.TimeStamp = time.Now().UnixMilli()
112112
if err != nil {
113113
return
114114
}
@@ -215,7 +215,7 @@ func getInterfaceInfo(client *adb.Device, stats *entity.SystemInfo) (err error)
215215
}
216216
info.Rx = rx
217217
info.Tx = tx
218-
info.TimeStamp = time.Now().Unix()
218+
info.TimeStamp = time.Now().UnixMilli()
219219
stats.NetworkInfo[intf] = info
220220
}
221221
}
@@ -303,7 +303,7 @@ func getCPU(client *adb.Device, stats *entity.SystemInfo) (err error) {
303303
var cpuPreTime = float32(preCPU.User + preCPU.Nice + preCPU.System + preCPU.Iowait + preCPU.Irq + preCPU.SoftIrq)
304304

305305
cpu.Usage = (cpuNowTime - cpuPreTime) / ((cpuNowTime + float32(nowCPU.Idle)) - (cpuPreTime + float32(preCPU.Idle))) * 100
306-
cpu.TimeStamp = time.Now().Unix()
306+
cpu.TimeStamp = time.Now().UnixMilli()
307307
stats.CPU[fields[0]] = cpu
308308
}
309309
}

0 commit comments

Comments
 (0)