Abnormality handling method, device, electronic device and storage medium

By responding to initial conditions on the first hardware, storing and analyzing network time variables to judge abnormalities, the problem of inconsistent interrupt execution time during software transplantation on different main frequency chips is solved, and timely monitoring and processing of hardware abnormalities is realized, and hardware performance is improved.

CN119759654APending Publication Date: 2025-04-04TCL AIR CONDITIONER ZHONGSHAN CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411826353.7
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-12-11
Publication Date
2025-04-04

AI Technical Summary

Technical Problem

When porting software to different main frequency chips, the execution time of interrupt programs is different, resulting in poor resource utilization, and problems such as interrupt conflicts, program abnormalities and even dead loops are prone to occur.

Method used

In response to the first hardware satisfying the initial conditions when running the target program, the network time is stored based on at least one time variable, and the judgment result is determined based on the network time and time variables to determine whether an exception occurs during the running of the target program, and corresponding processing is performed.

Benefits of technology

It realizes timely monitoring and handling of abnormalities in the first hardware during the operation of the target program, and can promptly detect and resolve faults, improving the performance of the hardware.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119759654A_ABST
    Figure CN119759654A_ABST
Patent Text Reader

Abstract

The disclosed embodiments disclose an exception handling method, device, electronic device and computer-readable storage medium, which relate to the field of exception detection technology. The method includes: in response to the first hardware satisfying the initial condition when running the target program, based on at least one time variable, storing the network time; based on the network time and the time variable, determining a judgment result, wherein the judgment result is used to indicate whether the first hardware has an exception in the process of running the target program; based on the judgment result, processing the first hardware. Thus, the time variable can be monitored based on the network time, and then it can be determined that the first hardware has an exception in the process of running the target program, such as a fault problem of interrupt time overflow. By timely monitoring the exception and processing it, it is possible to timely discover and solve the fault, thereby improving the performance of the hardware.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The embodiments of the present disclosure relate to the technical field of exception handling, and in particular to an exception handling method, device, electronic device, and computer-readable storage medium. Background Art

[0002] In the development of some controllers, it is necessary to port the software to different main frequency chips. The difference in main frequency chips often leads to different execution times of interrupt programs, making it difficult to achieve modular and unified porting of codes. The difference in main frequency chips affects resource utilization, and the interrupt timing varies greatly, which can easily lead to interrupt conflicts and program exceptions, and in serious cases, fall into an infinite loop.

[0003] Therefore, how to timely monitor the abnormalities during program operation is a problem that urgently needs to be solved. Summary of the invention

[0004] The embodiments of the present disclosure provide an exception handling method, an apparatus, an electronic device, and a computer-readable storage medium, which aim to solve one of the technical problems in the related art at least to a certain extent.

[0005] In a first aspect, an embodiment of the present disclosure provides an exception handling method, the method comprising:

[0006] In response to the first hardware satisfying an initial condition when running the target program, storing the network time based on at least one time variable;

[0007] Determine a judgment result based on the network time and the time variable, wherein the judgment result is used to indicate whether an abnormality occurs in the first hardware during the process of running the target program;

[0008] Based on the determination result, the first hardware is processed.

[0009] In a second aspect, an embodiment of the present disclosure further provides an exception handling device, the device comprising:

[0010] A storage module, configured to store the network time based on at least one time variable in response to the first hardware satisfying an initial condition when running the target program;

[0011] A determination module, used to determine a judgment result based on the network time and the time variable, wherein the judgment result is used to indicate whether an abnormality occurs in the first hardware during the process of running the target program;

[0012] A processing module is used to process the first hardware based on the judgment result.

[0013] In a third aspect, an embodiment of the present disclosure further provides an electronic device, which includes a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the computer program implements the steps in the above-mentioned exception handling method when executed by the processor.

[0014] In a fourth aspect, an embodiment of the present disclosure further provides a computer-readable storage medium, on which a computer program is stored, and when the computer program is executed by a processor, the steps in the above-mentioned exception handling method are implemented.

