CPU and Memory occupancy data monitoring and analysis method and system based on Android vehicle machine
Patent Information
- Application Number
- CN202210404762.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-04-18
- Publication Date
- 2024-09-24
- Estimated Expiration
- 2042-04-18
AI Technical Summary
[0003]目前只能通过上述两条命令来获取当前时刻Android设备各进程之间的CPU和Memory数据占用情况,而对于车机开发测试来说,通常需要通过操作车机来观察CPU和Memory的数据情况的实时变化,或者在进行monkey测试时,想获取并记录测试期间Android车机各进程的CPU和Memory数据占用情况,而通过命令行来读取通常比较麻烦,获取到的数据信息不够直观,也无法观察其变化趋势
[0034] (1) Communicate with the Android device through the Android debugging bridge (adb) command line tool, and then call the dumpsys tool to obtain the CPU and Memory occupation data information of each process in the android device, and use the python program to process the obtained data information. Process and then pass it to the QT interface to form a system that can monitor and analyze CPU and Memory usage data in real time, including: real-time monitoring of CPU and Memory data information of each process; file storage of CPU and Memory data; CPU and Memory data files can be imported for analysis; displayed in the program in the form of a line chart; and the process data that needs to be analyzed can be filtered.
Smart Images

Figure CN114816743B
Abstract
Description
Technical Field
[0001] The present invention belongs to the technical field of network data monitoring, and more specifically, relates to a method and system for monitoring and analyzing CPU and Memory occupancy data based on an Android vehicle machine. Background Art
[0002] During the development of Android car machines, developers can usually only use the dumpsys tool to obtain the CPU and memory usage of each process in real time. To obtain CPU usage data: adb shell dumpsys cpuinfo; to obtain memory usage data: adb shell dumpsys -t 60meminfo.
[0003] Currently, only the above two commands can be used to obtain the CPU and Memory data usage between each process of the Android device at the current moment. For vehicle computer development and testing, it is usually necessary to observe the real-time changes in the CPU and Memory data by operating the vehicle computer, or when performing monkey testing, you want to obtain and record the CPU and Memory data usage of each process of the Android vehicle computer during the test. However, reading through the command line is usually troublesome, and the obtained data information is not intuitive enough, and its changing trend cannot be observed. Secondly, if developers only want to obtain the CPU and Memory data information usage and changing trend of one or more processes during a certain test period, the process data is redundant and inconvenient to find, and it is not easy to observe its changes. Therefore, there are still certain limitations in using the above two commands to obtain the CPU and Memory data usage between each process of the Android device at the current moment. Summary of the invention
[0004] In view of the above defects or improvement needs of the prior art, the present invention proposes a CPU and Memory occupancy data monitoring and analysis method and system based on Android car machine, which can monitor and analyze CPU and Memory occupancy data in real time.
[0005] To achieve the above object, according to one aspect of the present invention, a CPU and Memory occupancy data monitoring and analysis system based on an Android vehicle is provided, comprising:
[0006] The real-time monitoring module of CPU data information of each process is used to obtain the CPU occupancy data information of each process in the Android device based on the Android debug bridge adb command line tool, and then call the dumpsys tool to process all the obtained CPU occupancy data information, generate a CPU data information dictionary, store the obtained CPU occupancy data in a txt file, and then process the data in the CPU data information dictionary through the python program and display it in real time on the QT interface to form a line chart of real-time monitoring changes, where the CPU data information dictionary includes the time of each process, the process name and the CPU occupancy rate at that time;
[0007] The real-time monitoring module of memory data information of each process is used to obtain the memory usage data information of each process in the Android device based on the Android debug bridge adb command line tool, and then call the dumpsys tool to process all the acquired memory usage data information, generate a memory data information dictionary, store the obtained memory usage data in a txt file, and then process the data in the memory data information dictionary through the python program and display it in real time on the QT interface to form a line chart for real-time monitoring changes. The memory data information dictionary includes the time of each process, the process name and the memory usage data size at that time;
[0008] The CPU occupancy rate analysis module of each process is used to obtain the txt file of CPU occupancy data, and then analyze and process the data information in the txt file of CPU occupancy data through the Python program, and convert it into a dictionary with the time mark as the key value and the process name and CPU data information dictionary as the value value, so as to generate a line chart of CPU data analysis;
[0009] The memory usage analysis module of each process is used to obtain the txt file of memory usage data, and then analyze and process the data information in the txt file of memory usage data through the python program, and convert it into a dictionary with the time mark as the key value and the process name and memory data information dictionary as the value value, so as to generate a line chart of memory data analysis.
[0010] In some optional implementation schemes, the CPU data information real-time monitoring module includes a CPU data information monitoring module and a CPU data information analysis module;
[0011] The CPU data information monitoring module is used to, after obtaining the instruction to collect CPU data information, start the CPU data collection thread through the Python program to automatically call the adb shell dumpsys cpuinfo command to obtain the CPU occupancy data of each process, and then obtain the time data through adb shell'data+%Y%m%d%H%M%S', generate the CPU data information dictionary of each moment through Python data processing, and set the buffer of the time list, sort the stored CPU data information dictionary according to the CPU occupancy data obtained at the last moment, and take the first several bits as real-time observation data, so as to obtain a real-time dynamic CPU data monitoring chart;
[0012] The CPU data information analysis module is used to use the time in the CPU data information dictionary as the coordinate list of the x-axis in the line graph in each CPU data collection, the CPU occupancy rate at each time as the y-coordinate list, put each process name into the process name list, and draw the line graph of each time by looping the data in the CPU data information dictionary.
[0013] In some optional implementation schemes, the Memory data information real-time monitoring module includes a Memory data information monitoring module and a Memory data information analysis module;
[0014] The Memory data information monitoring module is used to, after obtaining the instruction for collecting Memory data information, start the Memory data collection thread through the Python program and automatically call the adb shell dumpsys-t 60meminfo command to obtain the Memory data occupied by each process, and then obtain the time data through adb shell'data+%Y%m%d%H%M%S', generate the Memory data information dictionary at each moment through Python data processing, and set the buffer of the time list, sort the stored Memory data information dictionary according to the Memory data occupied size obtained at the last moment, and take the first several bits as real-time observation data, so as to obtain a real-time dynamic Memory data monitoring chart;
[0015] The memory data information analysis module is used to use the time in the memory data information dictionary as the x-axis coordinate list in the line graph in each memory data collection, the memory occupancy rate at each time as the y-coordinate list, put each process name into the process name list, and draw the line graph of each time by looping the data in the memory data information dictionary.
[0016] In some optional implementation schemes, the CPU occupancy analysis module is used to obtain CPU data information from a txt file of CPU occupancy data, and draw the CPU data information into a CPU data real-time monitoring chart or a CPU data analysis line chart through QT, wherein the drawn line chart shows all CPU processes, and by filtering the process names in the CPU data dictionary, the CPU data of the filtered individual process names or multiple process names can be drawn. At the same time, mouse linkage, left-click dragging of the canvas, scroll wheel zooming of the canvas, and mouse hovering of the secondary window are set for easy viewing and analysis.
[0017] In some optional implementation schemes, the memory occupancy analysis module is used to obtain memory data information from a txt file of memory occupancy data, and draw the memory data information into a real-time memory data monitoring chart or a memory data analysis line chart through QT, wherein the drawn line chart shows all memory processes, and by filtering the process names in the memory data dictionary, the memory data of the filtered individual process names or multiple process names can be drawn. At the same time, mouse linkage, left-click dragging of the canvas, scroll wheel zooming of the canvas, and mouse hovering of the secondary window are set to facilitate viewing and analysis.
[0018] According to another aspect of the present invention, a method for monitoring and analyzing CPU and Memory usage data based on an Android vehicle machine is provided, comprising:
[0019] (1) Based on the Android debug bridge adb command line tool, the dumpsys tool is called to obtain the CPU usage data information of each process in the Android device, and all the obtained CPU usage data information is processed to generate a CPU data information dictionary, and a txt file of the CPU usage data is stored. Then, the data in the CPU data information dictionary is processed by the Python program and displayed in real time on the QT interface to form a line chart for real-time monitoring changes. The CPU data information dictionary includes the time of each process, the process name and the CPU usage rate at that time;
[0020] (2) Based on the Android debug bridge adb command line tool, the dumpsys tool is called to obtain the memory usage data information of each process in the Android device, and all the obtained memory usage data information is processed to generate a memory data information dictionary, and a txt file of the memory usage data is stored. Then, the data in the memory data information dictionary is processed by the python program and displayed in real time on the QT interface to form a line chart for real-time monitoring changes. The memory data information dictionary includes the time of each process, the process name and the memory usage data size at that time;
[0021] (3) Obtain a txt file of CPU occupancy data, and then use a Python program to analyze and process the data information in the txt file of CPU occupancy data, converting it into a dictionary with the time mark as the key value and the process name and CPU data information dictionary as the value, thereby generating a line chart of CPU data analysis;
[0022] (4) Obtain a txt file of memory usage data, and then use a python program to analyze and process the data information in the txt file of memory usage data, converting it into a dictionary with the time stamp as the key value and the process name and memory data information dictionary as the value, thereby generating a line chart of memory data analysis.
[0023] In some optional embodiments, step (1) comprises:
[0024] (1.1) After obtaining the instruction to collect CPU data information, the Python program starts the CPU data collection thread and automatically calls the adb shell dumpsys cpuinfo command to obtain the CPU occupancy data of each process, and then obtains the time data through adb shell'data+%Y%m%d%H%M%S'. The CPU data information dictionary of each moment is generated through Python data processing, and the buffer of the time list is set. The stored CPU data information dictionary is sorted according to the CPU occupancy data obtained at the last moment, and the first several digits are taken as real-time observation data, so as to obtain a real-time dynamic CPU data monitoring chart;
[0025] (1.2) In each CPU data collection, the time in the CPU data information dictionary is used as the coordinate list of the x-axis in the line graph, and the CPU occupancy rate at each time is used as the y-coordinate list. Each process name is put into the process name list, and the line graph of each time is drawn by looping the data in the CPU data information dictionary.
[0026] In some optional embodiments, step (2) comprises:
[0027] (2.1) After obtaining the instruction to collect memory data information, the python program starts the memory data collection thread and automatically calls the adb shell dumpsys-t 60meminfo command to obtain the memory data occupied by each process, and then obtains the time data through adb shell'data+%Y%m%d%H%M%S'. The memory data information dictionary of each moment is generated through python data processing, and the buffer of the time list is set. The stored memory data information dictionary is sorted according to the memory data occupied by the last moment, and the first several bits are taken as real-time observation data, so as to obtain a real-time dynamic memory data monitoring chart;
[0028] (2.2) In each memory data collection, the time in the memory data information dictionary is used as the coordinate list of the x-axis in the line graph, and the memory occupancy rate at each time is used as the y-coordinate list. Each process name is put into the process name list, and the line graph of each time is drawn by looping the data in the memory data information dictionary.
[0029] In some optional embodiments, step (3) comprises:
[0030] Get the CPU data information from the txt file of CPU occupancy data, and draw the CPU data information into a real-time CPU data monitoring chart or a CPU data analysis line chart through QT. The drawn line chart shows all CPU processes. By filtering the process names in the CPU data dictionary, the CPU data of the filtered single process name or multiple process names can be drawn. At the same time, mouse linkage, left-click to drag the canvas, scroll wheel to zoom the canvas, and mouse hovering the secondary window are set to facilitate viewing and analysis.
[0031] In some optional embodiments, step (4) comprises:
[0032] Memory data information is obtained from the txt file of memory usage data, and the memory data information is drawn into a real-time memory data monitoring chart or a memory data analysis line chart through QT. The drawn line chart shows all memory processes. By filtering the process names in the memory data dictionary, the memory data of the filtered single process name or multiple process names can be drawn. At the same time, mouse linkage, left-click dragging of the canvas, scroll wheel zooming of the canvas, and mouse hovering of the secondary window are set to facilitate viewing and analysis.
[0033] In general, the above technical solutions conceived by the present invention can achieve the following beneficial effects compared with the prior art:
[0034] (1) Communicate with the Android device through the Android Debug Bridge (adb) command line tool, and then call the dumpsys tool to obtain the CPU and memory usage data information of each process in the Android device. The obtained data information is processed by the Python program and then passed to the QT interface to form a system that can monitor and analyze the CPU and memory usage data in real time, including: real-time monitoring of the CPU and memory data information of each process; file storage of CPU and memory data; import and analysis of stored CPU and memory data files; display in the program in the form of a line graph; and filter the process data that needs to be analyzed.
[0035] (2) The CPU and Memory data information real-time monitoring module sorts the values corresponding to the last moment in the process name in the data dictionary and obtains the top several processes with the highest proportion. It can generate a dynamic data dictionary of the top several process names through a loop and transmit it to the GUI interface for real-time display. That is, after the collection starts, it can be displayed dynamically, which is convenient for users to view the CPU and Memory data occupancy of the top several processes at the corresponding time and their changing trends during this period of time while operating the vehicle computer.
[0036] (3) The CPU occupancy rate analysis module and the memory occupancy analysis module of each process can read the stored cpu.txt or mem.txt files, process and analyze the data in the files, and convert them into line graphs to display in the figure canvas. By right-clicking in the canvas, you can filter the CPU data or memory data corresponding to the process name to be displayed, and interact with the displayed data line graph with the mouse. You can use the mouse wheel and left button to zoom in and out, drag, and hover the mouse to display a small pop-up window of labels, which is very convenient for users to use. BRIEF DESCRIPTION OF THE DRAWINGS
[0037] Figure 1 This is a schematic diagram of a CPU and Memory occupancy data monitoring and analysis system based on an Android vehicle machine provided by an embodiment of the present invention;
[0038] Figure 2 This is a schematic diagram of a CPU data information collection and analysis process provided by an embodiment of the present invention;
[0039] Figure 3This is a CPU and Memory real-time data monitoring diagram provided by an embodiment of the present invention;
[0040] Figure 4 This is a schematic diagram of CPU data analysis provided by an embodiment of the present invention;
[0041] Figure 5 It is a schematic diagram of an original data analysis diagram and a mouse hover prompt window provided by an embodiment of the present invention;
[0042] Figure 6 A secondary window for filtering in a memory data analysis display interface provided by an embodiment of the present invention. DETAILED DESCRIPTION
[0043] In order to make the purpose, technical solutions and advantages of the present invention more clearly understood, the present invention is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present invention and are not intended to limit the present invention. In addition, the technical features involved in the various embodiments of the present invention described below can be combined with each other as long as they do not conflict with each other.
[0044] The present invention is based on an Android debugging bridge (adb) command line tool, and then obtains the CPU and Memory occupation data information of each process in an Android device by calling a dumpsys tool. The CPU occupation rate, program number, process name and other data information of each process can be obtained by adb shell dumpsyscpuinfo instruction. Taking the extracted line as an example: 1.3%2764 / audioserver:0.8%user+0.4%kernel / faults:38minor, it can be obtained that the CPU occupation rate of the process named: audioserver at this time is 1.3%. Similarly, the Memory data occupation size of each process and the corresponding process name and other data information can be obtained by calling adb shell dumpsys-t 60meminfo instruction. Taking the extracted line as an example: 338,087K:com.baidu.che.codriver (pid 3847), it can be obtained that the memory data occupation of the process named: com.baidu.che.codriver at this time is 338087K.
[0045] like Figure 1 As shown, an embodiment of the present invention provides a CPU and Memory occupancy data monitoring and analysis system based on an Android vehicle machine, comprising:
[0046] The real-time monitoring module of CPU data information of each process processes all the acquired CPU data information to generate a CPU data information dictionary, processes the data through a Python program, and then displays it in real time on the QT interface to form a line chart of real-time monitoring changes. The CPU data information dictionary is a nested structure of dictionary-list-dictionary, expressed as: {time: [{CPU process name 1: CPU occupancy of CPU process name 1}, {CPU process name 2: CPU occupancy of CPU process name 2},…]};
[0047] The real-time monitoring module of memory data information of each process processes all acquired memory data information to generate a memory data information dictionary, processes the data through a python program, and then displays it in real time on the QT interface to form a line chart of real-time monitoring changes. The memory data information dictionary is a nested structure of dictionary-list-dictionary, expressed as {time: [{Memory process name 1: Memory value of memory process name 1}, {Memory process name 2: Memory value of memory process name 2},…]};
[0048] The CPU occupancy rate analysis module of each process collects CPU data information over a period of time. After the collection is completed, a txt file of CPU occupancy data will be generated. Then, the collected data information will be analyzed and processed by the Python program, and converted into a dictionary with the time mark as the key value and the process name and CPU data information dictionary as the value value, thereby generating a line chart of CPU data analysis;
[0049] The memory usage analysis module of each process collects memory data information over a period of time. After the collection is completed, a txt file of memory usage data will be generated. The collected data information is then analyzed and processed by the python program, and converted into a dictionary with the time stamp as the key value and the process name and memory data information dictionary as the value value, thereby generating a line chart of memory data analysis.
[0050] like Figure 2As shown in the figure, it is a schematic diagram of CPU data information monitoring and analysis. After clicking the start collection button, the python program starts the CPU data collection thread and automatically calls the adb shell dumpsys cpuinfo command to obtain the CPU occupancy data of each process, and then obtains the time data time1 through adb shell'data+%Y%m%d%H%M%S'. The data dictionary of time1 is generated through python data processing: {time1: {name1: [time1_cpu%], name2: [time1_cpu%], name3: [time1_cpu%], ...}}, and the data dictionary of time2 is: {time1: {name1: [time1_cpu%], name2: [time1_cpu%], name3: [time1_cpu%], ...}, time2: {name1: [time1 _cpu%,time2_cpu%],name2:[time1_cpu%,time2_cpu%],name3:[time1_cpu%,time2_cpu%],……},……},In order to prevent the data from being too full after long-term collection, in the embodiment of the present invention, the buffer of the time list is set to 20. In addition, since there are many processes in the vehicle computer, in development, only the processes that occupy a large amount of CPU data are usually observed. Therefore, the stored CPU data dictionary is sorted according to the data of the CPU occupancy rate obtained at the last time, and the first several bits (12 bits in the embodiment of the present invention) are taken as real-time observation data;
[0051] Each loop will use the time in the CPU data dictionary as the coordinate list of the x-axis in the line chart, and the CPU occupancy rate time_cpu% at each moment as the y-coordinate list. For example, at time1, the coordinate of the x-axis is x_axis: [time1], and the coordinate of the y-axis is: y_axis_1: [name1_time1_cpu%, name2_time1_cpu%, name3_time1_cpu%, …], at time2, the coordinate of the x-axis is [time1, time2], and the coordinate of the y-axis is [[name1_time1_cpu%, name2_time1_cpu%, name3_time1_cpu%, …], [name1_time2_cpu%, name2_time2_cpu%, name3_time2_cpu%, …]], and the name of each process is put into the cpu_name list as the legend of the line chart. By cyclically drawing the data of time1, time2, time3…, the dynamic CPU data monitoring chart with real-time display is obtained.
[0052] In the embodiment of the present invention, the monitoring and analysis of memory data information is the same as the monitoring and analysis principle of CPU data information to obtain a dynamic memory data detection graph. After obtaining the instruction for collecting memory data information, the python program starts the memory data collection thread and automatically calls the adb shell dumpsys-t 60meminfo command to obtain the memory data occupied size of each process, and then obtains the time data through adb shell'data+%Y%m%d%H%M%S'. The memory data information dictionary of each moment is generated through python data processing, and the buffer of the moment list is set. The stored memory data information dictionary is sorted according to the memory data occupied size obtained at the last moment, and the first several digits are taken as real-time observation data; in each memory data collection, the moment in the memory data information dictionary is used as the coordinate list of the x-axis in the line graph, and the memory occupancy rate at each moment is the y-coordinate list, and each process name is put into the process name list, and the line graph of each moment is drawn by cyclically drawing the data in the obtained memory data information dictionary, so as to obtain a dynamic memory data monitoring graph displayed in real time.
[0053] like Figure 3 , which is a CPU and Memory real-time data monitoring diagram obtained according to an embodiment of the present invention.
[0054] In the embodiment of the present invention, Figure 4As shown in the figure, it is a schematic diagram of CPU data analysis. In the CPU data analysis process, the steps after obtaining the CPU data are similar to those in the CPU data real-time monitoring module. The difference is that the CPU data analysis obtains data from the cpu.txt file for processing. As long as there is a cpu.txt file that has been collected before, the CPU data analysis can be performed through the file at any time. In the CPU data analysis module, by obtaining data information from the cpu.txt file, the CPU data information is drawn into a line chart through QT, just like the CPU data information monitoring and analysis principle. The drawn icon shows all CPU processes. In order to facilitate filtering and viewing, by filtering the process names in the CPU data dictionary, the CPU data of the filtered single process name or multiple process names can be drawn. In order to facilitate viewing, mouse linkage is set, the left button is used to drag the canvas, the wheel is used to zoom the canvas, and the mouse is hovered over the secondary window for easy viewing and analysis.
[0055] In an embodiment of the present invention, the memory data analysis is based on the same principle as the CPU data analysis. In the memory data analysis process, as in the memory data real-time monitoring module, the steps after obtaining the memory data are similar. The difference is that the memory data analysis obtains data from the memory.txt file for processing. As long as there is a memory.txt file that has been collected before, the memory data analysis can be performed through the file at any time. In the memory data analysis module, by obtaining data information from the memory.txt file, and then drawing the memory data information into a line chart through QT as in the memory data information monitoring and analysis principle. The drawn icons are all memory processes. In order to facilitate screening and viewing, by filtering the process names in the memory data dictionary, the filtered single process name or the memory data of multiple process names can be drawn. In order to facilitate viewing, mouse linkage is set, the left button drags the canvas, the scroll wheel zooms the canvas, and the mouse hovers over the secondary window for easy viewing and analysis.
[0056] like Figure 5 , which is a schematic diagram of a CPU raw data analysis diagram and a mouse hovering prompt window obtained in an embodiment of the present invention.
[0057] like Figure 6 As shown, a secondary window is screened in a Memory data analysis display interface obtained in an embodiment of the present invention.
[0058] It should be pointed out that, according to the needs of implementation, the various steps / components described in this application can be split into more steps / components, and two or more steps / components or partial operations of steps / components can be combined into new steps / components to achieve the purpose of the present invention.
[0059] It will be easily understood by those skilled in the art that the above description is only a preferred embodiment of the present invention and is not intended to limit the present invention. Any modifications, equivalent substitutions and improvements made within the spirit and principles of the present invention should be included in the protection scope of the present invention.
Claims
1. A CPU and Memory occupancy data monitoring and analysis system based on Android vehicle, characterized in that: include: The real-time monitoring module of CPU data information of each process is used to obtain the CPU occupancy data information of each process in the Android device based on the Android debug bridge adb command line tool, and then call the dumpsys tool to process all the obtained CPU occupancy data information, generate a CPU data information dictionary, store the obtained CPU occupancy data in a txt file, and then process the data in the CPU data information dictionary through the python program and display it in real time on the QT interface to form a line chart of real-time monitoring changes, where the CPU data information dictionary includes the time of each process, the process name and the CPU occupancy rate at that time; The real-time monitoring module of memory data information of each process is used to obtain the memory usage data information of each process in the Android device based on the Android debug bridge adb command line tool, and then call the dumpsys tool to process all the acquired memory usage data information, generate a memory data information dictionary, store the obtained memory usage data in a txt file, and then process the data in the memory data information dictionary through the python program and display it in real time on the QT interface to form a line chart for real-time monitoring changes. The memory data information dictionary includes the time of each process, the process name and the memory usage data size at that time; The CPU occupancy rate analysis module of each process is used to obtain the txt file of CPU occupancy data, and then analyze and process the data information in the txt file of CPU occupancy data through the Python program, and convert it into a dictionary with the time mark as the key value and the process name and CPU data information dictionary as the value value, so as to generate a line chart of CPU data analysis; The memory usage analysis module of each process is used to obtain the txt file of memory usage data, and then analyze and process the data information in the txt file of memory usage data through the python program, and convert it into a dictionary with the time mark as the key value and the process name and memory data information dictionary as the value value, so as to generate a line chart of memory data analysis.
2. The system according to claim 1, characterized in that The CPU data information real-time monitoring module includes a CPU data information monitoring module and a CPU data information analysis module; The CPU data information monitoring module is used to, after obtaining the instruction to collect CPU data information, start the CPU data collection thread through the Python program to automatically call the adb shell dumpsys cpuinfo command to obtain the CPU occupancy data of each process, and then obtain the time data through adb shell'data+%Y%m%d%H%M%S', generate the CPU data information dictionary of each moment through Python data processing, and set the buffer of the time list, sort the stored CPU data information dictionary according to the CPU occupancy data obtained at the last moment, and take the first several bits as real-time observation data, so as to obtain a real-time dynamic CPU data monitoring chart; The CPU data information analysis module is used to use the time in the CPU data information dictionary as the coordinate list of the x-axis in the line graph in each CPU data collection, the CPU occupancy rate at each time as the y-coordinate list, put each process name into the process name list, and draw the line graph of each time by looping the data in the CPU data information dictionary.
3. The system according to claim 1, characterized in that The memory data information real-time monitoring module includes a memory data information monitoring module and a memory data information analysis module; The Memory data information monitoring module is used to, after obtaining the instruction for collecting Memory data information, start the Memory data collection thread through the Python program and automatically call the adb shell dumpsys-t 60meminfo command to obtain the Memory data occupied by each process, and then obtain the time data through adb shell'data+%Y%m%d%H%M%S', generate the Memory data information dictionary at each moment through Python data processing, and set the buffer of the time list, sort the stored Memory data information dictionary according to the Memory data occupied size obtained at the last moment, and take the first several bits as real-time observation data, so as to obtain a real-time dynamic Memory data monitoring chart; The memory data information analysis module is used to use the time in the memory data information dictionary as the x-axis coordinate list in the line graph in each memory data collection, the memory occupancy rate at each time as the y-coordinate list, put each process name into the process name list, and draw the line graph of each time by looping the data in the memory data information dictionary.
4. The system according to claim 1 or 2, characterized in that: The CPU occupancy rate analysis module is used to obtain CPU data information from a txt file of CPU occupancy data, and draw the CPU data information into a CPU data real-time monitoring chart or a CPU data analysis line chart through QT, wherein the drawn line chart shows all CPU processes, and by filtering the process names in the CPU data dictionary, the CPU data of the filtered single process name or multiple process names can be drawn, and mouse linkage, left-click dragging of the canvas, scroll wheel zooming of the canvas, and mouse hovering of the secondary window are set to facilitate viewing and analysis.
5. The system according to claim 1 or 3, characterized in that: The memory occupancy analysis module is used to obtain memory data information from a txt file of memory occupancy data, and draw the memory data information into a real-time memory data monitoring chart or a memory data analysis line chart through QT, wherein the drawn line chart shows all memory processes, and by filtering the process names in the memory data dictionary, the memory data of the filtered single process name or multiple process names can be drawn, and mouse linkage, left-click dragging of the canvas, scroll wheel zooming of the canvas, and mouse hovering of the secondary window are set to facilitate viewing and analysis.
6. A method for monitoring and analyzing CPU and Memory occupancy data based on Android vehicle, characterized in that: include: (1) Based on the Android debug bridge adb command line tool, the dumpsys tool is called to obtain the CPU usage data information of each process in the Android device, and all the obtained CPU usage data information is processed to generate a CPU data information dictionary, and a txt file of the CPU usage data is stored. Then, the data in the CPU data information dictionary is processed by the Python program and displayed in real time on the QT interface to form a line chart for real-time monitoring changes. The CPU data information dictionary includes the time of each process, the process name and the CPU usage rate at that time; (2) Based on the Android debug bridge adb command line tool, the dumpsys tool is called to obtain the memory usage data information of each process in the Android device, and all the obtained memory usage data information is processed to generate a memory data information dictionary, and a txt file of the memory usage data is stored. Then, the data in the memory data information dictionary is processed by the python program and displayed in real time on the QT interface to form a line chart for real-time monitoring changes. The memory data information dictionary includes the time of each process, the process name and the memory usage data size at that time; (3) Obtain a txt file of CPU occupancy data, and then use a Python program to analyze and process the data information in the txt file of CPU occupancy data, converting it into a dictionary with the time mark as the key value and the process name and CPU data information dictionary as the value, thereby generating a line chart of CPU data analysis; (4) Obtain a txt file of memory usage data, and then use a python program to analyze and process the data information in the txt file of memory usage data, converting it into a dictionary with the time stamp as the key value and the process name and memory data information dictionary as the value, thereby generating a line chart of memory data analysis.
7. The method according to claim 6, characterized in that Step (1) comprises: (1.1) After obtaining the instruction to collect CPU data information, the Python program starts the CPU data collection thread and automatically calls the adb shell dumpsys cpuinfo command to obtain the CPU occupancy data of each process, and then obtains the time data through adb shell'data+%Y%m%d%H%M%S'. The CPU data information dictionary of each moment is generated through Python data processing, and the buffer of the time list is set. The stored CPU data information dictionary is sorted according to the CPU occupancy data obtained at the last moment, and the first several digits are taken as real-time observation data, so as to obtain a real-time dynamic CPU data monitoring chart; (1.2) In each CPU data collection, the time in the CPU data information dictionary is used as the coordinate list of the x-axis in the line graph, and the CPU occupancy rate at each time is used as the y-coordinate list. Each process name is put into the process name list, and the line graph of each time is drawn by looping the data in the CPU data information dictionary.
8. The method according to claim 6, characterized in that Step (2) comprises: (2.1) After obtaining the instruction to collect memory data information, the python program starts the memory data collection thread and automatically calls the adb shell dumpsys-t 60meminfo command to obtain the memory data occupied by each process, and then obtains the time data through adb shell'data+%Y%m%d%H%M%S'. The memory data information dictionary of each moment is generated through python data processing, and the buffer of the time list is set. The stored memory data information dictionary is sorted according to the memory data occupied by the last moment, and the first several bits are taken as real-time observation data, so as to obtain a real-time dynamic memory data monitoring chart; (2.2) In each memory data collection, the time in the memory data information dictionary is used as the coordinate list of the x-axis in the line graph, and the memory occupancy rate at each time is used as the y-coordinate list. Each process name is put into the process name list, and the line graph of each time is drawn by looping the data in the memory data information dictionary.
9. The method according to claim 6 or 7, characterized in that: Step (3) includes: Get the CPU data information from the txt file of CPU occupancy data, and draw the CPU data information into a real-time CPU data monitoring chart or a CPU data analysis line chart through QT. The drawn line chart shows all CPU processes. By filtering the process names in the CPU data dictionary, the CPU data of the filtered single process name or multiple process names can be drawn. At the same time, mouse linkage, left-click to drag the canvas, scroll wheel to zoom the canvas, and mouse hovering the secondary window are set to facilitate viewing and analysis.
10. The method according to claim 6 or 8, characterized in that: Step (4) comprises: Memory data information is obtained from the txt file of memory usage data, and the memory data information is drawn into a real-time memory data monitoring chart or a memory data analysis line chart through QT. The drawn line chart shows all memory processes. By filtering the process names in the memory data dictionary, the memory data of the filtered single process name or multiple process names can be drawn. At the same time, mouse linkage, left-click dragging of the canvas, scroll wheel zooming of the canvas, and mouse hovering of the secondary window are set to facilitate viewing and analysis.
