CPU utilization rate evaluation method and device, electronic equipment and storage medium

By rating and normalizing the CPU usage rate of applications to be evaluated in the on-board system, the problem of inability to objectively evaluate CPU usage is solved, timely optimization of CPU performance is achieved, and system fluency is improved.

CN119597588APending Publication Date: 2025-03-11CHENGDU CELIS TECH CO LTD
View PDF 6 Cites 0 Cited by

Patent Information

Application Number
CN202411757055.7
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-12-03
Publication Date
2025-03-11

AI Technical Summary

Technical Problem

The inability to objectively evaluate the CPU usage rate of the on-board applications in the on-board system, resulting in the inability to timely optimize the CPU performance, resulting in abnormal phenomena such as system lag and black screen.

Method used

A CPU usage evaluation method is provided, by obtaining the average and instantaneous values ​​of the front and backend CPU usage of the application to be evaluated, comparing with the preset threshold, rating, and determining the optimization identifier through score normalization.

Benefits of technology

It improves the objectivity and timeliness of the CPU usage score for the application, promotes CPU performance optimization, and improves system fluency.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119597588A_ABST
    Figure CN119597588A_ABST
Patent Text Reader

Abstract

The invention provides a CPU usage rate evaluation method and device, electronic equipment and a storage medium, and the method comprises the steps: obtaining a to-be-evaluated CPU usage rate of a to-be-evaluated application, the to-be-evaluated CPU usage rate comprises a to-be-evaluated average value of foreground and background CPU usage rates and a plurality of to-be-evaluated instantaneous values, comparing the to-be-evaluated CPU usage rate with a corresponding preset to-be-evaluated threshold value according to the type of the to-be-evaluated CPU usage rate, and determining whether the to-be-evaluated CPU usage rate is lower than the preset to-be-evaluated threshold value or not. Obtaining a comparison result, performing scoring according to the comparison result to obtain a plurality of utilization rate scores, performing normalization on each utilization rate score to obtain a target score, and determining an optimization identifier of the to-be-evaluated application according to the target score; according to the method, the objectivity of scoring the CPU utilization rate of the to-be-evaluated application is improved through the normalized score after classification scoring, and the timeliness of CPU performance optimization is improved, so that the system fluency is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the technical field of CPU usage monitoring, and in particular to a CPU usage evaluation method, device, electronic device and storage medium. Background Art

[0002] The in-vehicle system is a virtualized dual-system architecture solution. The Qnx operating system and the Android operating system (AndroidOS) share hardware resources such as the central processing unit (CPU) and memory through a virtualization architecture (Hypervisor). The CPU resource of the in-vehicle system is an important hardware resource, and the CPU load status often determines the fluency of the in-vehicle system. For example, the total computing power of the in-vehicle system is 105KDMIPS, with a total of 8 cores. When core 0 and core 1 are allocated to the Qnx operating system, cores 2-7 are allocated to the Android operating system in a virtual CPU manner, and the total computing power percentage is 600%.

[0003] The Android operating system mainly loads the central control entertainment system, and there are various in-vehicle applications on it, such as vehicle settings, Bluetooth phones, multimedia applications, driving recorders, 360-degree surround view, air conditioning settings, voice, virtual images, etc. Each application will occupy CPU resources when running, and each application will compete for CPU resources. If the CPU resource load is too high, it will cause abnormal phenomena such as freezing, black screen, and restart of the entire in-vehicle system. At present, there is no method to objectively evaluate the CPU usage of in-vehicle applications in the in-vehicle system to evaluate the healthy status of in-vehicle applications using CPU resources. Summary of the invention

[0004] The present application provides a CPU usage evaluation method, device, electronic device and storage medium to solve the above-mentioned technical problem that the CPU usage evaluation of the application to be evaluated cannot be objectively performed, resulting in the inability to timely optimize the CPU performance of the application to be evaluated.

[0005] In one embodiment of the present application, the present application provides a CPU usage evaluation method, including: obtaining the CPU usage to be evaluated of the application to be evaluated, the CPU usage to be evaluated including the average value to be evaluated of the foreground and background CPU usage and multiple instantaneous values ​​to be evaluated; comparing the CPU usage to be evaluated with the corresponding preset threshold to be evaluated according to the type of the CPU usage to be evaluated to obtain a comparison result, and scoring according to the comparison result to obtain multiple usage scores; normalizing each of the usage scores to obtain a target score, so as to determine the optimization identifier of the application to be evaluated according to the target score.

[0006] In one embodiment of the present application, the CPU usage to be evaluated is compared with the corresponding preset threshold to be evaluated according to the type of the CPU usage to be evaluated to obtain a comparison result, and a score is performed according to the comparison result to obtain multiple usage scores, including: if the type of the CPU usage to be evaluated is an instantaneous value to be evaluated, each instantaneous value to be evaluated is compared with the preset instantaneous value threshold in the preset threshold to be evaluated; if an instantaneous value to be evaluated exceeds the preset instantaneous value threshold, the instantaneous value to be evaluated is determined as the target instantaneous value; if the total number of the target instantaneous values ​​is less than the preset number threshold, the total number of the target instantaneous values ​​is determined as the usage score of the instantaneous value to be evaluated; if the total number of the target instantaneous values ​​is greater than or equal to the preset number threshold, the preset number threshold is determined as the usage score of the instantaneous value to be evaluated; wherein the instantaneous value to be evaluated includes a foreground instantaneous value and a background instantaneous value, and the preset instantaneous value threshold and the preset number threshold corresponding to the foreground instantaneous value and the background instantaneous value are equal or different.