[0015] In a fifth aspect, the embodiments of the present disclosure further provide a computer program product or a computer program, which includes a computer instruction stored in a computer-readable storage medium. The processor of the computer device reads the computer instruction from the computer-readable storage medium, and the processor executes the computer instruction, so that the computer device executes the method provided in various optional implementations of the embodiments of the present disclosure.

[0016] In the disclosed embodiment, first, in response to the first hardware satisfying the initial condition when running the target program, the network time is stored based on at least one time variable, and then a judgment result is determined based on the network time and the time variable, wherein the judgment result is used to indicate whether an abnormality occurs in the first hardware during the running of the target program, and then the first hardware is processed based on the judgment result. Thus, the time variable can be monitored based on the network time, and then it can be determined that an abnormality occurs in the first hardware during the running of the target program, such as a fault problem of interrupt time overflow. By timely monitoring and processing of abnormalities, faults can be discovered and resolved in a timely manner, thereby improving the performance of the hardware.

[0017] It is to be understood that the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the present disclosure. BRIEF DESCRIPTION OF THE DRAWINGS

[0018] In order to more clearly illustrate the technical solutions in the present disclosure, the drawings required for use in the description of the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without paying any creative work.

[0019] Figure 1 is a flowchart of an exception handling method provided by the first embodiment of the present disclosure;

[0020] Figure 2 is a flowchart of an exception handling method provided in the second embodiment of the present disclosure;

[0021] Figure 3is a schematic diagram of the structure of an exception handling device provided by an embodiment of the present disclosure;

[0022] Figure 4 It is a schematic diagram of the structure of an electronic device provided by an embodiment of the present disclosure. DETAILED DESCRIPTION

[0023] Some embodiments of the present disclosure will be described in detail here, and examples thereof are shown in the accompanying drawings. When the following description refers to the drawings, unless otherwise indicated, the same numbers in different drawings represent the same or similar elements. Various changes, modifications and equivalents of the methods, devices and / or systems described herein will become apparent after understanding the present disclosure. For example, the order of operations described herein is merely an example and is not limited to those orders set forth herein, but can be changed as becomes apparent after understanding the present disclosure, except for operations that must be performed in a specific order. In addition, for clarity and brevity, descriptions of features known in the art may be omitted.

[0024] The embodiments described in some embodiments of the present disclosure below do not represent all embodiments consistent with the present disclosure. Instead, they are merely examples of devices and methods consistent with some aspects of the present disclosure as detailed in the appended claims.

[0025] It should be noted that the execution subject of the exception handling method of this embodiment may be an exception handling device, and the device may be configured in any type of electronic device, which is not limited here.

[0026] In the embodiments of the present disclosure, the "exception handling device" is used as the execution subject to perform the exception handling method for illustration, and no limitation is made here. It should be noted that the description order of the following embodiments is not used as a limitation on the priority order of the embodiments.

[0027] Figure 1 It is a flowchart of an exception handling method provided according to the first embodiment of the present disclosure.

[0028] like Figure 1 As shown, the method includes:

[0029] Step 101 : In response to the first hardware satisfying an initial condition when running a target program, the network time is stored based on at least one time variable.

[0030] The first hardware may be hardware that currently needs to be monitored, and may be any type of hardware, such as a chip, an embedded device, a single-chip microcomputer, or any other type of processor.

[0031] As an example, in the embodiment of the present disclosure, the first hardware may be a chip, such as a chip in an air conditioner variable frequency controller, which is not limited here.

[0032] The target program may be a program to be monitored.

[0033] The initial condition may be a preset fault warning condition.

[0034] The time variable may be a variable representing a certain length of time, such as 1 minute, 10 minutes, 30 minutes, 1 hour, etc., which are not limited here. It is understandable that different characters may be used to define different time variables in the target program.

[0035] The network time may be the actual time read from the network address.

[0036] As a possible implementation method, the target program can be first run based on the first hardware, and then the running time of the target listening event in the target program can be timed to obtain the target running time. Then, when the target running time is greater than the second threshold, it can be determined that the initial condition is met.

[0037] The second threshold may be a threshold of the target running time, and the size of the second threshold may be set based on actual experience and is not limited here.

[0038] The target running time may be the processing time of the target monitoring event during the running process of the target program.

