Dormancy wake-up processing method and apparatus, electronic device, and storage medium
By recording only device information in the SOC that exceeds a threshold for hibernation or wake-up time, the problem of excessively long hibernation/wake-up time and information loss in the existing technology is solved, thereby improving debugging efficiency and anomaly location capabilities.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- BEIJING CO WHEELS TECH CO LTD
- Filing Date
- 2022-06-10
- Publication Date
- 2026-06-19
AI Technical Summary
In existing technologies, during the hibernation and wake-up process of a System-on-a-Chip (SoC), it is difficult to control the system time before and after each device's hibernation and wake-up function. This results in a long hibernation and wake-up process, affecting performance and potentially causing the SoC to fail to hibernate or wake up. Furthermore, system log information is lost, making it impossible to locate the problem.
By obtaining the system time of the device's preset function in the SOC as the start and end time, the device information is written to the system log only when the difference exceeds the preset threshold, and the device information is also recorded in the debug buffer, avoiding the recording of information about irrelevant devices and improving debugging efficiency.
Information is only recorded when the device sleep or wake-up time exceeds a threshold, which reduces the impact on sleep and wake-up performance, saves debugging time, improves debugging efficiency, and restores the debugging buffer information through system snapshots when the SOC restarts, ensuring anomaly localization.
Smart Images