[0007] In one embodiment of the present application, the CPU usage to be evaluated is compared with the corresponding preset threshold to be evaluated according to the type of the CPU usage to be evaluated to obtain a comparison result, and a score is given according to the comparison result to obtain multiple usage scores, and it also includes: if the type of the CPU usage to be evaluated is an average value to be evaluated, the average value to be evaluated is compared with a preset average value threshold in the preset threshold to be evaluated, and the preset average value threshold includes a first average threshold and a second average threshold; if the average value to be evaluated is less than the first average threshold, the preset first score is determined as the usage score of the average value to be evaluated; if the average value to be evaluated is If the average value to be evaluated is greater than or equal to the first average threshold, and the average value to be evaluated is less than the second average threshold, the product of the usage rate difference and the preset coefficient is determined as the usage score of the average value to be evaluated, and the usage rate difference is obtained based on the difference between the average value to be evaluated and the first average threshold; if the average value to be evaluated is greater than or equal to the second average threshold, the preset second score is determined as the usage score of the average value to be evaluated; wherein the average value to be evaluated includes a foreground average value and a background average value, and the preset average value thresholds, preset coefficients, preset first scores and preset second scores corresponding to the foreground average value and the background average value are equal or different.

[0008] In one embodiment of the present application, the optimization identification of the application to be reviewed is determined based on the target score, including: if the ranking of the target score is greater than a preset ranking threshold, the optimization identification of the application to be reviewed is determined as to be subject to relative optimization; and / or, if the target score is greater than a preset score threshold, the optimization identification of the application to be reviewed is determined as to be subject to passing optimization.

[0009] In one embodiment of the present application, obtaining the CPU usage rate of the application to be evaluated includes: sending multiple random foreground events to the application to be evaluated based on a preset first time interval within a preset test period; calculating multiple foreground instantaneous values ​​of the foreground CPU usage rate according to a preset second time interval; and calculating the foreground average value within the preset test period based on each of the foreground instantaneous values; wherein the average value to be evaluated includes the foreground average value, and the instantaneous value to be evaluated includes the foreground instantaneous value.

[0010] In one embodiment of the present application, obtaining the CPU usage rate of the application to be evaluated also includes: ending the sending of the random foreground event and switching the application to be evaluated to the background; calculating the background instantaneous values ​​of multiple background CPU usage rates according to the preset second time interval within the preset test period; and calculating the background average value within the preset test period based on each of the background instantaneous values; wherein the average value to be evaluated includes the background average value, and the instantaneous value to be evaluated includes the background instantaneous value.

[0011] In one embodiment of the present application, each of the usage scores is normalized to obtain a target score, including: assigning weights to each of the usage scores to obtain multiple usage weights; and performing weighted summation based on each of the usage scores and the usage weights corresponding to each of the usage scores to obtain the target score.

[0012] In one embodiment of the present application, the present application provides a CPU usage evaluation device, including: a usage acquisition module, used to obtain the CPU usage to be evaluated of the application to be evaluated, the CPU usage to be evaluated includes the average value to be evaluated and multiple instantaneous values ​​to be evaluated of the foreground and background CPUs; a usage scoring module, used to compare the CPU usage to be evaluated with the corresponding preset threshold to be evaluated according to the type of the CPU usage to be evaluated, to obtain a comparison result, and to score according to the comparison result to obtain multiple usage scores; a score normalization module, used to normalize each of the usage scores to obtain a target score, so as to determine the optimization identifier of the application to be evaluated according to the target score.

[0013] In one embodiment of the present application, the present application provides an electronic device, which includes: one or more processors; a storage device for storing one or more programs, and when the one or more programs are executed by the one or more processors, the electronic device implements the CPU usage evaluation method described in any of the above embodiments.

[0014] In one embodiment of the present application, the present application provides a computer-readable storage medium having a computer program stored thereon. When the computer program is executed by a processor of a computer, the computer executes the CPU usage evaluation method described in any one of the above embodiments.

[0015] Beneficial effects of the embodiments of the present application: The present application provides a CPU usage evaluation method, device, electronic device and storage medium. The embodiments of the present application obtain multiple usage scores by scoring different types of CPU usage to be evaluated respectively, and obtain a target score by normalizing each usage score. The normalized score after classification scoring improves the objectivity of CPU usage scoring of the application to be evaluated, and improves the timeliness of CPU performance optimization, thereby improving system fluency.

[0016] It should be understood that the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the present application. BRIEF DESCRIPTION OF THE DRAWINGS

[0017] The drawings herein are incorporated into the specification and constitute a part of the specification, showing embodiments consistent with the present application, and together with the specification, are used to explain the principles of the present application. Obviously, the drawings described below are only some embodiments of the present application, and for those of ordinary skill in the art, other drawings can be obtained based on these drawings without creative work. In the drawings:

