Service processing method and device and electronic equipment

By obtaining system logs in electronic devices and inputting them into machine learning models, predicting and processing services that will occur, the normal operation problem caused by service crashes in electronic devices is solved, and the prediction and processing of service exceptions are realized, ensuring the stable operation of the device.

CN119537072APending Publication Date: 2025-02-28GUANGDONG OPPO MOBILE TELECOMMUNICATIONS CORP LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411513895.9
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-10-28
Publication Date
2025-02-28

AI Technical Summary

Technical Problem

With the increasing enrichment and diversification of electronic equipment functions, the number and complexity of services have increased, resulting in different services collaborating with each other during operation, but there are also potential risks. When a service crashes, a series of problems may arise, which will seriously affect the normal operation of electronic equipment.

Method used

By obtaining the system logs in the electronic device, inputting them into the trained machine learning model, predicting services that will appear, and processing them to avoid the exception.

Benefits of technology

By predicting that services that are about to occur, they can be processed in a timely manner, thereby avoiding service abnormalities and ensuring the normal operation of electronic equipment.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119537072A_ABST
    Figure CN119537072A_ABST
Patent Text Reader

Abstract

The embodiment of the invention discloses a service processing method and device and electronic equipment, and the method comprises the steps: inputting a system log into a trained machine learning model after the system log in the electronic equipment is obtained, so as to obtain a to-be-abnormal service through the machine learning model; and processing the service which is about to be abnormal so as to avoid the occurrence of the abnormity. Therefore, in the mode, under the condition that the system log is obtained and the system log comprises the logs of the multiple services, the system log can be processed through the trained machine learning model, the service which is about to be abnormal can be predicted, the service which is about to be abnormal can be processed in time, and the service processing efficiency is improved. Therefore, the service is prevented from being abnormal.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of computer technology, and more specifically, to a service processing method, device and electronic device. Background Art

[0002] In electronic devices, a variety of services are usually running. These services range from basic system operation functions, such as power management and network connection, to complex application-related services, such as multimedia playback, social software background running, and services that various tool software rely on.

[0003] As the functions of electronic devices become increasingly rich and diverse, the number and complexity of services are also increasing. Different services cooperate with each other during operation, but there are also potential risks. When one of the services crashes, it may cause a series of problems, which in turn has a serious impact on the normal operation of electronic devices. Summary of the invention

[0004] In view of the above problems, the present application proposes a service processing method, device and electronic device to improve the above problems.

[0005] In a first aspect, the present application provides a service processing method, the method comprising: obtaining a system log in an electronic device, the system log comprising logs of multiple services; inputting the system log into a trained machine learning model to obtain services that are about to become abnormal through the machine learning model, the trained machine learning model being used to predict services that are about to become abnormal based on the input log; and processing the services that are about to become abnormal to avoid the occurrence of the abnormality.

[0006] In a second aspect, the present application provides a service processing device, comprising: a log acquisition unit, used to acquire a system log in an electronic device, wherein the system log includes logs of multiple services; a service prediction unit, used to input the system log into a trained machine learning model to obtain a service that is about to become abnormal through the machine learning model, and the trained machine learning model is used to predict a service that is about to become abnormal based on the input log; and a service processing unit, used to process the service that is about to become abnormal to avoid the occurrence of the abnormality.

[0007] In a third aspect, the present application provides an electronic device, which includes at least a processor and a memory; one or more programs are stored in the memory and configured to be executed by the processor to implement the above method.

[0008] In a fourth aspect, the present application provides a computer-readable storage medium, in which program code is stored, wherein the above method is executed when the program code is executed by a processor.

[0009] The present application proposes a service processing method, device and electronic device, in which after obtaining the system log in the electronic device, the system log can be input into a trained machine learning model, so as to obtain the service that is about to have an abnormality through the machine learning model, and process the service that is about to have an abnormality to avoid the abnormality. Thus, through the above method, when the system log is obtained and the system log includes logs of multiple services, the system log can be processed by the trained machine learning model, and then the service that is about to have an abnormality can be predicted, and the service that is about to have an abnormality can be processed in time, so as to avoid the abnormality of the service. BRIEF DESCRIPTION OF THE DRAWINGS

[0010] In order to more clearly illustrate the technical solutions in the embodiments of the present application, 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 application. For those skilled in the art, other drawings can be obtained based on these drawings without creative work.

[0011] Figure 1 A schematic diagram showing an application scenario proposed in an embodiment of the present application is shown;

[0012] Figure 2 A schematic diagram showing another application scenario proposed in an embodiment of the present application;

[0013] Figure 3 A flow chart of a service processing method provided by an embodiment of the present application is shown;

[0014] Figure 4 A schematic diagram showing the training process of the machine learning model in an embodiment of the present application is shown;

[0015] Figure 5 A flow chart showing a service processing method provided by another embodiment of the present application is shown;

[0016] Figure 6 A flow chart showing a service processing method provided by another embodiment of the present application is shown;

[0017] Figure 7 A flow chart showing a service processing method provided by another embodiment of the present application is shown;

[0018] Figure 8 A schematic diagram of filtering system logs in an embodiment of the present application is shown;

[0019] Fig. 9 A structural block diagram of a service processing device proposed in an embodiment of the present application is shown;

