1# Application Freeze Event Overview 2<!--Kit: Performance Analysis Kit--> 3<!--Subsystem: HiviewDFX--> 4<!--Owner: @rr_cn--> 5<!--Designer: @peterhuangyu--> 6<!--Tester: @gcw_KuLfPSbe--> 7<!--Adviser: @foryourself--> 8 9## Overview 10 11AppFreeze (application freeze) means that an application does not respond to user operations (for example, clicking) for a specified period of time. To address application freeze problems, the system provides the application freeze detection, maintenance and debugging log capturing, and log reporting capabilities to help you locate faults. 12 13## Detection Principles 14 15For details, see [Application Freeze Detection Principles](appfreeze-guidelines.md#detection-principles). 16 17## Available APIs 18 19You can subscribe to the application freeze event **hiAppEvent.event.APP_FREEZE** using the APIs provided by HiAppEvent. When detecting an application freeze, the system captures maintenance and debugging information and sends the freeze event to the application process through HiAppEvent. 20 21- [Subscribing to Application Freeze Events (ArkTS)](hiappevent-watcher-freeze-events-arkts.md) 22 23- [Subscribing to Application Freeze Events (C/C++)](hiappevent-watcher-freeze-events-ndk.md) 24 25## Event Fields 26 27### params 28 29The **params** attribute in the event information is described as follows. 30 31| Name| Type| Description| 32| -------- | -------- | -------- | 33| time | number | Event triggering time, in ms.| 34| foreground | boolean | Whether the application is running in the foreground. The value **true** indicates that the application is in the foreground, and the value **false** indicates the opposite.| 35| bundle_version | string | Application version.| 36| bundle_name | string | Application name.| 37| process_name | string | Process name of the application.| 38| pid | number | Process ID of an application.| 39| uid | number | User ID of an application.| 40| uuid | string | Error ID, which is generated based on fault information and uniquely identifies crash faults of the same type.| 41| exception | object | Exception information. For details, see **exception**.| 42| hilog | string[] | Log information.| 43| event_handler | string[] | Events not yet handled by the main thread.| 44| event_handler_size_3s | string | Number of tasks in the task stack at 3s during the [THREAD_BLOCK_6S event](appfreeze-guidelines.md#thread_block_6s-application-main-thread-timeout). This parameter is available only in the application freeze event.| 45| event_handler_size_6s | string | Number of tasks in the task stack at 6s during the [THREAD_BLOCK_6S event](appfreeze-guidelines.md#thread_block_6s-application-main-thread-timeout). This parameter is available only in the application freeze event.| 46| peer_binder | string[] | Binder call information.| 47| threads | object[] | Full thread call stack. For details, see **thread**.| 48| memory | object | Memory information. For details, see **memory**.| 49| external_log<sup>12+</sup> | string[] | Path of the error log file. If the directory files exceed the threshold (for details, see **log_over_limit**), new log files may fail to be written. Therefore, delete the log files immediately after they are processed.| 50| log_over_limit<sup>12+</sup> | boolean | Whether the size of generated fault log files and existing log files exceeds the upper limit (5 MB). The value **true** indicates that the upper limit is exceeded and logs fail to be written. The value **false** indicates that the upper limit is not exceeded.| 51 52### exception 53 54| Name| Type| Description| 55| -------- | -------- | -------- | 56| name | string | Exception type.| 57| message | string | Exception cause.| 58 59### thread 60 61| Name| Type| Description| 62| -------- | -------- | -------- | 63| thread_name | string | Thread name.| 64| tid | number | Thread ID.| 65| frames | object[] | Thread call stack. For details, see **frame**.| 66 67### frame 68 69Native frame 70 71| Name| Type| Description| 72| -------- | -------- | -------- | 73| symbol | string | Function name. If the name length exceeds 256 bytes, the name is deleted to prevent unknown issues.| 74| file | string | File name.| 75| buildId | string | Unique file ID. The file may not contain **buildId**. For details, see [Log Specifications](cppcrash-guidelines.md#common-faults).| 76| pc | string | Hexadecimal byte offset of the executed instruction within the file.| 77| offset | number | Byte offset of the executed instruction within the function.| 78 79JS frame 80 81| Name| Type| Description| 82| -------- | -------- | -------- | 83| file | string | File name.| 84| packageName | string | Package name of the module.| 85| symbol | string | Function name.| 86| line | number | Code line number.| 87| column | number | Code line number.| 88 89### memory 90 91| Name| Type| Description| 92| -------- | -------- | -------- | 93| rss | number | Size of the memory allocated for a process, in KB.| 94| vss | number | Size of the virtual memory applied by a process from the system, in KB.| 95| pss | number | Size of the physical memory actually used by a process, in KB.| 96| sys_free_mem | number | Size of free memory, in KB.| 97| sys_avail_mem | number | Size of available memory, in KB.| 98| sys_total_mem | number | Total memory size, in KB.| 99 100## Customizing Parameters for Application Freeze Events 101 102### Available APIs 103 104| Name| Description| 105| -------- | -------- | 106| setEventParam(params: Record<string, ParamType>, domain: string, name?: string): Promise<void> | Sets custom parameters for application freeze events.| 107 108### Setting Parameters 109 110You can use this API to subscribe to the application freeze event **hiAppEvent.event.APP_FREEZE**. For details, see [hiAppEvent.setEventParam](../reference/apis-performance-analysis-kit/js-apis-hiviewdfx-hiappevent.md#hiappeventseteventparam12). 111