[0018] Figure 1 A schematic diagram showing an exemplary system architecture to which the technical solution of the embodiments of the present application can be applied;

[0019] Figure 2 A schematic diagram of a CPU usage evaluation method according to an embodiment of the present application is shown;

[0020] Figure 3 The overall architecture diagram of the vehicle-mounted system according to one embodiment of the present application is shown;

[0021] Figure 4 A CPU usage architecture diagram of each application to be evaluated according to an embodiment of the present application is shown;

[0022] Figure 5 A schematic diagram showing calculation of foreground CPU usage rate of vehicle settings according to one embodiment of the present application is shown;

[0023] Figure 6 A schematic diagram of score ranking according to an embodiment of the present application is shown;

[0024] Figure 7 A block diagram of a CPU usage evaluation device according to an embodiment of the present application is shown;

[0025] Figure 8 A schematic diagram of the structure of a computer system suitable for implementing an electronic device of an embodiment of the present application is shown. DETAILED DESCRIPTION

[0026] 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.

[0027] 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.

[0028] 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.

[0029] See also Figure 1 , Figure 1 A schematic diagram of an exemplary system architecture to which the technical solution of the embodiment of the present application can be applied is shown. Figure 1 As shown, the system architecture may include a computer device 101 and a vehicle system 102. The computer device 101 may be a general-purpose computer, and the application to be evaluated is located in the vehicle system 102. The computer 101 is used to evaluate the CPU usage of the application to be evaluated in the vehicle system 102.

[0030] Exemplarily, after the computer device 101 obtains the CPU usage to be evaluated of the application to be evaluated, the CPU usage to be evaluated includes the average value to be evaluated of the foreground and background CPU usage and multiple instantaneous values ​​to be evaluated; according to the type of CPU usage to be evaluated, the CPU usage to be evaluated is compared with the corresponding preset threshold to be evaluated to obtain a comparison result, and scores are performed based on the comparison result to obtain multiple usage scores; each usage score is normalized to obtain a target score, so as to determine the optimization identifier of the application to be evaluated based on the target score.

[0031] In the related art, it is impossible to objectively evaluate the CPU usage of the application to be evaluated, resulting in a technical problem that the CPU performance of the application to be evaluated cannot be optimized in a timely manner.

[0032] In order to solve the above technical problems, the present application provides a CPU usage evaluation method, device, electronic device and storage medium. The implementation details of the technical solution of the embodiment of the present application are elaborated in detail below.

[0033] See also Figure 2 , Figure 2 FIG. 1 is a flow chart showing a method for evaluating CPU usage according to an embodiment of the present application. Figure 2 As shown, in an exemplary embodiment, the CPU usage evaluation method includes at least steps S210 to S230, which are described in detail as follows:

[0034] Step S210, obtaining the CPU usage of the application to be evaluated.

[0035] The CPU usage to be evaluated includes the average value to be evaluated of the foreground and background CPUs and multiple instantaneous values ​​to be evaluated.

[0036] In one embodiment of the present application, the application to be evaluated includes an in-vehicle application located in an in-vehicle system, and the in-vehicle application is hosted on an Android operating system.

[0037] In one embodiment of the present application, see Figure 3 , Figure 3 FIG. 1 shows the overall architecture of a vehicle-mounted system according to an embodiment of the present application. Figure 3 As shown, the QNX operating system is mainly responsible for instrument applications, the Android operating system includes cockpit applications, and cockpit applications include central control entertainment information applications; the lower layer of the two operating systems is the virtualization architecture (Hypervisor), which includes multiple architecture modules such as memory virtualization, CPU virtualization, and virtual machine communication; the lower layer of the virtualization architecture is the system chip; among them, the Android operating system uses 6 of the 8 cores of the system chip by providing a virtual CPU through CPU virtualization, accounting for a total of 600%.

[0038] In one embodiment of the present application, see Figure 4 , Figure 4 FIG. 1 shows a CPU usage architecture diagram of each application to be evaluated according to an embodiment of the present application. Figure 4As shown, the monkey test randomly simulates human operation behavior; the in-vehicle application is the application to be evaluated, including dozens of functional applications such as vehicle settings, Bluetooth phones, multimedia applications, and driving recorders; the system framework layer includes a performance monitor (PerfMonitor) and an activity management service (ActivityManagerService) native to the Android operating system. The performance monitor is a framework layer monitoring class newly added in this application for evaluating the CPU usage of in-vehicle applications. The performance monitor calculates the CPU usage of each application to be evaluated by obtaining statistical files; the statistical file (Proc / stat) under the system process information in the disk directory saves the running time, idle time, total running time, etc. of each CPU core, and each process number saves the information such as the CPU running time and idle time occupied by the corresponding process. After the application to be evaluated runs in the system, each application to be evaluated has a corresponding process number. For example, after the vehicle setting runs, its process number is 1428. If the CPU usage corresponding to the vehicle setting is calculated, the CPU usage time of the statistical file in process 1428 is calculated by the performance monitor to calculate the CPU usage to be evaluated.

