Android vehicle-mounted system CPU load monitoring method and device and Android vehicle-mounted system
By monitoring the CPU usage rate of on-board applications in Android in-car system and comparing it with the target value, the problem of lack of CPU usage monitoring in the prior art is solved, and real-time monitoring and performance optimization of on-board applications is achieved.
Patent Information
- Application Number
- CN202411757061.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-03
- Publication Date
- 2025-03-07
- Estimated Expiration
- Not applicable · inactive patent
AI Technical Summary
The existing technology lacks a monitoring method for the CPU usage of each vehicle application in Android vehicle system, which makes it impossible for relevant personnel to pay attention to CPU usage in a timely manner, affecting system performance.
Provides a CPU load monitoring method for Android in-vehicle system. By obtaining the actual CPU usage rate of the in-vehicle application and comparing it with the preset CPU usage target value, if the standard exceeds the standard, the CPU exceeds the standard information is displayed. The method includes steps such as determining whether the CPU monitoring function is turned on, obtaining CPU occupancy information, comparing CPU usage rate, and displaying information that exceeds the standard.
Real-time monitoring of the CPU usage of on-board applications is realized, timely displaying information on CPU exceeding standards, helping relevant personnel optimize performance and improve system fluency and performance.
Smart Images

Figure CN119576702A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of vehicle technology, and in particular to an Android vehicle system CPU load monitoring method, device and Android vehicle system. Background Art
[0002] With the development of intelligent driving and in-vehicle entertainment systems, Android car systems are used in many vehicles. The CPU (central processing unit) resource of the Android car system is an important hardware resource, and the CPU load often plays a decisive role in the fluency of the car system or the car system. The Android car system has a variety of car applications, such as vehicle settings, Bluetooth phone, multimedia, driving recorder, 360-degree surround view, air conditioning settings, voice, and virtual image. When each car application is running, it needs to occupy part of the CPU resources. Since the available CPU resources of the Android car system are limited, each car application will compete for CPU resources. This makes it easy for the system CPU to be overloaded. When the system CPU is overloaded, it will greatly reduce the system fluency and affect the system performance, such as operation jams and frozen screens.
[0003] Currently, due to the lack of a monitoring method for the CPU usage of each in-vehicle application in the Android in-vehicle system, relevant personnel cannot pay attention to the CPU usage of the in-vehicle application in a timely manner, and thus cannot perform application optimization or system optimization in a timely manner. Summary of the invention
[0004] The present application provides an Android vehicle system CPU load monitoring method, device and Android vehicle system to solve the technical problem in the prior art that due to the lack of a monitoring method for the CPU usage of each vehicle application in the Android vehicle system, relevant personnel cannot pay attention to the CPU usage of the vehicle application in the Android vehicle system in a timely manner.
[0005] The present application provides a method for monitoring CPU load of an Android vehicle system, the method comprising: obtaining an actual CPU usage rate of a vehicle application in the Android vehicle system;
[0006] Comparing the actual CPU usage with the corresponding CPU usage target value to determine whether the CPU usage of the vehicle-mounted application exceeds the standard or is normal, the CPU usage target value is read from a preset target value configuration file, the target value configuration file includes a one-to-one correspondence between an application package name and a CPU usage target value, the application package name being a unique identifier of the vehicle-mounted application;
[0007] If the CPU usage of the vehicle-mounted application exceeds the limit, the CPU usage exceeding limit information is displayed, and the CPU usage exceeding limit information includes: the application package name of the vehicle-mounted application whose CPU usage exceeds the limit, the actual CPU usage rate, and the CPU usage rate target value.
[0008] In one embodiment of the present application, before obtaining the actual CPU usage rate of the vehicle-mounted application in the Android vehicle-mounted system, it is also included to determine whether the CPU monitoring function is turned on, wherein determining whether the CPU monitoring function is turned on includes:
[0009] Monitoring the attribute value of the CPU monitoring switch, wherein the CPU monitoring switch is a preset system attribute, and the attribute value of the CPU monitoring switch changes with the on / off state of the CPU monitoring switch, and the on / off state of the CPU monitoring switch is manually set;
[0010] If it is detected that the attribute value of the CPU monitoring switch is a preset first attribute value, it is determined that the CPU monitoring function has been turned on; if it is determined that the CPU monitoring function has been turned on, the actual CPU usage rate of the vehicle-mounted application is obtained;
[0011] If it is detected that the attribute value of the CPU monitoring switch is a preset second attribute value, it is determined that the CPU monitoring function is turned off.
[0012] In one embodiment of the present application, it further includes:
[0013] According to the preset event sending frequency, monkey events are regularly sent to the Android vehicle-mounted system, wherein the monkey events are randomly generated user input events, and the user input events are used to perform random operations on the interface of the vehicle-mounted application.
[0014] In one embodiment of the present application, obtaining the actual CPU usage of the vehicle-mounted application in the Android vehicle-mounted system includes:
[0015] Obtaining CPU occupancy information of the Android vehicle-mounted system, wherein the CPU occupancy information includes: an initial CPU usage rate of an application process, and an application package name of the application process;
[0016] If there are application processes with the same application package name, summing the initial CPU usage rates of the application processes with the same application package name to obtain the actual CPU usage rate of the in-vehicle application corresponding to the current application package name;
[0017] If the application package names of the application processes in the CPU occupancy information are all different, the vehicle-mounted application to which the initial CPU usage belongs is determined according to the application package name in the CPU occupancy information, and the initial CPU usage is determined as the actual CPU usage of the corresponding vehicle-mounted application.
[0018] In one embodiment of the present application, obtaining the actual CPU usage rate of the vehicle-mounted application in the Android vehicle-mounted system includes: obtaining the actual CPU usage rate of the vehicle-mounted application according to the execution frequency, wherein determining the execution frequency includes:
[0019] Get the CPU idle rate of the Android car system;
[0020] If the CPU idle rate is greater than or equal to a preset idle rate threshold, determining the execution frequency as a preset first frequency;
[0021] If it is detected that the CPU idle rate is less than the idle rate threshold, the execution frequency is determined to be a preset second frequency, which is higher than the first frequency; and the CPU occupancy information is displayed on a preset display screen for a preset duration, and the display interface also includes a first QR code, wherein the step of generating the first QR code includes: encapsulating a string according to the CPU occupancy information to obtain a first string; and generating the first QR code according to the first string.
[0022] In one embodiment of the present application, if the CPU usage of the vehicle-mounted application exceeds the limit, displaying the CPU exceeding limit information includes:
[0023] If the CPU usage of the vehicle-mounted application exceeds the limit, encapsulating the CPU exceeding limit information and the current time into a character string to obtain a second character string;
[0024] Generate a second QR code according to the second character string;
[0025] The CPU exceeding standard information and the second QR code are displayed on the display screen, and the display time is the preset time.
[0026] In one embodiment of the present application, it further includes:
[0027] When it is determined that the display screen pops up an over-limit display interface, or the display data in the over-limit display interface changes, the application package name in the CPU over-limit information on the display interface is obtained;
[0028] Traversing the preset data structure list, if the application package name is the application package name recognized for the first time, determining the application package name of the current in-vehicle application as a key, and determining the actual CPU usage rate of the current in-vehicle application as a value; storing the key and the value in the data structure list, and taking a screenshot of the display interface;
[0029] If the application package name of the in-vehicle application already exists in the data structure list, the current actual CPU usage of the in-vehicle application is obtained; if the current actual CPU usage of the in-vehicle application is greater than the corresponding actual CPU usage in the data structure list, the data structure list is updated and a screenshot of the display interface is taken.
[0030] In one embodiment of the present application, it also includes: storing the screenshot image to a target directory of a target disk, the screenshot image in the target disk is used for acquisition and identification by a terminal device, the QR code in the image is an object identified by the terminal device, and the identified information is the basis for the terminal device to report the CPU exceeding standard Bug, wherein the trigger condition for generating and reporting the CPU exceeding standard Bug is that the CPU usage of the currently identified vehicle-mounted application exceeds the standard, and the currently identified application package name is the first identified application package name, and the associated information of the CPU exceeding standard Bug is recorded in a preset target list, and the associated information includes the application package name, the actual CPU usage rate, and the link to the CPU exceeding standard Bug;
[0031] The triggering conditions for updating the CPU exceeding standard Bug are that the CPU usage of the currently identified in-vehicle application exceeds the standard, the currently identified application package name already exists in the target list, and the currently identified actual CPU usage is greater than the corresponding actual CPU usage in the target list. Updating the CPU exceeding standard Bug means updating the actual CPU usage in the target list to the currently identified actual CPU usage.
[0032] The present application also provides an Android vehicle-mounted system CPU load monitoring device, the device comprising:
[0033] A data acquisition module is used to obtain the actual CPU usage of the vehicle-mounted applications in the Android vehicle-mounted system;
[0034] A first processing module, configured to compare the actual CPU usage with a corresponding CPU usage target value to determine whether the CPU usage of the vehicle-mounted application exceeds the standard or is normal, wherein the CPU usage target value is read from a preset target value configuration file, wherein the target value configuration file includes a one-to-one corresponding application package name and a CPU usage target value, wherein the application package name is a unique identifier of the vehicle-mounted application;
[0035] The second processing module is used to display CPU excess information if the CPU usage of the vehicle-mounted application exceeds the standard. The CPU excess information includes: the application package name of the vehicle-mounted application with excessive CPU usage, the actual CPU usage rate, and the CPU usage rate target value.
[0036] The present application also provides an Android vehicle-mounted system, comprising: an Android vehicle-mounted system CPU load monitoring device as described above.
[0037] Beneficial effects of the present application: The present application provides an Android vehicle system CPU load monitoring method, device and Android vehicle system, the method obtains the actual CPU usage of the vehicle application in the Android vehicle system; compares the actual CPU usage with the corresponding CPU usage target value to determine whether the CPU usage of the vehicle application exceeds the standard or is normal, the CPU usage target value is read from a preset target value configuration file, the target value configuration file includes a one-to-one corresponding application package name and CPU usage target value, the application package name is the unique identifier of the vehicle application; if the CPU usage of the vehicle application exceeds the standard, the CPU exceeding standard information is displayed, and the CPU exceeding standard information includes: the application package name of the vehicle application with excessive CPU usage, the actual CPU usage, and the CPU usage target value. The method can better realize the monitoring of the CPU usage of the vehicle application, so as to facilitate the timely performance optimization of the vehicle application according to the CPU usage exceeding standard situation, etc., and has strong feasibility and low cost. BRIEF DESCRIPTION OF THE DRAWINGS
[0038] Figure 1 A flowchart of a method for monitoring CPU load of an Android vehicle system provided in an embodiment of the present application;
[0039] Figure 2 A schematic diagram of a flow chart of presetting a target value configuration file in an Android vehicle-mounted system CPU load monitoring method provided in an embodiment of the present application;
[0040] Figure 3 A flowchart of a specific embodiment of a method for monitoring CPU load of an Android vehicle system provided in an embodiment of the present application;
[0041] Figure 4 A schematic diagram of the structure of a CPU load monitoring device for an Android vehicle system provided in one embodiment of the present application;
[0042] Figure 5 A schematic diagram of the structure of an electronic device provided in one embodiment of the present application. DETAILED DESCRIPTION
[0043] The following describes the embodiments of the present application through specific examples, and those skilled in the art can easily understand other advantages and effects of the present application from the contents disclosed in this specification. The present application can also be implemented or applied through other different specific embodiments, and the details in this specification can also be modified or changed in various ways based on different viewpoints and applications without departing from the spirit of the present application. It should be noted that the following embodiments and features in the embodiments can be combined with each other without conflict.
[0044] It should be noted that the illustrations provided in the following embodiments are only schematic illustrations of the basic concept of the present application, and thus the drawings only show components related to the present application rather than being drawn according to the number, shape and size of components in actual implementation. In actual implementation, the type, quantity and proportion of each component may be changed at will, and the component layout may also be more complicated.
[0045] In the following description, a large number of details are discussed to provide a more thorough explanation of the embodiments of the present application. However, it is obvious to those skilled in the art that the embodiments of the present application can be implemented without these specific details. In other embodiments, well-known structures and devices are shown in the form of block diagrams rather than in detail to avoid making the embodiments of the present application difficult to understand.
[0046] Combine the following Figures 1 to 5 , the Android vehicle system CPU load monitoring method, device and Android vehicle system provided in this application are explained.
[0047] See also Figure 1 , Figure 1 A flowchart of a method for monitoring CPU load of an Android vehicle system provided in an embodiment of the present application is shown in FIG. Figure 1 As shown, the method includes:
[0048] S110: Obtaining actual CPU usage of in-vehicle applications in the Android in-vehicle system.
[0049] It should be noted that the in-vehicle applications in the Android car system include instrument HMI (human-machine interface) applications, boot animation applications, and 360 panoramic imaging applications.
[0050] It should also be noted that the actual CPU usage of one or more vehicle-mounted applications may be obtained in the above step S110, that is, the actual CPU usage of a specified vehicle-mounted application may be obtained, and the specified vehicle-mounted application may be one or more, or the actual CPU usage of all vehicle-mounted applications in the Android vehicle-mounted system may be obtained. In order to better monitor the CPU occupancy of each vehicle-mounted application in the Android vehicle-mounted system, the actual CPU usage of all vehicle-mounted applications in the Android vehicle-mounted system is obtained in this embodiment, and subsequent comparison and monitoring are performed.
[0051] S120: Compare the actual CPU usage with the corresponding CPU usage target value to determine whether the CPU usage of the vehicle-mounted application exceeds the standard or is normal, the CPU usage target value is read from a preset target value configuration file, the target value configuration file includes a one-to-one corresponding application package name and CPU usage target value, and the application package name is a unique identifier of the vehicle-mounted application.
[0052] It should be noted that by presetting the target value configuration file, it is easy to read the CPU occupancy target value of the vehicle-mounted application, thereby facilitating the subsequent CPU occupancy comparison. In addition, by comparing the actual CPU usage with the corresponding CPU usage target value, it is easy to determine whether the vehicle-mounted application exceeds the standard. Specifically, if the actual CPU usage is greater than the corresponding CPU usage target value, it is determined that the CPU occupancy of the current vehicle-mounted application exceeds the standard; if the actual CPU usage is less than or equal to the corresponding CPU usage target value, it is determined that the CPU occupancy of the current vehicle-mounted application is normal.
[0053] S130: If the CPU usage of the vehicle-mounted application exceeds the limit, CPU usage information is displayed, where the CPU usage information includes: the application package name of the vehicle-mounted application whose CPU usage exceeds the limit, the actual CPU usage rate, and the CPU usage rate target value.
[0054] It should be noted that through the above steps, the real-time monitoring of the CPU usage or exceeding the standard of each vehicle application in the Android vehicle system can be well achieved, so that relevant personnel can deal with the CPU usage exceeding the standard in time and optimize the relevant vehicle applications. The CPU exceeding standard information can be displayed in a green screen with red text or other display methods to facilitate relevant personnel to identify.
[0055] In some embodiments, before obtaining the actual CPU usage rate of the vehicle-mounted application in the Android vehicle-mounted system, it is also included to determine whether the CPU monitoring function is turned on, wherein determining whether the CPU monitoring function is turned on includes:
[0056] 1. Monitor the attribute value of the CPU monitoring switch. The CPU monitoring switch is a preset system attribute. The attribute value of the CPU monitoring switch changes with the on / off state of the CPU monitoring switch. The on / off state of the CPU monitoring switch is set manually.
[0057] In some embodiments, when it is determined that the Android vehicle system has been started, a pre-registered listener is used to monitor the property value of the CPU monitoring switch.
[0058] It should be noted that after the Android vehicle system is started, the AMS (Activity Manager Service) service of the Android vehicle system is started, and the Android vehicle system CPU load monitoring device built into the AMS service (the device for running the Android vehicle system CPU load monitoring method) is started. In order to determine whether CPU load monitoring is required, the Android vehicle system CPU load monitoring device needs to obtain the on / off state of the CPU monitoring function, so that when it is determined that the CPU monitoring function is turned on, subsequent file reading (reading the target value configuration file) and obtaining the actual CPU usage rate of the vehicle application in the Android vehicle system are performed. This step improves the controllability of the entire Android vehicle system CPU load monitoring method.
[0059] Specifically, a user (tester or developer, etc.) can turn on or off the CPU monitoring switch in the engineering mode application of the Android vehicle system. When the user turns on the CPU monitoring switch, the engineering mode application sets the attribute value of the CPU monitoring switch to a preset first attribute value. Conversely, when the user turns off the CPU monitoring switch, the engineering mode application sets the attribute value of the CPU monitoring switch to a preset second attribute value. The first attribute value is different from the second attribute value.
[0060] 2. If the attribute value of the CPU monitoring switch is detected to be a preset first attribute value, it is determined that the CPU monitoring function is turned on. If it is determined that the CPU monitoring function is turned on, the actual CPU usage rate of the vehicle-mounted application is obtained.
[0061] 3. If it is detected that the attribute value of the CPU monitoring switch is a preset second attribute value, it is determined that the CPU monitoring function is turned off.
[0062] It should be noted that the first attribute value may be True, etc., and the second attribute value may be False, etc.
[0063] In addition to using a listener to monitor the property value of the CPU monitoring switch when determining that the Android vehicle system is started, in some embodiments, the following is also included:
[0064] 1. Monitor the change of the attribute value of the CPU monitoring switch, that is, use the monitor to monitor the change of the attribute value of the CPU monitoring switch.
[0065] 2. If it is monitored that the attribute value of the CPU monitoring switch changes from the first preset value to the second preset value, the CPU monitoring function is turned off.
[0066] 3. If it is monitored that the attribute value of the CPU monitoring switch changes from the second preset value to the first preset value, the CPU monitoring function is turned on.
[0067] It should be noted that by using a listener to monitor changes in the attribute value of the CPU monitoring switch, the CPU monitoring function can be turned on and off at any time.
[0068] In some embodiments, before obtaining the actual CPU usage of the vehicle-mounted application in the Android vehicle-mounted system, the method further includes: reading a preset target value configuration file to obtain the CPU usage target value of the vehicle-mounted application in the Android vehicle-mounted system. It should be noted that the step of reading the preset target value configuration file includes:
[0069] The target value configuration file pre-burned to the designated directory of the target disk is read to obtain structure data, wherein the structure data includes: an application package name and a CPU usage target value, and the application package name and the CPU usage target value correspond one to one.
[0070] It should be noted that by parsing the target value configuration file into the above structured data, it is possible to directly obtain the memory usage target value of the corresponding application package name and perform comparison in the subsequent comparison process.
[0071] It should also be noted that the target value configuration file is pre-configured with information such as the application package name, the CPU usage target value, and the system to which the application belongs. The CPU usage target value corresponding to each application package name in the target value configuration file is a preset empirical value, such as the CPU usage target value of the vehicle setting application is 70%, the CPU usage target value of the Bluetooth phone application is 20%, and the CPU usage target value of the driving recorder is 100%.
[0072] It should be mentioned that this embodiment adopts the vCPU (virtual central processing unit) method to divide the CPU of the vehicle system into multiple vCPUs. Assuming that there are currently 8 vCPUs (8 cores), the Android vehicle system (Android system) can occupy 6 cores of them, then the proportion of available CPU resources is 600%.
[0073] It is also worth mentioning that by setting the corresponding CPU usage target value for the vehicle-mounted application in the target value configuration file, the CPU occupancy upper limit of each vehicle-mounted application can be clearly defined, thereby facilitating subsequent monitoring of the CPU occupancy or exceeding of the vehicle-mounted application.
[0074] Figure 2 This is a flow chart of presetting a target value configuration file (pre-burning the target value configuration file to a specified directory of the target disk) in the vehicle application CPU occupancy monitoring method provided in an embodiment of the present application. Please refer to Figure 2First, write the target value configuration file in the system source code of the Android car system. Secondly, use the preset compilation tools, such as Jenkins (an open source automation server), etc. to compile and package the system source code. The compilation product is the system flashing package. Burn the system flashing package to the specified directory of the target disk of the vehicle system to complete the preset of the preset target value configuration file. By burning the target value configuration file to the specified directory of the above-mentioned target disk, it is possible to facilitate subsequent file reading and improve file reading efficiency. It should be mentioned that the system source code also includes product.mk (product build configuration file) and the like.
[0075] In some embodiments, it also includes:
[0076] According to the preset event sending frequency, Monkey events are regularly sent to the Android vehicle-mounted system. The Monkey events are randomly generated user input events, and the user input events are used to perform random operations on the interface of the vehicle-mounted application.
[0077] It should be noted that the event sending frequency can be set according to actual conditions, such as 450 milliseconds / time. User input events include random clicks, slides, scrolls, long presses, and text input. By regularly sending Monkey events to the operating system, it is possible to simulate real events, thereby fully covering the operating logic of each in-vehicle application and fully exposing the CPU usage of each in-vehicle application, so as to facilitate early monitoring of the CPU usage of the in-vehicle application and handle it as soon as possible.
[0078] In addition, in addition to the above-mentioned Monkey automated testing method, a manual testing method can also be used, that is, manually inputting corresponding test events and the like.
[0079] In some embodiments, obtaining the actual CPU usage of the vehicle application in the Android vehicle system includes:
[0080] 1. Obtain CPU usage information of the Android vehicle system, where the CPU usage information includes: an initial CPU usage rate of an application process, and an application package name of the application process.
[0081] In some embodiments, the CPU occupancy information may be obtained using a preset process monitor (top tool).
[0082] It should be noted that the CPU usage information corresponds to the application process in the operating system one by one, that is, one application process corresponds to one piece of CPU usage information. Each in-vehicle application corresponds to one or more application processes.
[0083] 2. If there are application processes with the same application package name, the initial CPU usage rates of the application processes with the same application package name are summed to obtain the actual CPU usage rate of the in-vehicle application corresponding to the current application package name.
[0084] It should be noted that if the application package names in different CPU usage information are the same, it means that the vehicle application corresponding to the application package name is a multi-process application. Therefore, the initial CPU usage rates of the application package names with the same name are summed to obtain the actual CPU usage rate of the vehicle application corresponding to the current application package name. The vehicle applications corresponding to the remaining CPU usage information are single-process applications. Therefore, the initial CPU usage rates in the remaining CPU usage information are the actual CPU usage rates of the corresponding vehicle applications.
[0085] 3. If the application package names of the application processes in the CPU occupancy information are all different, determine the in-vehicle application to which the initial CPU usage belongs based on the application package name in the CPU occupancy information, and determine the initial CPU usage as the actual CPU usage of the corresponding in-vehicle application.
[0086] It should be noted that if the application package names of the application processes in all the CPU occupancy information are different, it means that the vehicle-mounted applications of the operating system are all single-process applications, so the initial CPU usage rate in the CPU occupancy information is directly determined as the actual CPU usage rate of the corresponding vehicle-mounted application. It should be mentioned that the applications in the vehicle-mounted system are basically single-process applications, and the above embodiment can better meet the CPU occupancy monitoring needs of the vehicle-mounted system. In addition, even if the vehicle-mounted system includes multi-process applications, the above steps can better realize the monitoring of the CPU occupancy or exceeding of the vehicle-mounted application, and the feasibility is strong.
[0087] In some embodiments, obtaining the actual CPU usage of the vehicle-mounted application in the Android vehicle-mounted system includes: obtaining the actual CPU usage of the vehicle-mounted application according to the execution frequency, wherein determining the execution frequency includes:
[0088] 1. Get the CPU idle rate of the Android car system.
[0089] It should be noted that the CPU occupancy information and the CPU idle rate can be obtained simultaneously by using a process monitor. The CPU idle rate determines the execution frequency of subsequently obtaining the actual CPU usage rate of the vehicle-mounted application.
[0090] 2. If the CPU idle rate is greater than or equal to a preset idle rate threshold, the execution frequency is determined as a preset first frequency.
[0091] 3. If it is detected that the CPU idle rate is less than the preset idle rate threshold, the execution frequency is determined to be a preset second frequency and the first frequency is updated to a preset second frequency, and the second frequency is higher than the first frequency; and the CPU occupancy information is displayed on a preset display screen for a preset duration, and the display interface also includes a first QR code, wherein the step of generating the first QR code includes: encapsulating a string according to the CPU occupancy information to obtain a first string; and generating the first QR code according to the first string.
[0092] It should be noted that the first frequency may be 2 times / minute, etc., and the second frequency may be 12 times / minute, etc. The CPU idle rate may be 100% (the proportion of available CPU resources is 600%), etc. Through the above steps, the CPU usage of the operating system can be well monitored, which is convenient for subsequent timely optimization.
[0093] It should also be noted that if the CPU idle rate is less than the preset idle rate threshold, it means that the current CPU available resources of the operating system are relatively small, and the CPU usage of various in-vehicle applications is seriously exceeded. Therefore, the execution frequency is adjusted from the lower first frequency to the higher second frequency until the CPU idle rate is greater than or equal to the idle rate threshold, thereby achieving timely follow-up and accurate monitoring of the CPU usage exceeding the standard of in-vehicle applications.
[0094] In some embodiments, if the CPU usage of the vehicle-mounted application exceeds the limit, the step of displaying the CPU excess information includes:
[0095] 1. If the CPU usage of the vehicle-mounted application exceeds the limit, the CPU exceeding limit information and the current time are encapsulated into a character string to obtain a second character string.
[0096] 2. Generate a second QR code based on the second character string.
[0097] 3. Display the CPU exceeding standard information and the second QR code on the display screen for a display time equal to the preset time.
[0098] It should be noted that the preset time length can be 3 seconds, etc. By displaying the CPU exceeding standard information on the display screen, it is convenient for relevant personnel to understand the CPU exceeding standard information from the display screen. By displaying the first QR code or the second QR code on the display screen, it is convenient to read the information of the screenshot image later, that is, take a screenshot of the display interface of the display screen, and the terminal device can identify the QR code in the screenshot image to obtain the corresponding CPU exceeding standard information.
[0099] It should be mentioned that compared with the method of recognizing text information in pictures, the method of recognizing QR codes is not only simpler and faster, but also more accurate and is not affected by screen brightness, clarity, etc.
[0100] In some embodiments, it also includes:
[0101] 1. When it is determined that the display screen pops up an over-limit display interface, or the display data in the over-limit display interface changes, the application package name in the CPU over-limit information on the display interface is obtained.
[0102] 2. Traverse the preset data structure list. If the application package name is the application package name recognized for the first time, determine the application package name of the current in-vehicle application as the key, and determine the actual CPU usage rate of the current in-vehicle application as the value; store the key and the value in the data structure list, and take a screenshot of the display interface.
[0103] 3. If the application package name of the in-vehicle application already exists in the data structure list, obtain the current actual CPU usage of the in-vehicle application; if the current actual CPU usage of the in-vehicle application is greater than the corresponding actual CPU usage in the data structure list, update the data structure list and take a screenshot of the display interface.
[0104] It should be noted that in the above steps, only the screenshots with the highest actual CPU usage are retained, so as to facilitate relevant personnel to identify the CPU exceeding the standard of the vehicle application while reducing the disk load.
[0105] It is worth mentioning that the screenshots can be named with the application package name plus the current time.
[0106] In some embodiments, it also includes: storing the screenshot image to the target directory of the target disk, the screenshot image in the target disk is used for terminal device to obtain and identify, the QR code in the image is the object identified by the terminal device, and the identified information is the basis for the terminal device to report the CPU exceeding the standard Bug (vulnerability), wherein the trigger condition for generating and reporting the CPU exceeding the standard Bug is that the currently identified vehicle-mounted application CPU usage exceeds the standard, and the currently identified application package name is the first identified application package name, and the associated information of the CPU exceeding the standard Bug is recorded in a preset target list, and the associated information includes the application package name, the actual CPU usage, and the link to the CPU exceeding the standard Bug.
[0107] The triggering conditions for updating the CPU exceeding standard Bug are that the CPU usage of the currently identified in-vehicle application exceeds the standard, the currently identified application package name already exists in the target list, and the currently identified actual CPU usage is greater than the corresponding actual CPU usage in the target list. Updating the CPU exceeding standard Bug means updating the actual CPU usage in the target list to the currently identified actual CPU usage.
[0108] It should be noted that the terminal device can be a computer terminal, etc. The terminal device recognizes the QR code in the screenshot image in the target disk according to a preset recognition frequency (such as 30 seconds / time, etc.). If the CPU usage of the currently identified vehicle-mounted application exceeds the standard, and the currently identified application package name is the first identified application package name, the CPU exceeding standard Bug is generated and reported, and the associated information of the CPU exceeding standard Bug is recorded in the preset target list. If the CPU usage of the currently identified vehicle-mounted application exceeds the standard, the currently identified application package name already exists in the target list, and the currently identified actual CPU usage is greater than the corresponding actual CPU usage in the target list, the target list and the corresponding CPU exceeding standard Bug are updated. If the CPU usage of the currently identified vehicle-mounted application exceeds the standard, the currently identified application package name already exists in the target list, and the currently identified actual CPU usage is less than or equal to the corresponding actual CPU usage in the target list, the currently identified information is discarded.
[0109] It should be noted that through the above steps, accurate reporting of CPU over-limit bugs can be achieved, avoiding excessive reporting of data and causing redundancy.
[0110] The following is a specific example to further explain the Android vehicle system CPU load monitoring method in the above embodiment.
[0111] Please refer to Figure 3 First, the Android vehicle system CPU load monitoring device is started. Specifically, the Android vehicle system is started, after the Android vehicle system is started, the AMS service of the Android vehicle system is started, and the Android vehicle system CPU load monitoring device built into the AMS service is started.
[0112] Secondly, determine whether the CPU monitoring function is turned on. Specifically, if the attribute value of the CPU monitoring switch is a preset first attribute value, it is determined that the CPU monitoring function is turned on; if the attribute value of the CPU monitoring switch is a preset second attribute value, it is determined that the CPU monitoring function is turned off.
[0113] Then, when it is determined that the CPU monitoring function has been turned on, the preset target value configuration file is read to obtain structure data. The structure data includes: application package name and CPU usage target value, and the application package name and the CPU usage target value correspond one to one.
[0114] Finally, according to the execution frequency, the CPU monitoring operation is performed regularly. The CPU monitoring operation includes: regularly obtaining the CPU occupancy information of the Android vehicle system, the CPU occupancy information includes: the CPU idle rate of the operating system, the initial CPU usage rate of the application process, and the application package name of the application process; according to the initial CPU usage rate of the application process, the actual CPU usage rate of each vehicle application is obtained; according to the CPU idle rate of the operating system and the actual CPU usage rate of the vehicle application, subsequent comparison and screenshot operations are performed, which will not be repeated here.
[0115] The Android vehicle-mounted system CPU load monitoring device provided in the present application is described below. The Android vehicle-mounted system CPU load monitoring device described below and the Android vehicle-mounted system CPU load monitoring method described above can be referenced to each other.
[0116] Please refer to Figure 4 , the Android vehicle system CPU load monitoring device provided in this embodiment includes:
[0117] The data acquisition module 410 is used to obtain the actual CPU usage rate of the vehicle-mounted application in the Android vehicle-mounted system;
[0118] A first processing module 420 is used to compare the actual CPU usage with a corresponding CPU usage target value to determine whether the CPU usage of the vehicle-mounted application exceeds the standard or is normal, wherein the CPU usage target value is read from a preset target value configuration file, wherein the target value configuration file includes a one-to-one correspondence between an application package name and a CPU usage target value, wherein the application package name is a unique identifier of the vehicle-mounted application;
[0119] The second processing module 430 is used to display the CPU exceeding standard information if the CPU usage of the vehicle-mounted application exceeds the standard, and the CPU exceeding standard information includes: the application package name of the vehicle-mounted application with the CPU exceeding standard, the actual CPU usage rate, and the CPU usage rate target value. The Android vehicle-mounted system CPU load monitoring device in this embodiment can better realize the monitoring of the CPU usage of the vehicle-mounted application, so as to facilitate timely performance optimization of the vehicle-mounted application according to the CPU exceeding standard situation.
[0120] In some embodiments, the system further comprises: a state monitoring module, which is used to monitor the property value of a CPU monitoring switch, wherein the CPU monitoring switch is a preset system property, and the property value of the CPU monitoring switch changes with the on / off state of the CPU monitoring switch, and the on / off state of the CPU monitoring switch is manually set;
[0121] If it is detected that the attribute value of the CPU monitoring switch is a preset first attribute value, it is determined that the CPU monitoring function has been turned on; if it is determined that the CPU monitoring function has been turned on, the actual CPU usage rate of the vehicle-mounted application is obtained;
[0122] If it is detected that the attribute value of the CPU monitoring switch is a preset second attribute value, it is determined that the CPU monitoring function is turned off.
[0123] In some embodiments, it also includes: an event sending module, which is used to periodically send monkey events to the Android vehicle-mounted system according to a preset event sending frequency, wherein the monkey events are randomly generated user input events, and the user input events are used to perform random operations on the interface of the vehicle-mounted application.
[0124] In some embodiments, the data acquisition module 410 is specifically used to obtain CPU occupancy information of the Android vehicle-mounted system, and the CPU occupancy information includes: the initial CPU usage rate of the application process, and the application package name of the application process;
[0125] If there are application processes with the same application package name, summing the initial CPU usage rates of the application processes with the same application package name to obtain the actual CPU usage rate of the in-vehicle application corresponding to the current application package name;
[0126] If the application package names of the application processes in the CPU occupancy information are all different, the vehicle-mounted application to which the initial CPU usage belongs is determined according to the application package name in the CPU occupancy information, and the initial CPU usage is determined as the actual CPU usage of the corresponding vehicle-mounted application.
[0127] In some embodiments, the data acquisition module 410 is specifically used to obtain the actual CPU usage of the vehicle-mounted application according to the execution frequency.
[0128] In some embodiments, the data acquisition module 410 is further specifically used to obtain the CPU idle rate of the Android vehicle system;
[0129] If the CPU idle rate is greater than or equal to a preset idle rate threshold, determining the execution frequency as a preset first frequency;
[0130] If it is detected that the CPU idle rate is less than the preset idle rate threshold, the execution frequency is determined to be a preset second frequency and the first frequency is updated to a preset second frequency, and the second frequency is higher than the first frequency; and the CPU occupancy information is displayed on a preset display screen for a preset duration, and the display interface also includes a first QR code, wherein the step of generating the first QR code includes: encapsulating a string according to the CPU occupancy information to obtain a first string; and generating the first QR code according to the first string.
[0131] In some embodiments, the second processing module 430 is specifically configured to encapsulate the CPU exceeding information and the current time into a string to obtain a second string if the CPU usage of the vehicle-mounted application exceeds the limit;
[0132] Generate a second QR code according to the second character string;
[0133] The CPU exceeding standard information and the second QR code are displayed on the display screen, and the display time is the preset time.
[0134] In some embodiments, the second processing module 430 is further specifically configured to obtain the application package name in the CPU over-limit information on the display interface when it is determined that the display screen pops up an over-limit display interface or the display data in the over-limit display interface changes;
[0135] Traversing the preset data structure list, if the application package name is the application package name recognized for the first time, determining the application package name of the current in-vehicle application as a key, and determining the actual CPU usage rate of the current in-vehicle application as a value; storing the key and the value in the data structure list, and taking a screenshot of the display interface;
[0136] If the application package name of the in-vehicle application already exists in the data structure list, the current actual CPU usage of the in-vehicle application is obtained; if the current actual CPU usage of the in-vehicle application is greater than the corresponding actual CPU usage in the data structure list, the data structure list is updated and a screenshot of the display interface is taken.
[0137] In some embodiments, the second processing module 430 is further specifically used to store the screenshot image to the target directory of the target disk, the screenshot image in the target disk is used for the terminal device to obtain and identify, the QR code in the image is the object identified by the terminal device, and the identified information is the basis for the terminal device to report the CPU exceeding standard Bug, wherein the trigger condition for generating and reporting the CPU exceeding standard Bug is that the CPU usage of the currently identified vehicle-mounted application exceeds the standard, and the currently identified application package name is the first identified application package name, and the associated information of the CPU exceeding standard Bug is recorded in the preset target list, and the associated information includes the application package name, the actual CPU usage rate, and the link to the CPU exceeding standard Bug;
[0138] The triggering conditions for updating the CPU exceeding standard Bug are that the CPU usage of the currently identified in-vehicle application exceeds the standard, the currently identified application package name already exists in the target list, and the currently identified actual CPU usage is greater than the corresponding actual CPU usage in the target list. Updating the CPU exceeding standard Bug means updating the actual CPU usage in the target list to the currently identified actual CPU usage.
[0139] This embodiment further provides an Android vehicle-mounted system, comprising: the Android vehicle-mounted system CPU load monitoring device as described above. The Android vehicle-mounted system in this embodiment can achieve any of the above beneficial effects.
[0140] In some embodiments, an electronic device is also provided, which may be a server, and its internal structure is shown in FIG. Figure 5 As shown. The electronic device includes a processor, a memory, a network interface and a database connected via a system bus. Among them, the processor of the electronic device is used to provide computing and control capabilities. The memory of the electronic device includes a non-volatile and / or volatile storage medium and an internal memory. The non-volatile storage medium stores an Android vehicle system, a computer program and a database. The internal memory provides an environment for the operation of the Android vehicle system and the computer program in the non-volatile storage medium. The network interface of the electronic device is used to communicate with an external client through a network connection. When the computer program is executed by the processor, the functions or steps on the service side of the above method are implemented.
[0141] In some embodiments, an electronic device is provided, including a memory, a processor, and a computer program stored in the memory and executable on the processor. When the processor executes the computer program, the following steps are implemented: obtaining the actual CPU usage of an in-vehicle application in an Android in-vehicle system; comparing the actual CPU usage with the corresponding CPU usage target value to determine whether the CPU usage of the in-vehicle application exceeds the standard or is normal, wherein the CPU usage target value is read from a preset target value configuration file, wherein the target value configuration file includes a one-to-one corresponding application package name and a CPU usage target value, wherein the application package name is a unique identifier of the in-vehicle application; if the CPU usage of the in-vehicle application exceeds the standard, the CPU exceeding standard information is displayed, wherein the CPU exceeding standard information includes: the application package name of the in-vehicle application whose CPU usage exceeds the standard, the actual CPU usage, and the CPU usage target value.
[0142] In some embodiments, a computer-readable storage medium is provided, on which a computer program is stored. When the computer program is executed by a processor, the following steps are implemented: obtaining the actual CPU usage of an in-vehicle application in an Android in-vehicle system; comparing the actual CPU usage with the corresponding CPU usage target value to determine whether the CPU usage of the in-vehicle application exceeds the standard or is normal, the CPU usage target value is read from a preset target value configuration file, the target value configuration file includes a one-to-one corresponding application package name and CPU usage target value, the application package name is a unique identifier of the in-vehicle application; if the CPU usage of the in-vehicle application exceeds the standard, the CPU exceeding standard information is displayed, and the CPU exceeding standard information includes: the application package name of the in-vehicle application whose CPU usage exceeds the standard, the actual CPU usage, and the CPU usage target value.
[0143] It should be noted that the above functions or steps that can be implemented by the computer-readable storage medium or electronic device can refer to the relevant descriptions on the server side and the client side in the aforementioned method embodiment. To avoid repetition, they will not be described one by one here.
[0144] The flow chart and block diagram in the accompanying drawings illustrate the possible implementation architecture, function and operation of the method and computer program product according to various embodiments of the present disclosure. In this regard, each square box in the flow chart or block diagram can represent a module, a program segment, or a part of a code, and the module, program segment, or a part of a code contains one or more executable instructions for realizing the specified logical function. It should also be noted that in some implementations as replacements, the functions marked in the square box can also occur in a sequence different from that marked in the accompanying drawings. For example, two square boxes represented in succession can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each square box in the block diagram and / or flow chart, and the combination of the square boxes in the block diagram and / or flow chart can be implemented with a dedicated hardware-based system that performs a specified function or operation, or can be implemented with a combination of dedicated hardware and computer instructions.
[0145] The above embodiments are merely illustrative of the principles and effects of the present application and are not intended to limit the present application. Anyone familiar with the technology may modify or change the above embodiments without violating the spirit and scope of the present application. Therefore, all equivalent modifications or changes made by a person of ordinary skill in the art without departing from the spirit and technical ideas disclosed in the present application shall still be covered by the claims of the present application.
Claims
1. A method for monitoring CPU load of an Android vehicle system, characterized in that: include: Get the actual CPU usage of the in-vehicle applications in the Android in-vehicle system; Comparing the actual CPU usage with the corresponding CPU usage target value to determine whether the CPU usage of the vehicle-mounted application exceeds the standard or is normal, the CPU usage target value is read from a preset target value configuration file, the target value configuration file includes a one-to-one correspondence between an application package name and a CPU usage target value, the application package name being a unique identifier of the vehicle-mounted application; If the CPU usage of the vehicle-mounted application exceeds the limit, the CPU usage exceeding limit information is displayed, and the CPU usage exceeding limit information includes: the application package name of the vehicle-mounted application whose CPU usage exceeds the limit, the actual CPU usage rate, and the CPU usage rate target value.
2. The method for monitoring CPU load of an Android vehicle-mounted system according to claim 1, characterized in that: Before obtaining the actual CPU usage rate of the vehicle-mounted application in the Android vehicle-mounted system, it is also included to determine whether the CPU monitoring function is turned on, wherein determining whether the CPU monitoring function is turned on includes: Monitoring the attribute value of the CPU monitoring switch, wherein the CPU monitoring switch is a preset system attribute, and the attribute value of the CPU monitoring switch changes with the on / off state of the CPU monitoring switch, and the on / off state of the CPU monitoring switch is manually set; If it is detected that the attribute value of the CPU monitoring switch is a preset first attribute value, it is determined that the CPU monitoring function has been turned on; if it is determined that the CPU monitoring function has been turned on, the actual CPU usage rate of the vehicle-mounted application is obtained; If it is detected that the attribute value of the CPU monitoring switch is a preset second attribute value, it is determined that the CPU monitoring function is turned off.
3. The method for monitoring CPU load of an Android vehicle-mounted system according to claim 1 or 2, characterized in that: Also includes: According to the preset event sending frequency, monkey events are regularly sent to the Android vehicle-mounted system, wherein the monkey events are randomly generated user input events, and the user input events are used to perform random operations on the interface of the vehicle-mounted application.
4. The method for monitoring CPU load of an Android vehicle-mounted system according to claim 1, characterized in that: The method of obtaining the actual CPU usage rate of the vehicle-mounted application in the Android vehicle-mounted system includes: Obtaining CPU occupancy information of the Android vehicle-mounted system, wherein the CPU occupancy information includes: an initial CPU usage rate of an application process, and an application package name of the application process; If there are application processes with the same application package name, summing the initial CPU usage rates of the application processes with the same application package name to obtain the actual CPU usage rate of the in-vehicle application corresponding to the current application package name; If the application package names of the application processes in the CPU occupancy information are all different, the vehicle-mounted application to which the initial CPU usage belongs is determined according to the application package name in the CPU occupancy information, and the initial CPU usage is determined as the actual CPU usage of the corresponding vehicle-mounted application.
5. The method for monitoring CPU load of an Android vehicle-mounted system according to claim 1, characterized in that: The obtaining of the actual CPU usage rate of the vehicle-mounted application in the Android vehicle-mounted system includes: obtaining the actual CPU usage rate of the vehicle-mounted application according to the execution frequency, wherein determining the execution frequency includes: Get the CPU idle rate of the Android car system; If the CPU idle rate is greater than or equal to a preset idle rate threshold, determining the execution frequency as a preset first frequency; If it is detected that the CPU idle rate is less than the idle rate threshold, the execution frequency is determined to be a preset second frequency, which is higher than the first frequency; and the CPU occupancy information is displayed on a preset display screen for a preset duration, and the display interface also includes a first QR code, wherein the step of generating the first QR code includes: encapsulating a string according to the CPU occupancy information to obtain a first string; and generating the first QR code according to the first string.
6. The method for monitoring CPU load of an Android vehicle-mounted system according to claim 5, characterized in that: If the CPU usage of the vehicle-mounted application exceeds the limit, the CPU exceeding limit information is displayed including: If the CPU usage of the vehicle-mounted application exceeds the limit, encapsulating the CPU exceeding limit information and the current time into a character string to obtain a second character string; Generate a second QR code according to the second character string; The CPU exceeding standard information and the second QR code are displayed on the display screen, and the display duration is the preset duration.
7. The method for monitoring CPU load of an Android vehicle-mounted system according to claim 6, characterized in that: Also includes: When it is determined that the display screen pops up an over-limit display interface, or the display data in the over-limit display interface changes, obtaining the application package name in the CPU over-limit information on the display interface; Traversing the preset data structure list, if the application package name is the application package name recognized for the first time, determining the application package name of the current in-vehicle application as a key, and determining the actual CPU usage rate of the current in-vehicle application as a value; storing the key and the value in the data structure list, and taking a screenshot of the display interface; If the application package name of the in-vehicle application already exists in the data structure list, obtaining the current actual CPU usage rate of the in-vehicle application; If the current actual CPU usage of the in-vehicle application is greater than the corresponding actual CPU usage in the data structure list, the data structure list is updated and a screenshot of the display interface is taken.
8. The method for monitoring CPU load of an Android vehicle-mounted system according to claim 7, characterized in that: Also includes: The screenshot image is stored in the target directory of the target disk. The screenshot image in the target disk is used for acquisition and identification by the terminal device. The QR code in the image is the object identified by the terminal device. The identified information is the basis for the terminal device to report the CPU exceeding standard Bug. The trigger condition for generating and reporting the CPU exceeding standard Bug is that the CPU usage of the currently identified vehicle-mounted application exceeds the standard, and the currently identified application package name is the first identified application package name. The associated information of the CPU exceeding standard Bug is recorded in the preset target list. The associated information includes the application package name, the actual CPU usage rate, and the link to the CPU exceeding standard Bug. The triggering conditions for updating the CPU exceeding standard Bug are that the CPU usage of the currently identified in-vehicle application exceeds the standard, the currently identified application package name already exists in the target list, and the currently identified actual CPU usage is greater than the corresponding actual CPU usage in the target list. Updating the CPU exceeding standard Bug means updating the actual CPU usage in the target list to the currently identified actual CPU usage.
9. An Android vehicle system CPU load monitoring device, characterized in that: include: A data acquisition module is used to obtain the actual CPU usage of the vehicle-mounted applications in the Android vehicle-mounted system; A first processing module, configured to compare the actual CPU usage with a corresponding CPU usage target value to determine whether the CPU usage of the vehicle-mounted application exceeds the standard or is normal, wherein the CPU usage target value is read from a preset target value configuration file, wherein the target value configuration file includes a one-to-one corresponding application package name and a CPU usage target value, wherein the application package name is a unique identifier of the vehicle-mounted application; The second processing module is used to display CPU excess information if the CPU usage of the vehicle-mounted application exceeds the standard. The CPU excess information includes: the application package name of the vehicle-mounted application with excessive CPU usage, the actual CPU usage rate, and the CPU usage rate target value.
10. An Android vehicle-mounted system, characterized in that: include: The Android vehicle-mounted system CPU load monitoring device as described in claim 9.
Citation Information
Patent Citations
Equipment abnormal information display method and computer equipment
CN108920337A
Application program monitoring method and device, computer device, and computer storage medium
CN109542714A
Monitoring method and monitoring device for computer system and application program
CN111752800A
System and method for automatically monitoring application process in edge device container
CN115080338A
Memory monitoring method and device, electronic equipment and storage medium
CN118152229A