[0039] The target monitoring event may be an event to be monitored. For example, the target monitoring event may be an interruption event. Optionally, current loop interruption and speed loop interruption may be used as target monitoring events, which are not limited here.

[0040] It should be noted that the target monitoring event may be one or more events, which is not limited here.

[0041] Optionally, the target monitoring event may be an interruption event with two different carrier frequencies, which is not limited here.

[0042] As an example of an application scenario, the written target program can be first installed or uploaded to the first hardware. In the target program, the target listening event that needs to be timed is clearly defined. The target listening event can be triggered by external input (such as button pressing, sensor data change) or internal logic (such as completion of a specific task). Optionally, a timer can be placed in the target program to record the running time of the target listening event. This timer can start timing when the event is triggered and stop when the event processing is completed. After each event processing is completed, the running time of the event is obtained from the timer. This time can be expressed in milliseconds, seconds or other time units. Among them, a second threshold needs to be set according to business needs or system performance requirements to determine whether the event running time is too long. Compare the obtained target running time with the set second threshold. If the target running time is greater than the second threshold, it is determined that the initial condition is met.

[0043] The time variable may be one or more, which is not limited here.

[0044] For example, if there are two time variables, 1 minute and 10 minutes respectively, the network time can be recorded according to the time variables after determining that the initial conditions are met.

[0045] For example, for the "1 minute time variable", the network time t0, t1, t2, t3, t4 can be read at T0, T1, T2, T3, T4 respectively according to the timer inside the first hardware. Among them, T0 is the initial time of timing, T1 is the time corresponding to the first 1 minute, T2 is the time corresponding to the second 1 minute, T3 is the time corresponding to the third 1 minute, and T4 is the time corresponding to the fourth 1 minute. Inside the first hardware, the time interval between T0 and T1 is 1 minute, the time interval between T1 and T2 is 1 minute, the time interval between T2 and T3 is 1 minute, and the time interval between T3 and T4 is 1 minute.

[0046] Similarly, for the "10-minute time variable", the network time ta0, ta1, ta2, ta3, ta4 can be read at Ta, Ta1, Ta2, Ta3, Ta4 respectively according to the timer inside the first hardware. The specific process can refer to the above example and will not be repeated here.

[0047] Step 102: determining a judgment result based on the network time and the time variable, wherein the judgment result is used to indicate whether an abnormality occurs in the first hardware during the process of running the target program.

[0048] The judgment result may be abnormal or normal, which is not limited here.

[0049] If the judgment result is abnormal, it means that the first hardware has an abnormality in the process of running the target program. In the embodiment of the present disclosure, the abnormality can be an interrupt overflow fault, which is not limited here.

[0050] It should be noted that since the network time can represent the actual time, it is a more accurate time. Therefore, in the embodiment of the present disclosure, the network time can be used to calibrate one or more time variables in the first hardware, and then determine whether the timing of the time variable by the first hardware when running the target program has errors. For example, if the actual time length of the 10-minute time variable defined by the first hardware in running the target program is 9 minutes and 40 seconds, it means that there is an error in the 10-minute time variable. If the number of errors is greater than the set threshold, such as greater than 5 times, it can be considered that the first hardware has an abnormality in the process of running the target program.

[0051] Step 103: Process the first hardware based on the determination result.

[0052] It should be noted that if the judgment result indicates that it is normal, then no action is required on the first hardware, that is, the processing method is to keep the original state of the first hardware. If the judgment result indicates that it is abnormal, then the first hardware needs to be optimized.

[0053] As a possible implementation method, when the judgment result indicates that an abnormality occurs in the first hardware during the execution of the target program, a fault display may be performed, and the target program in the first hardware may be upgraded online.

[0054] Optionally, when it is determined that an abnormality has occurred, a fault display code may be triggered to display the fault, and the fault display may include recording the error in a log, displaying a warning message to the user, or triggering an alarm system, which is not limited here.

[0055] It should be noted that online upgrade, or OTA, is the full name of Over-the-Air Technology, which allows device manufacturers and software developers to update and manage device software online without physical contact with the user. The principle of OTA upgrade is to transmit the update package to the device through a wireless network (such as Wi-Fi, mobile data network, etc.). After receiving the update package, the device will decompress and install it to achieve software updates and upgrades.