[0039] In one embodiment of the present application, obtaining the CPU usage of the application to be evaluated includes: sending multiple random foreground events to the application to be evaluated based on a preset first time interval within a preset test period; calculating multiple foreground instantaneous values ​​of the foreground CPU usage according to a preset second time interval; and calculating the foreground average value within the preset test period based on each foreground instantaneous value; wherein the average value to be evaluated includes the foreground average value, and the instantaneous value to be evaluated includes the foreground instantaneous value.

[0040] In one embodiment of the present application, the random foreground event is implemented through monkey testing.

[0041] In one embodiment of the present application, within a preset test period, a random foreground event is sent to the application to be evaluated at every preset first time interval.

[0042] In one embodiment of the present application, the preset test period can be set to 10 minutes, and the preset first time interval can be set to 500 milliseconds.

[0043] In one embodiment of the present application, the foreground instantaneous value of the foreground CPU usage is calculated once every second preset time interval, wherein the second preset time interval can be set to 1 second.

[0044] In one embodiment of the present application, when each application to be evaluated is in Monkey test mode, the present application calculates four dimensions: the foreground average value and the foreground instantaneous value corresponding to the foreground CPU usage rate of each application to be evaluated, and the background average value and the background instantaneous value corresponding to the background CPU usage rate.

[0045] In one embodiment of the present application, see Figure 5 , Figure 5 FIG. 1 is a schematic diagram showing a foreground CPU usage calculation for a vehicle setting according to an embodiment of the present application. Figure 5 As shown, a random foreground event is sent to the vehicle setting every 500 milliseconds, and a monkey test is performed for 10 consecutive minutes. The foreground instantaneous value of the foreground CPU usage of the vehicle setting is calculated every 1 second through the performance monitor, and 600 foreground instantaneous values ​​are obtained. The foreground average value of the foreground CPU usage is obtained based on the 600 foreground instantaneous values, and the foreground average value and the 600 foreground instantaneous values ​​are saved in the preset data structure corresponding to the vehicle setting.

[0046] In one embodiment of the present application, obtaining the CPU usage rate of the application to be evaluated also includes: ending the sending of random foreground events and switching the application to be evaluated to the background; calculating the background instantaneous values ​​of multiple background CPU usage rates according to a preset second time interval within a preset test period; and calculating the background average value within the preset test period based on each background instantaneous value; wherein the average value to be evaluated includes the background average value, and the instantaneous value to be evaluated includes the background instantaneous value.

[0047] In one embodiment of the present application, the vehicle settings are switched to the background, the monkey test is canceled, and the performance monitor is used to continuously monitor for 10 minutes. The background CPU usage of the vehicle settings is calculated every 1 second. The background CPU usage includes the background average value and 600 background instantaneous values, which are saved in the preset data structure corresponding to the vehicle settings to distinguish the CPU usage processes to be evaluated of different applications to be evaluated.

[0048] Step S220, comparing the CPU usage to be evaluated with the corresponding preset threshold to be evaluated according to the type of the CPU usage to be evaluated, obtaining a comparison result, and scoring according to the comparison result to obtain multiple usage scores.

[0049] In one embodiment of the present application, the CPU usage to be evaluated is compared with the corresponding preset threshold to be evaluated according to the type of CPU usage to be evaluated to obtain a comparison result, and a score is given according to the comparison result to obtain multiple usage scores, which also includes: if the type of CPU usage to be evaluated is an average value to be evaluated, the average value to be evaluated is compared with a preset average value threshold in the preset threshold to be evaluated, and the preset average value threshold includes a first average threshold and a second average threshold; if the average value to be evaluated is less than the first average threshold, the preset first score is determined as the usage score of the average value to be evaluated; if the average value to be evaluated is greater than or equal to the first average threshold, and the average value to be evaluated is less than the second average threshold, the product of the usage difference and the preset coefficient is determined as the usage score of the average value to be evaluated, and the usage difference is obtained based on the difference between the average value to be evaluated and the first average threshold; if the average value to be evaluated is greater than or equal to the second average threshold, the preset second score is determined as the usage score of the average value to be evaluated; wherein the average value to be evaluated includes a foreground average value and a background average value, and the preset average value thresholds, preset coefficients, preset first scores and preset second scores corresponding to the foreground average value and the background average value are equal or unequal.

[0050] In one embodiment of the present application, the usage score of the average value to be evaluated is determined as follows:

[0051]

[0052] Among them, Score avg is the usage score of the average value to be evaluated, a1 is the preset first score, a2 is the preset second score, X avg is the average value to be evaluated, b1 is the first average threshold, b2 is the second average threshold, and c is the preset coefficient.

[0053] In one embodiment of the present application, when the application to be checked is in the foreground, the usage score of the foreground average value is in a first score range, such as [0, 100]; when the application to be checked is in the background, the usage score of the background average value is in a second score range, such as [0, 100].

[0054] In one embodiment of the present application, the preset first score is less than the preset second score. The preset first score is the lower limit of the first score interval, and the preset second score is the upper limit of the first score interval. For example, the preset first score and the preset second score can be set to 0 and 100 respectively, that is, a1 is equal to 0, and a2 is equal to 100.

