iOS 如何查看APP的jetsamEvent日志

1、如何在iPhone上查看

设置-通用-分析-分析数据- JetsamEvent+日志 打头的系统日志。

2、如何在Mac 上查看此类分析日志

1、手机链接MAC

2、打开iTunes,点开手机图标

3、点击同步按钮

日志会被同步到MAC中的以下目录中
/users/userName/Library/Logs/CrashReporter/MobileDevice/

3、关于日志的分析:

利用jetsamEvent 可以帮助我们查看被系统清理的APP内存占用情况。

{"bug_type":"298","timestamp":"2019-04-18 00:41:32.72 +0800","os_version":"iPhone OS 11.3.1 (15E302)","incident_id":"65385412-FCF1-4F8B-B9BA-7E3457FA2C43"}
{
  "crashReporterKey" : "cb1b46c9b29603987f13d3af5624dfe0891dcd8b",
  "kernel" : "Darwin Kernel Version 17.5.0: Tue Mar 13 21:32:11 PDT 2018; root:xnu-4570.52.2~8\/RELEASE_ARM64_T8010",
  "product" : "iPhone9,1",
  "incident" : "65385412-FCF1-4F8B-B9BA-7E3457FA2C43",
  "date" : "2019-04-18 00:41:32.67 +0800",
  "build" : "iPhone OS 11.3.1 (15E302)",
  "timeDelta" : 5,
  "memoryStatus" : {
  "compressorSize" : 50024,
  "compressions" : 79275112,
  "decompressions" : 61573914,
  "zoneMapCap" : 402653184,
  "largestZone" : "APFS_4K_OBJS",
  "largestZoneSize" : 13451264,
  "pageSize" : 16384,
  "uncompressed" : 120159,
  "zoneMapSize" : 113508352,
  "memoryPages" : {
    "active" : 29786,
    "throttled" : 0,
    "fileBacked" : 15361,
    "wired" : 26461,
    "anonymous" : 29604,
    "purgeable" : 33,
    "inactive" : 13602,
    "free" : 2391,
    "speculative" : 1577
  }
}
...
,
  "largestProcess" : "JD4iPhone",
  "genCounter" : 1,
  "processes" : [
  {
    "uuid" : "89715e1a-af5d-3c31-920a-b842f063e8be",
    "states" : [
      "daemon",
      "idle"
    ],
    "lifetimeMax" : 235,
    "age" : 1270330434891,
    "purgeable" : 0,
    "fds" : 50,
    "coalition" : 366,
    "rpages" : 115,
    "pid" : 19692,
    "idleDelta" : 3632517,
    "name" : "revisiond",
    "cpuTime" : 2.8573390000000001
  },

...

{
    "uuid" : "616cc66b-7c0b-3bd5-89ff-af63bd94dbb7",
    "states" : [
      "suspended"
    ],
    "lifetimeMax" : 14774,
    "age" : 82573963110,
    "purgeable" : 0,
    "fds" : 100,
    "coalition" : 4389,
    "rpages" : 10898,
    "pid" : 20571,
    "idleDelta" : 14614331251,
    "name" : "JD4iPhone",
    "cpuTime" : 268.98448000000002
  },

这是一部iPhone7 产生的jetsamEvent日志的部分内容
可以基本猜测以下日志的含义:
"largestProcess" : "JD4iPhone",表示 这个叫JD4iPhone 暂用的内存最多,没猜错的话应该是京东的app。

它占用了内存页为 "rpages" : 10898,
"pageSize" : 16384, 为每页的大小 16384/1024 = 16K
那么这个应用暂用的内存就是 10898*16K = 170M
"states" : [
"suspended"
],
它的状态是挂起的。

而 "uuid" : "89715e1a-af5d-3c31-920a-b842f063e8be",的进程
它的状态是闲置,且是一个守护线程,此类线程一般是系统维护。
虽然它只占用了 "rpages" : 115, 115 个内存页。

4、不同型号手机的单应用最大可用内存值

APP最大内存占用上限
iOS OOM原理探究

posted @ 2019-04-24 22:21  wjwdive  阅读(10583)  评论(0编辑  收藏  举报