[0056] Optionally, the OTA upgrade package can be transmitted to the first hardware via a wireless network (such as Wi-Fi or mobile data network). The upgrade package is then installed and executed on the first hardware to update the code of the target program, thereby optimizing the running time of the target program. The upgrade process may include steps such as verifying its integrity, decompressing and installing the new program. After the OTA upgrade is completed, verify whether the upgrade is successful and check whether the time error has been resolved.

[0057] In the disclosed embodiment, first, in response to the first hardware satisfying the initial condition when running the target program, the network time is stored based on at least one time variable, and then a judgment result is determined based on the network time and the time variable, wherein the judgment result is used to indicate whether an abnormality occurs in the first hardware during the running of the target program, and then the first hardware is processed based on the judgment result. Thus, the time variable can be monitored based on the network time, and then it can be determined that an abnormality occurs in the first hardware during the running of the target program, such as a fault problem of interrupt time overflow. By timely monitoring and processing of abnormalities, faults can be discovered and resolved in a timely manner, thereby improving the performance of the hardware.

[0058] Figure 2 It is a flowchart of an exception handling method provided according to the second embodiment of the present disclosure.

[0059] like Figure 2 As shown, the method includes:

[0060] Step 201: Run a target program based on first hardware.

[0061] It should be noted that the specific implementation of step 201 can refer to the above embodiment and will not be described in detail here.

[0062] Step 202: Based on a preset counter, the running time of the current loop interruption and the speed loop interruption in the target program is timed to obtain the accumulated running time of the current loop interruption and the speed loop interruption.

[0063] The accumulated running time may be the sum of the running time of the current loop interruption and the running time of the speed loop interruption.

[0064] It should be noted that the carrier frequency of the current loop interruption is usually greater than the carrier frequency of the speed loop interruption. This is because the current loop needs to respond and track the current changes of the motor faster to ensure the stable operation and performance of the motor. The speed loop adjusts the motor speed according to the control effect of the current loop, and its response speed is relatively slow, so the carrier frequency is also relatively low. Therefore, when determining the cumulative running time, the embodiment of the present disclosure can be to calculate the sum of the running time of the current loop interruption and the running time of N speed loop interruptions. For example, N=3, which is not limited here.

[0065] When the target program starts running, a counter for recording the number of high-frequency priority interrupts can be initialized first. The counter will be incremented each time a high-frequency priority interrupt occurs.

[0066] Then, the interrupt service routines for the current loop and the speed loop can be configured, which will be called under their respective trigger conditions. The current loop interrupt is usually related to the real-time current control of the motor, while the speed loop interrupt is related to the speed control of the motor. Then, the counter can record the time in the high-frequency priority interrupt, and in the handler of the high-frequency priority interrupt, record the current timestamp and increment the interrupt counter. If the current loop or speed loop interrupt is running at this time (that is, their interrupt handler is executing), then record this status. When the current loop or speed loop interrupt ends, use the previously recorded timestamp to calculate their respective actual running time. Accumulate these running times to track and count how much program running time resources are occupied in total, so as to obtain the cumulative running time.

[0067] Step 203: determine the accumulated running time as the target running time.

[0068] Specifically, the accumulated running time may be used as the target running time.

[0069] Step 204: When the target running time is greater than the second threshold, determine that the initial condition is met.

[0070] The second threshold may be 80% of the total running time of the target program, which is not limited here. If the second threshold is exceeded, it means that the processing time of the current loop and the speed loop is too long, which may affect the real-time performance or stability of the system, and then the network time can be obtained.

[0071] It should be noted that the specific implementation of step 204 can refer to the above embodiment and will not be described in detail here.

[0072] Step 205: Determine at least one time variable associated with the target program.

[0073] Optionally, a time variable used to track or record time in the target program may be identified first. The time variables required to be used by different target programs may be different or the same.

[0074] For example, for the target program x, time variables of 1 minute and 10 minutes are defined in the code for tracking or recording time, and thus the time variables of 1 minute and 10 minutes can be used as time variables associated with the target program x.

