From cc4cdbed99afbc152aebf78c1dbafd2498e3eed8 Mon Sep 17 00:00:00 2001 From: Nikolay Igotti Date: Fri, 31 Jan 2025 12:33:45 +0300 Subject: [PATCH 1/3] Restore click emulation, allow synthetic workload --- arkoala-arkts/arkui/src/Application.ts | 28 ++++++++++++-------------- arkoala-arkts/user/src/ets/page1.ets | 12 +++++++++++ 2 files changed, 25 insertions(+), 15 deletions(-) diff --git a/arkoala-arkts/arkui/src/Application.ts b/arkoala-arkts/arkui/src/Application.ts index 6fcf283dc..f57ebad37 100644 --- a/arkoala-arkts/arkui/src/Application.ts +++ b/arkoala-arkts/arkui/src/Application.ts @@ -20,7 +20,7 @@ import { PeerNode } from "./generated/PeerNode" import { ArkUINativeModule } from "#components" import { EventEmulator } from "./generated/ArkEventEmulatorMaterialized" import { UserView, UserViewBuilder } from "./UserView" -import { ClickEvent, SourceTool, SourceType } from "./generated" +import { ClickEvent, ClickEventInternal, SourceTool, SourceType } from "./generated" import { checkEvents, setCustomEventsChecker } from "./generated/Events" import { checkArkoalaCallbacks } from "./generated/peers/CallbacksChecker" import { setUIDetachedRootCreator } from "./generated/peers/CallbackTransformer" @@ -135,10 +135,15 @@ function dumpTree(node: IncrementalNode, indent: int32 = 0) { } } -let crashDumped = false -function drawCurrentCrash(crash: Object) { +function errorInfo(crash: Object): string { let msg = crash.toString() + "\n" if (Object.hasOwn(crash, "stack")) msg += (crash as Error).stack + return msg +} + +let crashDumped = false +function drawCurrentCrash(crash: Object) { + let msg = errorInfo(crash) if (!crashDumped) { InteropNativeModule._NativeLog(msg) crashDumped = true @@ -316,7 +321,7 @@ export class Application { } } } catch (error) { - InteropNativeModule._NativeLog("emitEvent error: " + error) + InteropNativeModule._NativeLog("emitEvent error: " + errorInfo(error as Object)) } } } @@ -333,16 +338,9 @@ export class Application { } function makeClickEvent(x: number, y: number): ClickEvent { - return { - displayX: 0, - displayY: 0, - windowX: 0, - windowY: 0, - screenX: 0, - screenY: 0, - x: x, - y: y, - preventDefault: () => {} - } + let result = new ClickEventInternal() + result.x = x + result.y = y + return result } diff --git a/arkoala-arkts/user/src/ets/page1.ets b/arkoala-arkts/user/src/ets/page1.ets index 66d1dab29..4df805660 100644 --- a/arkoala-arkts/user/src/ets/page1.ets +++ b/arkoala-arkts/user/src/ets/page1.ets @@ -60,13 +60,24 @@ struct TestStructBuilder { } } +function makeArray(items: number): Array { + const result = new Array(items) + for (let i = 0; i < items; i++) result[i] = `elem${i}` + return result +} + @Component struct Page1 { @State color1: string = '#ff0000' @State color2: string = '#00ff00' @State state: number = 1 + data: Array = makeArray(10) + build() { + console.log(`In Page1`) + + ForEach(this.data, (item: string, index: number) => { Column() { Button("Hi") .backgroundColor(this.color1) @@ -91,6 +102,7 @@ struct Page1 { .width('100%').height('100%') .backgroundColor(Color.Gray) .justifyContent(FlexAlign.Center) + }, (item:string, index: number) => item) } swap(): void { -- Gitee From 16741e856ce1e0fe741f32de281ecac10677b747 Mon Sep 17 00:00:00 2001 From: Nikolay Igotti Date: Fri, 31 Jan 2025 12:40:13 +0300 Subject: [PATCH 2/3] Better import --- arkoala-arkts/arkui/src/Application.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arkoala-arkts/arkui/src/Application.ts b/arkoala-arkts/arkui/src/Application.ts index f57ebad37..2328fe318 100644 --- a/arkoala-arkts/arkui/src/Application.ts +++ b/arkoala-arkts/arkui/src/Application.ts @@ -20,7 +20,7 @@ import { PeerNode } from "./generated/PeerNode" import { ArkUINativeModule } from "#components" import { EventEmulator } from "./generated/ArkEventEmulatorMaterialized" import { UserView, UserViewBuilder } from "./UserView" -import { ClickEvent, ClickEventInternal, SourceTool, SourceType } from "./generated" +import { ClickEvent, ClickEventInternal } from "./generated/ArkClickEventMaterialized" import { checkEvents, setCustomEventsChecker } from "./generated/Events" import { checkArkoalaCallbacks } from "./generated/peers/CallbacksChecker" import { setUIDetachedRootCreator } from "./generated/peers/CallbackTransformer" -- Gitee From f89064346d86a94e29482cf3ce5ec6981b4edaaf Mon Sep 17 00:00:00 2001 From: Nikolay Igotti Date: Fri, 31 Jan 2025 13:46:30 +0300 Subject: [PATCH 3/3] Allow perf runs --- .gitignore | 2 ++ arkoala-arkts/package.json | 3 ++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index 963497a80..e4f575b0e 100644 --- a/.gitignore +++ b/.gitignore @@ -17,4 +17,6 @@ interface_sdk-js **/command-line-tools **/libs **/*.abc +cachegrind.out.* +perf.data* diff --git a/arkoala-arkts/package.json b/arkoala-arkts/package.json index f48d5cab2..cdc4e2c95 100644 --- a/arkoala-arkts/package.json +++ b/arkoala-arkts/package.json @@ -84,6 +84,7 @@ "shopping:har-arm64": "npm run har-arm64 --prefix shopping", "clean": "rimraf build", "clean:native": "npm run clean --prefix ../arkoala/framework", - "clean:all": "npm run clean && npm run clean:common && npm run clean:incremental && npm run clean:interop && npm run clean:arkui-common && npm run clean:arkui-no-common && npm run clean:native && npm run clean --prefix har && npm run clean --prefix user && npm run clean:shopping" + "clean:all": "npm run clean && npm run clean:common && npm run clean:incremental && npm run clean:interop && npm run clean:arkui-common && npm run clean:arkui-no-common && npm run clean:native && npm run clean --prefix har && npm run clean --prefix user && npm run clean:shopping", + "perf:trivial": "npm run build:user && ACE_LIBRARY_PATH=build PANDA_HOME=../incremental/tools/panda/node_modules/@panda/sdk valgrind --tool=cachegrind --valgrind-stacksize=8000000 --main-stacksize=100000000 node build/index.js panda:TrivialApp 2>/dev/null && ls -lh cachegrind.out.* && echo 'Use cg_annotate to inspect'" } } -- Gitee