Android-based vehicle machine performance evaluation method
By collecting performance data in real time in the Android car system and implementing optimization strategies, the problem that the existing technology cannot optimize the car performance is solved, the user experience and car stability are improved, and driving safety is ensured.
Patent Information
- Application Number
- CN202310561235.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2023-05-18
- Publication Date
- 2024-11-22
AI Technical Summary
The existing technology cannot judge the status of the vehicle based on the real-time performance data of the Android vehicle system, and cannot optimize the performance in real time, resulting in poor user experience.
By collecting CPU occupancy and memory usage data in real time in the background, performing preset performance optimization strategies, including tolerant mode, normal mode and strict mode, cleaning processes, restricting background processes and crawling logs, to maintain smooth vehicle machines Sex and stability.
Real-time optimization of judging the status of the vehicle based on real-time performance data is achieved, avoiding problems such as lag and crashes, and improving users' driving safety and user experience.
Smart Images

Figure CN119003250A_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the technical field of software engineering, and in particular relates to an Android-based vehicle computer performance evaluation method. Background Art
[0002] At present, smart cockpits are becoming more and more popular in the automotive industry and have become mainstream, and Android-based car system applications are becoming more and more common. Car systems such as navigation software, audio and video software, etc. running on Android car system software are also increasingly frequently used in users' driving environments. In user usage scenarios, the performance and stability requirements of Android car systems are becoming higher and higher.
[0003] For example, Chinese patent CN115560994A relates to a technical field of automated testing of intelligent cockpit vehicle system, including: generating a test script; obtaining test instructions according to the test script; responding to the test instructions, conducting a vehicle test on the intelligent cockpit vehicle system based on multiple test modules, and obtaining test feedback of the intelligent cockpit vehicle system; the vehicle test includes a fluency test, a response time test, a stress test, and a vehicle-machine interconnection test on the intelligent cockpit vehicle system; and obtaining test results according to the test feedback. By generating a test script, and then obtaining test instructions, and then conducting a fluency test, a response time test, a stress test, and a vehicle-machine interconnection test on the intelligent cockpit vehicle system based on multiple test modules, the vehicle-wide test of the intelligent cockpit vehicle system is achieved, thereby improving the test efficiency of the intelligent vehicle system. For example, Chinese patent CN207010992U relates to the technical field of intelligent automobile vehicle-mounted systems, and more specifically, to a network vehicle-mounted diagnostic system. The invention comprises a hardware circuit for collecting PID parameters of vehicle OBDII, a mobile terminal for real-time display of PID parameters and a terminal server for integrating PID parameters and analyzing vehicle ECU performance; the vehicle PID parameters are read through the OBDII interface circuit in the hardware circuit, and the Bluetooth interface interacts with the Android software of the mobile terminal, and the read parameters are transmitted to the mobile terminal in real time; the received vehicle PID parameters are displayed in real time through the mobile terminal, and faults are diagnosed and cleared; data uploaded by the mobile terminal is received through the network communication terminal server, and a terminal server website system is designed to integrate and query the data uploaded by the terminal, so as to help the enterprise systematically analyze the vehicle ECU performance; and the circuit device is simple and the connection is reliable.
[0004] In addition, in the existing technology, it is also necessary to monitor the performance of the Android car system. The current technical means are mainly:
[0005] 1: Collect and upload basic device information, including manufacturer name, operating system type, CPU model, number of CPU cores, memory size, storage space size, and network connection method;
[0006] 2: Collect and upload application runtime performance data, including CPU usage, memory usage, and frame rate;
[0007] 3: Collect and upload application crash exception information, the application crash exception information includes: crash summary information and crash stack information.
[0008] However, as mentioned above, the existing technology often simply collects performance data, and is unable to determine the current state of the vehicle computer based on the performance data of the current vehicle computer and optimize the vehicle computer performance in real time to improve the user experience. Therefore, it is very necessary for both users and developers to provide a performance monitoring method for the Android vehicle computer system. Summary of the invention
[0009] The purpose of the present invention is to provide a vehicle computer performance evaluation method based on Android, which solves the existing problem of simply collecting data by collecting real-time performance data and optimizing it. The existing technical solution can judge the current state of the vehicle computer according to the performance data of the current vehicle computer, and combine the optimization algorithm built into the vehicle computer to optimize the vehicle computer performance in real time and improve the user experience.
[0010] In order to solve the above technical problems, the present invention is achieved through the following technical solutions:
[0011] The present invention is a vehicle computer performance evaluation method based on Android, comprising the following steps:
[0012] Start the performance monitoring background service, and continuously obtain the real-time Android performance data of the current vehicle equipment at intervals of 1 second. The Android performance data of the vehicle equipment includes CPU usage and memory usage.
[0013] After the performance monitoring background service obtains the performance data, it executes the currently configured performance optimization strategy, which includes: tolerant mode, normal mode, and strict mode. It ensures the smoothness and stability of the vehicle computer under various circumstances, avoids situations that affect the use due to performance problems, such as freezes, freezes, and restarts, and maintains the user's driving safety.
[0014] Furthermore, in the tolerance mode, when the CPU usage or memory usage exceeds a preset value, it is determined whether to start the log capture process according to the configuration information;
[0015] Normal mode: When the CPU usage exceeds the preset value 2 and / or the memory usage exceeds the preset value 3, the corresponding processes are cleaned up;
[0016] Strict mode: When the CPU usage or memory usage exceeds the preset value of four, the background process restriction function is enabled according to the importance value of the process;
[0017] Among them, preset value one>preset value two>preset value three>preset value four.
[0018] Furthermore, the method further comprises the following steps:
[0019] Obtain basic information of vehicle equipment, and obtain vehicle model and vehicle vi n information through vehicle S P I protocol;
[0020] Obtain basic information of the vehicle Android terminal, including: memory size, CPU model, number of CPU cores, operating system version, and memory size;
[0021] Read configuration information, which includes: 1. Application whitelist. Applications in the whitelist will not be cleaned up when the performance optimization policy is triggered; 2. Performance policy information. The tool obtains this information to choose to execute the corresponding performance optimization policy; 3. Whether to start the log service.
[0022] Furthermore, the method for obtaining the basic information of the vehicle machine Android terminal is:
[0023] Memory size: Get the memory size information of the Android side through the ActivityManager.MemoryInfo interface of the Android system;
[0024] CPU model: Get CPU model information through the Build class of the Android system;
[0025] Number of CPU cores: Use BufferedReader to read the / proc / stat file to obtain the number of CPU cores.
[0026] Operating system version: Get the Android operating system version through the Build class of the Android system;
[0027] Memory size: Use BufferedReader to read the / proc / meminfo file to obtain the memory size.
[0028] Furthermore, the performance data of the vehicle machine Android terminal is obtained, and the performance data of the vehicle machine Android terminal includes: CPU occupancy rate and memory usage rate; the calculation method of the CPU occupancy rate is:
[0029] Read the / proc / stat file to obtain the current CPU status information. The CPU status information contains N elements.
[0030] The CPU status information is obtained at intervals of 1 second. The two acquisition times are recorded as t1 and t2 respectively, where t1 and t2 both correspond to N elements.
[0031] Calculate the total CPU time:
[0032] Sum all the N items of CPU usage data corresponding to the first acquired time t1 to get total_t1;
[0033] Sum all the N items of CPU usage data corresponding to the first acquired time t2 to get total_t2;
[0034] All time slices within the time interval from t1 to t2, that is, totalCPUTime = total_t2 - total_t1;
[0035] Calculate the idle time idle: idle = idle_t2 – idle_t1, where idle_t1 and idle_t2 are the idle times corresponding to the two acquired times respectively;
[0036] Calculate CPU usage CPUUsage: CPUUsage = 100*(total_t2-total_t1–(idle_t2–idle_t1)) / (total_t2–total_t1).
[0037] Furthermore, the memory usage rate is calculated as follows:
[0038] Use the Runtime class to execute the terminal command "dumpsysmeminfo" and temporarily store the execution result in the Process class;
[0039] Get the string result information through the getInputStream method of the Process class, and use the BufferedReader class to temporarily store the result information;
[0040] Search the search information in the BufferedReader class and search for "TotalRAM" to obtain the total memory size of the vehicle equipment, which is recorded as totalRam.
[0041] Search for "FreeRAM" in the BufferedReader class to obtain the current free memory size, recorded as freeRam;
[0042] Calculate memory usage ramUsage: ramUsage = 100*(totalRam-freeRam) / totalRam.
[0043] Furthermore, the performance optimization strategies are:
[0044] Tolerance mode: When the CPU usage exceeds 85% or the memory usage exceeds 85%, the configuration information is used to determine whether to start the log capture process. The log process automatically captures various log information of the current system running in the background, which is convenient for developers to analyze and locate problems.
[0045] Normal Mode:
[0046] Case 1: When the CPU usage exceeds 70%, and the CPU usage is counted to exceed 70% more than 6 times within 10 seconds, use the Runtime class to execute the terminal command "top-m5" to obtain the 5 processes with the highest CPU usage and save them in a file;
[0047] Case 2: When the memory usage exceeds 60%, and the memory usage exceeds 60% more than 5 times within 10 seconds, use the Runtime class to execute the terminal command "dumpsys meminfo" and save the execution result in a file;
[0048] When the performance data of the vehicle Android terminal meets one or all of the above conditions 1 and 2, obtain all the processes running in the current system and obtain the importance value of the process, and mark the importance value as RunningAppProcessInfo.IMPORTANCE_VISIBLE. Combined with the application whitelist information obtained in the configuration information, kill all processes with importance values greater than RunningAppProcessInfo.IMPORTANCE_VISIBLE and not in the whitelist according to the importance value of the process;
[0049] Strict mode: When the CPU occupancy rate exceeds 50% or the memory usage rate exceeds 50%, all running processes of the current system are obtained and the importance value of the process is obtained, and the importance value is marked as RunningAppProcessInfo.IMPORTANCE_VISIBLE, and combined with the application whitelist information obtained in the configuration information, according to the importance value of the process, kill all processes whose importance value is greater than RunningAppProcessInfo.IMPORTANCE_VISIBLE and are not in the whitelist; In this mode, the background process restriction function in the Android developer options can be combined with the current Android system background process to meet the maximum performance of the vehicle equipment.
[0050] Furthermore, the log background service is started, and four types of logs, logcat, kernel, main, and event, are automatically captured in the device background and saved in the device in the form of files; the method for capturing the log process is:
[0051] Use the Runtime class to execute the terminal command "logcat –vthreadtime –r10240 –n20 –f / data / log / lanyou_logcat" to capture the current system log and save it in the device as a file;
[0052] When a system abnormality is detected, the log is uploaded to the server backend through the unique serial number of the vehicle equipment and the log is cleared; after analyzing the background abnormal log, major bugs are modified through hot updates.
[0053] Furthermore, the mechanism for obtaining the log is as follows: when the log service captures the log in the background, the four logs, logcat, kernel, main, and event, are written in four log files respectively, the log information is accompanied by the current vehicle time, and the log files are compressed and deleted.
[0054] Furthermore, the method for compressing and deleting the log file is:
[0055] When the log service detects that all current log files have reached the preset size (the log file size is determined by the size of the vehicle computer partition), all log files will be centrally compressed. The name of the compressed package is the current time of the vehicle computer to reduce the temporary use of the disk size. When all log compression packages and files reach the maximum capacity (determined by the size of the vehicle computer partition), the earliest compression package will be deleted first to release disk space to reduce the temporary use of the disk size.
[0056] The present invention has the following beneficial effects:
[0057] The present invention collects real-time performance data, optimizes it, and provides developers with relevant information for analyzing system performance, thereby facilitating after-sales problem handling and maintenance; meeting users' requirements for vehicle computer performance and improving user experience; in addition, it can also facilitate developers to track and locate after-sales problems in order to continuously optimize product performance.
[0058] Of course, any product implementing the present invention does not necessarily need to achieve all of the advantages described above at the same time. BRIEF DESCRIPTION OF THE DRAWINGS
[0059] In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the accompanying drawings required for describing the embodiments will be briefly introduced below. Obviously, the accompanying drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other accompanying drawings can be obtained based on these accompanying drawings without paying creative work.
[0060] Figure 1 This is a flow chart of the vehicle machine performance evaluation method based on Android of the present invention;
[0061] Figure 2 This is a flowchart of the implementation of the permissive mode strategy of the present invention;
[0062] Figure 3 This is a flow chart of the normal mode strategy execution of the present invention;
[0063] Figure 4 This is a flow chart of strict mode policy execution of the present invention;
[0064] Figure 5 This is a flow chart of log collection of the present invention;
[0065] Figure 6 This is a schematic diagram of hard interrupt information;
[0066] Figure 7 This is a schematic diagram of the current CPU status information;
[0067] Figure 8 This is a schematic diagram of search result information in the BufferedReader class. DETAILED DESCRIPTION
[0068] In the following description, specific details such as specific system structures, technologies, etc. are provided for the purpose of illustration rather than limitation, so as to provide a thorough understanding of the embodiments of the present application. However, it should be clear to those skilled in the art that the present application may also be implemented in other embodiments without these specific details. In other cases, detailed descriptions of well-known systems, devices, circuits, and methods are omitted to prevent unnecessary details from obstructing the description of the present application.
[0069] It should be understood that when used in the present specification and the appended claims, the term "comprising" indicates the presence of described features, wholes, steps, operations, elements and / or components, but does not exclude the presence or addition of one or more other features, wholes, steps, operations, elements, components and / or combinations thereof.
[0070] It should also be understood that the term “and / or” used in the specification and appended claims refers to any and all possible combinations of one or more of the associated listed items, and includes these combinations.
[0071] As used in the specification and appended claims of this application, the term "if" can be interpreted as "when" or "uponce" or "in response to determining" or "in response to detecting", depending on the context. Similarly, the phrase "if it is determined" or "if [described condition or event] is detected" can be interpreted as meaning "uponce it is determined" or "in response to determining" or "uponce [described condition or event] is detected" or "in response to detecting [described condition or event]", depending on the context.
[0072] In addition, in the description of the present application specification and the appended claims, the terms "first", "second", "third", etc. are only used to distinguish the descriptions and cannot be understood as indicating or implying relative importance.
[0073] References to "one embodiment" or "some embodiments" etc. described in the specification of this application mean that one or more embodiments of the present application include specific features, structures or characteristics described in conjunction with the embodiment. Therefore, the statements "in one embodiment", "in some embodiments", "in some other embodiments", "in some other embodiments", etc. that appear in different places in this specification do not necessarily refer to the same embodiment, but mean "one or more but not all embodiments", unless otherwise specifically emphasized in other ways. The terms "including", "comprising", "having" and their variations all mean "including but not limited to", unless otherwise specifically emphasized in other ways.
[0074] The vehicle computer system is related to driving safety, so the stability of performance is particularly important. This technical solution aims to ensure the smoothness and stability of the vehicle computer in various situations, avoid freezing, freezing, restarting and other situations that affect the use due to performance problems, and maintain the driving safety of users. Figure 1 As shown, the present invention is a vehicle computer performance evaluation method based on Android, comprising the following steps:
[0075] Step 1: Turn on the machine to automatically start the tool or manually start the tool;
[0076] Step 2: Obtain basic vehicle information and record it;
[0077] Step 3: Start the performance monitoring service, obtain and calculate the performance data of the car machine Android system, including CPU usage and memory usage, and monitor the current car machine Android end performance;
[0078] Step 4: Read the configuration information, obtain the current working mode and whether to start the log service;
[0079] Step 5: Enable performance mode according to the configuration information and test the Android system performance in the background;
[0080] Step 6: Based on the configuration information, determine whether to start the log service, collect real-time performance data, and optimize; and provide developers with relevant information for analyzing system performance to facilitate after-sales problem handling and maintenance. Monitor the performance of the Android system and improve the stability and fluency of software operation.
[0081] As an embodiment provided by the present invention, preferably, a performance monitoring background service is started, and the real-time vehicle machine Android end performance data of the current vehicle machine device is continuously obtained in the background at intervals of 1 second, and the vehicle machine Android end performance data includes CPU occupancy rate and memory usage rate; the current vehicle machine status can be judged according to the performance data of the current vehicle machine, and the vehicle machine performance can be optimized in real time in combination with the optimization algorithm built into the vehicle machine, so as to improve the user experience, avoid the situation that the vehicle machine is stuck, freezes, restarts, etc. due to performance problems and affect the use, and maintain the driving safety of the user;
[0082] After the performance monitoring background service obtains the performance data, it executes the currently configured performance optimization strategy, which includes:
[0083] Tolerance mode: When the CPU usage or memory usage exceeds the preset value, determine whether to start the log capture process based on the configuration information;
[0084] Normal mode: When the CPU usage exceeds the preset value 2 and / or the memory usage exceeds the preset value 3, the corresponding processes are cleaned up;
[0085] Strict mode: When the CPU usage or memory usage exceeds the preset value of four, the background process restriction function is enabled according to the importance value of the process;
[0086] Among them, preset value one>preset value two>preset value three>preset value four.
[0087] Monitor the performance of the Android system and improve the stability and smoothness of software operation.
[0088] As an embodiment provided by the present invention, preferably, the following steps are also included:
[0089] Get the basic information of the vehicle equipment, and get the vehicle model and vehicle vin information through the vehicle SPI protocol. The basic information of the vehicle equipment includes: project number, SW number, IVI version number, MCU version number, DSP version number, GNSS version number, and CCM version number;
[0090] Obtain basic information about the Android terminal of the vehicle computer, including: memory size, CPU model, number of CPU cores, operating system version, and memory size;
[0091] Read configuration information, which includes: 1. Application whitelist. Applications in the whitelist will not be cleaned up when the performance optimization policy is triggered; 2. Performance policy information. The tool obtains this information to choose to execute the corresponding performance optimization policy; 3. Whether to start the log service.
[0092] As an embodiment provided by the present invention, preferably, the method for acquiring the basic information of the vehicle machine Android terminal is:
[0093] Memory size: Get the memory size information of the Android side through the ActivityManager.MemoryInfo interface of the Android system;
[0094] CPU model: Get CPU model information through the Build class of the Android system;
[0095] Number of CPU cores: Use BufferedReader to read the / proc / stat file to obtain the number of CPU cores.
[0096] Operating system version: Get the Android operating system version through the Build class of the Android system;
[0097] Memory size: Use BufferedReader to read the / proc / meminfo file to obtain the memory size.
[0098] About memory:
[0099] As shown in Table 1 below:
[0100] Table 1
[0101]
[0102] The process space distribution is shown in Table 2:
[0103] Table 2
[0104]
[0105]
[0106] CPU related information: You can view CPU related information through the / proc / cpuinfo file, and hard interrupt information through / proc / interrupts, such as Figure 6 As shown, the fields from left to right are the logical interrupt number, the number of times the interrupt occurs on each CPU, the name of the parent device to which the interrupt belongs, the hardware interrupt number, the interrupt triggering mode, and the interrupt name.
[0107] As an embodiment provided by the present invention, preferably, the vehicle machine Android end performance data is obtained, and the vehicle machine Android end performance data includes: CPU occupancy rate and memory usage rate; the CPU occupancy rate is a dynamic value, and the calculation method of the CPU occupancy rate is:
[0108] Read the / proc / stat file to obtain the current CPU status information; the CPU status information contains N elements, such as Figure 7 As shown, we take the first row as an example, where the meaning of the data is shown in Table 3:
[0109] Table 3
[0110]
[0111]
[0112] Taking the first row as an example, the CPU status information contains N elements, N = 7, and the 7 elements are: user, nice, system, idle, iowait, irq, softirq;
[0113] The CPU status information is obtained at intervals of 1 second. The two acquisition times are recorded as t1 and t2 respectively, where t1 and t2 correspond to 7 elements (user, nice, system, idle, iowait, irq, softirq);
[0114] Calculate the total CPU time:
[0115] Sum all 7 items of CPU usage data corresponding to the first acquired time t1 to get total_t1;
[0116] Sum all 7 items of CPU usage data corresponding to the first acquired time t2 to get total_t2;
[0117] All time slices within the time interval from t1 to t2, that is, totalCPUTime = total_t2 - total_t1;
[0118] Calculate the idle time idle: idle = idle_t2–idle_t1, where idle_t1 and idle_t2 are the idle times corresponding to the two acquired times respectively; that is, idle corresponds to the data in the fourth column, and the second idle minus the first idle is sufficient: idle = idle_t2–idle_t1;
[0119] Calculate CPU usage CPUUsage: CPUUsage = 100*(total_t2-total_t1–(idle_t2–idle_t1)) / (total_t2–total_t1).
[0120] As an embodiment provided by the present invention, preferably, the method for calculating the memory usage rate is:
[0121] Use the Runtime class to execute the terminal command "dumpsys meminfo" and temporarily store the execution result in the Process class;
[0122] Get the string result information through the getInputStream method of the Process class, and use the BufferedReader class to temporarily store the result information;
[0123] Search result information in the BufferedReader class, such as Figure 8 As shown, search for "TotalRAM" to obtain the total memory size of the vehicle equipment, which is recorded as totalRam;
[0124] Search for "FreeRAM" in the BufferedReader class to obtain the current free memory size, recorded as freeRam;
[0125] Calculate memory usage ramUsage: ramUsage = 100*(totalRam-freeRam) / totalRam.
[0126] As an embodiment provided by the present invention, preferably, the performance optimization strategies are:
[0127] like Figure 2 As shown, tolerance mode: when the CPU usage exceeds 85% or the memory usage exceeds 85%, it is determined whether to start the log capture process according to the configuration information. The log process is a background process that automatically captures various log information of the current system operation, which is convenient for developers to analyze and locate problems;
[0128] like Figure 3 As shown, normal mode:
[0129] Case 1: When the CPU usage exceeds 70%, and the CPU usage is counted to exceed 70% more than 6 times within 10 seconds, use the Runtime class to execute the terminal command "top-m5" to obtain the 5 processes with the highest CPU usage and save them in a file;
[0130] Case 2: When the memory usage exceeds 60%, and the memory usage exceeds 60% more than 5 times within 10 seconds, use the Runtime class to execute the terminal command "dumpsys meminfo" and save the execution result in a file;
[0131] When the performance data of the vehicle Android terminal meets one or all of the above conditions 1 and 2, obtain all the processes running in the current system and obtain the importance value of the process, and mark the importance value as RunningAppProcessInfo.IMPORTANCE_VISIBLE. Combined with the application whitelist information obtained in the configuration information, kill all processes with importance values greater than RunningAppProcessInfo.IMPORTANCE_VISIBLE and not in the whitelist according to the importance value of the process;
[0132] like Figure 4 As shown, strict mode: when the CPU occupancy rate exceeds 50% or the memory usage rate exceeds 50%, obtain all running processes of the current system and obtain the importance value of the process, and mark the importance value as RunningAppProcessInfo.IMPORTANCE_VISIBLE, and combine the application whitelist information obtained in the configuration information, according to the importance value of the process, kill all processes whose importance value is greater than RunningAppProcessInfo.IMPORTANCE_VISIBLE and are not in the whitelist; in this mode, you can combine the background process restriction function in the Android developer options, and now the Android system background process to meet the maximum performance of the vehicle equipment.
[0133] As an embodiment provided by the present invention, preferably, the log background service is started, and four types of logs, logcat, kernel, main, and event, are automatically captured in the device background, and saved in the device in the form of files; the method for capturing the log process is:
[0134] Use the Runtime class to execute the terminal command "logcat –vthreadtime –r10240 –n20 –f / data / log / lanyou_logcat" to capture the current system log and save it in the device as a file;
[0135] When a system abnormality is detected, the log is uploaded to the server backend through the unique serial number of the vehicle equipment and the log is cleared; after analyzing the background abnormal log, major bugs are modified through hot updates.
[0136] As an embodiment provided by the present invention, more preferably, the method for capturing the log process is:
[0137] Logcat log capture: Use the Runtime class to execute the terminal command "logcat-vthreadtime-r10240-n20-f / data / log / logd / lanyou_logcat" to capture the current system log and save it in the device as a file;
[0138] Kernel log capture method: Use the Runtime class to execute the terminal command "cat / proc / kmsg> / data / log / kernel / kernel.log" to capture the current kernel log and save it in the device as a file;
[0139] Main log capture: Use the Runtime class to execute the terminal command "logcat-bmain–vthreadtime–r10240–n20–f / data / log / main / lanyou_main_logcat" to capture the current main log and save it in the device as a file;
[0140] Event log capture: Use the Runtime class to execute the terminal command "logcat-bevent–vthreadtime–r10240–n20–f / data / log / event / lanyou_event_logcat" to capture the current main log and save it in the device as a file.
[0141] As an embodiment provided by the present invention, preferably, the mechanism for obtaining the log is: when the log service captures the log in the background, the four logs of logcat, kernel, main, and event will be written in four log files respectively, the log information will be accompanied by the current vehicle time, and the log file will be compressed and deleted.
[0142] As an embodiment provided by the present invention, preferably, the method for compressing and deleting the log file is:
[0143] When the log service detects that all current log files have reached a certain size (the size of the log files is determined by the size of the vehicle computer partition), all log files will be centrally compressed. The name of the compressed package is the current time of the vehicle computer to reduce the temporary use of the disk size. When all log compressed packages and files reach the maximum capacity (determined by the size of the vehicle computer partition), the earliest compressed package will be deleted first to release disk space to reduce the temporary use of the disk size.
[0144] Among them, the definitions of the terms involved in this application are shown in Table 4:
[0145] Table 4
[0146]
[0147]
[0148] An Android-based vehicle computer performance evaluation method collects real-time performance data, optimizes it, and provides developers with relevant information for analyzing system performance, which facilitates after-sales problem handling and maintenance; meets user requirements for vehicle computer performance and improves user experience. In addition, it can also facilitate developers to track and locate after-sales problems so as to continuously optimize product performance.
[0149] In the description of this specification, the description with reference to the terms "one embodiment", "example", "specific example", etc. means that the specific features, structures, materials or characteristics described in conjunction with the embodiment or example are included in at least one embodiment or example of the present invention. In this specification, the schematic representation of the above terms does not necessarily refer to the same embodiment or example. Moreover, the specific features, structures, materials or characteristics described can be combined in any one or more embodiments or examples in a suitable manner.
[0150] The preferred embodiments of the present invention disclosed above are only used to help illustrate the present invention. The preferred embodiments do not describe all the details in detail, nor do they limit the invention to the specific implementation methods described. Obviously, many modifications and changes can be made according to the content of this specification. This specification selects and specifically describes these embodiments in order to better explain the principles and practical applications of the present invention, so that those skilled in the art can understand and use the present invention well. The present invention is limited only by the claims and their full scope and equivalents.
Claims
1. A vehicle computer performance evaluation method based on Android, characterized in that: The following steps are involved: Start the performance monitoring background service, and continuously obtain the real-time Android performance data of the current vehicle equipment in the background at intervals of 1 second. The performance data includes CPU usage and memory usage. After the performance monitoring background service obtains the performance data, it executes the currently configured performance optimization strategy, which includes: Tolerance mode: When the CPU usage or memory usage exceeds the preset value, determine whether to start the log capture process based on the configuration information; Normal mode: When the CPU usage exceeds the preset value 2 and / or the memory usage exceeds the preset value 3, the corresponding processes are cleaned up; Strict mode: When the CPU usage or memory usage exceeds the preset value of four, the background process restriction function is enabled according to the importance value of the process; Among them, preset value one>preset value two>preset value three>preset value four.
2. According to the Android-based vehicle computer performance evaluation method of claim 1, it is characterized in that: The following steps are also included: Get the basic information of the vehicle equipment, and obtain the vehicle model and vehicle VIN information through the vehicle SPI protocol; Obtain basic information about the Android terminal of the vehicle computer, including: memory size, CPU model, number of CPU cores, operating system version, and memory size; Read configuration information, including: application whitelist, performance policy information, and whether to start the log service.
3. According to the Android-based vehicle computer performance evaluation method of claim 2, it is characterized in that: The method for obtaining the basic information of the vehicle machine Android terminal is as follows: Memory size: Get the memory size information of the Android side through the ActivityManager.MemoryInfo interface of the Android system; CPU model: Get CPU model information through the Build class of the Android system; Number of CPU cores: Use BufferedReader to read the / proc / stat file to obtain the number of CPU cores. Operating system version: Get the Android operating system version through the Build class of the Android system; Memory size: Use BufferedReader to read the / proc / meminfo file to obtain the memory size.
4. The method for evaluating vehicle computer performance based on Android according to claim 1, characterized in that: The CPU occupancy rate is calculated as follows: Read the / proc / stat file to obtain the current CPU status information. The CPU status information contains N elements. The CPU status information is obtained at intervals of 1 second. The two acquisition times are recorded as t1 and t2 respectively, where t1 and t2 both correspond to N elements. Calculate the total CPU time: Sum all the N items of CPU usage data corresponding to the first acquired time t1 to get total_t1; Sum all the N items of CPU usage data corresponding to the first acquired time t2 to get total_t2; All time slices within the time interval from t1 to t2, that is, totalCPUTime = total_t2 - total_t1; Calculate the idle time idle: idle = idle_t2 – idle_t1, where idle_t1 and idle_t2 are the idle times corresponding to the two acquired times respectively; Calculate CPU usage CPUUsage: CPUUsage = 100*(total_t2-total_t1–(idle_t2–idle_t1)) / (total_t2–total_t1).
5. According to the Android-based vehicle computer performance evaluation method of claim 1, it is characterized in that: The memory usage rate is calculated as follows: Use the Runtime class to execute the terminal command "dumpsys meminfo", and the execution result is temporarily stored in the Process class; Get the string result information through the getInputStream method of the Process class, and use the BufferedReader class to temporarily store the result information; Search the search information in the BufferedReader class and search for "Total RAM" to obtain the total memory size of the vehicle equipment, which is recorded as totalRam. Search for "Free RAM" in the BufferedReader class to obtain the current free memory size, recorded as freeRam; Calculate memory usage ramUsage: ramUsage = 100*(totalRam-freeRam) / totalRam.
6. The method for evaluating vehicle computer performance based on Android according to claim 1, characterized in that: The performance optimization strategies are: Tolerant mode: When the CPU usage exceeds 85% or the memory usage exceeds 85%, it is determined whether to start the log capture process based on the configuration information; Normal Mode: Case 1: When the CPU usage exceeds 70%, and the CPU usage is counted to exceed 70% more than 6 times within 10 seconds, use the Runtime class to execute the terminal command "top-m 5" to obtain the 5 processes with the highest CPU usage and save them in a file; Case 2: When the memory usage exceeds 60%, and the memory usage is counted to exceed 60% more than 5 times within 10 seconds, use the Runtime class to execute the terminal command "dumpsys meminfo" and save the execution result in a file; When the performance data of the vehicle Android terminal meets one or all of the above conditions 1 and 2, obtain all the processes running in the current system and obtain the importance value of the process, and mark the importance value as RunningAppProcessInfo.IMPORTANCE_VISIBLE. Combined with the application whitelist information obtained in the configuration information, kill all processes with importance values greater than RunningAppProcessInfo.IMPORTANCE_VISIBLE and not in the whitelist according to the importance value of the process; Strict mode: When the CPU usage exceeds 50% or the memory usage exceeds 50%, all running processes in the current system are obtained and the importance value of the process is obtained, and the importance value is marked as RunningAppProcessInfo.IMPORTANCE_VISIBLE. Combined with the application whitelist information obtained in the configuration information, all processes with importance values greater than RunningAppProcessInfo.IMPORTANCE_VISIBLE and not in the whitelist are killed according to the importance value of the process.
7. The method for evaluating vehicle computer performance based on Android according to claim 1 or 6, characterized in that: Start the log background service, automatically capture four types of logs, logcat, kernel, main, and event, in the device background, and save them in the device as files; the method for capturing the log process is: Use the Runtime class to execute the terminal command "logcat –v threadtime –r 10240 –n 20 –f / data / log / lanyou_logcat" to capture the current system log and save it in the device as a file; When a system abnormality is detected, the log is uploaded to the server backend through the unique serial number of the vehicle equipment and the log is cleared; After analyzing the background exception log, fix the bug through hot update.
8. The method for evaluating vehicle computer performance based on Android according to claim 7, characterized in that: The mechanism for obtaining the log is as follows: when the log service captures the log in the background, the four logs, logcat, kernel, main, and event, are written into four log files respectively, the log information is accompanied by the current vehicle computer time, and the log files are compressed and deleted.
9. The method for evaluating vehicle computer performance based on Android according to claim 8, characterized in that: The method to compress and delete log files is: When the log service detects that all current log files have reached the preset size, it will centrally compress all log files, and the name of the compressed package will be the current time of the vehicle computer; when all log compressed packages and files reach the maximum capacity, the earliest compressed package will be deleted first to free up disk space.
Citation Information
Cited By
CPU utilization rate evaluation method and device, electronic equipment and storage medium
CN119597588A
