diff --git a/en/device-dev/get-code/sourcecode-acquire.md b/en/device-dev/get-code/sourcecode-acquire.md
index 2f00491cc1ff1919411fd26d5c925456b97a1192..2e29260d044739232d954a1fef7616c230f84f45 100644
--- a/en/device-dev/get-code/sourcecode-acquire.md
+++ b/en/device-dev/get-code/sourcecode-acquire.md
@@ -6,14 +6,15 @@
- [When to Use](#section10881513459)
- [Prerequisites](#section102871547153314)
- [How to Use](#section429012478331)
+
- [Method 2: Acquiring Source Code from DevEco Marketplace](#section463013147412)
- [When to Use](#section26661067443)
- [Prerequisites](#section17544943123315)
- [How to Use](#section954619433333)
+
- [Method 3: Acquiring Source Code from a Mirror Site](#section1186691118430)
- [Method 4: Acquiring Source Code from the GitHub Image Repository \(at 23:00 UTC Every Day\)](#section23448418360)
-- [ Source Code Directories](#section1072115612811)
-
+- [Source Code Directories](#section1072115612811)
## About OpenHarmony
@@ -70,7 +71,7 @@ This document describes how to acquire OpenHarmony source code and provides its
**Obtaining the Source Code for Mini/Small/Standard Systems**
-> **NOTE:**
+> **NOTE:**
>Download the master code if you want to get quick access to the latest features for your development. Download the release code, which is more stable, if you want to develop commercial functionalities.
- **Obtaining OpenHarmony master code**
@@ -91,7 +92,6 @@ This document describes how to acquire OpenHarmony source code and provides its
repo forall -c 'git lfs pull'
```
-
- **Obtaining OpenHarmony release code**
For details about how to obtain the source code of an OpenHarmony release, see the [Release-Notes](../../release-notes/Readme.md).
@@ -178,121 +178,167 @@ The table below provides only the sites for downloading the latest OpenHarmony m
**Table 1** Sites for acquiring source code
-
LTS Code
+
LTS Code
+
+
Version Information
+
+
Site
+
+
SHA-256 Verification Code
+
+
+
+
Full code base (for mini, small, and standard systems)
@@ -316,7 +362,7 @@ repo sync -c
repo forall -c 'git lfs pull'
```
-## Source Code Directories
+## Source Code Directories
The following table describes the OpenHarmony source code directories.
diff --git a/en/device-dev/subsystems/figure/call-chain-tracing-in-synchronous-communication.png b/en/device-dev/subsystems/figure/call-chain-tracing-in-synchronous-communication.png
new file mode 100644
index 0000000000000000000000000000000000000000..585d8aac7b4857645b78ab11effbe900e5350f9d
Binary files /dev/null and b/en/device-dev/subsystems/figure/call-chain-tracing-in-synchronous-communication.png differ
diff --git a/en/device-dev/subsystems/figure/service-calling-process-(inter-device-and-inter-process-synchronous-call).png b/en/device-dev/subsystems/figure/service-calling-process-(inter-device-and-inter-process-synchronous-call).png
new file mode 100644
index 0000000000000000000000000000000000000000..8d2f131151856e03e63ae906687a7a570a953540
Binary files /dev/null and b/en/device-dev/subsystems/figure/service-calling-process-(inter-device-and-inter-process-synchronous-call).png differ
diff --git a/en/device-dev/subsystems/figure/service-calling-process.png b/en/device-dev/subsystems/figure/service-calling-process.png
new file mode 100644
index 0000000000000000000000000000000000000000..e2564fab03924ea36fbc371dbafeb6b4724bb5b3
Binary files /dev/null and b/en/device-dev/subsystems/figure/service-calling-process.png differ
diff --git a/en/device-dev/subsystems/figure/time-delay-in-the-service-calling-process.png b/en/device-dev/subsystems/figure/time-delay-in-the-service-calling-process.png
new file mode 100644
index 0000000000000000000000000000000000000000..d04fc58ea7b7f87148d86f6c5cd3423a042a82be
Binary files /dev/null and b/en/device-dev/subsystems/figure/time-delay-in-the-service-calling-process.png differ
diff --git a/en/device-dev/subsystems/figure/use-cases-of-hitrace.png b/en/device-dev/subsystems/figure/use-cases-of-hitrace.png
new file mode 100644
index 0000000000000000000000000000000000000000..20e4592ac077d3d7b63f072d3d640732ac9ee3ac
Binary files /dev/null and b/en/device-dev/subsystems/figure/use-cases-of-hitrace.png differ
diff --git a/en/device-dev/subsystems/subsys-dfx-hilog-lite.md b/en/device-dev/subsystems/subsys-dfx-development-guidelines-on-hilog_lite.md
similarity index 97%
rename from en/device-dev/subsystems/subsys-dfx-hilog-lite.md
rename to en/device-dev/subsystems/subsys-dfx-development-guidelines-on-hilog_lite.md
index 8ba38a3c8a56b6037efbc407af558797eaa921f5..8581d4f00286bcf7d490e40ba3501974433c6eb7 100644
--- a/en/device-dev/subsystems/subsys-dfx-hilog-lite.md
+++ b/en/device-dev/subsystems/subsys-dfx-development-guidelines-on-hilog_lite.md
@@ -1,4 +1,4 @@
-# Development Guidelines on HiLog\_Lite
+# Development Guidelines on HiLog\_Lite
- [Overview](#section775017517390)
- [Available APIs](#section114412157402)
@@ -6,7 +6,7 @@
## Overview
-HiLog\_Lite is the HiLog framework for Mini-System Devices \(reference memory ≥ 128 KB\) and Small-System Devices \(reference memory ≥ 1 MB\). It implements functions such as log printing, log output, and flow control.
+HiLog\_Lite is the HiLog framework for Mini-System Devices \(reference memory ≥ 128 KiB\) and Small-System Devices \(reference memory ≥ 1 MiB\). It implements functions such as log printing, log output, and flow control.
## Available APIs
diff --git a/en/device-dev/subsystems/subsys-dfx-hicollie-development.md b/en/device-dev/subsystems/subsys-dfx-hicollie-development.md
new file mode 100644
index 0000000000000000000000000000000000000000..8bfeecbdde0a26de7371ec864ff9794c4a55b10f
--- /dev/null
+++ b/en/device-dev/subsystems/subsys-dfx-hicollie-development.md
@@ -0,0 +1,194 @@
+# HiCollie Development
+
+- [Overview](#section3432134085116)
+- [Available APIs](#section139261151145116)
+- [Example](#section1589120102458)
+- [How to Develop](#section13905646534)
+ - [C++](#section9797199145316)
+ - [Thread Suspension Monitoring](#section1734221332)
+ - [Timeout Monitoring](#section2186947140)
+
+
+## Overview
+
+HiCollie provides the software watchdog function. It provides a unified framework for fault detection and fault log generation to help you locate software timeout faults resulting from system service deadlock, application main thread blocking, and service process timeout.
+
+## Available APIs
+
+**Table 1** Description of C++ APIs
+
+
+
Class
+
+
API
+
+
Description
+
+
+
+
XCollieChecker
+
+
virtual void CheckBlock()
+
+
Provides the callback of the suspension detection result.
+
Input arguments: none
+
Output arguments: none
+
Return value: none
+
+
+
XCollieChecker
+
+
virtual void CheckThreadBlock()
+
+
Provides the callback of the thread suspension detection result.
+
Input arguments: none
+
Output arguments: none
+
Return value: none
+
+
+
XCollie
+
+
void RegisterXCollieChecker(const sptr<XCollieChecker> &checker, unsigned int type)
+
+
Registers the callback of the thread suspension detection result.
+
Input arguments:
+
checker: Indicates the pointer to the XCollieChecker instance.
type: Indicates the suspension detection type. Set it to XCOLLIE_THREAD.
+
Output arguments: none
+
Return value: none
+
+
+
XCollie
+
+
int SetTimer(const std::string &name, unsigned int timeout, std::function<void (void *)> func, void *arg, unsigned int flag)
+
+
Adds timers.
+
Input arguments:
+
name: Indicates the timer name.
timeout: Indicates the timeout duration, in seconds.
func: Indicates the timeout callback.
arg: Indicates the pointer to the timeout callback.
flag: Indicates the timer operation type.
XCOLLIE_FLAG_DEFAULT // Indicates the default flag, which is the combination of the other three options.
+
XCOLLIE_FLAG_NOOP // Calls only the timeout callback.
+
XCOLLIE_FLAG_LOG // Generates a timeout fault log.
+
XCOLLIE_FLAG_RECOVERY // Exits the process.
+
+
Output arguments: none
+
Return value: Returns the timer ID if the operation is successful; returns -1 otherwise.
+
+
+
XCollie
+
+
bool UpdateTimer(int id, unsigned int timeout)
+
+
Updates timers.
+
Input arguments:
+
id: Indicates the timer ID.
timeout: Indicates the timeout duration, in seconds.
+
Output arguments: none
+
Return value: Returns true if the operation is successful; returns false otherwise.
+
+
+
XCollie
+
+
void CancelTimer(int id)
+
+
Cancels timers.
+
Input arguments:
+
id: Indicates the timer ID.
+
Output arguments: none
+
Return value: none
+
+
+
+
+
+## Example
+
+Print logs.
+
+```
+timeout: TimeoutTimer start at 1611040305 to check 1s ago
+
+----------StacktraceCatcher CurrentTime:2021-01-19 15:11:45 Unexecuted(-1)(LogType:Stacktrace Pid:27689 Process:XCollieTimeoutModuleTest)----------
+
+
+----- pid 27689 at 2021-01-19 15:11:45 -----
+Cmd line: ./XCollieTimeoutModuleTest
+ABI: 'arm64'
+
+"XCollieTimeoutM" sysTid=27689
+ #01 pc 00000000000174cc /data/test/XCollieTimeoutModuleTest
+```
+
+## How to Develop
+
+### C++
+
+### Thread Suspension Monitoring
+
+This function requires you to implement two callback functions: **CheckBlock** and **CheckThreadBlock** of the **XCollieChecker** class. After the callbacks are implemented, you need to use the **RegisterXCollieChecker** function of the **XCollie** class to register their instances. The suspension monitoring thread periodically executes all successfully registered callbacks, checks the thread logic completion flag, and determines whether the service logic of any registered thread is suspended.
+
+1. Develop the source code.
+
+ Include the **xcollie** header file in the source file.
+
+ ```
+ #include "xcollie.h"
+ ```
+
+ Add the following code to the service code:
+
+ ```
+ void MyXCollieChecker::CheckLock()
+ {
+ /* time consuming job */
+ }
+
+ void MyXCollieChecker::CheckThreadBlock()
+ {
+ /* time consuming job */
+ }
+
+ sptr checker = new MyXCollieChecker("MyXCollieChecker");
+ XCollie::GetInstance().RegisterXCollieChecker(checker,
+ (XCOLLIE_LOCK | XCOLLIE_THREAD));
+ ...
+ ```
+
+2. Configure compilation information. Specifically, add the subsystem SDK dependency to **BUILD.gn**.
+
+ ```
+ external_deps = [ "hiviewdfx:libxcollie" ]
+ ```
+
+
+### Timeout Monitoring
+
+You can add a maximum of 128 timers for a single process by using the **SetTimer** function. Adding timers will fail if the number of timers has reached the upper limit.
+
+1. Develop the source code.
+
+ Include the **xcollie** header file in the source file.
+
+ ```
+ #include "xcollie.h"
+ ```
+
+ Add the code to add, update, and cancel timers.
+
+ ```
+ std::function callback = [](void *args)
+ {
+ /* dump helpful information */
+ };
+
+ int id = XCollie::GetInstance().SetTimer("MyXCollieTimer", 10, callback ,nullptr, XCOLLIE_FLAG_LOG);
+ /* time consuming job */
+ XCollie::GetInstance().UpdateTimer(id, 5);
+ /* time consuming job */
+ XCollie::GetInstance().CancelTimer(id);
+ ...
+ ```
+
+2. Configure compilation information. Specifically, add the subsystem SDK dependency to **BUILD.gn**.
+
+ ```
+ external_deps = [ "hiviewdfx:libxcollie" ]
+ ```
+
+
diff --git a/en/device-dev/subsystems/subsys-dfx-hilog-rich.md b/en/device-dev/subsystems/subsys-dfx-hilog-development.md
similarity index 81%
rename from en/device-dev/subsystems/subsys-dfx-hilog-rich.md
rename to en/device-dev/subsystems/subsys-dfx-hilog-development.md
index 762d0fca3279ccad9b9fe0a6ee6fb23871ff47e0..287e312ea2bfe4cafeac830969933f8d3a780f13 100644
--- a/en/device-dev/subsystems/subsys-dfx-hilog-rich.md
+++ b/en/device-dev/subsystems/subsys-dfx-hilog-development.md
@@ -1,4 +1,4 @@
-# Development Guidelines on HiLog
+# HiLog Development
- [Overview](#section8154107175019)
- [Available APIs](#section6748124155012)
@@ -18,61 +18,68 @@ This development guide is applicable to Standard-System Devices \(reference memo
**Table 1** Description of C++ and C APIs
-
C++
+
C++
-
C
+
+
C
-
Class
+
Class
-
API
+
API
-
API/Macro
+
API/Macro
-
HiLog
+
HiLog
+
+
+
+
+
+
-
int Debug(const HiLogLabel &label, const char *fmt, ...)
+
int Debug(const HiLogLabel &label, const char *fmt, ...)
-
HILOG_DEBUG(type, ...)
+
HILOG_DEBUG(type, ...)
int Info(const HiLogLabel &label, const char *fmt, ...)
-
HILOG_INFO(type, ...)
+
HILOG_INFO(type, ...)
int Warn(const HiLogLabel &label, const char *fmt, ...)
-
HILOG_WARN(type, ...)
+
HILOG_WARN(type, ...)
int Error(const HiLogLabel &label, const char *fmt, ...)
-
HILOG_ERROR(type, ...)
+
HILOG_ERROR(type, ...)
int Fatal(const HiLogLabel &label, const char *fmt, ...)
-
HILOG_FATAL(type, ...)
+
HILOG_FATAL(type, ...)
NA
-
int HiLogPrint(LogType type, LogLevel level, unsigned int domain, const char *tag, const char *fmt, ...)
+
int HiLogPrint(LogType type, LogLevel level, unsigned int domain, const char *tag, const char *fmt, ...)
boolean IsLoggable(unsigned int domain, const char *tag, LogLevel level)
-
bool HiLogIsLoggable(unsigned int domain, const char *tag, LogLevel level)
+
bool HiLogIsLoggable(unsigned int domain, const char *tag, LogLevel level)
-
HiLogLabel
+
HiLogLabel
-
struct HiLogLabel
+
struct HiLogLabel
-
LOG_DOMAIN
+
LOG_DOMAIN
LOG_TAG
@@ -91,6 +98,11 @@ This development guide is applicable to Standard-System Devices \(reference memo
HiLog
+
+
+
+
+
int Debug(const HiLogLabel &label, const char *fmt, ...)
diff --git a/en/device-dev/subsystems/subsys-dfx-hisysevent-development.md b/en/device-dev/subsystems/subsys-dfx-hisysevent-development.md
new file mode 100644
index 0000000000000000000000000000000000000000..7910777bbae98f58225fb9f186d73e8f5cb3071b
--- /dev/null
+++ b/en/device-dev/subsystems/subsys-dfx-hisysevent-development.md
@@ -0,0 +1,11 @@
+# DHiSysEvent Development
+
+- **[HiSysEvent Logging](hisysevent-logging.md)**
+
+- **[HiSysEvent Listening](hisysevent-listening.md)**
+
+- **[HiSysEvent Query](hisysevent-query.md)**
+
+- **[HiSysEvent Tool Usage](hisysevent-tool-usage.md)**
+
+
diff --git a/en/device-dev/subsystems/subsys-dfx-hisysevent-listening.md b/en/device-dev/subsystems/subsys-dfx-hisysevent-listening.md
new file mode 100644
index 0000000000000000000000000000000000000000..3144455e1b1fadad7bca25448c421d666e6fc3ca
--- /dev/null
+++ b/en/device-dev/subsystems/subsys-dfx-hisysevent-listening.md
@@ -0,0 +1,152 @@
+# HiSysEvent Listening
+
+- [Overview](#section315316685112)
+- [Available APIs](#section0342191810519)
+- [How to Develop](#section123181432175110)
+ - [C++](#section2016116181902)
+
+
+## Overview
+
+HiSysEvent supports listening for events across processes. You can register a listener to listen for concerned events on a real-time basis. For example, you can enable the battery module to listen for power consumption event for power usage analysis.
+
+## Available APIs
+
+**Table 1** HiSysEvent listener APIs
+
+
+
API
+
+
Description
+
+
+
+
int HiSysEventManager::AddEventListener(std::shared_ptr<HiSysEventSubscribeCallBackBase> listener, std::vector<struct ListenerRule>& rules)
+
+
Registers a listener for system events. You can listen for certain events by specifying rules.
+
+## How to Develop
+
+### **C++**
+
+In this example, you'll be instructed to register a listener for all system events that belong to the **HIVIEWDFX** domain.
+
+1. Develop the source code.
+
+ - Import the corresponding header file:
+
+ hisysevent\_manager.h
+
+ - Implement the callback API.
+
+ HiSysEventSubscribeCallBackBase::OnHandle\(const std::string& domain, const std::string& eventName, const int eventType, const std::string& eventDetail\)
+
+ - Register a callback object.
+
+ HiSysEventManager::AddEventListener\(std::shared\_ptr listener, std::vector& rules\)
+
+
+ ```
+ // Register a listener for all system events that belong to the HIVIEWDFX domain.
+ #include "hisysevent_manager.h"
+ #include
+ namespace OHOS {
+ namespace HiviewDFX {
+ // Implement the API for registering a listener for callback objects.
+ void HiSysEventToolListener::OnHandle(const std::string& domain, const std::string& eventName,
+ const int eventType, const std::string& eventDetail)
+ {
+ std::cout << eventDetail << std::endl;
+ }
+
+ void HiSysEventToolListener::OnServiceDied()
+ {
+ std::cout << std::string("service disconnect, exit") << std::endl;
+ exit(0);
+ }
+ } // namespace HiviewDFX
+ } // namespace OHOS
+
+ // Register a listener for callback objects.
+ auto toolListener = std::make_shared();
+ struct ListenerRule rule;
+ rule.ruleType = 1; // 1: default type
+ rule.domain = "HIVIEWDFX";
+ std::vector sysRules;
+ sysRules.push_back(rule);
+ HiSysEventManager::AddEventListener(toolListener, sysRules);
+ ```
+
+2. Modify the **BUILD.gn** file.
+
+ In the **BUILD.gn** file, add the **libhisyseventmanager** library that depends on the** hisysevent\_native** component.
+
+ ```
+ external_deps = [ "hisysevent_native:libhisyseventmanager", ]
+ ```
+
+
diff --git a/en/device-dev/subsystems/subsys-dfx-hisysevent.md b/en/device-dev/subsystems/subsys-dfx-hisysevent-logging.md
similarity index 91%
rename from en/device-dev/subsystems/subsys-dfx-hisysevent.md
rename to en/device-dev/subsystems/subsys-dfx-hisysevent-logging.md
index a50973f8b093660bcd4dd2983dc3320a27479648..b0acfd53ca0f801bfc5ffcacfbfb5751e7666762 100644
--- a/en/device-dev/subsystems/subsys-dfx-hisysevent.md
+++ b/en/device-dev/subsystems/subsys-dfx-hisysevent-logging.md
@@ -1,4 +1,4 @@
-# Development Guidelines on HiSysEvent
+# HiSysEvent Logging
- [Overview](#section77571101789)
- [Available APIs](#section13480315886)
@@ -27,7 +27,7 @@ For details about the **HiSysEvent** class, see the API reference.
Logs system events.
Input arguments:
-
domain: Indicates the domain related to the event. You can use a preconfigured domain or customize a domain as needed. The name of a custom domain can contain a maximum of 16 characters, including digits (0-9) and uppercase letters (A-Z). It must start with a letter.
eventName: Indicates the event name. The value contains a maximum of 32 characters, including digits (0 to 9), lowercase letters (a-z), uppercase letters (A-Z), and underscores (_). It must start with a letter and cannot end with an underscore (_).
type: Indicates the event type. For details, see EventType.
keyValues: Indicates the key-value pairs of event parameters. It can be in the format of the basic data type, std::string, std::vector<basic data type>, or std:vector<std::string>. The value contains a maximum of 48 characters, including digits (0 to 9), lowercase letters (a-z), uppercase letters (A-Z), and underscores (_). It must start with a letter and cannot end with an underscore (_). The number of parameter names cannot exceed 32.
+
domain: Indicates the domain related to the event. You can use a preconfigured domain or customize a domain as needed. The name of a custom domain can contain a maximum of 16 characters, including digits (0-9) and uppercase letters (A-Z). It must start with a letter.
eventName: Indicates the event name. The value contains a maximum of 32 characters, including digits (0 to 9), letters (A-Z), and underscore (_). It must start with a letter and cannot end with an underscore (_).
type: Indicates the event type. For details, see EventType.
keyValues: Indicates the key-value pairs of event parameters. It can be in the format of the basic data type, std::string, std::vector<basic data type>, or std:vector<std::string>. The value contains a maximum of 48 characters, including digits (0 to 9), letters (A-Z), and underscore (_). It must start with a letter and cannot end with an underscore (_). The number of parameter names cannot exceed 32.
Return value: Returns 0 if the operation is successful; returns a value less than 0 otherwise.
@@ -270,7 +270,7 @@ For details about the **HiSysEvent** class, see the API reference.
#include "hisysevent.h"
```
- Add the event logging code. For example, if you want to log events specific to the app start time \(start\_app\), then add the following code to the service implementation source file:
+ Add the event logging code. For example, if you want to log events specific to the app start time \(**start\_app**\), then add the following code to the service implementation source file:
```
HiSysEvent::Write(HiSysEvent::Domain::AAFWK, "start_app", HiSysEvent::EventType::FAULT, "app_name", "com.demo");
diff --git a/en/device-dev/subsystems/subsys-dfx-hisysevent-query.md b/en/device-dev/subsystems/subsys-dfx-hisysevent-query.md
new file mode 100644
index 0000000000000000000000000000000000000000..979e02f2662309c172f7e66db59d9030828d060f
--- /dev/null
+++ b/en/device-dev/subsystems/subsys-dfx-hisysevent-query.md
@@ -0,0 +1,179 @@
+# HiSysEvent Query
+
+- [Overview](#section279684125212)
+- [Available APIs](#section03869128521)
+- [How to Develop](#section14286111855212)
+ - [C++](#section162045551743)
+
+
+## Overview
+
+HiSysEvent provides an API for you to query system events. You can query concerned events by specifying search criteria. For example, for a power consumption module, you can query required system events for analysis.
+
+## Available APIs
+
+**Table 1** HiSysEvent query API
+
+
+