Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
T
TestToolChainDemo
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
dsq
TestToolChainDemo
Commits
7ff3d311
Commit
7ff3d311
authored
May 14, 2026
by
dsq
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
用于临时测试-不合入master2
parent
188e4831
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
112 additions
and
32 deletions
+112
-32
1500.kt
...p/src/commonMain/kotlin/com.dong.demo013/1500Text/1500.kt
+31
-7
App.kt
composeApp/src/commonMain/kotlin/com.dong.demo013/App.kt
+3
-2
project.pbxproj
iosApp/iosApp.xcodeproj/project.pbxproj
+4
-4
iOSApp.swift
iosApp/iosApp/iOSApp.swift
+74
-19
No files found.
composeApp/src/commonMain/kotlin/com.dong.demo013/1500Text/1500.kt
View file @
7ff3d311
...
@@ -2,11 +2,14 @@ package com.dong.demo013
...
@@ -2,11 +2,14 @@ package com.dong.demo013
import
androidx.compose.foundation.border
import
androidx.compose.foundation.border
import
androidx.compose.foundation.layout.*
import
androidx.compose.foundation.layout.*
import
androidx.compose.foundation.lazy.rememberLazyListState
import
androidx.compose.foundation.rememberScrollState
import
androidx.compose.foundation.rememberScrollState
import
androidx.compose.foundation.verticalScroll
import
androidx.compose.foundation.verticalScroll
import
androidx.compose.material3.Text
import
androidx.compose.material3.Text
import
androidx.compose.runtime.Composable
import
androidx.compose.runtime.Composable
import
androidx.compose.runtime.LaunchedEffect
import
androidx.compose.runtime.LaunchedEffect
import
androidx.compose.runtime.mutableStateOf
import
androidx.compose.runtime.remember
import
androidx.compose.runtime.withFrameMillis
import
androidx.compose.runtime.withFrameMillis
import
androidx.compose.ui.Alignment
import
androidx.compose.ui.Alignment
import
androidx.compose.ui.Modifier
import
androidx.compose.ui.Modifier
...
@@ -15,6 +18,8 @@ import androidx.compose.ui.semantics.contentDescription
...
@@ -15,6 +18,8 @@ import androidx.compose.ui.semantics.contentDescription
import
androidx.compose.ui.semantics.semantics
import
androidx.compose.ui.semantics.semantics
import
androidx.compose.ui.unit.dp
import
androidx.compose.ui.unit.dp
import
androidx.compose.ui.unit.sp
import
androidx.compose.ui.unit.sp
import
androidx.compose.runtime.getValue
import
androidx.compose.runtime.setValue
private
fun
perfPlatformTag
():
String
{
private
fun
perfPlatformTag
():
String
{
val
n
=
"11111"
val
n
=
"11111"
...
@@ -29,25 +34,44 @@ private fun perfPlatformTag(): String {
...
@@ -29,25 +34,44 @@ private fun perfPlatformTag(): String {
internal
fun
Compose1500Text
()
{
internal
fun
Compose1500Text
()
{
val
scrollState
=
rememberScrollState
()
val
scrollState
=
rememberScrollState
()
val
platformTag
=
perfPlatformTag
()
val
platformTag
=
perfPlatformTag
()
val
listState
=
rememberLazyListState
()
// ✅ 记录滚动开始和结束
var
isScrolling
by
remember
{
mutableStateOf
(
false
)
}
var
scrollStartTime
by
remember
{
mutableStateOf
(
0L
)
}
// 监听滚动状态变化
LaunchedEffect
(
scrollState
.
isScrollInProgress
)
{
if
(
scrollState
.
isScrollInProgress
&&
!
isScrolling
)
{
// 滚动开始
isScrolling
=
true
os_signal_set
(
"滚动(开始)"
,
"1500_scroll"
,
true
)
}
else
if
(!
scrollState
.
isScrollInProgress
&&
isScrolling
)
{
// 滚动结束
isScrolling
=
false
os_signal_set
(
"滚动(结束)"
,
"1500_scroll"
,
false
)
}
}
LaunchedEffect
(
Unit
)
{
LaunchedEffect
(
Unit
)
{
// 至少等到一帧真正调度后再记「首帧」,避免与点击同一时刻的伪首帧
// 至少等到一帧真正调度后再记「首帧」,避免与点击同一时刻的伪首帧
withFrameMillis
{}
//组合完成
withFrameMillis
{}
//组合完成
//等一帧-开始渲染
//等一帧-开始渲染
os_signal_set
(
"响应时间-上帧(结束)"
,
"respose_time"
,
false
)
os_signal_set
(
"响应时间-上帧(结束)"
,
"respose_time"
,
false
)
// 等布局给出可滚动高度后再滚到底,再等一帧记「完成」
- 确保可交互
// 等布局给出可滚动高度后再滚到底,再等一帧记「完成」
while
(
scrollState
.
maxValue
==
0
)
{
while
(
scrollState
.
maxValue
==
0
)
{
withFrameMillis
{
}
withFrameMillis
{
}
}
}
withFrameMillis
{
}
os_signal_set
(
"结束时间-加载完成+可交互(结束)"
,
"finish_time"
,
false
)
os_signal_set
(
"结束时间-加载完成+可交互(结束)"
,
"finish_time"
,
false
)
//这里发送开始滚动
//这里发送开始滚动
os_signal_set
(
"滚动(开始)"
,
"1500_scroll"
,
true
)
//
os_signal_set("滚动(开始)","1500_scroll",true)
scrollState
.
scrollTo
(
scrollState
.
maxValue
)
//
scrollState.scrollTo(scrollState.maxValue)
withFrameMillis
{
}
//
withFrameMillis { }
os_signal_set
(
"滚动(结束)"
,
"1500_scroll"
,
false
)
//
os_signal_set("滚动(结束)","1500_scroll",false)
}
}
Column
(
Column
(
...
...
composeApp/src/commonMain/kotlin/com.dong.demo013/App.kt
View file @
7ff3d311
...
@@ -76,8 +76,7 @@ internal fun HomeScreen(
...
@@ -76,8 +76,7 @@ internal fun HomeScreen(
)
{
)
{
Button
(
Button
(
onClick
=
{
onClick
=
{
os_signal_set
(
"响应时延-从点击(开始)"
,
"respose_time"
,
true
)
os_signal_set
(
"完成时延-从点击(开始)"
,
"finish_time"
,
true
)
val
debugDataDemo
=
ComponentDemo
(
val
debugDataDemo
=
ComponentDemo
(
id
=
"to_1500"
,
id
=
"to_1500"
,
title
=
"进入1500Text测试页面"
,
title
=
"进入1500Text测试页面"
,
...
@@ -392,6 +391,8 @@ internal fun DemoScreen(
...
@@ -392,6 +391,8 @@ internal fun DemoScreen(
}
}
"to_1500"
->
{
"to_1500"
->
{
os_signal_set
(
"响应时延-从点击(开始)"
,
"respose_time"
,
true
)
os_signal_set
(
"完成时延-从点击(开始)"
,
"finish_time"
,
true
)
Compose1500Text
()
Compose1500Text
()
}
}
...
...
iosApp/iosApp.xcodeproj/project.pbxproj
View file @
7ff3d311
...
@@ -245,7 +245,7 @@
...
@@ -245,7 +245,7 @@
GCC_WARN_UNINITIALIZED_AUTOS
=
YES_AGGRESSIVE
;
GCC_WARN_UNINITIALIZED_AUTOS
=
YES_AGGRESSIVE
;
GCC_WARN_UNUSED_FUNCTION
=
YES
;
GCC_WARN_UNUSED_FUNCTION
=
YES
;
GCC_WARN_UNUSED_VARIABLE
=
YES
;
GCC_WARN_UNUSED_VARIABLE
=
YES
;
IPHONEOS_DEPLOYMENT_TARGET
=
1
5.3
;
IPHONEOS_DEPLOYMENT_TARGET
=
1
6.0
;
MTL_ENABLE_DEBUG_INFO
=
INCLUDE_SOURCE
;
MTL_ENABLE_DEBUG_INFO
=
INCLUDE_SOURCE
;
MTL_FAST_MATH
=
YES
;
MTL_FAST_MATH
=
YES
;
ONLY_ACTIVE_ARCH
=
YES
;
ONLY_ACTIVE_ARCH
=
YES
;
...
@@ -302,7 +302,7 @@
...
@@ -302,7 +302,7 @@
GCC_WARN_UNINITIALIZED_AUTOS
=
YES_AGGRESSIVE
;
GCC_WARN_UNINITIALIZED_AUTOS
=
YES_AGGRESSIVE
;
GCC_WARN_UNUSED_FUNCTION
=
YES
;
GCC_WARN_UNUSED_FUNCTION
=
YES
;
GCC_WARN_UNUSED_VARIABLE
=
YES
;
GCC_WARN_UNUSED_VARIABLE
=
YES
;
IPHONEOS_DEPLOYMENT_TARGET
=
1
5.3
;
IPHONEOS_DEPLOYMENT_TARGET
=
1
6.0
;
MTL_ENABLE_DEBUG_INFO
=
NO
;
MTL_ENABLE_DEBUG_INFO
=
NO
;
MTL_FAST_MATH
=
YES
;
MTL_FAST_MATH
=
YES
;
SDKROOT
=
iphoneos
;
SDKROOT
=
iphoneos
;
...
@@ -327,7 +327,7 @@
...
@@ -327,7 +327,7 @@
"$(PROJECT_DIR)/Frameworks"
,
"$(PROJECT_DIR)/Frameworks"
,
);
);
INFOPLIST_FILE
=
iosApp/Info.plist
;
INFOPLIST_FILE
=
iosApp/Info.plist
;
IPHONEOS_DEPLOYMENT_TARGET
=
1
5.3
;
IPHONEOS_DEPLOYMENT_TARGET
=
1
6.0
;
LD_RUNPATH_SEARCH_PATHS
=
(
LD_RUNPATH_SEARCH_PATHS
=
(
"$(inherited)"
,
"$(inherited)"
,
"@executable_path/Frameworks"
,
"@executable_path/Frameworks"
,
...
@@ -360,7 +360,7 @@
...
@@ -360,7 +360,7 @@
"$(PROJECT_DIR)/Frameworks"
,
"$(PROJECT_DIR)/Frameworks"
,
);
);
INFOPLIST_FILE
=
iosApp/Info.plist
;
INFOPLIST_FILE
=
iosApp/Info.plist
;
IPHONEOS_DEPLOYMENT_TARGET
=
1
5.3
;
IPHONEOS_DEPLOYMENT_TARGET
=
1
6.0
;
LD_RUNPATH_SEARCH_PATHS
=
(
LD_RUNPATH_SEARCH_PATHS
=
(
"$(inherited)"
,
"$(inherited)"
,
"@executable_path/Frameworks"
,
"@executable_path/Frameworks"
,
...
...
iosApp/iosApp/iOSApp.swift
View file @
7ff3d311
...
@@ -2,14 +2,73 @@ import ComposeApp
...
@@ -2,14 +2,73 @@ import ComposeApp
import
SwiftUI
import
SwiftUI
import
os
import
os
private
let
bundleSubsystem
=
Bundle
.
main
.
bundleIdentifier
??
"com.dong.demo013"
/// Use `OSSignposter` + interval state (Apple’s supported path). Raw `os_signpost` often does not
/// show up under the Points of Interest / os_signposts instruments unless wired this way.
private
let
signalSignposter
=
OSSignposter
(
subsystem
:
bundleSubsystem
,
category
:
.
pointsOfInterest
)
private
let
signalLogger
=
Logger
(
subsystem
:
bundleSubsystem
,
category
:
"set_os_signal"
)
private
enum
SignalSignpostName
{
static
let
interval
:
StaticString
=
"signal"
}
/// 多段区间可时间交叉:`respose_time` 与 `finish_time` 各自一条栈,互不影响。
/// 同一 `signalId` 多次 begin 再 end:按 **后进先出** 配对(嵌套重叠);若同一 id **交叉**
/// 非嵌套(begin A / begin B / end A / end B),需在 Kotlin 侧增加 token 再扩展 key。
private
final
class
SignalIntervalBridge
:
@unchecked
Sendable
{
private
var
openStacks
:
[
String
:
[
OSSignpostIntervalState
]]
=
[:]
private
let
lock
=
NSLock
()
func
begin
(
signalId
:
String
,
text
:
String
)
{
let
sid
=
signalSignposter
.
makeSignpostID
()
let
state
=
signalSignposter
.
beginInterval
(
SignalSignpostName
.
interval
,
id
:
sid
,
"
\(
text
,
privacy
:
.
public
)
"
)
lock
.
lock
()
var
stack
=
openStacks
[
signalId
]
??
[]
stack
.
append
(
state
)
openStacks
[
signalId
]
=
stack
lock
.
unlock
()
}
func
end
(
signalId
:
String
,
text
:
String
)
{
lock
.
lock
()
var
stack
=
openStacks
[
signalId
]
??
[]
let
state
=
stack
.
popLast
()
if
stack
.
isEmpty
{
openStacks
[
signalId
]
=
nil
}
else
{
openStacks
[
signalId
]
=
stack
}
lock
.
unlock
()
if
let
state
{
signalSignposter
.
endInterval
(
SignalSignpostName
.
interval
,
state
,
"
\(
text
,
privacy
:
.
public
)
"
)
}
}
}
private
let
signalIntervalBridge
=
SignalIntervalBridge
()
@main
@main
struct
iOSApp
:
App
{
struct
iOSApp
:
App
{
var
body
:
some
Scene
{
var
body
:
some
Scene
{
let
test1
:
String
=
"111"
;
WindowGroup
{
WindowGroup
{
ContentView
()
.
onAppear
(){
ContentView
()
.
onAppear
()
{
NotificationCenter
.
default
.
addObserver
(
NotificationCenter
.
default
.
addObserver
(
forName
:
NSNotification
.
Name
(
"set_os_signal"
),
forName
:
NSNotification
.
Name
(
"set_os_signal"
),
object
:
nil
,
object
:
nil
,
...
@@ -17,29 +76,25 @@ struct iOSApp: App {
...
@@ -17,29 +76,25 @@ struct iOSApp: App {
)
{
note
in
)
{
note
in
if
let
dic
=
note
.
object
as?
NSDictionary
{
if
let
dic
=
note
.
object
as?
NSDictionary
{
let
text
=
dic
.
object
(
forKey
:
"text"
)
as!
String
let
text
=
dic
.
object
(
forKey
:
"text"
)
as!
String
print
(
"set_os_signal:
\(
text
)
"
)
print
(
"set_os_signal-text:
\(
text
)
"
)
// let staticText = StaticString(stringLiteral: text as String)
let
isBeginNumber
=
dic
.
object
(
forKey
:
"isBegin"
)
as!
NSNumber
let
isBeginNumber
=
dic
.
object
(
forKey
:
"isBegin"
)
as!
NSNumber
print
(
"set_os_signal:
\(
isBeginNumber
.
boolValue
)
"
)
print
(
"set_os_signal
-isbegin
:
\(
isBeginNumber
.
boolValue
)
"
)
let
signalId
=
dic
.
object
(
forKey
:
"id"
)
as!
NSString
let
signalId
=
dic
.
object
(
forKey
:
"id"
)
as!
NSString
let
signpostID
=
OSSignpostID
(
log
:
.
default
,
object
:
signalId
)
let
signalIdStr
=
signalId
as
String
print
(
"set_os_signal:
\(
signalId
)
"
)
print
(
"set_os_signal-id:
\(
signalId
)
"
)
signalLogger
.
notice
(
"set_os_signal text=
\(
text
,
privacy
:
.
public
)
id=
\(
signalIdStr
,
privacy
:
.
public
)
isBegin=
\(
isBeginNumber
.
boolValue
,
privacy
:
.
public
)
"
)
if
isBeginNumber
.
boolValue
==
true
{
if
isBeginNumber
.
boolValue
{
os_signpost
(
.
begin
,
log
:
.
default
,
name
:
"开始"
,
signpostID
:
signpostID
)
signalIntervalBridge
.
begin
(
signalId
:
signalIdStr
,
text
:
text
)
}
else
{
}
else
{
// ✅ 结束事件
signalIntervalBridge
.
end
(
signalId
:
signalIdStr
,
text
:
text
)
os_signpost
(
.
end
,
log
:
.
default
,
name
:
"结束"
,
signpostID
:
signpostID
)
}
}
}
}
}
}
}
}
.
ignoresSafeArea
()
.
ignoresSafeArea
()
.
background
(
Color
.
clear
)
// 确保整个背景透明
.
background
(
Color
.
clear
)
}
}
}
}
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment