System performance optimization method, apparatus, and electronic device
By monitoring and automating the management process, the problem of user-initiated system performance optimization in existing technologies has been solved, achieving seamless system performance optimization and improving system efficiency and user experience.
Patent Information
- Application Number
- CN202311338283.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-10-16
- Publication Date
- 2025-11-28
- Estimated Expiration
- 2043-10-16
AI Technical Summary
Existing system performance optimization methods rely on user intervention and knowledge, requiring users to spend time and effort on configuration and optimization, which involves operational risks and uncertainties.
A system performance optimization method and apparatus are provided. By monitoring processes, the activity of processes is automatically detected and processes are suspended or resumed when necessary to reduce resource consumption. Automated optimization is achieved by utilizing a process monitoring module, an optimization decision module, and a process recovery module.
It enables automated optimization of system performance without the user's awareness, reducing the user's burden, improving system efficiency and user experience, and reducing the risk of erroneous operations.
Smart Images

Figure CN119883719B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the technical field of computer, in particular to a system performance optimization method and device and electronic equipment. BACKGROUND
[0002] Currently, many operating systems and applications provide user interfaces and setting options, allowing users to configure performance optimization according to their own needs and preferences. For example, users can choose to turn off visual effects, adjust power plans, adjust screen brightness, etc. to reduce the occupation of system resources. Operating systems usually also provide task managers or system monitoring tools, which allow users to view the running processes, resource occupation and performance indicators. Users can use these tools to identify resource-intensive processes and decide whether to terminate or optimize them as needed.
[0003] These existing methods can allow users to participate in system performance optimization, but they still rely on user's active intervention and settings, and users need to understand system performance-related knowledge and configure and optimize operations according to their own needs and preferences. Users need to judge when to optimize and may need to spend time and effort to optimize system performance. SUMMARY
[0004] The technical problem solved by the embodiments of the present application is how to provide a more intelligent and automated system performance optimization technology, so as to perform optimization operations without user awareness, reduce user burden and save time and effort.
[0005] To solve the above technical problems, one technical solution adopted by the embodiments of the present application is to provide a system performance optimization method, comprising: monitoring the processes of a current system; obtaining the processes and detecting the activity of the processes to determine whether to optimize the processes; when it is determined to optimize the processes, suspending the processes so that the processes do not respond to system messages; monitoring system messages of the current system, and when the monitored system message is sent to the optimized processes, resuming the processes and sending the monitored system message to the processes.
[0006] To solve the above technical problems, another technical solution adopted by the embodiments of the present application is to provide a system performance optimization device, comprising: a process monitoring module, configured to monitor the processes of a current system; an optimization decision module, configured to acquire the processes and detect the activities of the processes to determine whether to optimize the processes; an optimization processing module, configured to suspend the processes to make the processes not respond to system messages when it is determined to optimize the processes; and a process recovery module, configured to monitor the system messages of the current system, and recover the processes and send the monitored system messages to the processes when the monitored system messages are sent to the optimized processes.
[0007] To solve the above technical problems, still another technical solution adopted by the embodiments of the present application is to provide an electronic device, comprising: at least one processor; and a memory connected with the at least one processor in communication; wherein the memory stores instructions executable by the at least one processor, and the instructions are executed by the at least one processor to enable the at least one processor to perform the system performance optimization method as described above.
[0008] To solve the above technical problems, still another technical solution adopted by the embodiments of the present application is to provide a non-volatile computer readable storage medium, which stores computer executable instructions, and when the computer executable instructions are executed by an electronic device, the electronic device performs the system performance optimization method as described above.
[0009] To solve the above technical problems, still another technical solution adopted by the embodiments of the present application is to provide a computer program product, which comprises a computer program stored on a non-volatile computer readable storage medium, and the computer program comprises program instructions, and when the program instructions are executed by an electronic device, the electronic device performs the system performance optimization method as described above.
[0010] Different from the related art, the embodiment of the application provides a system performance optimization method, device and electronic equipment. The process of the current system is monitored. The process is acquired, and activity detection is performed on the process to determine whether to optimize the process. When it is determined to optimize the process, the process is suspended, so that the process does not respond to system messages. The system messages of the current system are monitored, and when the monitored system message is sent to the optimized process, the process is restored, and the monitored system message is sent to the process. Wherein, by monitoring the process of the system, the activity and performance information of the process can be acquired in real time, which enables the system to comprehensively control the process and provides basic data for subsequent optimization operation; the activity state and performance requirement of the process can be used to automatically determine whether the process needs to be optimized, so that the user intervention and decision process can be reduced, and automatic optimization can be realized; when the process needs to be optimized, the process is suspended, so that the process does not respond to system messages, thereby reducing the occupation of system resources by the process; when the system receives the message sent to the optimized process, the process is restored, and the message is transmitted to the process for processing, so that intelligent management of the process can be realized, and the burden of the user can be reduced. Therefore, the embodiment of the application provides an intelligent and automatic system performance optimization technology, so that the optimization operation can be performed without the user's awareness, the burden of the user is reduced, time and energy are saved, and the efficiency of the system and the user experience are improved. BRIEF DESCRIPTION OF DRAWINGS
[0011] One or more embodiments are illustrated by way of example with reference to the accompanying drawings, which are schematic and not intended to be limiting of the embodiments, and in which like reference numerals designate similar items in the figures, and in which: the drawings are not to scale.
[0012] Figure 1 is a flowchart of a system performance optimization method provided by the embodiment of the application;
[0013] Figure 2 is a flowchart of a method for detecting the activity of the process to determine whether to optimize the process provided by the embodiment of the application;
[0014] Figure 3 is a flowchart of a method for determining whether to optimize the process according to the running state of the process and the running state of the window provided by the embodiment of the application;
[0015] Figure 4 is a flowchart of a method for determining whether to optimize the process provided by the embodiment of the application;
[0016] Figure 5 is a structural schematic diagram of a system performance optimization device provided by the embodiment of the application;
[0017] Figure 6 FIG. 1 is a schematic diagram of a hardware structure of an electronic device for executing a system performance optimization method according to an embodiment of the present application. DETAILED DESCRIPTION
[0018] In order to make the objects, technical solutions and advantages of the present application clearer, the present application will be further described in detail below with reference to the drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and should not be used to limit the present application.
[0019] It should be noted that the various features of the embodiments of the present application can be combined with each other without conflict, and are within the protection scope of the present application. In addition, although the functional modules are divided in the device schematic diagram, and the logical order is shown in the flowchart, in some cases, the steps shown or described can be executed in a different order from the module division in the device schematic diagram or the order in the flowchart.
[0020] Unless otherwise defined, all technical and scientific terms used in the present application have the same meanings as those commonly understood by one skilled in the art to which the present application belongs. The terms used in the specification of the present application are only for the purpose of describing the specific embodiments and are not intended to limit the present application.
[0021] When the operating system (such as Windows system, iOS system, etc.) appears the phenomenon of lag, the performance optimization tool on the system can be usually used to optimize the system. For example, using the disk cleanup tool (such as the disk cleanup tool provided by Windows) to clean up unnecessary temporary files, cache and files in the recycle bin to release disk space. Using the task manager or system configuration tool (msconfig) to disable unnecessary programs started at boot to reduce the burden of system startup. Using the task manager or system configuration tool (msconfig) to close unnecessary programs and services running in the background to release system resources. Using reliable antivirus software to perform full disk scanning to ensure that the system is not infected by viruses, malicious software or adware. If the system memory is insufficient, additional memory can also be considered to increase to improve the performance of the system. The above-mentioned system performance optimization methods need to be operated manually by the user, and the user needs to select the appropriate optimization method according to his own needs and conditions, and make corresponding settings and adjustments.
[0022] However, performance optimization usually requires certain technical knowledge and experience, and for non-professionals, it can be confusing and uncertain, and users may need to spend time learning and understanding relevant concepts, tools and operation steps. It is difficult for non-professionals to accurately determine which optimization methods are most suitable for their own systems and needs, and incorrect optimization operations may cause system instability, limited functionality or other problems. In addition, performance optimization is usually not a one-time operation, but a continuous process, and users may need to frequently monitor system performance, resource usage, and adjust optimization strategies according to changes, which may require non-professionals to invest more time and effort. Furthermore, some performance optimization operations may involve modifying system settings, changing configuration files or running scripts, etc., which may cause system crashes, data loss or security vulnerabilities if not performed correctly, and non-professionals need to be particularly cautious when performing these operations to avoid irreversible damage to the system. In summary, although manual performance optimization operations have certain flexibility and controllability, non-professionals may face some challenges and risks.
[0023] Based on this, the inventors found that it is meaningful for users and system optimization to provide a more intelligent and automated system performance optimization technology, and to perform system optimization operations without user awareness, reducing the burden on users and saving time and effort. Therefore, the embodiments of the present application provide a system performance optimization method and device, mainly using a user-unaware optimization scheme to optimize the memory and CPU of the system, which mainly explains when to optimize the system and what to optimize.
[0024] The following embodiments provide a system performance optimization method. The execution subject of the system performance optimization method is generally an electronic device with certain computing power, such as a computer device, and in some possible implementation manners, the system performance optimization method can be realized by calling computer readable instructions stored in the memory through the processor.
[0025] Specifically, Figure 1 is a flowchart of a system performance optimization method provided by the embodiments of the present application. The method comprises:
[0026] S11, monitoring the process of the current system.
[0027] The current system can be a Windows system, a Linux system, etc. According to the version and configuration of the operating system, a suitable method can be selected to monitor the processes of the system. For example, in the Windows system, the processes currently running, CPU and memory usage, etc. can be viewed in the "Processes" tab of the Task Manager, and the processes occupying high resources can also be found through sorting and filtering functions. The PowerShell command can also be used to obtain the process information of the system, for example, the "Get-Process" command can list all running processes and provide detailed information of the processes. Third-party tools such as Process Explorer, Process Monitor, etc. can also be used to monitor system processes, which provide more detailed and advanced process monitoring functions, such as real-time graphical display, process performance indicators, etc.
[0028] For example, in the Linux system, the "top" command can be input in the terminal corresponding to the current system to display the process list and resource usage of the system in real time. The top command can sort the processes by CPU usage and provide real-time updated information. Third-party tools such as htop, Glances, etc. can also be used to monitor system processes, which provide more functions and options to more conveniently monitor and manage processes.
[0029] S12, obtaining the process and performing activity detection on the process to determine whether to optimize the process.
[0030] A timer can be used to trigger when to perform system performance optimization. When preparing to perform system performance optimization, the process is obtained, specifically, all processes currently running on the system can be periodically obtained. For example, all processes of the current system can be obtained every 5 minutes.
[0031] The activity detection of the process refers to the monitoring and evaluation of the activity state of the process to determine whether the process needs to be optimized. Specifically, the CPU utilization of the process can be detected. If the process occupies too high CPU resources for a long time, it may cause the system response to slow down, and optimization needs to be considered. The memory occupation of the process can also be detected. If the process occupies too much memory, it may cause the system to run out of memory, affecting the normal operation of other processes. The disk read-write activity of the process can also be detected. If the process frequently performs a large amount of disk read-write operation, it may cause the disk load to be too high, affecting the response speed of the system. The network communication activity of the process can also be detected. If the process continuously performs a large amount of network communication, it may affect the network bandwidth and delay, and optimization can be considered.
[0032] In an embodiment of the present application, as Figure 2As shown, the step of acquiring the process and performing activity detection on the process to determine whether to optimize the process includes:
[0033] S121. Obtain the processes. All currently running processes of the system can be obtained periodically.
[0034] S122. Obtain the process running status and window running status corresponding to the process based on the process.
[0035] Process running status can refer to the evaluation and monitoring of a process's running state, resource usage, and interactions with other processes. Window running status refers to the running state and behavior of windows associated with a process. In an operating system, each process typically corresponds to one or more windows used to display the user interface or for interaction.
[0036] You can use some tools and APIs (Application Programming Interfaces) provided by the operating system to obtain information about process running status and window running status.
[0037] S123. Determine whether to optimize the process based on the process running status and the window running status.
[0038] Specifically, such as Figure 3 As shown, determining whether to optimize the process based on the process running status and the window running status includes:
[0039] S1231. Based on the process running status, obtain the long connection information between the process and external services, the communication information between the process and internal services, and the information on the multimedia devices occupied by the process.
[0040] The long connection information of the process with the external service refers to the relevant information of the persistent network connection established by the process with other computers or servers. Such connection is usually based on TCP (Transmission Control Protocol) or UDP (User Datagram Protocol) protocol. In network communication, the process can communicate with the external service by establishing a TCP connection or using a UDP socket. Long connection refers to the state of maintaining continuous connection for a period of time, rather than short one-time connection. Such long connection is usually used in application scenarios that need to exchange data frequently or maintain real-time communication, such as instant messaging, video streaming, remote monitoring, etc. The long connection information of the process with the external service can include the following contents: IP address: indicates the network address of the external service, which can be IPv4 or IPv6 address. Port number: indicates the port of the external service, which is used to identify the specific application program or service of the service. Protocol type: indicates the protocol used, such as TCP or UDP. Connection state: indicates the current state of the connection, such as established, closed, etc. Data transmission volume: indicates the amount of data transmitted between the process and the external service during the connection.
[0041] The long connection information of the process with the external service includes: network monitoring tools such as Wireshark, tcpdump, etc. can be used to monitor network traffic on the operating system, including UDP and TCP connections. These tools can capture network communication packets between the process and the external service, and provide detailed information about the connection, such as source IP address, target IP address, port number, etc. System commands or APIs can also be used to obtain the network connection information of the process with the external service. For example, the netstat command in the Linux system can list the current network connection state, including process ID, local address, remote address, port, etc.
[0042] The communication information between the process and the internal service refers to the relevant information of the process interacting and communicating with other services or components on the same computer. This communication is usually achieved through the IPC (Inter-Process Communication) mechanism provided by the operating system. In an operating system, multiple processes can communicate through the IPC mechanism to achieve data transmission, shared resources, synchronization operations, etc. The communication information between the process and the internal service includes the following contents: communication mode: indicating the IPC mechanism used, such as pipe, message queue, shared memory, semaphore, etc. Process identifier (PID): indicating the unique identifier of the process, used to identify the communication relationship between processes. Message or data: indicating the specific message or data content transmitted between processes. Communication state: indicating the current state of communication, such as established, transmitting, closed, etc. Synchronization mechanism: indicating the mechanism used for inter-process synchronization operations, such as mutex, semaphore, etc. By obtaining the communication information between the process and the internal service, the data exchange between the process and other services, the communication mode, the synchronization operation, etc. can be understood, so as to analyze the inter-process cooperation, troubleshoot or optimize the performance.
[0043] The communication information between the process and the internal service can be obtained using the IPC (Inter-Process Communication) mechanism and related tools provided by the operating system. The specific implementation method may vary depending on the operating system and programming language. For example, in the Linux system, commands such as ipcs, ipcrm, ipcmk can be used to view and manage IPC resources such as message queues, shared memory, etc. Using these commands can obtain the relevant information of the IPC resource and understand the communication state between the process and the internal service.
[0044] The information of the process occupying the multimedia device refers to whether the process is using or occupying the multimedia device on the computer, such as camera, microphone or speaker, etc. These devices are commonly used for audio, video or image input and output.
[0045] The information of the process occupying the multimedia device can be obtained in the following ways:
[0046] Use system tools and APIs: The operating system usually provides tools and APIs for managing and controlling multimedia devices. By calling the corresponding system functions or using specific commands, the status and occupation of the device can be obtained. For example, in the Windows system, Windows API functions such as EnumDevices can be used to obtain the status and occupation of the multimedia device.
[0047] Use specific libraries or frameworks: Some programming languages and frameworks provide libraries or modules specifically designed for operating multimedia devices. By using these tools, it is convenient to obtain information about whether a process occupies a multimedia device. For example, the OpenCV library in Python can be used to access and control the camera, while the PyAudio library can be used to access and control the microphone.
[0048] Monitor system resources: By monitoring the use of system resources, it can be understood which processes are occupying multimedia devices. The operating system provides some tools and APIs to obtain the use of system resources, including multimedia devices. By analyzing this information, it can be determined whether a process is using a multimedia device.
[0049] In this embodiment, by judging whether the current process is monitoring UDP, TCP, IPC, microphone, speaker, camera, etc., it can be understood whether the process is using related resources and the occupation of system resources. This judgment is important for various application scenarios and needs, such as understanding whether the process is monitoring UDP, TCP, IPC, etc. Network connection can help understand the occupation of network resources by the process, which can avoid waste or conflict of resources for system performance optimization. Judging whether a process is monitoring network connections or using devices such as cameras and microphones can help understand user needs and optimize processes to ensure that user expectations for functionality and experience are not compromised. For example, if a process is an application for real-time communication and occupies a microphone, considering user needs can not optimize the process.
[0050] S1232, obtain the non-active time of the process according to the window running situation.
[0051] Among them, the non-active time refers to the time period when the process is in a non-active state in the system. Non-active time indicates that the process has no interaction with the user or has not executed any task within a period of time.
[0052] Among them, the non-active time obtained according to the window running situation includes:
[0053] (1) Monitor the activity state of the window of the system; the activity state of the window of the operating system can be monitored through the interface or tool provided by the system, such as the change of window focus, the visibility of window, etc.
[0054] (2) When monitoring that the window is set as an active window, record the time when the window becomes an active window, and save the correspondence between the window and its active time; the correspondence between the window and the active time can be stored using data structures (such as dictionaries or mapping tables).
[0055] (3) Obtain the process corresponding to the window according to the window, and establish a mapping relationship between the process and the window; the mapping relationship between the process and the window can be established by the process identifier, window title or other identifier of the window.
[0056] (4) Obtain the activity time of the window according to the correspondence between the window and its activity time, compare the activity time with the current time, and calculate the difference between the activity time and the current time.
[0057] (5) Based on the difference, if the difference is greater than a preset threshold, the process corresponding to the window is obtained according to the mapping relationship between the process and the window, and the process is determined to be in an inactive state.
[0058] (6) Obtain the time during which the process is in an inactive state; this time is the inactive time of the process. The inactive time can be obtained by accumulating the inactive time of each window. Specifically, a variable can be maintained for each window to record the total inactive time of that window; the initial value can be set to 0. When a window is determined to be inactive, the difference in inactive time is added to the total inactive time of the window. When a window is re-set as an active window, the total inactive time of the window is reset to zero, and the calculation of inactive time restarts. For each process, the total inactive time of the process is obtained by traversing its associated windows and summing the inactive times of each window.
[0059] S1233. When the long connection information between the process and the external service, the communication information between the process and the internal service, the information on the multimedia device occupied by the process, and the inactive time of the process all meet the preset conditions, it is determined to optimize the process; otherwise, the process is not optimized.
[0060] Specifically, such as Figure 4 As shown, when the long-term connection information between the process and external services, the communication information between the process and internal services, the information on the multimedia device occupied by the process, and the inactivity time of the process all meet preset conditions, the process is determined to be optimized; otherwise, the process is not optimized, including:
[0061] A: Determine whether the process has a long connection with the external service based on the long connection information between the process and the external service;
[0062] B: If the process is not in a long-term connection with an external service, then determine whether the process is communicating with an internal service based on the communication information between the process and the internal service;
[0063] C: If the process is not communicating with the internal service, determine whether the process is currently using the multimedia device based on the information about the multimedia device being used by the process;
[0064] D: if the process is not currently using a multimedia device, determining whether the inactivity time of the process is greater than a preset time threshold;
[0065] E: if the inactivity time of the process is greater than the preset time threshold, determining to optimize the process, otherwise, not optimizing the process.
[0066] It should be noted that the order of the above steps ABC is not limited to the above manner, but can also be to first determine whether the process communicates with an internal service, then determine whether the process is in long connection with an external service, and then determine whether the process is currently using a multimedia device. It can also be to first determine whether the process is currently using a multimedia device, then determine whether the process communicates with an internal service, and then determine whether the process is in long connection with an external service, and so on. The order of the above steps ABC can be arbitrarily combined.
[0067] S13, when it is determined to optimize the process, suspending the process so that the process does not respond to system messages.
[0068] The suspension operation will put the process into a hibernation state and suspend its execution in the system. Alternatively, the optimized process can also be terminated, and the termination operation will completely terminate the process.
[0069] S14, monitoring system messages of the current system, and when the monitored system message is sent to the optimized process, resuming the process and sending the monitored system message to the process.
[0070] In this embodiment, system messages can continue to be monitored, including messages sent to the optimized process. When a system message is sent to the optimized process: upon receiving the system message, the execution of the optimized process is resumed, and the received system message is sent to the process. The resumed process continues to execute and processes the received system message.
[0071] In particular, the minimized messages and window activation messages of the current system can be monitored; when the minimized message or the window activation message is monitored, it is detected whether the monitored minimized message or the window activation message is sent to the optimized process; if the monitored minimized message or the window activation message is sent to the optimized process, the optimized process is resumed; and the monitored minimized message or the window activation message is sent to the resumed process.
[0072] The minimize message refers to a message sent to the process corresponding to the application when the user minimizes the window (minimizes it to the taskbar or system tray). When the user clicks the minimize button of the window or performs the corresponding keyboard shortcut, the operating system sends a minimize message to the process corresponding to the application so that the process can respond to it, such as the process hiding the window or iconizing it to reduce the space occupied on the screen. The process is an instance of the application created at runtime, and each running application has a corresponding process.
[0073] The window activation message refers to a message sent to the process corresponding to the application when the user switches the focus from one window to another. When the user clicks on a window or uses the keyboard to switch the focus, the operating system sends a window activation message to the process corresponding to the application so that the process can perform the necessary operations, such as the process updating the interface, responding to user input, or performing other tasks related to window interaction according to the window activation message.
[0074] The above-mentioned "window" refers to the window of the application. An application can contain one or more windows, each window used to display different parts of the application or implement different user interactions. The process is an instance of the program running in the operating system, and when an application is started, the operating system will create a corresponding process for the application to run in the system. Therefore, the window is a visible element of the application on the user interface, the application is a collection of software programs written by developers, and the process is an instance of the application running in the operating system. It should be noted that an application can have multiple windows, each window belonging to the same process of the application. These windows share the resources and context of the application and interact with the same process.
[0075] In this embodiment, when it is monitored that the minimize message or the window activation message is sent to the optimized process, the optimized process can be restored in time, which will ensure that the process can run normally after the user switches the window or minimizes the window, avoiding the situation that the process cannot respond or pause. Optionally, after the optimized process is restored, the previous state of the process can be maintained, including the opened files, edited content, browsing traces, and location of the historical operation. In this way, the user can continue working from the last operation without starting over or finding the previous state. Therefore, by monitoring and restoring the minimize message and the window activation message, a better user experience can be provided, work efficiency can be improved, and the optimized process can be kept active when the window is switched or minimized.
[0076] The embodiment of the present application provides a system performance optimization method, which comprises the following steps: monitoring the process of a current system; acquiring the process and detecting the activity of the process to determine whether to optimize the process; when it is determined to optimize the process, suspending the process so that the process does not respond to system messages; and when the monitored system message is sent to the optimized process, resuming the process and sending the monitored system message to the process. Wherein, the activity and performance information of the process can be acquired in real time by monitoring the process of the system, which enables the system to comprehensively control the process and provides basic data for subsequent optimization operation; the process can be automatically determined whether to be optimized according to the activity state and performance requirement of the process, which can reduce the intervention and decision process of the user and realize automatic optimization; when the process needs to be optimized, the process is suspended so as not to respond to system messages, thereby reducing the occupation of system resources by the process; when the system receives the message sent to the optimized process, the process is resumed and the message is transmitted to the process for processing, so that intelligent management of the process can be realized and the burden of the user is reduced. The embodiment of the present application provides an intelligent and automatic system performance optimization technology, which enables the optimization operation to be performed without the user's awareness, reduces the burden of the user, saves time and effort, and improves the efficiency of the system and the user experience.
[0077] Please refer to Figure 5 , Figure 5 is a structural schematic diagram of a system performance optimization device provided by the embodiment of the present application. The system performance optimization device 20 comprises a process monitoring module 21, an optimization decision module 22, an optimization processing module 23 and a process resuming module 24.
[0078] The process monitoring module 21 is used for monitoring the process of a current system; the optimization decision module 22 is used for acquiring the process and detecting the activity of the process to determine whether to optimize the process; the optimization processing module 23 is used for suspending the process when it is determined to optimize the process, so that the process does not respond to system messages; and the process resuming module 24 is used for monitoring the system messages of the current system and resuming the process and sending the monitored system messages to the process when the monitored system message is sent to the optimized process.
[0079] The optimization decision module 22 is specifically configured to acquire the process, acquire process running conditions and window running conditions corresponding to the process according to the process, and determine whether to optimize the process according to the process running conditions and the window running conditions. The determination of whether to optimize the process according to the process running conditions and the window running conditions includes: acquiring long connection information of the process and an external service, communication information of the process and an internal service, and information that the process occupies a multimedia device according to the process running conditions; acquiring non-active time of the process according to the window running conditions; when the long connection information of the process and the external service, the communication information of the process and the internal service, the information that the process occupies the multimedia device, and the non-active time of the process all satisfy preset conditions, it is determined that the process is optimized, otherwise, the process is not optimized.
[0080] When the long connection information of the process and the external service, the communication information of the process and the internal service, the information that the process occupies the multimedia device, and the non-active time of the process all satisfy preset conditions, it is determined that the process is optimized, otherwise, the process is not optimized, including: determining whether the process is long-connected with an external service according to the long connection information of the process and the external service; if the process is not long-connected with the external service, determining whether the process communicates with an internal service according to the communication information of the process and the internal service; if the process does not communicate with the internal service, determining whether the process currently uses a multimedia device according to the information that the process occupies the multimedia device; if the process currently does not use the multimedia device, determining whether the last active time of the process is less than a preset time threshold according to the non-active time of the process; if the last active time of the process is less than the preset time threshold, it is determined that the process is optimized, otherwise, the process is not optimized.
[0081] The acquisition of the non-active time of the process according to the window running conditions includes: monitoring an activity state of a window of the system; when it is monitored that the window is set as an active window, recording a time when the window becomes the active window, and saving a correspondence between the window and the active time of the window; acquiring a process corresponding to the window according to the window, and establishing a mapping relationship between the process and the window; acquiring the active time of the window according to the correspondence between the window and the active time of the window, and comparing the active time with a current time to calculate a difference value between the active time and the current time; determining according to the difference value, if the difference value is greater than a preset threshold, acquiring the process corresponding to the window according to the mapping relationship between the process and the window, and determining that the process is in a non-active state; acquiring a time when the process is in the non-active state, and the time is the non-active time of the process.
[0082] The acquiring the processes comprises: periodically acquiring all processes currently running in the system.
[0083] The process recovery module 24 is specifically configured to: monitor the minimized message and the window activation message of the current system; when the minimized message or the window activation message is monitored, detect whether the monitored minimized message or window activation message is sent to the optimized process; if so, recover the optimized process; and send the monitored minimized message or window activation message to the recovered process.
[0084] It should be noted that the system performance optimization apparatus can execute the system performance optimization method provided in the embodiments of the present application, and has the corresponding function modules and beneficial effects of the execution method. Technical details not described in detail in the system performance optimization apparatus embodiments can be referred to the system performance optimization method provided in the embodiments of the present application.
[0085] Please refer to Figure 6 , Figure 6 is a hardware structure schematic diagram of an electronic device 30 for executing the system performance optimization method provided in the embodiments of the present application, as shown in Figure 6 , the electronic device 30 comprises:
[0086] one or more processors 31 and memories 32, Figure 6 take one processor 31 as an example.
[0087] The processor 31 and the memory 32 can be connected through a bus or other means, Figure 6 take the connection through the bus as an example.
[0088] The memory 32 is a kind of non-volatile computer readable storage medium, and can be used to store non-volatile software programs, non-volatile computer executable programs and modules, such as the program instructions / modules (for example, various modules shown in the attached Figure 5 ) corresponding to the system performance optimization method in the embodiments of the present application. The processor 31 executes the various functions of the electronic device and data processing by running the non-volatile software programs, instructions and modules stored in the memory 32, that is, the system performance optimization method of the above method embodiment is realized.
[0089] The memory 32 can include a program storage area and a data storage area, where the program storage area can store an operating system, application programs required by at least one function, and the data storage area can store data created according to the use of the system performance optimization apparatus, etc. In addition, the memory 32 can include a high-speed random access memory, and can also include a nonvolatile memory, such as at least one magnetic disk storage device, a flash memory device, or other nonvolatile solid-state memory device. In some embodiments, the memory 32 can optionally include a memory disposed remotely with respect to the processor 31, and these remote memories can be connected to the system performance optimization apparatus through a network. Examples of the above network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and combinations thereof.
[0090] The one or more modules are stored in the memory 32, and when executed by the one or more processors 31, perform the system performance optimization method in any of the above method embodiments, for example, perform the method steps in Figure 1 、 Figure 2 、 Figure 3 and Figure 4 described above, and realize the functions of the modules in Figure 5 .
[0091] The above product can perform the method provided in the embodiments of the present application, and has the corresponding function modules and beneficial effects of performing the method. Technical details not described in detail in the embodiments can be referred to the method provided in the embodiments of the present application.
[0092] The electronic device of the embodiments of the present application exists in various forms, including personal computers, notebook computers, smart phones, server and other intelligent terminal devices.
[0093] The embodiments of the present application provide a non-volatile computer readable storage medium, which stores computer executable instructions, and the computer executable instructions are executed by one or more processors, for example, one processor 31 in Figure 6 , so that the above one or more processors can perform the system performance optimization method in any of the above method embodiments, for example, perform the method steps in Figure 1 、 Figure 2 、 Figure 3 and Figure 4 described above, and realize the functions of the modules in Figure 5 .
[0094] The embodiment of the present application provides a computer program product, the computer program product comprises a computer program stored on a non-volatile computer readable storage medium, the computer program comprises program instructions, when the program instructions are executed by the electronic device, the electronic device can execute the system performance optimization method in any method embodiment described above, for example, execute the method steps in Figure 1 , Figure 2 , Figure 3 And Figure 4 , and realize the function of the module in Figure 5 .
[0095] The device embodiments described above are only schematic, wherein the units illustrated as separate components can or can not be physically separated, and the components illustrated as units can or can not be physical units, that is, can be located in one place, or can be distributed on multiple network units. Part or all of the modules can be selected according to actual needs to achieve the purpose of the embodiment scheme.
[0096] Through the description of the above embodiments, those skilled in the art can clearly understand that each embodiment can be realized by means of software plus a general hardware platform, and of course can also be realized by hardware. Those skilled in the art can understand that all or part of the processes in the above embodiment methods can be completed by a computer program instructing related hardware, and the program can be stored in a computer readable storage medium. When the program is executed, it can include the processes of the above embodiment methods. The storage medium can be a magnetic disc, an optical disc, a read-only memory (ROM) or a random access memory (RAM), etc.
[0097] Finally, it should be noted that: the above embodiments are only used to illustrate the technical solutions of the present application, and not to limit them; under the idea of the present application, the technical features in the above embodiments or different embodiments can also be combined, the steps can be implemented in any order, and there are many other changes of different aspects of the present application as described above. In order to be brief, they are not provided in details; although the present application has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that: it can still modify the technical solutions recorded in the foregoing embodiments, or make equivalent replacement to part of the technical features; and these modifications or replacements do not make the essence of the corresponding technical solutions deviate from the scope of the technical solutions of the embodiments of the present application.
Claims
1. A system performance optimization method, characterized in that, include: Monitor the processes of the current system; The process is acquired, and its activity is detected to determine whether the process should be optimized. When it is determined that the process should be optimized, the process is suspended so that it does not respond to system messages; Monitor the system messages of the current system, and when the monitored system message is sent to the optimized process, restore the process and send the monitored system message to the process; The step of acquiring the process and performing activity detection on the process to determine whether to optimize the process includes: Obtain the process; Based on the process, obtain the process running status and window running status corresponding to the process; Based on the process's running status, obtain the long connection information between the process and external services, the communication information between the process and internal services, and the information on the multimedia devices occupied by the process; The inactive time of the process is obtained based on the window's operation status; If the long-term connection information between the process and external services, the communication information between the process and internal services, the information on the multimedia device occupied by the process, and the inactivity time of the process all meet preset conditions, then the process is determined to be optimized; otherwise, the process is not optimized.
2. The method according to claim 1, characterized in that, When the long-term connection information between the process and external services, the communication information between the process and internal services, the information on the multimedia device occupied by the process, and the inactivity time of the process all meet preset conditions, the process is determined to be optimized; otherwise, the process is not optimized. This includes: Determine whether the process has a long connection with the external service based on the long connection information between the process and the external service. If the process is not in a long-term connection with an external service, then determine whether the process is communicating with an internal service based on the communication information between the process and the internal service. If the process is not communicating with the internal service, then determine whether the process is currently using the multimedia device based on the information about the multimedia device being used by the process. If the process is not currently using a multimedia device, then determine whether the inactivity time of the process is greater than a preset time threshold. If the time exceeds the preset time threshold, the process will be optimized; otherwise, the process will not be optimized.
3. The method according to claim 1, characterized in that, The step of obtaining the inactive time of the process based on the window's running status includes: Monitor the activity status of the system's windows; When the monitoring detects that the window is set as the active window, record the time when the window becomes the active window, and save the correspondence between the window and its active time; Obtain the process corresponding to the window based on the window, and establish a mapping relationship between the process and the window; The activity time of a window is obtained according to the correspondence between the window and its activity time, and the activity time is compared with the current time to calculate the difference between the activity time and the current time. Based on the difference, if the difference is greater than a preset threshold, the process corresponding to the window is obtained according to the mapping relationship between the process and the window, and it is determined that the process is in an inactive state. The time during which the process was in the inactive state is obtained, and the time is the inactive time of the process.
4. The method according to any one of claims 1 to 3, characterized in that, The monitoring of system messages of the current system, and when the monitored system message is sent to the optimized process, restoring the process and sending the monitored system message to the process, includes: Monitor the minimized and window activated messages of the current system; When the minimize message or the window activation message is detected, it is determined whether the detected minimize message or the window activation message is sent to the optimized process; If so, restore the optimized process; Send the monitored minimize message or window activation message to the resumed process.
5. A system performance optimization device, characterized in that, include: The process monitoring module is used to monitor the processes of the current system. An optimization decision module is used to acquire the process and perform activity detection on the process to determine whether to optimize the process. An optimization processing module is used to suspend the process when it is determined to optimize the process, so that the process does not respond to system messages. The process recovery module is used to monitor the system messages of the current system, and when the monitored system message is sent to the optimized process, it restores the process and sends the monitored system message to the process. The optimization decision module is specifically used for: acquiring the process; Based on the process, obtain the process running status and window running status corresponding to the process; Based on the process's running status, obtain the long connection information between the process and external services, the communication information between the process and internal services, and the information on the multimedia devices occupied by the process; The inactive time of the process is obtained based on the window's operation status; If the long-term connection information between the process and external services, the communication information between the process and internal services, the information on the multimedia device occupied by the process, and the inactivity time of the process all meet preset conditions, then the process is determined to be optimized; otherwise, the process is not optimized.
6. An electronic device, characterized in that, include: At least one processor; And a memory communicatively connected to the at least one processor; wherein the memory stores instructions executable by the at least one processor to enable the at least one processor to perform the method according to any one of claims 1-4.
7. A non-volatile computer-readable storage medium, characterized in that, The non-volatile computer-readable storage medium stores computer-executable instructions that, when executed by an electronic device, cause the electronic device to perform the method described in any one of claims 1-4.
8. A computer program product, characterized in that, The computer program product includes a computer program stored on a non-volatile computer-readable storage medium, the computer program including program instructions that, when executed by an electronic device, cause the electronic device to perform the method of any one of claims 1-4.
Citation Information
Patent Citations
Application program background process management method and device
CN102981906A
Power management method and device, computing equipment and storage medium
CN116520968A