This commit is contained in:
qiuqiu 2025-04-07 15:13:46 +08:00
parent a0e58a04ab
commit 0f370e1f8b
28 changed files with 228 additions and 31 deletions

17
.idea/workspace.xml generated
View File

@ -7,11 +7,18 @@
</component>
<component name="ChangeListManager">
<list default="true" id="fec10672-acda-4616-894b-a4b6f93aea6f" name="Default Changelist" comment="">
<change beforePath="$PROJECT_DIR$/.idea/.idea.Obsidian笔记.dir/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/.idea.Obsidian笔记.dir/.idea/workspace.xml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/笔记文件/日记/2025_03_26_星期三.md" beforeDir="false" afterPath="$PROJECT_DIR$/笔记文件/日记/2025_03_26_星期三.md" afterDir="false" />
<change beforePath="$PROJECT_DIR$/笔记文件/日记/2025_04_04_星期五.md" beforeDir="false" afterPath="$PROJECT_DIR$/笔记文件/日记/2025_04_04_星期五.md" afterDir="false" />
<change beforePath="$PROJECT_DIR$/笔记文件/日记/2025_04_05_星期六.md" beforeDir="false" afterPath="$PROJECT_DIR$/笔记文件/日记/2025_04_05_星期六.md" afterDir="false" />
<change beforePath="$PROJECT_DIR$/笔记文件/2.笔记/ios获取内存相关.md" beforeDir="false" afterPath="$PROJECT_DIR$/笔记文件/2.笔记/ios获取内存相关.md" afterDir="false" />
<change beforePath="$PROJECT_DIR$/笔记文件/2.笔记/xcode依赖处理 打包后处理通过podfile添加第三方库.md" beforeDir="false" afterPath="$PROJECT_DIR$/笔记文件/2.笔记/xcode依赖处理 打包后处理通过podfile添加第三方库.md" afterDir="false" />
<change beforePath="$PROJECT_DIR$/笔记文件/2.笔记/广告变现 临时记录.md" beforeDir="false" afterPath="$PROJECT_DIR$/笔记文件/2.笔记/广告变现 临时记录.md" afterDir="false" />
<change beforePath="$PROJECT_DIR$/笔记文件/2.笔记/性能监测平台 临时记录.md" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/笔记文件/2.笔记/性能监测平台.md" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/笔记文件/日记/2025_02_13_星期四.md" beforeDir="false" afterPath="$PROJECT_DIR$/笔记文件/日记/2025_02_13_星期四.md" afterDir="false" />
<change beforePath="$PROJECT_DIR$/笔记文件/日记/2025_03_05_星期三.md" beforeDir="false" afterPath="$PROJECT_DIR$/笔记文件/日记/2025_03_05_星期三.md" afterDir="false" />
<change beforePath="$PROJECT_DIR$/笔记文件/日记/2025_03_14_星期五.md" beforeDir="false" afterPath="$PROJECT_DIR$/笔记文件/日记/2025_03_14_星期五.md" afterDir="false" />
<change beforePath="$PROJECT_DIR$/笔记文件/日记/2025_03_18_星期二.md" beforeDir="false" afterPath="$PROJECT_DIR$/笔记文件/日记/2025_03_18_星期二.md" afterDir="false" />
<change beforePath="$PROJECT_DIR$/笔记文件/日记/2025_04_06_星期日.md" beforeDir="false" afterPath="$PROJECT_DIR$/笔记文件/日记/2025_04_06_星期日.md" afterDir="false" />
<change beforePath="$PROJECT_DIR$/笔记文件/日记/2025_04_07_星期一.md" beforeDir="false" afterPath="$PROJECT_DIR$/笔记文件/日记/2025_04_07_星期一.md" afterDir="false" />
</list>
<option name="SHOW_DIALOG" value="false" />
<option name="HIGHLIGHT_CONFLICTS" value="true" />
@ -178,7 +185,7 @@
<entry key="branch">
<value>
<list>
<option value="main" />
<option value="origin/main" />
</list>
</value>
</entry>

View File