[0055] In one embodiment of the present application, the first average threshold and the second average threshold corresponding to the foreground average value may be set to 100% and 300% respectively, that is, b1 is equal to 100% and b2 is equal to 300%.

[0056] In one embodiment of the present application, the first average threshold and the second average threshold corresponding to the background average value are set to 40% and 90% respectively, that is, b1 is equal to 40% and b2 is equal to 90%.

[0057] In one embodiment of the present application, the preset coefficient is obtained based on the difference between the second average threshold and the first average threshold, and a preset second score.

[0058] In one embodiment of the present application, the preset coefficient is determined as follows:

[0059] c=a2 / (b2-b1) Formula (2)

[0060] Among them, c is a preset coefficient, a2 is a preset second score, b1 is a first average threshold, and b2 is a second average threshold.

[0061] In one embodiment of the present application, if b2 is equal to 300%, b1 is equal to 100%, a2 is equal to 100, then c is equal to 50.

[0062] In one embodiment of the present application, if b2 is equal to 90%, b1 is equal to 40%, a2 is equal to 100, then c is equal to 200.

[0063] In one embodiment of the present application, the usage score of the foreground average is determined as follows:

[0064]

[0065] Among them, Score for_avg is the usage score of the front-end average, X for_avg The average value of the front end.

[0066] In one embodiment of the present application, the usage score of the foreground average is determined as follows:

[0067]

[0068] Among them, Score back_avg is the usage score of the front-end average, X back_avg The average value of the front end.

[0069] In one embodiment of the present application, the CPU usage to be evaluated is compared with the corresponding preset threshold to be evaluated according to the type of CPU usage to be evaluated to obtain a comparison result, and a score is performed according to the comparison result to obtain multiple usage scores, including: if the type of CPU usage to be evaluated is an instantaneous value to be evaluated, then each instantaneous value to be evaluated is compared with a preset instantaneous value threshold in the preset threshold to be evaluated; if an instantaneous value to be evaluated exceeds the preset instantaneous value threshold, the instantaneous value to be evaluated is determined as the target instantaneous value; if the total number of target instantaneous values ​​is less than the preset number threshold, the total number of target instantaneous values ​​is determined as the usage score of the instantaneous value to be evaluated; if the total number of target instantaneous values ​​is greater than or equal to the preset number threshold, the preset number threshold is determined as the usage score of the instantaneous value to be evaluated; wherein, the instantaneous value to be evaluated includes a foreground instantaneous value and a background instantaneous value, and the preset instantaneous value threshold and the preset number threshold corresponding to the foreground instantaneous value and the background instantaneous value are equal or different.

[0070] In one embodiment of the present application, the scoring includes determining the usage score of the instantaneous value to be evaluated based on a comparison between the total number and the preset number threshold if the comparison result is that the instantaneous value to be evaluated exceeds the preset instantaneous value threshold.

[0071] In one embodiment of the present application, the preset instantaneous value threshold corresponding to the foreground instantaneous value is equal to the first average threshold corresponding to the foreground average value. The preset instantaneous value threshold corresponding to the background instantaneous value is equal to the first average threshold corresponding to the background average value.

[0072] In one embodiment of the present application, the preset instantaneous value threshold corresponding to the foreground instantaneous value may be set to 100%, and the preset instantaneous value threshold corresponding to the background instantaneous value may be set to 40%.

[0073] In one embodiment of the present application, the usage score of the instantaneous value to be evaluated is determined as follows:

[0074]

[0075] Among them, Score inst is the utilization score of the instantaneous value to be evaluated, Y inst is the total number of target instantaneous values, and d is the preset quantity threshold.

[0076] In one embodiment of the present application, when the application to be inspected is in the foreground, the usage score of the foreground instantaneous value is within a third score interval, such as [0, 100]; when the application to be inspected is in the background, the usage score of the background instantaneous value is within a fourth score interval, such as [0, 100].

[0077] In one embodiment of the present application, the preset quantity threshold corresponding to the foreground instantaneous value is the upper limit of the third score interval, and the preset quantity threshold corresponding to the background instantaneous value is the upper limit of the fourth score interval. For example, the preset quantity threshold can be set to 100.

[0078] In one embodiment of the present application, the usage score of the foreground instantaneous value is determined as follows:

[0079]

[0080] Among them, Score for_inst is the usage score of the foreground instantaneous value, Y for_inst The total number of foreground instantaneous values ​​exceeding 100%.

[0081] In one embodiment of the present application, the method for determining the usage score of the background instantaneous value is as follows:

[0082]

[0083] Among them, Score back_inst is the usage score of the background instantaneous value, Y back_inst The total number of background instantaneous values ​​exceeding 40%.

[0084] Step S230 , normalizing each usage rate score to obtain a target score, and determining an optimization identifier of the application to be evaluated according to the target score.

[0085] In one embodiment of the present application, each usage score is normalized to obtain a target score, including: assigning a weight to each usage score to obtain multiple usage weights; and performing a weighted summation based on each usage score and the usage weight corresponding to each usage score to obtain the target score.

[0086] In one embodiment of the present application, the target score is determined as follows:

