清理告警

Signed-off-by: frank-huangran <frank.huangran@huawei.com>
This commit is contained in:
frank-huangran 2024-08-07 15:09:44 +08:00
parent 1a2df0e62e
commit 462d2d7fcf
4 changed files with 162 additions and 166 deletions

View File

@ -21,8 +21,6 @@ struct ControlBall {
tcp = socket.constructTCPSocketInstance()
tcp.setExtraOptions({
keepAlive: true,
OOBInline: true,
TCPNoDelay: true,
socketLinger: {on: true, linger: 10},
receiveBufferSize: 1000,
sendBufferSize: 1000,
@ -57,7 +55,7 @@ struct ControlBall {
})
}
globalThis.showFloatingWindow = false
destroyFloatWindow("sp_controlWindow")
destroyFloatWindow('sp_controlWindow')
}
onStart() {
@ -67,7 +65,7 @@ struct ControlBall {
let timeoutDur = 20000
for (let i = 0; i < globalThis.selectApps.length; i++) {
let curApp = globalThis.selectApps[i]
let arrStr = curApp.split(":")
let arrStr = curApp.split(':')
if(globalThis.startType == 'coldStart') {
this.perFromInfo.name = arrStr[1] + '冷启动'
timeoutDur = 20000
@ -97,17 +95,17 @@ struct ControlBall {
this.playerState = TaskStatus.task_stop
let buffer = value.message
let dataView = new DataView(buffer)
let str = ""
let str = ''
for (let i = 0; i < dataView.byteLength; ++i) {
str += String.fromCharCode(dataView.getUint8(i))
}
if (str.indexOf(":") > 0) {
let arr = str.split(":")
if (str.indexOf(':') > 0) {
let arr = str.split(':')
let value = arr[1]
let date = new Date()
this.perFromInfo.endTime = date.getTime().toString()
this.perFromInfo.value = value.toString()
database.insertPerformData("t_perform_info", this.perFromInfo)
database.insertPerformData('t_perform_info', this.perFromInfo)
}
setTimeout(() => {
this.onTcpClose()
@ -135,35 +133,35 @@ struct ControlBall {
.fill(Color.White)
.fillOpacity(0)
.opacity(0.8)
.border({radius: '90vp', width: '0.5vp', color: $r("app.color.color_333")})
.border({radius: '90vp', width: '0.5vp', color: $r('app.color.color_333')})
.linearGradient({
angle: 135,
direction: GradientDirection.Left,
colors: [[$r("app.color.color_333"), 1.0], [$r("app.color.color_333"), 1.0]]
colors: [[$r('app.color.color_333'), 1.0], [$r('app.color.color_333'), 1.0]]
})
Text('初始化..')
.fontSize(12)
.textAlign(TextAlign.Center)
.fontColor($r("app.color.color_fff"))
.fontColor($r('app.color.color_fff'))
.width('100%')
.height('100%')
.gesture(
GestureGroup(GestureMode.Exclusive,
TapGesture({ count: 2})
.onAction(()=>{
}),
PanGesture({})
.onActionStart(() =>{
})
.onActionUpdate((event: GestureEvent) => {
this.offsetX = event.offsetX
this.offsetY = event.offsetY
})
.onActionEnd(() => {
this.MoveWindow(this.offsetX, this.offsetY)
this.SetWindowPosition(this.offsetX, this.offsetY)
})
))
GestureGroup(GestureMode.Exclusive,
TapGesture({ count: 2})
.onAction(()=>{
}),
PanGesture({})
.onActionStart(() =>{
})
.onActionUpdate((event: GestureEvent) => {
this.offsetX = event.offsetX
this.offsetY = event.offsetY
})
.onActionEnd(() => {
this.MoveWindow(this.offsetX, this.offsetY)
this.SetWindowPosition(this.offsetX, this.offsetY)
})
))
}
// 测试中
if (this.playerState == TaskStatus.task_running) {
@ -173,34 +171,34 @@ struct ControlBall {
.fill(Color.White)
.fillOpacity(0)
.opacity(0.5)
.border({radius: '90vp', width: '0.5vp', color: $r("app.color.color_333")})
.border({radius: '90vp', width: '0.5vp', color: $r('app.color.color_333')})
.linearGradient({
angle: 135,
direction: GradientDirection.Left,
colors: [[$r("app.color.color_333"), 0.7], [$r("app.color.color_333"), 0.7]]
colors: [[$r('app.color.color_333'), 0.7], [$r('app.color.color_333'), 0.7]]
})
Text('测试中..')
.fontSize(12)
.textAlign(TextAlign.Center)
.fontColor($r("app.color.color_fff"))
.fontColor($r('app.color.color_fff'))
.width('100%')
.height('100%')
.gesture(
GestureGroup(GestureMode.Exclusive,
LongPressGesture({ fingers: 1, repeat: false, duration: 1000})
.onAction(()=>{
}),
PanGesture({})
.onActionStart(() =>{
})
.onActionUpdate((event: GestureEvent) => {
this.offsetX = event.offsetX
this.offsetY = event.offsetY
})
.onActionEnd(() => {
this.MoveWindow(this.offsetX, this.offsetY)
this.SetWindowPosition(this.offsetX, this.offsetY)
})
LongPressGesture({ fingers: 1, repeat: false, duration: 1000})
.onAction(()=>{
}),
PanGesture({})
.onActionStart(() =>{
})
.onActionUpdate((event: GestureEvent) => {
this.offsetX = event.offsetX
this.offsetY = event.offsetY
})
.onActionEnd(() => {
this.MoveWindow(this.offsetX, this.offsetY)
this.SetWindowPosition(this.offsetX, this.offsetY)
})
)
)
}
@ -211,16 +209,16 @@ struct ControlBall {
.fill(Color.White)
.fillOpacity(0)
.opacity(0.8)
.border({radius: '90vp', width: '0.5vp', color: $r("app.color.color_333")})
.border({radius: '90vp', width: '0.5vp', color: $r('app.color.color_333')})
.linearGradient({
angle: 135,
direction: GradientDirection.Left,
colors: [[$r("app.color.color_333"), 1.0], [$r("app.color.color_333"), 1.0]]
colors: [[$r('app.color.color_333'), 1.0], [$r('app.color.color_333'), 1.0]]
})
Text('测试完成,保存数据中..')
.fontSize(12)
.textAlign(TextAlign.Center)
.fontColor($r("app.color.color_fff"))
.fontColor($r('app.color.color_fff'))
.width('100%')
.height('100%')
}
@ -231,16 +229,16 @@ struct ControlBall {
.fill(Color.White)
.fillOpacity(0)
.opacity(0.5)
.border({radius: '90vp', width: '0.5vp', color: $r("app.color.color_333")})
.border({radius: '90vp', width: '0.5vp', color: $r('app.color.color_333')})
.linearGradient({
angle: 135,
direction: GradientDirection.Left,
colors: [[$r("app.color.color_333"), 0.7], [$r("app.color.color_333"), 0.7]]
colors: [[$r('app.color.color_333'), 0.7], [$r('app.color.color_333'), 0.7]]
})
Text('请求超时请确认daemon服务是否启动')
.fontSize(12)
.textAlign(TextAlign.Center)
.fontColor($r("app.color.color_fff"))
.fontColor($r('app.color.color_fff'))
.width('100%')
.height('100%')
}

View File

@ -40,8 +40,6 @@ struct FrameRateBall {
tcp = socket.constructTCPSocketInstance()
tcp.setExtraOptions({
keepAlive: true,
OOBInline: true,
TCPNoDelay: true,
socketLinger: {on: true, linger: 10},
receiveBufferSize: 1000,
sendBufferSize: 1000,
@ -79,7 +77,7 @@ struct FrameRateBall {
tcp.off('message')
}
globalThis.showFloatingWindow = false
destroyFloatWindow("sp_FrameRateWindow")
destroyFloatWindow('sp_FrameRateWindow')
}
onStart() {
@ -88,7 +86,7 @@ struct FrameRateBall {
this.frameRateInfo.startTime = date.getTime().toString()
for (let i = 0; i < globalThis.selectApps.length; i++) {
let curApp = globalThis.selectApps[i]
let arrStr = curApp.split(":")
let arrStr = curApp.split(':')
this.frameRateInfo.name = arrStr[1]
let commandName = ''
if(globalThis.FrameRateType == 'startFrame') {
@ -131,17 +129,17 @@ struct FrameRateBall {
this.playerState = TaskStatus.task_stop
let buffer = value.message
let dataView = new DataView(buffer)
let str = ""
let str = ''
for (let i = 0; i < dataView.byteLength; ++i) {
str += String.fromCharCode(dataView.getUint8(i))
}
if (str.indexOf(":") > 0) {
let arr = str.split(":")
if (str.indexOf(':') > 0) {
let arr = str.split(':')
let value = arr[1]
let date = new Date()
this.frameRateInfo.endTime = date.getTime().toString()
this.frameRateInfo.value = Number(value.split("fps")[0]) === -1 ? value.split("fps")[0] : Number(value.split("fps")[0]).toFixed(2)
database.insertFrameRateData("t_FrameRate_info", this.frameRateInfo)
this.frameRateInfo.value = Number(value.split('fps')[0]) === -1 ? value.split('fps')[0] : Number(value.split('fps')[0]).toFixed(2)
database.insertFrameRateData('t_FrameRate_info', this.frameRateInfo)
}
setTimeout(() => {
this.onTcpClose()
@ -158,30 +156,30 @@ struct FrameRateBall {
Column() {
if (globalThis.FrameRateType === 'startFrame') {
Text('开始测试')
.fontSize(12)
.fontColor($r("app.color.color_fff"))
.fontSize(12)
.fontColor($r('app.color.color_fff'))
} else {
Text(`请手动打开「${globalThis.FrameRateName}」后,点击开始测试`)
.fontSize(12)
.fontColor($r("app.color.color_fff"))
.fontColor($r('app.color.color_fff'))
.margin({bottom: 2})
Button('开始测试')
.width('80vp')
.height('25vp')
.fontSize(12)
.backgroundColor($r("app.color.colorPrimary"))
.fontColor($r("app.color.color_fff"))
.gesture(
GestureGroup(GestureMode.Exclusive,
TapGesture({ count: 1})
.onAction(() => {
if (globalThis.FrameRateType !== 'startFrame') {
this.onStart()
this.countdown()
}
})
)
)
.width('80vp')
.height('25vp')
.fontSize(12)
.backgroundColor($r('app.color.colorPrimary'))
.fontColor($r('app.color.color_fff'))
.gesture(
GestureGroup(GestureMode.Exclusive,
TapGesture({ count: 1})
.onAction(() => {
if (globalThis.FrameRateType !== 'startFrame') {
this.onStart()
this.countdown()
}
})
)
)
}
}
.justifyContent(FlexAlign.Center)
@ -197,40 +195,40 @@ struct FrameRateBall {
Row() {
Text('测试中')
.fontSize(12)
.fontColor($r("app.color.color_fff"))
.fontColor($r('app.color.color_fff'))
Text('0' + this.startTimerNum)
.fontSize(12)
.fontColor($r("app.color.color_fff"))
.backgroundColor($r("app.color.colorPrimary"))
.fontColor($r('app.color.color_fff'))
.backgroundColor($r('app.color.colorPrimary'))
.borderRadius(4)
.margin({ left: '2vp'})
.padding({ top: '0vp', right: '3vp', bottom: '0vp', left: '3vp'})
}
} else {
if (globalThis.FrameRateType == "ExitFrame") {
if (globalThis.FrameRateType == 'ExitFrame') {
Text(`请在6s内手动退出「${globalThis.FrameRateName}」`)
.fontSize(12)
.fontColor($r("app.color.color_fff"))
.fontColor($r('app.color.color_fff'))
.margin({ bottom: 2})
} else if (globalThis.FrameRateType == "SwitchingFrame") {
} else if (globalThis.FrameRateType == 'SwitchingFrame') {
Text(`请在6s内手动切换页面一次`)
.fontSize(12)
.fontColor($r("app.color.color_fff"))
.fontColor($r('app.color.color_fff'))
.margin({ bottom: 2})
} else if (globalThis.FrameRateType == "SlidingFrame") {
} else if (globalThis.FrameRateType == 'SlidingFrame') {
Text(`请在6s内手动上滑或下滑页面一次`)
.fontSize(12)
.fontColor($r("app.color.color_fff"))
.fontColor($r('app.color.color_fff'))
.margin({ bottom: 2})
}
Row() {
Text("测试中")
Text('测试中')
.fontSize(12)
.fontColor($r("app.color.color_fff"))
.fontColor($r('app.color.color_fff'))
Text('0' + this.timerNum)
.fontSize(12)
.fontColor($r("app.color.color_fff"))
.backgroundColor($r("app.color.colorPrimary"))
.fontColor($r('app.color.color_fff'))
.backgroundColor($r('app.color.colorPrimary'))
.borderRadius(4)
.margin({ left: '2vp'})
.padding({ top: '0vp', right: '3vp', bottom: '0vp', left: '3vp'})
@ -239,7 +237,7 @@ struct FrameRateBall {
}
.justifyContent(FlexAlign.Center)
.padding({ right: 10, left: 10, top:6, bottom: 6})
.backgroundColor($r("app.color.color_333"))
.backgroundColor($r('app.color.color_333'))
.opacity(0.8)
.borderRadius(4)
}
@ -248,12 +246,12 @@ struct FrameRateBall {
Column() {
Text('测试完成,保存数据中..')
.fontSize(12)
.fontColor($r("app.color.color_fff"))
.fontColor($r('app.color.color_fff'))
.textAlign(TextAlign.Center)
}
.justifyContent(FlexAlign.Center)
.padding({ right: 10, left: 10, top:6, bottom: 6})
.backgroundColor($r("app.color.color_333"))
.backgroundColor($r('app.color.color_333'))
.opacity(0.8)
.borderRadius(4)
}
@ -261,13 +259,13 @@ struct FrameRateBall {
if (this.playerState == TaskStatus.task_Timeout) {
Column() {
Text('请求超时请确认daemon服务是否启动')
.fontSize(12)
.textAlign(TextAlign.Center)
.fontColor($r("app.color.color_fff"))
.fontSize(12)
.textAlign(TextAlign.Center)
.fontColor($r('app.color.color_fff'))
}
.justifyContent(FlexAlign.Center)
.padding({ right: 10, left: 10, top:6, bottom: 6})
.backgroundColor($r("app.color.color_333"))
.backgroundColor($r('app.color.color_333'))
.opacity(0.8)
.borderRadius(4)
}

View File

@ -4,7 +4,7 @@ import { StartTestTitleComponent } from '../common/ui/StartTestTitleComponent';
import prompt from '@system.prompt';
import promptAction from '@ohos.promptAction'
const TAG = "FrameRateTestPage"
const TAG = 'FrameRateTestPage'
@Entry
@ -12,14 +12,14 @@ const TAG = "FrameRateTestPage"
struct FrameRateTestPage {
@State private curAppList:Array<AppInfoItem> = globalThis.appList
@State selectApps: Array<String> = new Array<String>()
@State private collectConfigs: Array<CollectItem> = new Array()
@State private collectConfigs: CollectItem[] = []
aboutToAppear() {
this.collectConfigs.push(
new CollectItem("启动帧率", true, true),
new CollectItem("退出帧率", true, false),
new CollectItem("切换帧率", true, false),
new CollectItem("滑动帧率", true, false)
new CollectItem('启动帧率', true, true),
new CollectItem('退出帧率', true, false),
new CollectItem('切换帧率', true, false),
new CollectItem('滑动帧率', true, false)
)
}
@ -54,17 +54,17 @@ struct FrameRateTestPage {
Radio({ value: 'Radio1', group: 'radioGroup1'})
.onChange((value: boolean) => {
if (value) {
this.selectApps.push(appInfoItem.packageName + ":" + appInfoItem.appName)
this.selectApps.push(appInfoItem.packageName + ':' + appInfoItem.appName)
}
if(!value) {
this.delItemArray(appInfoItem.packageName + ":" + appInfoItem.appName, this.selectApps)
this.delItemArray(appInfoItem.packageName + ':' + appInfoItem.appName, this.selectApps)
}
})
.width(10)
.height(10)
Text(appInfoItem.appName).fontSize(12).fontColor('#182431')
}
.padding({top:"5vp"})
.padding({top:'5vp'})
}
.width('70vp')
.height('70vp')
@ -85,7 +85,7 @@ struct FrameRateTestPage {
.margin({ top: '0vp' })
.scrollBarColor('#ffffff')
}
}
}
.height('59%')
.width('94%')
.backgroundColor('#ffffff')
@ -146,7 +146,7 @@ struct FrameRateTestPage {
}
.margin({left:'10vp'})
}
.margin({top:'5vp'})
.margin({top:'5vp'})
}
.height('80vp')
.width('94%')
@ -167,20 +167,20 @@ struct FrameRateTestPage {
.margin({ top: '30vp' })
.onClick(() => {
if( this.selectApps.length == 0) {
prompt.showToast({ message: "请选择应用", duration: 1000})
prompt.showToast({ message: '请选择应用', duration: 1000})
return
}
if (!globalThis.FrameRateType) {
prompt.showToast({ message: "请选择帧率测试类型", duration: 1000})
prompt.showToast({ message: '请选择帧率测试类型', duration: 1000})
return
}
if (!globalThis.useDaemon) {
prompt.showToast({ message: "请确认daemon服务是否启动", duration: 1000})
prompt.showToast({ message: '请确认daemon服务是否启动', duration: 1000})
return
}
globalThis.selectApps = this.selectApps
for (let i = 0; i < globalThis.selectApps.length; i++) {
globalThis.FrameRateName = this.selectApps[i].split(":")[1]
globalThis.FrameRateName = this.selectApps[i].split(':')[1]
}
let message = ''
if ( globalThis.FrameRateType === 'startFrame') {
@ -194,32 +194,32 @@ struct FrameRateTestPage {
}
try {
promptAction.showDialog({
title: "测试方法",
title: '测试方法',
message: message,
buttons: [
{
text: '取消',
color: '#000000'
},
{
text: '确认',
color: '#1890ff'
}
{
text: '取消',
color: '#000000'
},
{
text: '确认',
color: '#1890ff'
}
]
})
.then(data => {
if (data.index == 1) {
globalThis.CreateFrameRateWindow()
router.back({ uri: "pages/MainPage"})
}
})
.catch(err =>{})
.then(data => {
if (data.index == 1) {
globalThis.CreateFrameRateWindow()
router.back({ uri: 'pages/MainPage'})
}
})
.catch(err =>{})
} catch (error) {
console.log(error)
console.log(error)
}
})
Divider().height('15%').width("80%").visibility(Visibility.Hidden)
}
Divider().height('15%').width('80%').visibility(Visibility.Hidden)
}
.height('100%')
.width('100%')
.backgroundColor('#eeeeee')

View File

@ -5,7 +5,7 @@ import prompt from '@system.prompt';
import {dateNormal } from '../common/utils/TimeUtils';
import promptAction from '@ohos.promptAction'
const TAG = "StartUpPage"
const TAG = 'StartUpPage'
/*
* 测试配置页
@ -16,15 +16,15 @@ const TAG = "StartUpPage"
struct StartUpPage {
@State private curAppList:Array<AppInfoItem> = globalThis.appList
@State selectApps:Array<String> = new Array<String>()
@State selectAppIcon: string = ""
@State selectAppIcon: string = ''
@State customPopup: boolean = true
@State startType: boolean = false
@State private collectConfigs: Array<CollectItem> = new Array()
@State private collectConfigs: CollectItem[] = []
aboutToAppear() {
this.collectConfigs.push(
new CollectItem("冷启动时延", true, true),
new CollectItem("热启动时延", true, false)
new CollectItem('冷启动时延', true, true),
new CollectItem('热启动时延', true, false)
)
}
@ -59,17 +59,17 @@ struct StartUpPage {
Radio({ value: 'checkbox1', group: 'checkboxGroup'})
.onChange((value: boolean) => {
if (value) {
this.selectApps.push(appInfoItem.packageName + ":" + appInfoItem.appName)
this.selectApps.push(appInfoItem.packageName + ':' + appInfoItem.appName)
}
if(!value) {
this.delItemArray(appInfoItem.packageName + ":" + appInfoItem.appName, this.selectApps)
this.delItemArray(appInfoItem.packageName + ':' + appInfoItem.appName, this.selectApps)
}
})
.width(10)
.height(10)
Text(appInfoItem.appName).fontSize(12).fontColor('#182431')
}
.padding({top:"5vp"})
.padding({top:'5vp'})
}
.width('70vp')
.height('70vp')
@ -90,14 +90,14 @@ struct StartUpPage {
.margin({ top: '0vp' })
.scrollBarColor('#ffffff')
}
}
}
.height('59%')
.width('94%')
.backgroundColor('#ffffff')
.borderRadius('10')
.padding({ top: '0vp', right: '5vp', bottom: '10vp', left: '5vp'})
.margin({ top: '12vp', right: 'auto', left: 'auto'})
// 冷热启动方式
// 冷热启动方式
Row() {
Row() {
Text('冷启动')
@ -141,51 +141,51 @@ struct StartUpPage {
.border({ radius: '20vp'})
.width('80%')
.height('60vp')
.backgroundColor($r("app.color.colorPrimary"))
.backgroundColor($r('app.color.colorPrimary'))
.margin({ top: '30vp' })
.onClick(() => {
if( this.selectApps.length == 0) {
prompt.showToast({ message: "请选择应用", duration: 1000})
prompt.showToast({ message: '请选择应用', duration: 1000})
return
}
if (this.startType == false) {
prompt.showToast({ message: "请选择启动类型", duration: 1000})
prompt.showToast({ message: '请选择启动类型', duration: 1000})
return
}
if (!globalThis.useDaemon) {
prompt.showToast({ message: "请确认daemon服务是否启动", duration: 1000})
prompt.showToast({ message: '请确认daemon服务是否启动', duration: 1000})
return
}
globalThis.selectApps = this.selectApps
let selectAppName = ''
for (let i = 0; i < globalThis.selectApps.length; i++) {
selectAppName = this.selectApps[i].split(":")[1]
selectAppName = this.selectApps[i].split(':')[1]
}
let message = globalThis.startType == 'hotStart' ? '热启动' : '冷启动'
promptAction.showDialog({
title: "测试方法",
title: '测试方法',
message: `${message}为【自动测试】\n请确认被测应用「${selectAppName}」与SmartPerf应用图标在同一桌面上否则会导致应用启动失败。`,
buttons: [
{
text: '取消',
color: '#000000'
},
{
text: '确认',
color: '#1890ff'
}
{
text: '取消',
color: '#000000'
},
{
text: '确认',
color: '#1890ff'
}
]
})
.then(data => {
if (data.index == 1) {
globalThis.CreateControlWindow()
router.back({ uri: "pages/MainPage"})
}
})
.catch(err =>{})
.then(data => {
if (data.index == 1) {
globalThis.CreateControlWindow()
router.back({ uri: 'pages/MainPage'})
}
})
.catch(err =>{})
})
Divider().height('15%').width("80%").visibility(Visibility.Hidden)
}
Divider().height('15%').width('80%').visibility(Visibility.Hidden)
}
.height('100%')
.width('100%')
.backgroundColor('#eeeeee')
@ -200,6 +200,6 @@ struct StartUpPage {
}
}
let curDate = dateNormal()
globalThis.testTaskName = "测试" + curDate
globalThis.testTaskName = '测试' + curDate
}
}