Skip to content

Commit

Permalink
更新帧率采集工具 --fix:模拟器执行bug
Browse files Browse the repository at this point in the history
  • Loading branch information
aoliaoaoaojiao committed Jul 13, 2024
1 parent 35dc173 commit 00002b5
Show file tree
Hide file tree
Showing 7 changed files with 7 additions and 6 deletions.
Binary file modified android/perf/lib/PerfTool.jar
Binary file not shown.
Binary file modified android/perf/lib/arm64-v8a/libPerfTool.so
Binary file not shown.
Binary file modified android/perf/lib/armeabi-v7a/libPerfTool.so
Binary file not shown.
Binary file modified android/perf/lib/x86/libPerfTool.so
Binary file not shown.
Binary file modified android/perf/lib/x86_64/libPerfTool.so
Binary file not shown.
11 changes: 6 additions & 5 deletions android/perf/perf_tool.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ type PerfTool struct {
frameSocket net.Conn
exitCallBackFunc context.CancelFunc
exitCtx context.Context
startToolFlag bool
perfFrameDataChan chan *entity.SysFrameInfo
}

Expand Down Expand Up @@ -98,7 +99,7 @@ func (s *PerfTool) Init() {
} else if strings.Contains(abi, "armeabi-v7a") {
s.dev.Push(bytes.NewReader(libArm32), libPushPath, time.Now())
} else if strings.Contains(abi, "x86_64") {
s.dev.Push(bytes.NewReader(lib86), libPushPath, time.Now())
s.dev.Push(bytes.NewReader(lib86_64), libPushPath, time.Now())
} else {
s.dev.Push(bytes.NewReader(lib86_64), libPushPath, time.Now())
}
Expand Down Expand Up @@ -156,6 +157,7 @@ func (s *PerfTool) runBinary(cid int) {
return
default:
n, err = output.Read(bytesOutput)
//log.Info(string(bytesOutput[:n]))
if err != nil {
// 如果发生超时错误,你可以根据具体情况进行处理
if err1, ok := err.(net.Error); ok && err1.Timeout() {
Expand All @@ -166,12 +168,13 @@ func (s *PerfTool) runBinary(cid int) {
log.Error("frame output err,", err)
return
}
log.Debug(string(bytesOutput[:n]))
log.Info(string(bytesOutput[:n]))
}

}
}()
isRelease.Wait()
s.startToolFlag = true
}

func (s *PerfTool) startServer() {
Expand Down Expand Up @@ -228,7 +231,6 @@ func (s *PerfTool) getFrameSteam() {

func (s *PerfTool) GetFrame(getBackCall func(frame *entity.SysFrameInfo, code entity.ServerCode)) {
ticker := time.NewTicker(1 * time.Second)
isNoFirst := false
go func() {
for {
<-ticker.C
Expand All @@ -237,12 +239,11 @@ func (s *PerfTool) GetFrame(getBackCall func(frame *entity.SysFrameInfo, code en
}
select {
case perfData, ok := <-s.perfFrameDataChan:
isNoFirst = true
if ok && getBackCall != nil {
getBackCall(perfData, entity.RequestSucceed)
}
default:
if isNoFirst {
if s.startToolFlag {
getBackCall(&entity.SysFrameInfo{Timestamp: time.Now().UnixMilli()}, entity.RequestSucceed)
}
}
Expand Down
2 changes: 1 addition & 1 deletion android/perf/perf_tool_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import (

func TestPerfTool(t *testing.T) {
SetClient()
device, err := android_util.GetDevice(client, "")
device, err := android_util.GetDevice(client, "emulator-5554")
if err != nil {
panic(err)
}
Expand Down

0 comments on commit 00002b5

Please sign in to comment.