[0087] S=w1·Score for_avg +w2·Score for_inst +w3·Score back_avg +w4·Score back_inst Formula (8)

[0088] Among them, S is the target score, w1 is the usage weight corresponding to the foreground average value, w2 is the second weight corresponding to the foreground instantaneous value, w3 is the usage weight corresponding to the background average value, and w4 is the usage weight corresponding to the background instantaneous value.

[0089] In one embodiment of the present application, the usage weights are 0.25, 0.25, 0.25, and 0.25, respectively.

[0090] In one embodiment of the present application, a higher target score of the application to be evaluated indicates a higher CPU usage rate, a greater load on the vehicle system, and a worse performance; a lower target score of the application to be evaluated indicates a lower CPU usage rate, a smaller load on the vehicle system, and a better performance.

[0091] In one embodiment of the present application, an optimization identification of the application to be reviewed is determined based on a target score, including: if the ranking of the target score is greater than a preset ranking threshold, the optimization identification of the application to be reviewed is determined as to be relatively optimized; and / or, if the target score is greater than a preset score threshold, the optimization identification of the application to be reviewed is determined as to be qualified optimized.

[0092] In one embodiment of the present application, the target score of each application to be evaluated is ranked, and the higher the score, the higher the ranking, which means that the application occupies more CPU, and the more CPU is occupied, the more it affects the performance of the vehicle system. Application developers can perform relative optimization based on the ranking of application scores.

[0093] In one embodiment of the present application, the preset score threshold can be set to 40 points. For example, if the target score of an application to be evaluated is higher than 40 points, it means that the CPU usage of the application to be evaluated is not up to standard. If the score is equal to or less than 40 points, it means that the CPU usage of the application to be evaluated is qualified. The application developer can optimize the CPU according to whether the score is up to standard.

[0094] In one embodiment of the present application, see Figure 6 , Figure 6 FIG. 2 shows a schematic diagram of score ranking according to an embodiment of the present application. Figure 6 As shown, the target score of each application to be evaluated is obtained according to the usage weight corresponding to the different types of scores, and the usage weight corresponding to each type of CPU usage to be evaluated is 0.25; the target score for vehicle settings is 78.5, the target score for multimedia applications is 67.8, the target score for driving recorders is 54, the target score for Bluetooth phones is 38.5, and the target score for air conditioning settings is 36; the higher the ranking, the more CPU resources are consumed, and the less qualified; the scores of vehicle settings, multimedia applications, and driving recorders are unqualified, and the CPU can be optimized to pass. This application objectively scores the CPU usage of multiple types to be evaluated, and normalizes them to obtain the target score, so as to determine the vehicle-mounted system applications with relatively poor CPU usage performance, and / or the vehicle-mounted system applications with unqualified CPU usage through the target score, so that the corresponding developers can optimize the CPU performance in time and improve the system fluency.

[0095] See also Figure 7 , Figure 7 A block diagram of a CPU usage evaluation device according to an embodiment of the present application is shown. The device can be applied to Figure 1The implementation environment shown in the figure is specifically configured in the computer device 101. The device can also be applied to other exemplary implementation environments and specifically configured in other devices. This embodiment does not limit the implementation environment to which the device is applied.

[0096] like Figure 7 As shown, according to an embodiment of the present application, a CPU usage evaluation device 700 includes: a usage acquisition module 701, a usage scoring module 702 and a score normalization module 703.

[0097] The usage acquisition module 701 is used to acquire the CPU usage of the application to be evaluated, and the CPU usage includes the average value of the front and back CPUs to be evaluated and multiple instantaneous values ​​to be evaluated.

[0098] The usage rate scoring module 702 is used to compare the CPU usage rate to be evaluated with the corresponding preset threshold value to be evaluated according to the type of the CPU usage rate to be evaluated, obtain a comparison result, and score according to the comparison result to obtain multiple usage rate scores;

[0099] The score normalization module 703 is used to normalize each usage rate score to obtain a target score, so as to determine the optimization mark of the application to be evaluated according to the target score.

[0100] It should be noted that the CPU usage evaluation device provided in the above embodiment and the CPU usage evaluation method provided in the above embodiment belong to the same concept, wherein the specific manner in which each module and unit performs operations has been described in detail in the method embodiment, and will not be repeated here. In actual applications, the CPU usage evaluation device provided in the above embodiment can distribute the above functions to different functional modules as needed, that is, divide the internal structure of the device into different functional modules to complete all or part of the functions described above, and this is not limited here.

[0101] An embodiment of the present application also provides an electronic device, comprising: one or more processors; a storage device for storing one or more programs, when the one or more programs are executed by one or more processors, the electronic device implements the CPU usage evaluation method provided in the above-mentioned embodiments.

[0102] See also Figure 8 , Figure 8 The structure diagram of the computer system suitable for implementing the electronic device of the embodiment of the present application is shown. It should be noted that: Figure 8 The computer system 800 of the electronic device shown is only an example and should not bring any limitation to the functions and scope of use of the embodiments of the present application.