[0075] Step 206: determine each first moment to be recorded based on the time variable.

[0076] The first moment may be the moment of reading the network time.

[0077] In the embodiment of the present disclosure, for each time variable, it is necessary to determine the first moments to be recorded corresponding thereto.

[0078] For example, for the "1 minute time variable", T0 is the initial time of timing, T1 is the time corresponding to the first minute determined by the first hardware, T2 is the time corresponding to the second minute determined by the first hardware, T3 is the time corresponding to the third minute determined by the first hardware, and T4 is the time corresponding to the fourth minute determined by the first hardware. Within the first hardware, the first hardware considers that the time interval between T0 and T1 is 1 minute, the time interval between T1 and T2 is 1 minute, the time interval between T2 and T3 is 1 minute, and the time interval between T3 and T4 is 1 minute. Therefore, T0, T1, T2, and T3 can be regarded as the first moment.

[0079] Step 207: Obtain the network time corresponding to each first moment.

[0080] Optionally, based on a wireless network module connected to the first hardware, the network time corresponding to each first moment may be read from the target network address.

[0081] The target network address is the address from which the first hardware reads the network time.

[0082] It should be noted that, considering the data persistence and reading speed, a specific area of ​​non-volatile memory (such as EEPROM, Flash memory) or high-speed SRAM can be selected to store the network time. First, the corresponding variables and data structures can be defined in the code according to the format of the network address. For example, for an IPv4 address, a 4-byte array or a 32-bit integer variable can be defined. Write a function to write the network address to the specified storage location and read the network address from the specified storage location. Then, the Wi-Fi module (wireless network module) can be initialized and the network address can be read. When the system starts, the Wi-Fi module is initialized. The network time in the target network address is read through the Wi-Fi module and the network time is stored.

[0083] Step 208: Determine at least one actual duration corresponding to the time variable according to the network time.

[0084] The actual duration may be the actual time length corresponding to the time variable within the time period recorded by the first hardware using the time variable.

[0085] For example, a time variable defined by the first hardware is 1 minute, with t1 as the start time and t2 as the end time. The time length of 1 minute in the first hardware is the time difference between t2 and t1, but in practice, the time interval between t2 and t1 may be 1 minute, or may be greater or less than 1 minute, that is, there is a difference.

[0086] For example, if the time variable is 10 minutes, the network times corresponding to the time variable are 18:12, 18:23, 18:34, and 18:45. Through the network times recorded above, it can be found that there are 3 actual durations corresponding to the time variable. Since 18:12 is the network time recorded at the first moment of the start. The time interval between 18:12 and 18:23 is 11 minutes, which is the first actual duration corresponding to the time variable. The time interval between 18:23 and 18:34 is 11 minutes, which is the second actual duration corresponding to the time variable. The time interval between 18:34 and 18:45 is 11 minutes, which is the third actual duration corresponding to the time variable.

[0087] Step 209: If, among at least one actual duration corresponding to any time variable, N actual durations do not match the reference duration corresponding to any time variable, the number of errors corresponding to any time variable is determined to be N, where N is a positive number.

[0088] The reference time length may be an ideal time length corresponding to the time variable.

[0089] Based on the above example, if the time variable is 10 minutes, there are 3 actual durations corresponding to the time variable, and these 3 actual durations are all 11 minutes, not 10 minutes. This means that there are 3 mismatches between the time variable and the reference time length of 10 minutes, that is, the corresponding number of errors is 3.

[0090] Step 210: When the number of errors corresponding to any time variable is greater than a first threshold, determine that the judgment result is abnormal.

[0091] The first threshold may be a threshold of the number of errors, and the specific value may be set based on actual experience.

[0092] For example, if any time variable is 10 minutes, the first threshold is 5, and the number of errors of the time variable is 6 times, which is greater than the first threshold, it can be determined that the judgment result is abnormal.

[0093] It is understandable that there may be multiple time variables. If the number of errors of any time variable is greater than the first threshold first, it can be determined that the judgment result is abnormal.