Figure CN115437859B_ABST
Abstract
Description
Technical Field
[0001] This disclosure relates to the field of computer technology, and in particular to a sleep / wake-up processing method, apparatus, electronic device, and storage medium. Background Technology
[0002] A System-on-Chip (SOC) refers to a complex and complete system that integrates a processor, bus, memory, and various peripherals onto a single chip. In the automotive industry, SOCs can be used for in-vehicle screen control.
[0003] Suspension and wake-up are important functions of a System-on-a-Chip (SoC). Suspension refers to the SoC entering a low-power mode where the CPU and various peripherals consume very little power, and only the memory enters self-refresh mode. Wake-up refers to the SoC exiting suspend mode and entering normal operating mode when an external wake-up event occurs.
[0004] To ensure the normal operation of the SOC's hibernation and wake-up functions, the hibernation and wake-up processes need to be debugged. Finding a debugging method that does not affect the performance of the hibernation and wake-up processes has become the current research focus. Summary of the Invention
[0005] In order to solve the above-mentioned technical problems, or at least partially solve the above-mentioned technical problems, at least one embodiment of the present disclosure provides a sleep / wake-up processing method, apparatus, electronic device and storage medium.
[0006] In a first aspect, this disclosure provides a hibernation / wake-up processing method, including:
[0007] The system time at which the preset function of the first device in the system-on-a-chip (SoC) is called is used as the first start time, wherein the preset function is a sleep function or a wake-up function;
[0008] The system time at which the call to the preset function ends is obtained as the first end time;
[0009] If the difference between the first end time and the first start time is greater than a preset threshold, the device information of the first device will be written into the system log.
[0010] Secondly, this disclosure provides a sleep / wake-up processing device, comprising:
[0011] The first acquisition module is used to acquire the system time when the preset function of the first device in the system on-chip SOC is called as the first start time, wherein the preset function is a sleep function or a wake-up function;
[0012] The second acquisition module is used to acquire the system time when the call to the preset function ends as the first end time;
[0013] The processing module is used to write the device information of the first device into the system log when the difference between the first end time and the first start time is greater than a preset threshold.
[0014] Thirdly, this disclosure provides an electronic device, including: a processor and a memory; the processor executes any of the sleep / wake-up processing methods provided in the embodiments of this disclosure by calling programs or instructions stored in the memory.
[0015] Fourthly, this disclosure provides a computer-readable storage medium storing a program or instructions that cause a computer to execute any of the sleep / wake-up processing methods provided in the embodiments of this disclosure.
[0016] Fifthly, this disclosure provides a computer program product for executing any of the sleep / wake-up processing methods described in the embodiments of this disclosure.
[0017] The technical solution provided in this disclosure has at least the following advantages compared with the prior art:
[0018] In this embodiment, the system time when the preset function of the first device in the system-on-a-chip (SoC) is called is used as the first start time, and the system time when the preset function is called is used as the first end time. The preset function is either a sleep function or a wake-up function. If the difference between the first end time and the first start time is greater than a preset threshold, the device information of the first device is written to the system log. This technical solution ensures that device information is only written to the system log when the sleep or wake-up time exceeds the preset threshold, rather than writing the device information of every single device to the system log. This avoids the impact of recording the device information of each device on the SoC's sleep / wake-up performance, reduces the impact of debugging methods on the sleep / wake-up process, and avoids analyzing devices with short sleep / wake-up times. Only devices with longer sleep / wake-up times recorded in the system log need to be analyzed, saving debugging time and improving debugging efficiency. Attached Figure Description
[0019] The accompanying drawings, which are incorporated in and form a part of this specification, illustrate embodiments consistent with this disclosure and, together with the description, serve to explain the principles of this disclosure.
[0020] To more clearly illustrate the technical solutions in the embodiments of this disclosure or the prior art, the accompanying drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, for those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0021] Figure 1 A schematic flowchart of a sleep-wake processing method provided in an embodiment of this disclosure;
[0022] Figure 2 A schematic flowchart illustrating a sleep-wake processing method provided in another embodiment of this disclosure;
[0023] Figure 3 This is a schematic diagram of a hibernation process provided in an embodiment of the present disclosure;
[0024] Figure 4 This is a schematic diagram of a wake-up process provided in an embodiment of the present disclosure;
[0025] Figure 5 This is a schematic diagram of the structure of a hibernation / wake-up processing device provided in an embodiment of the present disclosure. Detailed Implementation
[0026] To better understand the above-described objectives, features, and advantages of this disclosure, the present disclosure will be further described in detail below with reference to the accompanying drawings and embodiments. It is understood that the described embodiments are only some, not all, of the embodiments of this disclosure. The specific embodiments described herein are merely for explaining this disclosure and not for limiting it. Unless otherwise specified, the embodiments of this disclosure and the features within them can be combined with each other. All other embodiments obtained by those skilled in the art based on the described embodiments of this disclosure are within the scope of protection of this disclosure.
[0027] Numerous specific details are set forth in the following description in order to provide a full understanding of this disclosure, but this disclosure may also be implemented in other ways different from those described herein; obviously, the embodiments in the specification are only some, and not all, of the embodiments of this disclosure.
[0028] To ensure the proper functioning of the SOC's hibernation and wake-up functions, it is usually necessary to debug the hibernation and wake-up process. Current debugging methods involve recording the system time before and after calling the hibernation or wake-up function for each device in the SOC, calculating and printing the time difference to debug hibernation and wake-up issues.
[0029] However, a System-on-a-Chip (SOC) may have hundreds of devices, each printing at different times, resulting in longer processing times. This makes the SOC's sleep / wake-up process timed out, impacting sleep / wake-up performance and potentially causing timeouts, triggering a restart and leading to sleep / wake-up failure. Furthermore, when the SOC restarts due to timeouts or other issues during the sleep / wake-up process, some information in the system logs may be lost. This makes it impossible to identify the device causing the sleep / wake-up anomaly through system log analysis, rendering debugging methods ineffective and hindering problem location.
[0030] To address the aforementioned issues, this disclosure provides a hibernation / wake-up processing method. This method obtains the system time when a preset function of a first device in the System-on-a-Chip (SoC) is called as the first start time, and the system time when the preset function is called is obtained as the first end time. The preset function is either a hibernation function or a wake-up function. Then, if the difference between the first end time and the first start time exceeds a preset threshold, the device information of the first device is written to the system log. This ensures that device information is only written to the system log when the hibernation or wake-up time exceeds the preset threshold, rather than writing the device information for every single device. This avoids the impact of recording the device information for each device on the SoC's hibernation / wake-up performance, reduces the impact of debugging methods on the hibernation / wake-up process, and avoids analyzing devices with short hibernation / wake-up times. Only devices with longer hibernation / wake-up times recorded in the system log need to be analyzed, saving debugging time and improving debugging efficiency.
[0031] Figure 1 This is a schematic flowchart of a sleep / wake-up processing method provided in an embodiment of the present disclosure. The sleep / wake-up processing method can be executed by a sleep / wake-up processing device provided in the embodiment of the present disclosure. The sleep / wake-up processing device can be implemented in software and / or hardware and can be integrated into any electronic device with processing capabilities, such as a computer, vehicle terminal, etc.
[0032] like Figure 1 As shown, the sleep / wake-up processing method provided in this embodiment may include the following steps:
[0033] Step 101: Obtain the system time when the preset function of the first device in the system on-chip (SOC) is called as the first start time, wherein the preset function is a sleep function or a wake-up function.
[0034] The System-on-Chip (SoC) integrates multiple devices, each with its own sleep and wake-up functions. When the SoC is put into sleep or woken up, the sleep or wake-up functions corresponding to each device in the SoC need to be called sequentially to put each device into sleep or wake it up. In this embodiment, when sleep or wake-up begins, the system time at the time the sleep or wake-up function of the first device in the SoC is called can be obtained, and this system time is used as the start time of calling the sleep or wake-up function, denoted as the first start time.
[0035] The first device is any device in the SOC.
[0036] It is understandable that when the preset function is a hibernation function, the first start time is the start time of initiating the hibernation process for the first device; when the preset function is a wake-up function, the first start time is the start time of initiating the wake-up process for the first device.
[0037] Step 102: Obtain the system time at the end of the call to the preset function as the first end time.
[0038] In this embodiment of the disclosure, when the sleep function or wake-up function of the first device is called and completed, the system time at the time of completion of the call can be obtained, and the system time can be used as the end time of the call to the sleep function or wake-up function, and recorded as the first end time.
[0039] Step 103: If the difference between the first end time and the first start time is greater than a preset threshold, write the device information of the first device into the system log.
[0040] In this embodiment, after obtaining the first start time and the first end time before and after calling the preset function, the difference between the first end time and the first start time can be calculated. This difference is then compared with a preset threshold. If the difference between the first end time and the first start time is greater than the preset threshold, the device information of the first device is written to the system log. Therefore, device information is only written to the system log when the sleep or wake-up time exceeds the preset threshold, instead of printing information for every single device in the system log, thus avoiding interference from unrelated devices in the sleep or wake-up process.
[0041] The preset thresholds can be pre-set. For hibernation and wake-up, corresponding thresholds can be set according to actual needs. For example, the threshold corresponding to the hibernation process can be set as the first threshold, and the threshold corresponding to the wake-up process can be set as the second threshold. The first threshold and the second threshold can be the same or different, and this disclosure does not impose any restrictions on this. For example, the first threshold and the second threshold can both be set to 200ms. When the first device goes into hibernation, if the difference between the first end time and the first start time is greater than the first threshold, the device information of the first device is written to the system log. When the first device is woken up, if the difference between the first end time and the first start time is greater than the second threshold, the device information of the first device is written to the system log.
[0042] The device information written to the system log may include, but is not limited to, the device name, the device's unique identifier, whether the call to the sleep function or the wake-up function timed out, and the duration consumed by calling the sleep function or the wake-up function.
[0043] After the SOC successfully hibernates or wakes up, you can check the system logs to see which devices took longer than a preset threshold during the hibernation / wake-up process. This allows you to analyze the hibernation / wake-up functions of the devices recorded in the system logs and find the specific reasons for the long delay.
[0044] The hibernation / wake-up processing method of this disclosure obtains the system time when a preset function of a first device in the System-on-a-Chip (SoC) is called as a first start time, and obtains the system time when the preset function is called as a first end time. The preset function is either a hibernation function or a wake-up function. Then, if the difference between the first end time and the first start time is greater than a preset threshold, the device information of the first device is written to the system log. By adopting the above technical solution, device information is only written to the system log when the time spent on hibernation or wake-up exceeds the preset threshold, instead of writing the device information of every single device to the system log. This avoids the impact of the time spent recording the device information of each device on the SoC's hibernation / wake-up performance, reduces the impact of debugging methods on the hibernation / wake-up process, and avoids analyzing devices with short hibernation / wake-up times. Only devices with longer hibernation / wake-up times recorded in the system log need to be analyzed, saving debugging time and improving debugging efficiency.
[0045] In one optional embodiment of this disclosure, the first device name, first start time, and first end time of the first device may also be written into a preset debug buffer.
[0046] The debug buffer is a memory area used to record device information of a device that is currently sleeping or waking up.
[0047] Since it is impossible to predict in advance which device will take a long time during the hibernation or wake-up process, or even fail to complete the hibernation or wake-up process, in this embodiment of the disclosure, the device name, start time and end time of the device currently hibernating or waking up are written into a preset debug buffer. This allows the relevant information to be obtained from the debug buffer and analyzed to identify the device that has experienced a timeout restart once a timeout restart occurs.
[0048] Furthermore, in one optional embodiment of this disclosure, the debug buffer includes a hibernation start memory area, a hibernation end memory area, a wake-up start memory area, and a wake-up end memory area. The hibernation start memory area (denoted as suspend_b_slot) is used to record device information before hibernation, the hibernation end memory area (denoted as suspend_e_slot) is used to record device information after hibernation, the wake-up start memory area (denoted as resume_b_slot) is used to record device information before wake-up, and the wake-up end memory area (denoted as resume_e_slot) is used to record device information after wake-up.
[0049] Therefore, in this embodiment, writing the first device name, first start time, and first end time of the first device into a preset debug buffer may include:
[0050] When the preset function is the hibernation function, the first device name and the first start time of the first device are written to the hibernation start memory area, and the first device name and the first end time are written to the hibernation end memory area.
[0051] If the preset function is the wake-up function, the first device name and the first start time are written to the wake-up start memory area, and the first device name and the first end time are written to the wake-up end memory area.
[0052] In other words, in this embodiment of the disclosure, during the hibernation or wake-up process, when a device is put into hibernation, after obtaining the first start time when the device's hibernation function is called, the device name and the first start time are written to the hibernation start memory area. After obtaining the first end time when the device's hibernation function is called, the device name and the first end time are written to the hibernation end memory area. Similarly, when a device is woken up, after obtaining the first start time when the device's wake-up function is called, the device name and the first start time are written to the wake-up start memory area. After obtaining the first end time when the device's wake-up function is called, the device name and the first end time are written to the wake-up end memory area. Therefore, the device information of the wake-up process and the device information of the hibernation process can be recorded separately, which facilitates subsequent analysis based on the information recorded in the debug buffer to determine whether the device malfunctions during the hibernation or wake-up phase.
[0053] To save storage space and avoid unnecessary information occupying memory space, in an optional embodiment of this disclosure, the device information in each partition of the debug buffer is overwritten by the device information of the next device; that is, each partition of the debug buffer records only one piece of device information. Therefore, based on the foregoing embodiments, the method further includes:
[0054] When the second start time of the second device is obtained, the first device name and first start time in the start memory area of the debug buffer are updated to the second device name and second start time of the second device. The start memory area includes the sleep start memory area or the wake-up start memory area.
[0055] When the second end time of the second device is obtained, the first device name and the first end time in the end memory area of the debug buffer are updated to the second device name and the second end time. The end memory area includes the hibernation end memory area or the wake-up end memory area.
[0056] In this embodiment of the disclosure, during the hibernation process, after one device (denoted as the first device) completes hibernation, its first device name and first start time are recorded in the hibernation start memory area of the debug buffer, and its first device name and first end time are recorded in the hibernation end memory area of the debug buffer. The process then continues to hibernate the next device (denoted as the second device). During the hibernation of the second device, the system time at the time the hibernation function of the second device is called is obtained as the second start time. The first device name and first start time recorded in the hibernation start memory area of the debug buffer are then updated with the second device name and second start time of the second device. That is, the second device name and second start time overwrite the currently recorded content in the hibernation start memory area, ensuring that only the device information of the currently hibernating second device is recorded in the hibernation start memory area. After the hibernation function of the second device is called, the system time at the time the hibernation function is called is obtained as the second end time, and the first device name and first end time in the debug buffer are updated with the second device name and second end time. The wake-up process is similar to the hibernation process. It uses the device information of the next device to overwrite the existing information in the wake-up start / end memory area of the debug buffer, so that the wake-up start / end memory area only records the device information of the device currently being woken up. This will not be elaborated here.
[0057] In this embodiment, by updating the first device name and first start time in the start memory area of the debug buffer to the second device name and second start time of the second device when the second start time of the second device is obtained, and updating the first device name and first end time in the end memory area of the debug buffer to the second device name and second end time when the second end time of the second device is obtained, the relevant information of the second device is used to overwrite the relevant information of the first device in the debug buffer. This ensures that the debug buffer only records the information of the device currently in hibernation or wake-up, which not only saves storage space and avoids unnecessary information occupying memory space, but also avoids analyzing unnecessary devices when performing subsequent analysis based on the information recorded in the debug buffer. Only the device causing hibernation / wake-up anomalies needs to be analyzed, thereby greatly improving the efficiency of anomaly handling.
[0058] When the SOC successfully wakes up from hibernation, the information recorded in the system log can be analyzed to find the reason for the long hibernation wake-up time. However, if the SOC fails to wake up from hibernation, such as due to a long hibernation wake-up time, causing the SOC to restart, the SOC restart may cause the loss of some or all information in the system log, making it impossible to find the abnormal device in the system log. In this embodiment of the disclosure, the device information for hibernation wake-up is recorded in the debug buffer. When the SOC restarts, the debug buffer can be restored from the system snapshot automatically captured during the restart process, and then the contents of the restored debug buffer can be analyzed to determine the device that caused the restart. Therefore, in one optional embodiment of this disclosure, such as Figure 2 As shown, based on the foregoing embodiments, the method further includes:
[0059] Step 201: When the SOC restart is detected, obtain a system snapshot of the SOC.
[0060] When a SOC restart is detected, such as when the SOC times out and restarts due to a long hibernation / wake-up time, or when other problems occur during the hibernation / wake-up process that cause the SOC to restart, a system snapshot of the SOC can be obtained.
[0061] The SOC system snapshot is a minidump file automatically captured during the restart process when the SOC unexpectedly stops during runtime.
[0062] Step 202: parse the system snapshot to obtain the target debug buffer when the SOC restarts.
[0063] In this embodiment of the disclosure, after obtaining the system snapshot of the SOC, relevant tools can be used to parse the system snapshot and extract the target debug buffer when the SOC restarts.
[0064] It is understandable that the target debug buffer records information that was written to the debug buffer when the SOC restarts. This information may include the name of the device that is hibernating or waking up at the time of the restart, the start time, and the name of the previous device and the end time of the previous device's hibernation or wake-up.
[0065] Step 203: Based on the target debug buffer, determine the target device with hibernation-wake-up anomaly.
[0066] In this embodiment of the disclosure, after parsing the target debug buffer from the system snapshot, the target device with hibernation-wake-up anomaly can be determined based on the target debug buffer.
[0067] Specifically, for the obtained target debug buffer, the contents recorded in the hibernation start memory area and hibernation end memory area of the target debug buffer, as well as the contents recorded in the wake-up start memory area and wake-up end memory area of the target debug buffer, can be analyzed to determine whether there are devices with hibernation abnormalities or wake-up abnormalities.
[0068] For example, for the obtained target debug buffer, it can first be determined whether there is an empty memory area. If the hibernation start memory area and hibernation end memory area are empty, it can be determined whether there is a device with a wake-up exception based on the contents recorded in the wake-up start memory area and wake-up end memory area. If the wake-up start memory area and wake-up end memory area are empty, it can be determined whether there is a device with a hibernation exception based on the contents recorded in the hibernation start memory area and hibernation end memory area. If none of the memory areas of the target debug buffer are empty, it can be determined whether there is a device with a hibernation exception based on the contents recorded in the hibernation start memory area and hibernation end memory area, and whether there is a device with a wake-up exception based on the contents recorded in the wake-up start memory area and wake-up end memory area.
[0069] In this embodiment of the disclosure, different methods can be used to determine devices with abnormal sleep and / or abnormal wake-up.
[0070] In one optional embodiment of this disclosure, determining the target device with a sleep-wake anomaly based on the target debug buffer may include:
[0071] Get the hibernation start time and the third device name from the hibernation start memory area of the target debug buffer, and get the hibernation end time from the hibernation end memory area of the target debug buffer;
[0072] If the hibernation start time is greater than the hibernation end time, then the device corresponding to the third device name is determined to be the target device with hibernation anomaly; and / or
[0073] Get the wake-up start time and the name of the fourth device from the wake-up start memory area of the target debug buffer, and get the wake-up end time from the wake-up end memory area of the target debug buffer;
[0074] If the wake-up start time is longer than the wake-up end time, then the device corresponding to the fourth device name is determined to be the target device of the wake-up anomaly.
[0075] In other words, the time information recorded in the start and end memory areas can be used to determine whether a device is experiencing hibernation or wake-up abnormalities. If the hibernation start time obtained from the hibernation start memory area is greater than the hibernation end time obtained from the hibernation end memory area, it indicates that the third device corresponding to the third device name recorded in the hibernation start memory area took too long to hibernate, and the SOC restarted before the information of the third device could be recorded in the hibernation end memory area. At this time, the hibernation end memory area records the information of the previous hibernating device, so it can be determined that the third device corresponding to the third device name is the target device of the hibernation abnormality. Similarly, if the wake-up start time obtained from the wake-up start memory area is greater than the wake-up end time obtained from the wake-up end memory area, it can be determined that the wake-up end memory area records the information of the previous wake-up device, and the fourth device corresponding to the fourth device name recorded in the wake-up start memory area is the target device of the wake-up abnormality.
[0076] In one optional embodiment of this disclosure, determining the target device with a sleep-wake anomaly based on the target debug buffer may include:
[0077] Get the first hibernation device name from the hibernation start memory area of the target debug buffer, and get the second hibernation device name from the hibernation end memory area of the target debug buffer;
[0078] If the first hibernation device name and the second hibernation device name are inconsistent, then the device corresponding to the first hibernation device name is determined to be the target device with hibernation abnormality; and / or
[0079] Get the first wake-up device name from the wake-up start memory area of the target debug buffer, and get the second wake-up device name from the wake-up end memory area of the target debug buffer;
[0080] If the first wake-up device name and the second wake-up device name are different, then the device corresponding to the first wake-up device name is determined to be the target device of the wake-up anomaly.
[0081] During the SOC's hibernation and wake-up process, the next device will only begin hibernation after one device completes hibernation, and the next device will only begin waking up after one device completes waking up. Therefore, if a device can hibernate or wake up normally, the device name recorded in the hibernation start memory area and the hibernation end memory area should be the same. Similarly, the device name recorded in the wake-up start memory area and the wake-up end memory area should also be the same. However, if the SOC restarts due to a long hibernation or wake-up time, it's possible that only the device name and the start time of hibernation or wake-up were recorded in the hibernation start memory area or the wake-up start memory area during the hibernation or wake-up process, while the information in the hibernation end memory area or the wake-up end memory area has not yet been updated. The recorded information might still be the device name and hibernation or wake-up end time of the previous device, leading to inconsistencies in the device names recorded in the hibernation start memory area and the hibernation end memory area, or vice versa.
[0082] Therefore, in this embodiment of the disclosure, the device name recorded in the hibernation start memory area and the hibernation end memory area can be used to determine whether the device is hibernating abnormally. Specifically, the device name can be obtained from the hibernation start memory area of the target debug buffer as the first hibernation device name, and the device name can be obtained from the hibernation end memory area of the target debug buffer as the second hibernation device name. The first hibernation device name and the second hibernation device name are compared to see if they are consistent. If they are inconsistent, the device corresponding to the first hibernation device name is identified as the target device with hibernation abnormality. Similarly, the device name recorded in the wake-up start memory area and the wake-up end memory area can be used to determine whether the device is waking up abnormally. If the first wake-up device name obtained from the wake-up start memory area of the target debug buffer is inconsistent with the second wake-up device name obtained from the wake-up end memory area of the target debug buffer, the device corresponding to the first wake-up device name is identified as the target device with wake-up abnormality.
[0083] In this embodiment of the disclosure, when a SOC restart is detected, a system snapshot of the SOC is obtained and parsed to obtain the target debug buffer at the time of the SOC restart. Then, the target device with hibernation-wake-up anomaly is determined based on the target debug buffer. Thus, when a restart occurs during hibernation-wake-up, the target device with hibernation-wake-up anomaly can be determined based on the target debug buffer parsed from the system snapshot automatically captured during the restart process. This ensures the normal implementation of debugging methods and solves the problem in the prior art where SOC restart causes the loss of log information, making it impossible to locate the anomaly.
[0084] Figure 3 This is a schematic diagram of a hibernation process provided in an embodiment of the present disclosure, such as... Figure 3As shown, after initiating the hibernation process, the current system time (denoted as t_suspend_start) and the device name of the currently hibernating device (the first device in the SOC at the start of the hibernation process) are obtained. t_suspend_start and the device name are stored in suspend_b_slot. Then, the hibernation function corresponding to the currently hibernating device is called. Upon completion of the hibernation function call, the current system time (denoted as t_suspend_end) and the device name are obtained and stored in suspend_e_slot. The difference between t_suspend_end and t_suspend_start (denoted as t_detal_suspend) is calculated. If this difference is greater than a preset first threshold, the device information of the currently hibernating device is written to the system log. Afterward, the process continues to hibernate the next device, repeating the above process until the SOC successfully hibernates or restarts.
[0085] Figure 4 This is a schematic diagram of a wake-up process provided in an embodiment of the present disclosure, such as... Figure 4 As shown, after entering the wake-up process, the current system time (denoted as t_resume_start) and the device name of the currently woken-up device (the first device in the SOC at the start of the wake-up process) are obtained. t_resume_start and the device name are stored in resume_b_slot. Then, the wake-up function corresponding to the currently woken-up device is called. Upon completion of the wake-up function call, the current system time (denoted as t_resume_end) and the device name are obtained and stored in resume_e_slot. The difference between t_resume_end and t_resume_start (denoted as t_detal_resume) is calculated. If this difference is greater than a preset second threshold, the device information of the currently woken-up device is written to the system log. Afterward, the process continues to wake up the next device, repeating the above process until the SOC successfully wakes up or restarts.
[0086] Through the above Figure 3 and Figure 4 The method shown only records information about devices whose hibernation or wake-up time exceeds a preset threshold in the system log during debugging. This avoids negatively impacting the hibernation or wake-up process due to the debugging method itself. Furthermore, it writes information about devices that successfully hibernate or wake up but time out into the system log and records information about devices currently hibernating or waking up in the debug buffer by overwriting the log. This ensures that regardless of whether a restart occurs during hibernation or wake-up, information about devices with longer time consumption can be analyzed, guaranteeing effective debugging.
[0087] To implement the above embodiments, this disclosure also provides a sleep / wake-up processing device.
[0088] Figure 5 This is a schematic diagram of a sleep / wake-up processing device provided in an embodiment of the present disclosure. The device can be implemented in software and / or hardware and can be integrated into any electronic device with processing capabilities, such as a computer, vehicle terminal, etc.
[0089] like Figure 5 As shown, the sleep / wake-up processing device 50 provided in this embodiment may include: a first acquisition module 501, a second acquisition module 502, and a processing module 503, wherein:
[0090] The first acquisition module 501 is used to acquire the system time when the preset function of the first device in the system on-chip SOC is called as the first start time, wherein the preset function is a sleep function or a wake-up function;
[0091] The second acquisition module 502 is used to acquire the system time when the preset function is called as the first end time;
[0092] The processing module 503 is used to write the device information of the first device into the system log when the difference between the first end time and the first start time is greater than a preset threshold.
[0093] Optionally, the sleep / wake-up processing device further includes:
[0094] The writing module is used to write the first device name, the first start time, and the first end time of the first device into a preset debug buffer.
[0095] Optionally, the debug buffer includes a hibernation start memory area, a hibernation end memory area, a wake-up start memory area, and a wake-up end memory area, and the write module is specifically used for:
[0096] When the preset function is a hibernation function, the first device name and the first start time of the first device are written into the hibernation start memory area, and the first device name and the first end time are written into the hibernation end memory area;
[0097] When the preset function is a wake-up function, the first device name and the first start time are written into the wake-up start memory area, and the first device name and the first end time are written into the wake-up end memory area.
[0098] Optionally, the sleep / wake-up processing device further includes: an update module; the update module is used for:
[0099] When the second start time of the second device is obtained, the first device name and the first start time in the start memory area of the debug buffer are updated to the second device name and the second start time of the second device, wherein the start memory area includes the hibernation start memory area or the wake-up start memory area;
[0100] When the second end time of the second device is obtained, the first device name and the first end time in the end memory area of the debug buffer are updated to the second device name and the second end time, wherein the end memory area includes the hibernation end memory area or the wake-up end memory area.
[0101] Optionally, the sleep / wake-up processing device further includes:
[0102] The third acquisition module is used to acquire a system snapshot of the SOC when the SOC restart is detected;
[0103] The parsing module is used to parse the system snapshot to obtain the target debug buffer when the SOC restarts;
[0104] The determination module is used to determine the target device with hibernation-wake-up anomaly based on the target debug buffer.
[0105] Optionally, the determining module is further configured to:
[0106] Obtain the hibernation start time and the third device name from the hibernation start memory area of the target debug buffer, and obtain the hibernation end time from the hibernation end memory area of the target debug buffer;
[0107] If the hibernation start time is greater than the hibernation end time, then the device corresponding to the third device name is determined to be the target device with hibernation anomaly; and / or
[0108] The wake-up start time and the name of the fourth device are obtained from the wake-up start memory area of the target debug buffer, and the wake-up end time is obtained from the wake-up end memory area of the target debug buffer;
[0109] If the wake-up start time is greater than the wake-up end time, then the device corresponding to the fourth device name is determined to be the target device of the wake-up anomaly.
[0110] Optionally, the determining module is further configured to:
[0111] The first hibernation device name is obtained from the hibernation start memory area of the target debug buffer, and the second hibernation device name is obtained from the hibernation end memory area of the target debug buffer;
[0112] If the first hibernation device name is inconsistent with the second hibernation device name, then the device corresponding to the first hibernation device name is determined to be the target device with hibernation abnormality; and / or
[0113] The first wake-up device name is obtained from the wake-up start memory area of the target debug buffer, and the second wake-up device name is obtained from the wake-up end memory area of the target debug buffer;
[0114] If the first wake-up device name is different from the second wake-up device name, then the device corresponding to the first wake-up device name is determined to be the target device of the wake-up anomaly.
[0115] The sleep / wake-up processing device configurable on electronic devices provided in this disclosure can execute any sleep / wake-up processing method provided in this disclosure, and has the corresponding functional modules and beneficial effects for executing the method. Content not described in detail in the device embodiments of this disclosure can be referred to the description in any method embodiment of this disclosure.
[0116] This disclosure also provides an electronic device, including a processor and a memory; the processor executes the steps of the sleep-wake processing method as described in the foregoing embodiments by calling programs or instructions stored in the memory. To avoid repetition, these steps will not be repeated here.
[0117] This disclosure also provides a non-transitory computer-readable storage medium that stores a program or instructions that cause a computer to perform the steps of the hibernation and wake-up processing methods described in the foregoing embodiments. To avoid repetition, these steps will not be repeated here.
[0118] This disclosure also provides a computer program product for performing the steps of the hibernation and wake-up processing methods described in the foregoing embodiments.
[0119] It should be noted that, in this document, relational terms such as "first" and "second" are used merely to distinguish one entity or operation from another, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Furthermore, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Without further limitations, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes said element.
[0120] The above description is merely a specific embodiment of this disclosure, enabling those skilled in the art to understand or implement it. Various modifications to these embodiments will be readily apparent to those skilled in the art, and the general principles defined herein may be implemented in other embodiments without departing from the spirit or scope of this disclosure. Therefore, this disclosure is not to be limited to the embodiments described herein, but is to be accorded the widest scope consistent with the principles and novel features disclosed herein.
Claims
1. A hibernate wake-up processing method, characterized by, include: The system time at which the preset function of the first device in the system-on-a-chip (SoC) is called is used as the first start time, wherein the preset function is a sleep function or a wake-up function; The system time at which the call to the preset function ends is obtained as the first end time; If the difference between the first end time and the first start time is greater than a preset threshold, the device information of the first device will be written into the system log. The method further includes: The first device name, first start time, and first end time of the first device are written into a preset debug buffer. The debug buffer is a memory area used to record the device information of the device currently in hibernation or wake-up, including a hibernation start memory area, a hibernation end memory area, a wake-up start memory area, and a wake-up end memory area. The hibernation start memory area and the hibernation end memory area are used to record the device information of the device currently in hibernation. The wake-up start memory area and the wake-up end memory area are used to record the device information of the device currently in wake-up. When a new device hibernates or wakes up, the device information in the hibernation start / end memory area is updated to the device name, start time, and / or end time of the new hibernation device, and the device information in the wake-up start / end memory area is updated to the device name, start time, and / or end time of the new wake-up device. When the SOC restart is detected, the debug buffer is restored from the system snapshot captured during the restart process. The contents of the restored debug buffer are analyzed to determine the device that caused the restart. Specifically, the device causing the restart is determined by the relationship between the hibernation start time and hibernation end time in the restored debug buffer, or by the relationship between the wake-up start time and wake-up end time in the restored debug buffer, or by whether the hibernation device name in the hibernation start memory area and the hibernation end memory area in the restored debug buffer are the same, or by whether the wake-up device name in the wake-up start memory area and the wake-up end memory area in the restored debug buffer are the same.
2. The method of claim 1, wherein, The step of writing the first device name, the first start time, and the first end time of the first device into a preset debug buffer includes: When the preset function is a hibernation function, the first device name and the first start time of the first device are written into the hibernation start memory area, and the first device name and the first end time are written into the hibernation end memory area; When the preset function is a wake-up function, the first device name and the first start time are written into the wake-up start memory area, and the first device name and the first end time are written into the wake-up end memory area.
3. The method of claim 2, wherein, The method further includes: When the second start time of the second device is obtained, the first device name and the first start time in the start memory area of the debug buffer are updated to the second device name and the second start time of the second device, wherein the start memory area includes the hibernation start memory area or the wake-up start memory area; When the second end time of the second device is obtained, the first device name and the first end time in the end memory area of the debug buffer are updated to the second device name and the second end time, wherein the end memory area includes the hibernation end memory area or the wake-up end memory area.
4. The method of claim 3, wherein, The method further includes: When the SOC restart is detected, a system snapshot of the SOC is obtained; The system snapshot is parsed to obtain the target debug buffer at the time of SOC restart; Based on the target debug buffer, the target device with hibernation-wake-up anomaly is identified.
5. The method of claim 4, wherein, The step of determining the target device with sleep-wake anomaly based on the target debug buffer includes: Obtain the hibernation start time and the third device name from the hibernation start memory area of the target debug buffer, and obtain the hibernation end time from the hibernation end memory area of the target debug buffer; If the hibernation start time is greater than the hibernation end time, then the device corresponding to the third device name is determined to be the target device with hibernation anomaly; and / or The wake-up start time and the name of the fourth device are obtained from the wake-up start memory area of the target debug buffer, and the wake-up end time is obtained from the wake-up end memory area of the target debug buffer; If the wake-up start time is greater than the wake-up end time, then the device corresponding to the fourth device name is determined to be the target device of the wake-up anomaly.
6. The method of claim 4, wherein, The step of determining the target device with sleep-wake anomaly based on the target debug buffer includes: The first hibernation device name is obtained from the hibernation start memory area of the target debug buffer, and the second hibernation device name is obtained from the hibernation end memory area of the target debug buffer; If the first hibernation device name is inconsistent with the second hibernation device name, then the device corresponding to the first hibernation device name is determined to be the target device with hibernation abnormality; and / or The first wake-up device name is obtained from the wake-up start memory area of the target debug buffer, and the second wake-up device name is obtained from the wake-up end memory area of the target debug buffer; If the first wake-up device name is different from the second wake-up device name, then the device corresponding to the first wake-up device name is determined to be the target device of the wake-up anomaly.
7. A hibernate wake-up processing apparatus, characterized by comprising: include: The first acquisition module is used to acquire the system time when the preset function of the first device in the system on-chip SOC is called as the first start time, wherein the preset function is a sleep function or a wake-up function; The second acquisition module is used to acquire the system time when the call to the preset function ends as the first end time; The processing module is used to write the device information of the first device into the system log when the difference between the first end time and the first start time is greater than a preset threshold. The device further includes: The writing module is used to write the first device name, the first start time, and the first end time of the first device into a preset debug buffer. The debug buffer is a memory area used to record the device information of the device currently in hibernation or wake-up, including a hibernation start memory area, a hibernation end memory area, a wake-up start memory area, and a wake-up end memory area. The hibernation start memory area and the hibernation end memory area are used to record the device information of the device currently in hibernation, and the wake-up start memory area and the wake-up end memory area are used to record the device information of the device currently being woken up. When a new device goes into hibernation or wakes up, the device information in the hibernation start / end memory area is updated to the device name, start time, and / or end time of the new hibernation device, and the device information in the wake-up start / end memory area is updated to the device name, start time, and / or end time of the new wake-up device. The device is also used for: When the SOC restart is detected, the debug buffer is restored from the system snapshot captured during the restart process. The contents of the restored debug buffer are analyzed to determine the device that caused the restart. Specifically, the device causing the restart is determined by the relationship between the hibernation start time and hibernation end time in the restored debug buffer, or by the relationship between the wake-up start time and wake-up end time in the restored debug buffer, or by whether the hibernation device name in the hibernation start memory area and the hibernation end memory area in the restored debug buffer are the same, or by whether the wake-up device name in the wake-up start memory area and the wake-up end memory area in the restored debug buffer are the same.
8. An electronic device, comprising: include: Processor and memory; The processor executes the sleep / wake-up processing method as described in any one of claims 1 to 6 by calling the program or instructions stored in the memory.
9. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a program or instructions that cause the computer to perform the hibernation / wake-up process as described in any one of claims 1 to 6.