[0103] like Figure 8As shown, the computer system 800 includes a central processing unit (CPU) 801, which can perform various appropriate actions and processes according to the program stored in the read-only memory (ROM) 802 or the program loaded from the storage part 808 to the random access memory (RAM) 803, such as executing the method in the above embodiment. In the random access memory 803, various programs and data required for system operation are also stored. The central processing unit 801, the read-only memory 802 and the random access memory 803 are connected to each other through a bus 804. The input / output (I / O) interface 805 is also connected to the bus 804.

[0104] The following components are connected to the input / output interface 805: an input section 806 including a keyboard, a mouse, etc.; an output section 807 including a cathode ray tube (CRT), a liquid crystal display (LCD), etc., and a speaker; a storage section 808 including a hard disk, etc.; and a communication section 809 including a network interface card such as a LAN (Local Area Network) card, a modem, etc. The communication section 809 performs communication processing via a network such as the Internet. A drive 810 is also connected to the input / output interface 805 as needed. A removable medium 811, such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, etc., is installed on the drive 810 as needed so that a computer program read therefrom is installed into the storage section 808 as needed.

[0105] In particular, according to an embodiment of the present application, the process described above with reference to the flowchart can be implemented as a computer software program. For example, an embodiment of the present application includes a computer program product, which includes a computer program carried on a computer-readable medium, and the computer program includes a computer program for executing the method shown in the flowchart. In such an embodiment, the computer program can be downloaded and installed from a network through a communication section 809, and / or installed from a removable medium 811. When the computer program is executed by a central processing unit (CPU) 801, various functions defined in the system of the present application are executed.

[0106] It should be noted that the computer-readable medium shown in the embodiment of the present application can be a computer-readable signal medium or a computer-readable storage medium or any combination of the above two. The computer-readable storage medium can be, for example, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or device, or any combination of the above. More specific examples of computer-readable storage media can include, but are not limited to: an electrical connection with one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM), a flash memory, an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above. In the present application, a computer-readable signal medium may include a data signal propagated in a baseband or as part of a carrier wave, wherein a computer-readable computer program is carried. This propagated data signal can take a variety of forms, including but not limited to an electromagnetic signal, an optical signal, or any suitable combination of the above. A computer-readable signal medium may also be any computer-readable medium other than a computer-readable storage medium, which may send, propagate or transmit a program for use by or in conjunction with an instruction execution system, apparatus or device. A computer program contained on a computer-readable medium may be transmitted using any appropriate medium, including but not limited to: wireless, wired, etc., or any suitable combination of the above.

[0107] The flowchart and block diagram in the accompanying drawings illustrate the possible architecture, functions and operations of the system, method and computer program product according to various embodiments of the present application. Wherein, each box in the flowchart or block diagram can represent a module, a program segment, or a part of the code, and the above-mentioned module, program segment, or a part of the code contains one or more executable instructions for realizing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the box can also occur in a different order from the order marked in the accompanying drawings. For example, two 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 box in the block diagram or flowchart, and the combination of boxes in the block diagram or flowchart 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.

[0108] The units involved in the embodiments described in the present application can be implemented by software or by hardware, and the units described can also be set in a processor. Among them, the names of these units do not constitute a limitation on the units themselves under certain circumstances. Therefore, the technical solution according to the implementation mode of the present application can be embodied in the form of a software product, which can be stored in a non-volatile storage medium (which can be a CD-ROM, a USB flash drive, a mobile hard disk, etc.) or on a network, including a number of instructions to enable a computing device (which can be a personal computer, a server, a touch terminal, or a network device, etc.) to execute the method according to the implementation mode of the present application.

[0109] Another aspect of the present application further provides a computer-readable storage medium on which a computer program is stored. When the computer program is executed by a processor of a computer, the computer executes the CPU usage evaluation method provided in each of the above embodiments. The computer-readable storage medium may be included in the electronic device described in the above embodiments, or may exist independently without being assembled into the electronic device.

[0110] In the above embodiments, unless otherwise specified, by using serial numbers such as "first" and "second" to describe common objects, it only means that they refer to different instances of the same object, rather than indicating that the objects being described must adopt a given order, whether in time, space, sorting or any other way.

[0111] 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 CPU usage evaluation method, characterized in that: The method comprises: Obtaining a CPU usage rate of the application to be evaluated, wherein the CPU usage rate to be evaluated includes an average value to be evaluated of the foreground and background CPU usage rates and multiple instantaneous values ​​to be evaluated; According to the type of the CPU usage to be evaluated, the CPU usage to be evaluated is compared with the corresponding preset threshold to be evaluated to obtain a comparison result, and a score is given according to the comparison result to obtain multiple usage scores; Each of the usage rate scores is normalized to obtain a target score, so as to determine an optimization identifier of the application to be evaluated according to the target score.