[0094] Step 211: Process the first hardware based on the determination result.

[0095] It should be noted that the specific implementation of step 211 can refer to the above embodiment and will not be described in detail here.

[0096] In the disclosed embodiment, the target program is first run based on the first hardware, and then the running time of the current loop interruption and the speed loop interruption in the target program is timed based on the preset counter to obtain the cumulative running time of the current loop interruption and the speed loop interruption, and the cumulative running time is determined to be the target running time. Afterwards, when the target running time is greater than the second threshold, it is determined that the initial condition is satisfied, and then at least one time variable associated with the target program is determined. Afterwards, based on the time variable, each first moment to be recorded is determined, and then the network time corresponding to each first moment is obtained. Afterwards, at least one actual duration corresponding to the time variable can be determined according to the network time. If there are N actual durations and reference time lengths corresponding to any time variable in at least one actual duration corresponding to any time variable that do not match, the number of errors corresponding to any time variable is determined to be N, and then when the number of errors corresponding to any time variable is greater than the first threshold, the judgment result is determined to be abnormal, and finally, based on the judgment result, the first hardware is processed. Thus, by accurately timing the running time of the current loop interruption and the speed loop interruption through the preset counter, their cumulative running time can be obtained, which helps to understand the execution efficiency and stability of the interrupt program. When the target running time is greater than the second threshold, it indicates that the interrupt program may run abnormally or too frequently. At this point, by further analyzing the time variable and the corresponding network time, potential faults or performance problems can be discovered in a timely manner. By comparing the actual duration corresponding to the time variable and the reference time length, the number of errors can be calculated. When the number of errors is greater than the first threshold, the judgment result is abnormal, which helps to accurately identify problems in hardware or software. As a result, real-time monitoring of code problems of interrupt overflows that are not easy to find can be provided, the network time is read, and the time variable is compared multiple times, so as to timely discover overflow interrupt faults, occupying only a small amount of code space and memory variables.

[0097] In order to better implement the exception handling method of the present disclosure, the present disclosure also provides an exception handling device based on the above exception handling method. The meanings of the terms are the same as those in the above exception handling method, and the specific implementation details can refer to the description in the method embodiment.

[0098] See also Figure 3 , Figure 3 is a schematic diagram of the structure of an exception handling device provided in an embodiment of the present disclosure, the exception handling device 300 includes:

[0099] The storage module 310 is used to store the network time based on at least one time variable in response to the first hardware satisfying the initial condition when running the target program;

[0100] A determination module 320, configured to determine a determination result based on the network time and the time variable, wherein the determination result is used to indicate whether an abnormality occurs in the first hardware during the process of running the target program;

[0101] The processing module 330 is used to process the first hardware based on the determination result.

[0102] Optionally, the determining module is specifically used to:

[0103] Determine at least one actual duration corresponding to the time variable according to the network time;

[0104] If, among at least one actual duration corresponding to any time variable, N actual durations do not match the reference duration corresponding to any time variable, determine that the number of errors corresponding to any time variable is N, where N is a positive number;

[0105] When the number of errors corresponding to any time variable is greater than a first threshold, the judgment result is determined to be abnormal.

[0106] Optionally, the storage module includes:

[0107] An operating unit, configured to operate the target program based on the first hardware;

[0108] A timing unit, used for timing the running time of the target listening event in the target program to obtain the target running time;

[0109] The first determining unit is configured to determine that an initial condition is satisfied when the target running time is greater than a second threshold.

[0110] Optionally, the timing unit is specifically used for:

[0111] Based on a preset counter, the running time of the current loop interruption and the speed loop interruption in the target program is timed to obtain the cumulative running time of the current loop interruption and the speed loop interruption;

[0112] The accumulated running time is determined as the target running time.

[0113] Optionally, the storage module includes:

[0114] a second determining unit, configured to determine at least one time variable associated with the target program;

[0115] A third determining unit, configured to determine each first moment to be recorded based on the time variable;

[0116] An acquiring unit is used to acquire the network time corresponding to each first moment.

[0117] Optionally, the acquisition unit is specifically used to:

[0118] Based on a wireless network module connected to the first hardware, the network time corresponding to each first moment is read from the target network address.