@ -0,0 +1,33 @@
#安卓
#unity/日常积累
测试包体bundle id为
![[Pasted image 20250407144019.png]]
```
测试包名:
com.DefaultCompany.LGCollecter
```
真机开启调试模式然后运行对应的unity应用程序然后可以使用相关指令获取到内存占用相关信息
``` shell
adb shell dumpsys meminfo com.DefaultCompany.LGCollecter
```
![[Pasted image 20250407144241.png]]
![[Pasted image 20250407144250.png]]
![[Pasted image 20250407144320.png]]
![[Pasted image 20250407144330.png]]
还可以直接使用,相关指令,通过读取配置文件的形式,拿到特定的内存占用数据
``` shell
adb shell "pid=$(pidof com.DefaultCompany.LGCollecter); grep -E 'VmRSS|VmHWM|VmSize|VmSwap' /proc/$pid/status"
```
可以用来校验[[安卓获取内存相关]]得到的数据,是否准确

View File

@ -6,7 +6,7 @@ ios相关逻辑
## MemoryInfoPlugin.h
``` c
``` objc
#import <Foundation/Foundation.h>
@interface MemoryInfoPlugin : NSObject
@ -21,7 +21,7 @@ ios相关逻辑
## MemoryInfoPlugin.mm
``` cpp
``` objc
#import "MemoryInfoPlugin.h"
#import <mach/mach.h>
#import <sys/sysctl.h>

View File

@ -1,4 +1,5 @@
#unity/代码缓存
#ios
有一个前提macos已经正确安装了pod相关的工具
@ -45,7 +46,13 @@ static class PostProcessBuildClass {
PlistDocument plist = new PlistDocument();
plist.ReadFromFile(plistPath);
PlistElementDict rootDict = plist.root;
rootDict.SetString("NSUserTrackingUsageDescription", "We need your consent to track advertisements to provide better services。");
// 添加广告追踪权限说明
rootDict.SetString("NSUserTrackingUsageDescription", "We need your consent to track advertisements to provide better services.");
// 添加定位服务权限说明
rootDict.SetString("NSLocationWhenInUseUsageDescription", "We need your location to provide personalized services.");
File.WriteAllText(plistPath, plist.WriteToString());
}
@ -312,7 +319,7 @@ end";
process.WaitForExit();
if (process.ExitCode != 0)
{
{
string error = process.StandardError.ReadToEnd();
Debug.LogError($"启动终端失败: {error}");
}

View File

@ -0,0 +1,96 @@
#安卓
#unity/日常积累
移动端存在几个不同的内存获取方式USS、PSS、RSS他们之间的区别
对于USSUnique Set Size计算了TotalPrivateDirty和TotalPrivateClean的总和再转换为MB。USS指的是进程独占的物理内存不包含共享库的部分这部分是正确的。
PSSProportional Set Size是共享内存按比例分配后的值比如三个进程共享一个库每个进程的PSS会加上该库大小的1/3。这也是正确的实现。
RSS实际物理内存占用通过读取/proc/self/status中的VmRSS来获取这是更直接且准确的方式因为系统提供的这个值直接反映了RSS的大小。
![[Pasted image 20250407142019.png]]
逻辑参考:
``` java
//获取USS
public static int getUSSMemoryMB()
{
try {
// if (!hasUsageStatsPermission()) {
// return -2;
// }
int pid = android.os.Process.myPid();
Activity activity = UnityActivity.getActivity();
ActivityManager am = (ActivityManager) activity.getSystemService(Context.ACTIVITY_SERVICE);
Debug.MemoryInfo[] memInfoArray = am.getProcessMemoryInfo(new int[]{pid});
if (memInfoArray != null && memInfoArray.length > 0)
{
Debug.MemoryInfo mi = memInfoArray[0];
int ussKb = mi.getTotalPrivateDirty() + mi.getTotalPrivateClean();
return ussKb / 1024; //转MB
}
}
catch (Exception e) {
e.printStackTrace();
}
return -1;
}
// 获取 PSSMB
public static int getPSSMemoryMB() {
try {
// if (!hasUsageStatsPermission()) {
// return -2;
// }
int pid = android.os.Process.myPid();
Activity activity = UnityActivity.getActivity();
ActivityManager am = (ActivityManager) activity.getSystemService(Context.ACTIVITY_SERVICE);
Debug.MemoryInfo[] memInfoArray = am.getProcessMemoryInfo(new int[]{pid});
if (memInfoArray != null && memInfoArray.length > 0) {
return memInfoArray[0].getTotalPss() / 1024; // 转换为MB
}
} catch (Exception e) {
e.printStackTrace();
}
return -1;
}
// 获取 RSSMB
public static int getRSSMemoryMBProc() {
// long startTime = System.nanoTime(); // 记录开始时间
try (BufferedReader br = new BufferedReader(new FileReader("/proc/self/status"))) {
String line;
while ((line = br.readLine()) != null) {
if (line.startsWith("VmRSS:")) {
String[] parts = line.split("\\s+");
int kb = Integer.parseInt(parts[1]);
// long duration = (System.nanoTime() - startTime) / 1000; // 微秒耗时
// Log.d("PerfMonitor", "getRSSMemoryMBProc took " + duration + "μs");
return kb / 1024;
}
}
// 如果没有找到VmRSS行也记录耗时
// long duration = (System.nanoTime() - startTime) / 1000;
// Log.d("PerfMonitor", "getRSSMemoryMBProc (no data) took " + duration + "μs");
} catch (Exception e) {
// long duration = (System.nanoTime() - startTime) / 1000;
// Log.e("PerfMonitor", "getRSSMemoryMBProc failed after " + duration + "μs", e);
e.printStackTrace();
}
return -1;
}
// 获取系统可用内存百分比
public float getAvailableMemoryPercent() {
ActivityManager.MemoryInfo mi = new ActivityManager.MemoryInfo();
Activity activity = UnityActivity.getActivity();
ActivityManager am = (ActivityManager) activity.getSystemService(Context.ACTIVITY_SERVICE);
am.getMemoryInfo(mi);
return (float)mi.availMem / mi.totalMem * 100;
}
```
安卓相关的Manifest.xml文件也添加一下权限申请
![[Pasted image 20250407143343.png]]

View File

@ -106,3 +106,16 @@ slot配置链接
```
https://icongamesg.com/app-ads.txt
```
会有邮件提示,需要添加相关权限申请
![[img_v3_02l0_ad3a491b-0a7b-4423-acf3-7d71ffc2c3hu.jpg]]
根据提示,添加对应的,定位权限申请即可
``` cs
// 添加定位服务权限说明
rootDict.SetString("NSLocationWhenInUseUsageDescription", "We need your location to provide personalized services.");
```
![[Pasted image 20250407091527.png]]

View File

@ -0,0 +1,53 @@
#灵感
局域网 服务端地址
服务器 IP[[192.168.1.177](http://192.168.1.177)]([http://192.168.1.177/](http://192.168.1.177/)) 用户root 密码cZr8YTtp
参考的上报日志 分析平台 演示:
[https://creporter.inspiregames.cn:81/](https://creporter.inspiregames.cn:81/) lg753951
这里是采集到,客户端发过来数据的接口逻辑:
![[Pasted image 20250314184241.png]]
安卓端,采集内存占用,统计采集耗时,逻辑参考
``` java
public static int getRSSMemoryMBProc() {
long startTime = System.nanoTime(); // 记录开始时间
try (BufferedReader br = new BufferedReader(new FileReader("/proc/self/status"))) {
String line;
while ((line = br.readLine()) != null) {
if (line.startsWith("VmRSS:")) {
String[] parts = line.split("\\s+");
int kb = Integer.parseInt(parts[1]);
long duration = (System.nanoTime() - startTime) / 1000; // 微秒耗时
Log.d("PerfMonitor", "getRSSMemoryMBProc took " + duration + "μs");
return kb / 1024;
}
}
// 如果没有找到VmRSS行也记录耗时
long duration = (System.nanoTime() - startTime) / 1000;
Log.d("PerfMonitor", "getRSSMemoryMBProc (no data) took " + duration + "μs");
} catch (Exception e) {
long duration = (System.nanoTime() - startTime) / 1000;
Log.e("PerfMonitor", "getRSSMemoryMBProc failed after " + duration + "μs", e);
e.printStackTrace();
}
return -1;
}
```
耗时统计:
![[Pasted image 20250407134056.png]]
微秒和毫秒的换算:
![[Pasted image 20250407134132.png]]
![[Pasted image 20250407134143.png]]

View File

@ -1,13 +0,0 @@
#灵感
局域网 服务端地址
服务器 IP[[192.168.1.177](http://192.168.1.177)]([http://192.168.1.177/](http://192.168.1.177/)) 用户root 密码cZr8YTtp
参考的上报日志 分析平台 演示:
[https://creporter.inspiregames.cn:81/](https://creporter.inspiregames.cn:81/) lg753951
这里是采集到,客户端发过来数据的接口逻辑:
![[Pasted image 20250314184241.png]]

View File

@ -23,7 +23,6 @@
- [x] 记得申请一下X项目组的创作中心
- [x] 处理一下 三消 谷歌相关的,同步到主干
- [ ] 测试一下 是否可以还原 FMod缓存导致XAsset出包数据异常的问题
---
3.第三章 亚当和夏娃的一天(Av113978432820994,P3).mp3 00H:38m:10s
1.第1(Av485473214,P1).mp3 01H:58m:53s

View File

@ -27,7 +27,7 @@
- [x] 买袜子相关
- [x] 续费俩电信卡
- [x] 调研 比亚迪 DM-i智驾120km超越型
- [ ] 输出一份 PerfSight功能业务 调研报告
- [x] 输出一份 性能检测系统 思维导图
- [x] IAP支付 集成到中台库
- [x] Facebook登录 集成到中台库
- [x] 震动 延帧处理

View File

@ -31,7 +31,7 @@
- [x] 明天记得买咖啡
- [x] 明天记得买 化毛膏
---
[[性能测平台]]
[[性能测平台 临时记录]]
[[性能测平台]]
[[性能测平台 临时记录]]
[[灵感 安卓工程路径]]
# Journal

View File

@ -24,7 +24,7 @@
- [x] 把 AppLovin的函数private改成公有的
- [x] AppLovin 相关重发逻辑修改 还是对标官方的机制吧
- [x] 准备一下 OKR复盘相关
- [ ] 性能监测工具 测试一下 BufferReader读取内存文件 耗时
- [x] 性能监测工具 测试一下 BufferReader读取内存文件 耗时
- [ ] 性能监测工具,测试后台线程读取 机制和功能
- [ ] 完善一下 打包机 打包失败的日志推送
- [x] 补卡3月12号的

View File

@ -24,7 +24,7 @@
- [x] 记得安排 骨传导 耳机退货
- [x] 再过一遍 震动叠加的Seek逻辑是否还需要调整
- [x] 试一下 旧版 消息推送 在老机器是否正常
- [ ] 把性能监测工具客户端逻辑整理一下上传到git
- [x] 把性能监测工具客户端逻辑整理一下上传到git
---
[[Adjust 临时记录]]
# Journal

View File

@ -21,7 +21,7 @@
# 今日任务
- [ ] 探索一下 生成unity动画的ai流程
- [ ] 探索一下 生成unity 2d动画的ai流程
- [x] 记得今天申请一下 银行面签&办理护照 周二请假
- [x] 今天也记得拿一下 快递
- [x] 记得检查一下 网站服务器 续费 和处理一下 https签名

View File

@ -24,6 +24,8 @@
- [ ] 明天要记得带身份证出门,去办理护照
- [ ] 确认一下 xmind 8 双端
- [ ] 买一下猫砂
- [ ] 完成OKR制定
---
[[安卓获取内存相关]]
[[adb获取真机内存占用]]
# Journal

Binary file not shown.

After

Width:  |  Height:  |  Size: 939 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 202 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 35 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 32 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 479 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 20 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 34 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 38 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 18 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 29 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 222 KiB