2. The CPU usage evaluation method according to claim 1, characterized in that: The CPU usage to be evaluated is compared with a corresponding preset threshold to be evaluated according to the type of the CPU usage to be evaluated to obtain a comparison result, and a score is performed according to the comparison result to obtain multiple usage scores, including: If the type of the CPU usage to be evaluated is an instantaneous value to be evaluated, then each instantaneous value to be evaluated is compared with a preset instantaneous value threshold in the preset threshold to be evaluated; If an instantaneous value to be evaluated exceeds a preset instantaneous value threshold, the instantaneous value to be evaluated is determined as a target instantaneous value; If the total number of the target instantaneous values ​​is less than the preset number threshold, the total number of the target instantaneous values ​​is determined as the usage rate score of the instantaneous value to be evaluated; If the total number of the target instantaneous values ​​is greater than or equal to a preset number threshold, the preset number threshold is determined as the usage rate score of the instantaneous value to be evaluated; The instantaneous value to be evaluated includes a foreground instantaneous value and a background instantaneous value, and the preset instantaneous value threshold and the preset quantity threshold corresponding to the foreground instantaneous value and the background instantaneous value are equal or different.

3. The CPU usage evaluation method according to claim 1, characterized in that: The CPU usage to be evaluated is compared with a corresponding preset threshold value to be evaluated according to the type of the CPU usage to be evaluated to obtain a comparison result, and a score is given according to the comparison result to obtain multiple usage scores, further comprising: If the type of the CPU usage to be evaluated is an average value to be evaluated, comparing the average value to be evaluated with a preset average value threshold in the preset threshold to be evaluated, wherein the preset average value threshold includes a first average threshold and a second average threshold; If the average value to be evaluated is less than the first average threshold, determining the preset first score as the usage score of the average value to be evaluated; If the average value to be evaluated is greater than or equal to the first average threshold, and the average value to be evaluated is less than the second average threshold, the product of the usage rate difference and the preset coefficient is determined as the usage rate score of the average value to be evaluated, and the usage rate difference is obtained based on the difference between the average value to be evaluated and the first average threshold; If the average value to be evaluated is greater than or equal to the second average threshold, the preset second score is determined as the usage score of the average value to be evaluated; The average value to be evaluated includes a foreground average value and a background average value, and the preset average value thresholds, preset coefficients, preset first scores and preset second scores corresponding to the foreground average value and the background average value are equal or different.

4. The CPU usage evaluation method according to claim 1, characterized in that: Determining the optimization mark of the application to be reviewed according to the target score includes: If the ranking of the target score is greater than a preset ranking threshold, the optimization mark of the application to be evaluated is determined as to be relatively optimized; and / or, If the target score is greater than a preset score threshold, the optimization mark of the application to be evaluated is determined as a pending optimization.

5. The CPU usage evaluation method according to any one of claims 1 to 4, characterized in that: Get the CPU usage of the application to be reviewed, including: Sending a plurality of random foreground events to the application to be evaluated based on a preset first time interval within a preset test period; Calculating a plurality of foreground instantaneous values ​​of the foreground CPU usage according to a preset second time interval; Calculating the foreground average value within the preset test period based on each of the foreground instantaneous values; The average value to be evaluated includes the foreground average value, and the instantaneous value to be evaluated includes the foreground instantaneous value.

6. The CPU usage evaluation method according to claim 5, characterized in that: Get the CPU usage of the application to be reviewed, including: End the sending of the random foreground event and switch the application to be reviewed to the background; Calculating the background instantaneous values ​​of the plurality of background CPU usage rates according to the preset second time interval within the preset test period; Counting the background average value within the preset test period according to each of the background instantaneous values; The average value to be evaluated includes the background average value, and the instantaneous value to be evaluated includes the background instantaneous value.

7. The CPU usage evaluation method according to any one of claims 1 to 4, characterized in that: Each of the usage rate scores is normalized to obtain a target score, including: Assigning weights to each of the usage rate scores to obtain a plurality of usage rate weights; A target score is obtained by performing a weighted summation on the usage rate scores and the usage rate weights corresponding to the usage rate scores.

8. A CPU usage evaluation device, characterized in that: The device comprises: A usage acquisition module, used to acquire the CPU usage of the application to be evaluated, wherein the CPU usage includes the average value of the front-end and back-end CPUs to be evaluated and multiple instantaneous values ​​to be evaluated; A usage scoring module is used to compare the CPU usage to be evaluated with a corresponding preset threshold to be evaluated according to the type of the CPU usage to be evaluated, obtain a comparison result, and perform scoring according to the comparison result to obtain multiple usage scores; The score normalization module is used to normalize the usage rate scores to obtain a target score, so as to determine the optimization identifier of the application to be evaluated according to the target score.

9. An electronic device, characterized in that: The electronic device comprises: one or more processors; A storage device for storing one or more programs, when the one or more programs are executed by the one or more processors, enables the electronic device to implement the CPU usage evaluation method as described in any one of claims 1 to 7.

10. A computer-readable storage medium, characterized in that: A computer program is stored thereon, and when the computer program is executed by a processor of a computer, the computer is caused to execute the CPU usage evaluation method according to any one of claims 1 to 7.

Citation Information

Patent Citations

  • Performance evaluation method of hardware resources in specific environment

    CN110633194A

  • Method and device for acquiring CPU utilization rate of cloud platform and medium

    CN115309609A

  • Android-based vehicle machine performance evaluation method

    CN119003250A

  • Multi-core load balancing method mobile terminal thereof

    KR1020140080058A

  • Processor overload control for network nodes

    US20060245359A1