[0020] Fig.10 A structural block diagram of an electronic device for executing a service processing method according to an embodiment of the present application is shown;

[0021] Fig.11 It is a storage unit of an embodiment of the present application for storing or carrying program codes for implementing the service processing method according to an embodiment of the present application. DETAILED DESCRIPTION

[0022] The following will be combined with the drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.

[0023] In electronic devices, a variety of services are usually running, which form the cornerstone of the device's functional operation. They not only cover the most basic system operation functions, such as power management, network connection, memory allocation and recycling, file system management, etc., to ensure that the device can stably start, continuously power supply and communicate smoothly with the outside world, but also extend to more complex application-related services. These services include but are not limited to multimedia playback services, which allow us to enjoy rich entertainment content such as music and videos; social software background running services, which maintain our online status, receive and push messages in real time, and promote instant communication between people; and services that various tool software rely on, such as automatic saving and cloud synchronization services of office software, positioning and navigation services of map applications, etc., which greatly improve the convenience of our work and life.

[0024] With the rapid development of electronic equipment technology, its functions are becoming increasingly rich and diverse, and the number and complexity of services are also showing explosive growth. From simple task scheduling to complex concurrent processing, from single data storage to distributed data synchronization, the interaction between services has become more frequent and in-depth. Different services collaborate with each other during operation to jointly support the various functions of electronic devices. However, this close collaboration also means an increase in potential risks. When one of the services is abnormal (for example, crashes), it may have a serious impact on the normal operation of the electronic device.

[0025] Therefore, the inventors proposed the service processing method, device and electronic device in the present application. In this method, after obtaining the system log in the electronic device, the system log can be input into the trained machine learning model to obtain the service that is about to have an abnormality through the machine learning model, and the service that is about to have an abnormality can be processed to avoid the abnormality. Therefore, through the above method, when the system log is obtained and the system log includes logs of multiple services, the system log can be processed by the trained machine learning model, and then the service that is about to have an abnormality can be predicted, and the service that is about to have an abnormality can be processed in time, so as to avoid the abnormality of the service.

[0026] Before further describing the embodiments of the present application in detail, an application environment involved in the embodiments of the present application is introduced.

[0027] The following first introduces the application scenarios involved in the embodiments of the present application.

[0028] In the embodiment of the present application, the service processing method provided can be executed by an electronic device. In this way, all steps in the service processing method provided by the embodiment of the present application can be executed by the electronic device. For example, Figure 1 As shown, in the case where all steps in the service processing method provided in the embodiment of the present application can be executed by an electronic device, all steps can be executed by the processor of the electronic device 100.

[0029] Furthermore, the service processing method provided in the embodiment of the present application can also be executed by a server. Correspondingly, in this mode of execution by the server, the server can start executing the steps in the service processing method provided in the embodiment of the present application in response to a trigger instruction. The trigger instruction can be sent by an electronic device used by the user, or can be triggered locally by the server in response to some automation events.

[0030] In addition, if Figure 2 As shown, the service processing method provided by the embodiment of the present application can also be executed collaboratively by an electronic device and a server. In this manner of collaborative execution by an electronic device and a server, some steps in the service processing method provided by the embodiment of the present application are executed by the electronic device, while the other steps are executed by the server. Exemplarily, taking the service processing method as an example, the electronic device 100 can execute the service processing method including: obtaining a system log in the electronic device. Afterwards, the electronic device 100 transmits the system log to the server 200, and then the server 200 executes subsequent steps to obtain the service that is about to have an abnormality, and returns the service that is about to have an abnormality to the electronic device 100, so that the electronic device 100 processes the service that is about to have an abnormality to avoid the abnormality.

[0031] It should be noted that in this method of collaborative execution by the electronic device and the server, the steps respectively executed by the electronic device and the server are not limited to the methods introduced in the above examples. In actual applications, the steps respectively executed by the electronic device and the server can be dynamically adjusted according to actual conditions.

[0032] It should be noted that the electronic device 100 is Figure 1 and Figure 2 In addition to the smartphone shown in , it can also be a tablet computer, a smart watch, smart glasses and other devices. Server 200 can be an independent physical server, or it can be a server cluster or a distributed system composed of multiple physical servers. Among them, in the case where the service processing method provided in the embodiment of the present application is executed by a server cluster or a distributed system composed of multiple physical servers, different steps in the service processing method can be executed by different physical servers respectively, or can be executed in a distributed manner by a server built based on a distributed system.

[0033] The embodiments of the present application will be described in detail below with reference to the accompanying drawings.

[0034] See also Figure 3 , a service processing method provided in an embodiment of the present application includes:

[0035] S110: Obtain a system log in the electronic device, where the system log includes logs of multiple services.

[0036] In an embodiment of the present application, the system log may include logs of multiple services. Wherein, a service may also be understood as a program in an electronic device, which may be a system program or an application program. Wherein, the service log records various information generated by the service (program) during operation. For example, it may include the start time, start parameters, shutdown time and shutdown reason of the service, etc., and may also include key steps and states of the service during operation, such as user interaction, data processing and background services, etc., and may also include exceptions and error information that appear in the service, including exception types, error codes, error descriptions and stack traces, etc., and may also record performance data of the service, such as response time, loading time and resource usage, etc., and may also record the user's interactive behavior in the service, such as clicks, slides and inputs, etc., and may also record the network requests issued by the service and the response information received, including the requested URL (Uniform Resource Locator), request parameters, response results and response time, etc.

[0037] In addition, the system log may also include logs related to the operating system. Among them, the logs related to the operating system record various events and status information at the operating system level. Optionally, it may include the startup and shutdown time of the operating system, as well as the key steps and status in the startup process. It may also include the startup, operation and stop of system processes and services, as well as the interaction and communication between them. It may also include the usage of system resources such as CPU, memory, storage, including usage rate, peak value and average value, etc. It may also include network connection status, network usage, and detailed information of network requests and responses. It may also include errors and warning information, including error codes, error descriptions and occurrence times, etc. It may also include security-related events, such as malware detection, permission requests and authorizations, etc.

[0038] In the embodiment of the present application, one reason for obtaining logs of multiple services is to predict the service that will have an abnormality by obtaining the relationship between the multiple services. The relationship between the multiple services may include mutual dependence (for example, the operation of one service may depend on the data obtained by another service during the operation), etc.

[0039] S120: Input the system log into the trained machine learning model to obtain the service that is about to become abnormal through the machine learning model, and the trained machine learning model is used to predict the service that is about to become abnormal based on the input log.

[0040] In an embodiment of the present application, the trained machine learning model has the function of outputting a service that is about to become abnormal based on an input system log. In this case, after the system log of the electronic device is collected, the system log can be input into the trained machine learning model to obtain the service that is about to become abnormal.

[0041] In the application embodiment, the machine learning model to be trained can be trained by training data to obtain a trained machine learning model. Optionally, relevant logs before and after the service crash in the system can be collected, and some logs of the service in normal operation can be added, and the two can be combined in proportion to obtain training data.

[0042] Optionally, after collecting the logs, the collected logs can be preprocessed first, and then the preprocessed logs can be used as training data. Preprocessing the collected logs can include steps such as data cleaning, format conversion, and feature extraction. Data cleaning aims to remove invalid, redundant, or erroneous data to ensure the quality of data input into the machine learning model. Format conversion converts log data into a format suitable for processing by the machine learning model, such as numeric or text data. Feature extraction extracts feature information from log data that is useful for predicting abnormal services, such as timestamps, event types, error codes, etc.

[0043] For example, the model training process involved in the embodiments of the present application can be as follows: Figure 4 As shown, the machine learning model to be trained may include an input layer, multiple hidden layers, and an output layer. Optionally, the classification activation function softmax can be used as the output layer. The output layer can output an array of size m+1, where each element in the array represents the probability that the corresponding service may be abnormal. In addition to these services, there is also a normal state, in which the system runs normally and there is no service that will be abnormal. The sum of all these probabilities is 1, and the model will select the identifier of the service with the highest probability as the output.

[0044] After the system log is input into the trained machine learning model, the trained machine learning model can output the probability of each service in the electronic device being abnormal and the probability of the system being normal based on the input system log. Among them, a normal system indicates that there is no service that is about to be abnormal. In this case, the trained machine learning model can select the service with the highest probability of being abnormal for output.

[0045] S130: Process the service that is about to become abnormal to avoid the abnormality.

[0046] In the embodiment of the present application, the service that is about to have an abnormality can be understood as a service that has not yet had an abnormality, but may have an abnormality. In this case, the service that is about to have an abnormality is processed, and then it can be processed in time before the service that is about to have an abnormality actually has an abnormality, so as to avoid the service actually having an abnormality.

[0047] It should be noted that in the embodiments of the present application, there may be multiple types of exceptions that may occur in the service. For example, the types of exceptions may include crashes, memory leaks, and deadlocks. Among them, the crash of a service can be understood as the sudden interruption or cessation of the service during execution, resulting in the inability to use the service normally. Among them, a memory leak refers to a situation where the service cannot release the memory used by the service after applying for memory. When a service continuously allocates memory but does not correctly release memory that is no longer in use, the available memory will gradually decrease as the service runs. Among them, deadlock refers to a phenomenon in which two or more services wait for each other due to competition for resources during execution in a multi-process or multi-threaded environment.

[0048] Among them, for services that are about to become abnormal, targeted processing can be performed according to the type of abnormal situation that is about to occur. For example, if a service is predicted to crash, the service that is about to crash can be restarted in advance to avoid the service crashing. Among them, the crash of the service may be caused by a variety of reasons. When it is predicted that the service is about to crash, one of the reasons for restarting is that restarting the service can clean up the state (for example, all states accumulated during the operation of the service can be cleared, including data in memory, file locks, network connections, etc., which helps to solve crashes caused by inconsistent states or resource occupation), release occupied resources, reload code, and fix possible temporary errors, so that the service can resume normal operation.

[0049] Exemplarily, the electronic device includes service 1, service 2, service 3, and service 4. After the logs of service 1, service 2, service 3, and service 4 are input into the trained machine learning model, the trained machine learning model can obtain the probability of abnormality of each of service 1, service 2, service 3, and service 4. Exemplarily, as shown in the following table:

[0050] ID Logo Probability 1 Serves 1 a% 2 Serves 2 b% 3 Serves 3 c% 4 Serves 4 d% 5 normal e%

[0051] As shown in the table above, the probability of each service being abnormal is shown. Among them, "normal" represents the probability that no service in the system will be abnormal. Among them, if c% is the largest, the machine model will output service 3, and then it can be determined that service 3 is the service that will be abnormal.

[0052] As a method, the trained machine learning model can only predict one type of abnormality. In this case, the abnormality category of the service that is about to be abnormal output by the machine learning model is relatively clear. For example, if the machine learning model can predict the service that is about to crash, then the service that is about to be abnormal output by the machine learning model can be understood as the service that is about to crash. For another example, if the machine learning model can predict the service that is about to have a memory leak, then the service that is about to be abnormal output by the machine learning model can be understood as the service that is about to have a memory leak.

[0053] As a method, the trained machine learning model can predict multiple types of abnormalities. In this case, after the trained machine learning model outputs the service that is about to have an abnormality, the electronic device can detect the specific abnormality type of the service that is about to have an abnormality based on the operation status of the service that is about to have an abnormality. The operation status may include the resource usage of the service, the interaction between the service and other services, etc.

[0054] As a method, the trained machine learning model can predict multiple types of anomalies. In this case, in addition to outputting the service that is about to have an anomaly, the trained machine learning model can also output the specific type of the anomaly that is about to occur in the service. The type can be a crash, memory leak, or deadlock. In this way, the service that is about to have an anomaly can be processed in a targeted manner.

[0055] This embodiment proposes a service processing method, in which after obtaining the system log in the electronic device, the system log can be input into a trained machine learning model, so as to obtain the service that is about to have an abnormality through the machine learning model, and process the service that is about to have an abnormality to avoid the abnormality. Thus, through the above method, when the system log is obtained and the system log includes logs of multiple services, the system log can be processed by the trained machine learning model, and then the service that is about to have an abnormality can be predicted, and the service that is about to have an abnormality can be processed in time, so as to avoid the abnormality of the service.

[0056] See also Figure 5 , a service processing method provided in an embodiment of the present application includes:

[0057] S210: Obtain a system log in the electronic device, where the system log includes logs of multiple services.

[0058] S220: Input the system log into the trained machine learning model to obtain the service that is about to crash through the machine learning model, and the trained machine learning model is used to predict the service that is about to crash based on the input log.

[0059] S230: Restart the service that is about to crash, so as to avoid the service that is about to crash from crashing.

[0060] It should be noted that after detecting that a service is about to crash, it may not be appropriate to restart the service immediately. This is because the system resources of the electronic device will be occupied during the service restart process. Therefore, as a method, before restarting the service that is about to crash, it can also include: detecting whether the service processing conditions are currently met, and if the service processing conditions are met, restarting the service that is about to crash to avoid the crash of the service that is about to crash.

[0061] Optionally, the service processing condition may include at least one of the following conditions: the electronic device is not currently in a busy state; it is currently in a preset time period; and an instruction to agree to restart triggered by the target user is detected. It should be noted that when the electronic device is in a busy state, restarting will increase the resource burden of the electronic device. Therefore, choosing to restart the electronic device when it is not in a busy state (for example, in an idle state) is conducive to avoiding a large resource burden. Among them, the preset time period can represent a time period when the user does not frequently use the electronic device. Among them, in some cases, during the service restart process, the service may be in an unavailable state. Therefore, restarting the service may affect the user's use of the service (the service to be restarted). In this case, a prompt message can be sent to ask the user whether to agree to restart. If the user agrees (for example, the user clicks on the control representing the consent), it is determined that the instruction to agree to restart triggered by the target user is detected. Among them, the target user can be understood as a user who is currently using the electronic device, or as a user with a pre-set specific identity.

[0062] In the embodiment of the present application, there are multiple ways to detect the busy state and the idle state.

[0063] As a method, if at least one of the following conditions is detected, it is determined that the electronic device is currently in a busy state; the usage rate of each processor of the electronic device is greater than the usage threshold; the available memory of the electronic device is less than the memory threshold; the number of active processes in the electronic device is greater than a preset number; and the frequency of touch operations detected by the electronic device is greater than a preset frequency.

[0064] As another way, whether the electronic device is in a busy state or an idle state can be determined according to the current time period. It should be noted that the operation of the electronic device every day may have certain regularities. For example, the electronic device may run more services in a certain fixed time period every day, and fewer services in some time periods.

[0065] Optionally, in an embodiment of the present application, time can be divided into an idle time period and a busy time period based on the operation of the electronic device. The idle time period can be understood as a time period when the electronic device needs to run relatively fewer services, and the busy time period can be understood as a time period when the electronic device needs to run relatively more services.

[0066] In the embodiment of the present application, the idle time period and the busy time period can be divided according to the historical operation status of the electronic device.

[0067] As one approach, the idle time period and the busy time period may be divided according to the number of services run by the electronic device.

[0068] Optionally, multiple time periods may be pre-divided, and then the number of services running in each time period is counted, and each time period is further divided into an idle time period or a busy time period according to the number of services running in each time period. For example, a time period in which the number of services running is less than a first number threshold may be determined as an idle time period, and a time period in which the number of services running is not less than the first number threshold may be determined as a busy time period.

[0069] The length of each pre-divided time period may be of various types, for example, the length of each time period may be 1 hour, 2 hours, or 3 hours.

[0070] Optionally, the time period can be divided by counting the running conditions of the services in the electronic device, and it can be simultaneously determined whether the divided time period is an idle time period or a busy time period. In this way, the moment when the number of running services changes compared to the first number threshold can be used as the moment when the idle time period and the busy time period intersect. After the electronic device is started, the number of currently running services can be detected, and the moment of startup can be used as the starting time of the idle time period. If it is detected that the number of running services is greater than the first number threshold, the moment when the number of services is detected to be greater than the first number threshold can be used as the starting time of the busy time period, and the starting time is also the end time of an idle time period before the busy time period. If it is detected that the number of running services is greater than the first number threshold, it is detected that the number of services is not greater than the first number threshold, the moment when the number of services is detected to be less than the first number threshold will be used as the end time of the current busy time period, and the end time is also the start time of a new idle time period entered. In this way, the electronic device does not need to divide multiple time periods in advance, and thus has better flexibility.

[0071] Optionally, the time period can be divided by counting the occupancy of the processor in the electronic device, and synchronously determining whether the divided time period is an idle time period or a busy time period. In this way, the moment when the current occupancy of the processor changes compared to the first occupancy threshold can be used as the moment when the idle time period and the busy time period intersect. Among them, after the electronic device is started, the current occupancy of the processor can be detected, and the moment of startup can be used as the starting moment of the idle time period. If the occupancy of the processor is detected to be greater than the first occupancy threshold, the moment when the occupancy is detected to be greater than the first occupancy threshold can be used as the starting moment of the busy time period, and the starting moment is also the end moment of an idle time period before the busy time period. If after detecting that the occupancy is greater than the first occupancy threshold, it is detected that the occupancy is not greater than the first occupancy threshold, the moment when the occupancy is detected to be less than the first occupancy threshold will be used as the end moment of the current busy time period, and the end moment is also the start moment of a new idle time period entered.

[0072] In the case where there are multiple ways to divide the idle time period and the busy time period, the electronic device can flexibly determine which division method is currently used.

[0073] As a determination method, the user of the electronic device may determine the specific method of dividing the idle time period and the busy time period. As another method, the electronic device may determine the specific method of dividing the idle time period and the busy time period according to actual conditions.

[0074] Optionally, the method of dividing the idle time period and the busy time period may be determined according to the total running time of the electronic device after the electronic device is first started. Moreover, different division methods may result in different idle time periods and busy time periods.

[0075] It should be noted that in the early stage of using electronic devices, the user's program usage habits are relatively unstable. If the time periods are directly divided by counting the operation status of the services in the electronic devices, and the divided time periods are simultaneously determined to be idle time periods or busy time periods, the divided idle time periods and busy time periods may be inaccurate. Correspondingly, after the user has used the electronic device for a period of time, the operation rules of the programs in the electronic device will be relatively fixed. In this case, it will be relatively more accurate to divide the idle time periods or busy time periods in real time based on the operation status.

[0076] Furthermore, when the total running time of the electronic device after the first startup is less than the first specified time, multiple time periods can be pre-divided, and then the number of services running in each time period can be counted, and then each time period can be divided into an idle time period or a busy time period according to the number of services running in each time period. Correspondingly, when the total running time of the electronic device after the first startup is not less than the first specified time, the time period can be divided by counting the running status of the program in the electronic device, and simultaneously determining whether the divided time period is an idle time period or a busy time period.

[0077] It should be noted that this embodiment only uses crash as an exception category to illustrate the process involving service processing conditions. For other exception categories, it is also applicable to first detect the service processing conditions, and then process them when it is detected that the service processing conditions are met. For example, before processing a service that is about to have an exception, it can be detected whether the service processing conditions are currently met. If the service processing conditions are met, the service that is about to have an exception is processed to avoid the exception.

[0078] In addition, it should be noted that for services waiting to meet service processing conditions, since they have not been processed, they may still be output by the machine learning model as services that are about to become abnormal. As a way, after obtaining the service that is about to become abnormal output by the machine learning model, the electronic device can detect whether the output service that is about to become abnormal is among the services currently waiting to be processed. If so, the output service that is about to become abnormal is ignored.

[0079] This embodiment proposes a service processing method, in which after obtaining the system log in the electronic device, the system log can be input into a trained machine learning model, so as to obtain the service that is about to crash through the machine learning model, and process the service that is about to crash to avoid the crash. Thus, through the above method, when the system log is obtained and the system log includes logs of multiple services, the system log can be processed by the trained machine learning model, and then the service that is about to crash can be predicted, and the service that is about to crash can be restarted in time, so as to avoid the crash of the service.

[0080] See also Figure 6 , a service processing method provided in an embodiment of the present application includes:

[0081] S310: Obtain a system log in the electronic device, where the system log includes logs of multiple services.

[0082] S320: Input the system log into the trained machine learning model to obtain the service that is about to become abnormal through the machine learning model. The trained machine learning model is used to predict the service that is about to become abnormal based on the input log.

[0083] S330: If there are multiple services that are about to become abnormal, sort the multiple services that are about to become abnormal to obtain a sorting result.

[0084] In the embodiment of the present application, multiple services that are about to become abnormal may be generated in various situations.

[0085] In one case, the machine learning model may output multiple services that are about to become abnormal. In this case, the trained machine learning model can simultaneously output multiple services that are about to become abnormal. Exemplarily, after obtaining the probability that multiple services in the electronic device are about to become abnormal, the trained machine learning model can output multiple services with the highest probability.

[0086] In one case, the machine learning model outputs only one service that is about to become abnormal each time. However, based on the above content, it can be known that the electronic device may start processing the service that is about to become abnormal only when it detects that the service processing conditions are met. Therefore, it is possible that the machine learning model outputs another service that is about to become abnormal before the previously output service that is about to become abnormal has been processed. In this case, there will be multiple services that are about to become abnormal.

[0087] S340: Based on the order represented by the sorting result, sequentially process a plurality of services that are about to become abnormal.

[0088] Optionally, sorting the multiple services that are about to have an abnormality may include: sorting the multiple services that are about to have an abnormality according to the importance of each of the multiple services that are about to have an abnormality. Optionally, the importance of the service may be determined based on reference information of the service, and the reference information may include: at least one of the degree of association between the service that is about to have an abnormality and other services, the operating time of the service that is about to have an abnormality, and the operating frequency of the service that is about to have an abnormality.

[0089] It should be noted that some services may have more associations with other services. For example, some services may have more information interactions, and some services may have dependencies on each other in terms of function implementation. In the embodiments of the present application, there may be multiple ways to determine whether two services have an association relationship.

[0090] As a method, the electronic device can make a determination based on the actual operation of the included services. It should be noted that two or more services with an associated relationship may be in a state of co-operation for a period of time. In this way, the electronic device can count the running time of the services to determine the time period when each service is in operation, so as to obtain services that have had a common running time, and then determine multiple services whose co-operation time is greater than the threshold time as services with an associated relationship.

[0091] Exemplarily, the common operation time obtained by counting the electronic devices may be shown in the following table:

[0092] ID Service Logo 1 Service Logo 2 Co-operation time 1 Service A1 Service A2 T1 2 Service A1 Service A3 T2 3 Service A2 Service A3 T3

[0093] As shown in the figure above, in the statistical results, the duration of service A1 and service A2 running together is T1, the duration of service A1 and service A3 running together is T2, and the duration of service A2 and service A3 running together is T3. If T3 is greater than the threshold duration, it can be determined that service A2 and service A3 are associated with each other.

[0094] In this way, the longer the two services run together, the greater the degree of association between the two services.

[0095] As a way, whether there is an association relationship between two services can be determined based on the functions of the services. It should be noted that for some services, their corresponding functions may have a certain association with each other. For example, shopping services and price comparison services can complement each other, the former providing commodity purchase services, and the latter helping users find the lowest price. For another example, e-book reading services and note-taking services can work together, the former for reading e-books, and the latter for recording notes and ideas. For another example, music playback services and music production services can complement each other, the former for listening to songs, and the latter for creating music. In this case, the electronic device can determine the function of the service based on the name of the service or the package name, and then determine whether the services are associated based on the pre-established relationships between multiple functions.

[0096] In this way, the degree of association between two services can be determined based on the degree of complementarity of the functions of the two services.

[0097] The running time and running frequency of a service reflect the user's demand for the service to a certain extent. If the running time of a service is longer or the running frequency is higher, it means that the user is more concerned about the service, so the service with a longer running time or a higher running frequency can be ranked relatively higher.

[0098] This embodiment proposes a service processing method, so that through the above method, when a system log is obtained and the system log includes logs of multiple services, the system log can be processed through the trained machine learning model, and then the service that is about to have an abnormality is predicted, and the service that is about to have an abnormality is processed in time, so as to avoid the abnormality of the service. In addition, in this embodiment, if there are multiple services predicted to have an abnormality, the multiple services predicted to have an abnormality will be sorted, and then processed in sequence according to the sorting results.

[0099] See also Figure 7 , a service processing method provided in an embodiment of the present application includes:

[0100] S410: Obtain a system log in the electronic device, where the system log includes logs of multiple services.

[0101] S420: Filter the system log based on preset content to obtain a filtered system log.

[0102] In the embodiment of the present application, filtering the system log based on the preset content can be understood as filtering out the content related to the preset content in the system log to obtain the filtered system log. Alternatively, filtering the system log based on the preset content can be understood as retaining the content related to the preset content in the system log to use the retained content as the filtered system log.

[0103] Optionally, the electronic device may filter the system log by using a Grep method.

[0104] S430: Input the filtered system log into the trained machine learning model to obtain the service that is about to become abnormal through the machine learning model. The trained machine learning model is used to predict the service that is about to become abnormal based on the input log.

[0105] S440: Process the service that is about to become abnormal to avoid the abnormality.

[0106] For example, Figure 8 As shown, after obtaining the system log, the obtained system log can be filtered by preset keywords (preset content). Finally, the service X output by the machine learning model can be understood as a service that is about to become abnormal.

[0107] This embodiment proposes a service processing method, so that the service that is about to become abnormal can be processed in time through the above method, so as to avoid the abnormality of the service. In addition, in the embodiment of the present application, the obtained system log will be filtered based on the preset content first, so that the system log can be streamlined to filter out some logs with low relevance, so that the machine learning model can more accurately predict the service that is about to become abnormal.

[0108] In an embodiment of the present application, after obtaining the output of the machine learning model for the service that is about to become abnormal, the log of the service that is about to become abnormal can also be recorded to provide early warning to the management personnel.

[0109] See also Fig. 9 , an embodiment of the present application provides a service processing device 500, the device 500 comprising:

[0110] The log acquisition unit 510 is used to acquire the system log in the electronic device, where the system log includes logs of multiple services;

[0111] A service prediction unit 520, configured to input the system log into a trained machine learning model to obtain a service that is about to become abnormal through the machine learning model, wherein the trained machine learning model is used to predict a service that is about to become abnormal based on the input log;

[0112] The service processing unit 530 is used to process the service that is about to have an exception to avoid the exception.

[0113] As a mode, the abnormality includes a crash. In this mode, the service processing unit 530 is specifically used to restart the service that is about to crash, so as to avoid the crash of the service that is about to crash.

[0114] Optionally, the service processing unit 530 is further specifically configured to detect whether a service processing condition is currently satisfied. If the service processing condition is satisfied, the service that is about to crash is restarted to avoid crashing of the service that is about to crash.

[0115] Optionally, the service processing unit 530 is further specifically used to determine that the electronic device is currently in a busy state if it is detected that at least one of the following conditions is met: the usage rate of each processor of the electronic device is greater than a usage threshold; the available memory of the electronic device is less than a memory threshold; the number of active processes in the electronic device is greater than a preset number; and the frequency of touch operations detected by the electronic device is greater than a preset frequency.

[0116] Optionally, the service processing unit 530 is specifically used to sort the multiple services that are about to have an exception to obtain a sorting result if there are multiple services that are about to have an exception; and process the multiple services that are about to have an exception in sequence based on the order represented by the sorting result.

[0117] Optionally, the service processing unit 530 is specifically used to sort multiple services that are about to experience abnormalities according to their respective importance levels, wherein the importance levels are determined based on reference information of the services that are about to experience abnormalities, and the reference information includes: at least one of the degree of association between the services that are about to experience abnormalities and other services, the operating duration of the services that are about to experience abnormalities, and the operating frequency of the services that are about to experience abnormalities.

[0118] This embodiment proposes a service processing device, so that through the above device, when a system log is obtained and the system log includes logs of multiple services, the system log can be processed by a trained machine learning model, and then the service that is about to have an abnormality can be predicted, and the service that is about to have an abnormality can be processed in time, so as to avoid service abnormalities.

[0119] The following will be combined Fig.10 An electronic device provided by the present application is described.

[0120] See also Fig.10Based on the above service processing method and device, the embodiment of the present application also provides an electronic device 1000 that can execute the above service processing method. The electronic device 1000 includes one or more (only one is shown in the figure) processors 105, a memory 104, an audio playback module 106 and an audio acquisition device 108 that are coupled to each other. Among them, the memory 104 stores a program that can execute the content of the above embodiment, and the processor 105 can execute the program stored in the memory 104.

[0121] Among them, the processor 105 may include one or more processing cores. The processor 105 uses various interfaces and lines to connect various parts of the entire electronic device 1000, and executes various functions and processes data of the electronic device 1000 by running or executing instructions, programs, code sets or instruction sets stored in the memory 104, and calling data stored in the memory 104. Optionally, the processor 105 can be implemented in at least one hardware form of digital signal processing (Digital Signal Processing, DSP), field programmable gate array (Field-Programmable Gate Array, FPGA), and programmable logic array (Programmable Logic Array, PLA). The processor 105 can integrate one or a combination of a central processing unit (Central Processing Unit, CPU), a graphics processing unit (Graphics Processing Unit, GPU) and a modem. Among them, the CPU mainly processes the operating system, user interface and application programs; the GPU is responsible for rendering and drawing display content; and the modem is used to process wireless communications. It can be understood that the above-mentioned modem may not be integrated into the processor 105, but may be implemented separately through a communication chip.

[0122] The memory 104 may include a random access memory (RAM) or a read-only memory (ROM). The memory 104 may be used to store instructions, programs, codes, code sets or instruction sets. The memory 104 may include a program storage area and a data storage area, wherein the program storage area may store instructions for implementing an operating system, instructions for implementing at least one function (such as a touch function, a sound playback function, an image playback function, etc.), instructions for implementing the following various method embodiments, etc.

[0123] Furthermore, in addition to the aforementioned components, the electronic device 1000 may further include a network module 110 and a sensor module 112 .

[0124] The network module 110 is used to realize information interaction between the electronic device 1000 and other devices. For example, a connection can be established with other audio playback devices or other electronic devices, and information interaction is performed based on the established connection. As a way, the network module 110 of the electronic device 1000 is a radio frequency module, which is used to receive and send electromagnetic waves, realize the mutual conversion of electromagnetic waves and electrical signals, and thus communicate with a communication network or other devices. The radio frequency module may include various existing circuit elements for performing these functions, such as antennas, radio frequency transceivers, digital signal processors, encryption / decryption chips, user identity modules (SIM) cards, memories, etc. For example, the radio frequency module can interact with external devices through electromagnetic waves sent or received.

[0125] The sensor module 112 may include at least one sensor. Specifically, the sensor module 112 may include but is not limited to: a pressure sensor, a motion sensor, an acceleration sensor, and other sensors.