[0119] Optionally, the processing module is specifically used to:

[0120] When the judgment result indicates that an abnormality occurs in the first hardware during the running of the target program, a fault display is performed, and the target program in the first hardware is upgraded online.

[0121] In the disclosed embodiment, the exception handling device first stores the network time based on at least one time variable in response to the first hardware satisfying the initial condition when running the target program, and then determines the judgment result based on the network time and the time variable, wherein the judgment result is used to indicate whether the first hardware has an exception in the process of running the target program, and then processes the first hardware based on the judgment result. Thus, the time variable can be monitored based on the network time, and then it can be determined that the first hardware has an exception in the process of running the target program, such as a fault problem of interrupt time overflow. By timely monitoring and processing of exceptions, faults can be discovered and resolved in a timely manner, thereby improving the performance of the hardware.

[0122] In addition, the present disclosure also provides an electronic device, such as Figure 4 As shown, it shows a schematic diagram of the structure of the electronic device involved in the present disclosure, specifically:

[0123] The electronic device may include components such as a processor 401 with one or more processing cores, a memory 402 with one or more computer-readable storage media, a power supply 403, and an input unit 404. Those skilled in the art will appreciate that Figure 4 The electronic device structure shown in the figure does not constitute a limitation on the electronic device, and may include more or fewer components than shown in the figure, or combine certain components, or arrange the components differently.

[0124] The processor 401 is the control center of the electronic device, and uses various interfaces and lines to connect various parts of the entire electronic device. By running or executing software programs and / or modules stored in the memory 402, and calling data stored in the memory 402, the processor 401 performs various functions of the electronic device and processes data, thereby monitoring the electronic device as a whole. Optionally, the processor 401 may include one or more processing cores; preferably, the processor 401 may integrate an application processor and a modem processor, wherein the application processor mainly processes the operating system, user interface, and application programs, and the modem processor mainly processes wireless communications. It is understandable that the above-mentioned modem processor may not be integrated into the processor 401.

[0125] The memory 402 can be used to store software programs and modules. The processor 401 executes various functional applications and data processing by running the software programs and modules stored in the memory 402. The memory 402 may mainly include a program storage area and a data storage area, wherein the program storage area may store an operating system, an application required for at least one function (such as a sound playback function, an image playback function, etc.), etc.; the data storage area may store data created according to the use of the electronic device, etc. In addition, the memory 402 may include a high-speed random access memory, and may also include a non-volatile memory, such as at least one disk storage device, a flash memory device, or other volatile solid-state storage devices. Accordingly, the memory 402 may also include a memory controller to provide the processor 401 with access to the memory 402.

[0126] The electronic device also includes a power supply 403 for supplying power to each component. Preferably, the power supply 403 can be logically connected to the processor 401 through a power management system, so as to manage charging, discharging, and power consumption through the power management system. The power supply 403 can also include one or more DC or AC power supplies, recharging systems, power supply device debugging circuits, power converters or inverters, power status indicators, and other arbitrary components.

[0127] The electronic device may further include an input unit 404, which may be used to receive input digital or character information and generate keyboard, mouse, joystick, optical or trackball signal input related to user settings and function control.

[0128] Although not shown, the electronic device may further include a display unit, etc., which will not be described in detail herein. Specifically in this embodiment, the processor 401 in the electronic device will load the executable files corresponding to the processes of one or more application programs into the memory 402 according to the following instructions, and the processor 401 will run the application programs stored in the memory 402, thereby implementing the steps in any one of the exception handling methods provided in the embodiments of the present disclosure.

[0129] In the disclosed embodiment, first, in response to the first hardware satisfying the initial condition when running the target program, the network time is stored based on at least one time variable, and then a judgment result is determined based on the network time and the time variable, wherein the judgment result is used to indicate whether an abnormality occurs in the first hardware during the running of the target program, and then the first hardware is processed based on the judgment result. Thus, the time variable can be monitored based on the network time, and then it can be determined that an abnormality occurs in the first hardware during the running of the target program, such as a fault problem of interrupt time overflow. By timely monitoring and processing of abnormalities, faults can be discovered and resolved in a timely manner, thereby improving the performance of the hardware.

[0130] The specific implementation of the above operations can be found in the previous embodiments, which will not be described in detail here.

[0131] A person of ordinary skill in the art will appreciate that all or part of the steps in the various methods of the above embodiments may be completed by instructions, or by controlling related hardware through instructions. The instructions may be stored in a computer-readable storage medium and loaded and executed by a processor.

[0132] To this end, the present disclosure provides a computer-readable storage medium, on which a computer program is stored. The computer program can be loaded by a processor to execute the steps in any one of the exception handling methods provided by the present disclosure.

[0133] The specific implementation of the above operations can be found in the previous embodiments, which will not be described in detail here.

[0134] The computer-readable storage medium may include: a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk, etc.

[0135] Since the instructions stored in the computer-readable storage medium can execute the steps in any one of the exception handling methods provided in the present disclosure, the beneficial effects that can be achieved by any one of the exception handling methods provided in the present disclosure can be achieved. Please refer to the previous embodiments for details and will not be repeated here.

[0136] The above is a detailed introduction to an exception handling method, device, electronic device and computer-readable storage medium provided by the present disclosure. Specific examples are used herein to illustrate the principles and implementation methods of the present invention. The description of the above embodiments is only used to help understand the method of the present invention and its core idea. At the same time, for those skilled in the art, according to the idea of ​​the present invention, there will be changes in the specific implementation method and application scope. In summary, the content of this specification should not be understood as a limitation on the present invention.

Claims

1. An exception handling method, characterized in that: include: In response to the first hardware satisfying an initial condition when running the target program, storing the network time based on at least one time variable; Determine a judgment result based on the network time and the time variable, wherein the judgment result is used to indicate whether an abnormality occurs in the first hardware during the process of running the target program; Based on the determination result, the first hardware is processed.

2. The method according to claim 1, characterized in that: The determining of the judgment result based on the network time and the time variable includes: Determine at least one actual duration corresponding to the time variable according to the network time; If, among at least one actual duration corresponding to any time variable, N actual durations do not match the reference duration corresponding to any time variable, determine that the number of errors corresponding to any time variable is N, where N is a positive number; When the number of errors corresponding to any time variable is greater than a first threshold, the judgment result is determined to be abnormal.

3. The method according to claim 1, characterized in that In response to the first hardware satisfying the initial condition when running the target program, the method comprises: Running the target program based on the first hardware; Timing the running time of the target listening event in the target program to obtain the target running time; When the target running time is greater than the second threshold, it is determined that the initial condition is met.

4. The method according to claim 3, characterized in that The timing of the interruption running time of the target monitoring event in the target program to obtain the target running time includes: Based on a preset counter, the running time of the current loop interruption and the speed loop interruption in the target program is timed to obtain the cumulative running time of the current loop interruption and the speed loop interruption; The accumulated running time is determined as the target running time.

5. The method according to claim 1, characterized in that The storing of the network time based on at least one time variable comprises: determining at least one time variable associated with the target program; Based on the time variable, determining each first moment to be recorded; The network time corresponding to each first moment is obtained.

6. The method according to claim 5, characterized in that The obtaining of the network time corresponding to each first moment includes: Based on a wireless network module connected to the first hardware, the network time corresponding to each first moment is read from the target network address.

7. The method according to claim 1, characterized in that The processing of the first hardware based on the determination result includes: When the judgment result indicates that an abnormality occurs in the first hardware during the running of the target program, a fault display is performed, and the target program in the first hardware is upgraded online.

8. An exception handling device, characterized in that: include: A storage module, configured to store the network time based on at least one time variable in response to the first hardware satisfying an initial condition when running the target program; A determination module, used to determine a judgment result based on the network time and the time variable, wherein the judgment result is used to indicate whether an abnormality occurs in the first hardware during the process of running the target program; A processing module is used to process the first hardware based on the judgment result.

9. An electronic device, characterized in that: The method comprises a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the steps in the method according to any one of claims 1 to 7 when executing the computer program.

10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the steps in the method according to any one of claims 1 to 7 are implemented.