[0126] Among them, the pressure sensor may be a sensor that detects the pressure generated by pressing on the electronic device 1000. That is, the pressure sensor detects the pressure generated by contact or pressing between the user and the electronic device 1000, for example, the pressure generated by contact or pressing between the user's ear and the electronic device 1000. Therefore, the pressure sensor can be used to determine whether contact or pressing occurs between the user and the electronic device 1000, and the magnitude of the pressure.

[0127] Among them, the acceleration sensor can detect the magnitude of acceleration in all directions (generally three axes), and can detect the magnitude and direction of gravity when stationary, and can be used for applications that recognize the posture of the electronic device 1000 (such as horizontal and vertical screen switching, related games, magnetometer posture calibration), vibration recognition related functions (such as pedometer, tapping), etc. In addition, the electronic device 1000 can also be equipped with other sensors such as gyroscopes, barometers, hygrometers, thermometers, etc., which will not be repeated here.

[0128] The audio collection device 108 is used to collect audio signals. Optionally, the audio collection device 108 includes a plurality of audio collection devices, which may be microphones.

[0129] Please refer to Fig.11 , which shows a structural block diagram of a computer-readable storage medium provided in an embodiment of the present application. The computer-readable medium 800 stores program codes, which can be called by a processor to execute the method described in the above method embodiment.

[0130] The computer readable storage medium 800 may be an electronic memory such as a flash memory, an EEPROM (electrically erasable programmable read-only memory), an EPROM, a hard disk, or a ROM. Optionally, the computer readable storage medium 800 includes a non-transitory computer-readable storage medium. The computer readable storage medium 800 has storage space for program code 810 that performs any method step in the above method. These program codes can be read from or written to one or more computer program products. The program code 810 can be compressed, for example, in an appropriate form.

[0131] In summary, the present application proposes a service processing method, device and electronic device. In the method, after obtaining the system log in the electronic device, the system log can be input into the trained machine learning model to obtain the service that is about to have an abnormality through the machine learning model, and the service that is about to have an abnormality is processed to avoid the abnormality. Thus, through the above method, when the system log is obtained and the system log includes logs of multiple services, the system log can be processed by the trained machine learning model, and then the service that is about to have an abnormality is predicted, and the service that is about to have an abnormality is processed in time, so as to avoid the abnormality of the service.

[0132] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present application, rather than to limit it. Although the present application has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. However, these modifications or replacements do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of the present application.

Claims

1. A service processing method, characterized in that: The method comprises: Acquire a system log in the electronic device, wherein the system log includes logs of multiple services; Inputting the system log into a trained machine learning model to obtain services that are about to become abnormal through the machine learning model, wherein the trained machine learning model is used to predict services that are about to become abnormal based on the input log; The service that is about to have an exception is processed to avoid the exception.

2. The method according to claim 1, characterized in that The exception includes a crash, and the processing of the service that is about to have an exception to avoid the exception includes: The service that is about to crash is restarted to avoid crashing of the service that is about to crash.

3. The method according to claim 2, characterized in that The restarting of the service that is about to crash to prevent the service that is about to crash from crashing also includes: Check whether the service processing conditions are currently met; If the service processing condition is met, the restart processing of the service that is about to crash is performed to avoid the crash of the service that is about to crash.

4. The method according to claim 3, characterized in that The service processing condition includes at least one of the following conditions: The electronic device is not currently busy; Currently in a preset time period; and An instruction triggering consent for restarting is detected by the target user.

5. The method according to claim 4, characterized in that The method further includes: determining that the electronic device is currently in a busy state if at least one of the following conditions is detected to be satisfied; The usage rate of each processor of the electronic device is greater than a usage threshold; The available memory of the electronic device is less than the memory threshold; The number of active processes in the electronic device exceeds a preset number; and The frequency of touch operations detected by the electronic device is greater than a preset frequency.

6. The method according to claim 1, characterized in that The processing of the service that is about to have an exception to avoid the exception includes: If there are multiple services that are about to have an exception, sort the multiple services that are about to have an exception to obtain a sorting result; Based on the order represented by the sorting result, multiple services that are about to become abnormal are processed in sequence.

7. The method according to claim 6, characterized in that The step of sorting multiple services that are about to become abnormal includes: According to the respective importance of the services that are about to experience abnormalities, the multiple services that are about to experience abnormalities are sorted, wherein the importance is determined based on reference information of the services that are about to experience abnormalities, and the reference information includes: at least one of the degree of association between the services that are about to experience abnormalities and other services, the operating duration of the services that are about to experience abnormalities, and the operating frequency of the services that are about to experience abnormalities.

8. A service processing device, characterized in that: The device comprises: A log acquisition unit, used to acquire a system log in the electronic device, wherein the system log includes logs of multiple services; A service prediction unit, used to input the system log into a trained machine learning model to obtain a service that is about to become abnormal through the machine learning model, wherein the trained machine learning model is used to predict a service that is about to become abnormal based on the input log; The service processing unit is used to process the service that is about to have an exception to avoid the exception.

9. An electronic device, characterized in that: The method comprises a processor and a memory; one or more programs are stored in the memory and configured to be executed by the processor to implement any one of the methods of claims 1-7.

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