Updating method of hotspot code, control system, storage medium and electronic equipment
Hotspot code is converted and aggregated through the device or cloud, generating and executing code, and dynamically detecting and updating hotspot codes on the device side, solving the problem of the deviation between hotspot code optimization and user usage habits in the existing technology, and achieving efficient application Performance optimization.
Patent Information
- Application Number
- CN202411558429.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-04
- Publication Date
- 2025-02-14
AI Technical Summary
In the prior art, the hot code optimization method cannot be updated according to the user's usage habits, resulting in a deviation from the user's usage habits.
Hotspot code is converted and aggregated through the device side or cloud side, file information is generated, and compiled on the device side to generate execution code. The device side determines whether the hotspot code needs to be updated based on the execution code, and dynamically detects and updates the hotspot code.
It realizes dynamic detection and update of hot codes, optimizes application performance based on user usage habits, and improves user experience.
Smart Images

Figure CN119440582A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of automobile intelligent control systems, and in particular to a hotspot code updating method, a control system, a storage medium and an electronic device. Background Art
[0002] In the Android system of the smart cockpit, the performance of applications has become a hot spot of competition among major manufacturers. The performance of Android applications can even become an important factor in users' judgment of the quality of a car. Since hot code is frequently executed during the operation of the application, after identifying the hot code, the optimization work can be concentrated on these key parts to improve the performance of the application.
[0003] The existing hotspot code optimization method can generate a baseline profile file from some hotspot codes and integrate it into the apk file of the application during the compilation phase of the application, and then store the baseline profile in the system directory when the apk is installed, and guide AOT (Ahead of Time) compilation based on this content. When the Android art virtual machine is running, there is no need to perform immediate interpretation when executing the hotspot code. The baseline profile file can be used to increase the running speed and improve the user experience.
[0004] However, since the hotspot codes are determined in advance in this way and cannot be updated according to the user's usage habits, there is a deviation between the optimization of application performance and the user's usage habits. Summary of the invention
[0005] The purpose of the present invention is to solve the shortcomings of the prior art and to propose a hotspot code updating method, control system, storage medium and electronic device.
[0006] In order to achieve the above object, the present invention adopts the following technical solution: a method for updating hotspot codes, comprising:
[0007] The device classifies a number of applications and collects hotspot codes of a number of the applications;
[0008] The hotspot code is converted by the device end, or the hotspot code is aggregated and converted by the cloud end, and the generated file information is transmitted back to the device end;
[0009] The device end compiles according to the file information to generate an execution code, and the device end determines whether the execution code is a hotspot code within a time interval. If not, the collected hotspot code is updated.
[0010] As a further description of the above technical solution: several applications are classified into:
[0011] Determine a corresponding code segment according to the execution function of the application, and record the code segment in a folder corresponding to the application,
[0012] Collecting hotspot codes includes counting the number of executions of the code segments in the folder within a time interval, and selecting the hotspot codes according to the number of executions.
[0013] As a further description of the above technical solution: the steps of aggregating and converting hotspot codes through the cloud include:
[0014] The cloud aggregates the plurality of hotspot codes to generate an aggregate file, and converts the aggregate file to generate file information.
[0015] As a further description of the above technical solution: the step of aggregating hotspot codes through the cloud includes:
[0016] The cloud receives the hotspot codes sent by several device ends, saves the hotspot codes according to application classification, deduplicates the hotspot codes of the same application, saves them in a file, and generates the aggregate file.
[0017] As a further description of the above technical solution: the generated file information is transmitted back to the device end to a storage directory of the device end, wherein the storage directory is established according to the application classification;
[0018] The execution code is stored in a storage directory established according to the application classification.
[0019] As a further description of the above technical solution: the method for determining whether the execution code is a hotspot code includes: detecting the code segment within the time interval according to a detection threshold or sorting, including setting a detection threshold, detecting the execution code according to the detection threshold, and if it exceeds the detection threshold, determining it is a hotspot code, and if it does not exceed, determining it is not a hotspot code;
[0020] The code segments are sorted according to the number of executions, and at least one or more code segments are selected from large to small to determine whether the execution code is selected. If selected, it is determined to be a hotspot code, and if not selected, it is determined not to be a hotspot code.
[0021] Also included is a control system, which is applicable to the updating method described in any one of the above technical solutions, including:
[0022] Convert and compile the code segments on the device side to generate machine code;
[0023] The device side includes:
[0024] Detection module: collects code segments on the device side;
[0025] The first conversion module: converts the hotspot code into file information;
[0026] Compilation module: receiving the file information sent by the first conversion module and compiling it into execution code;
[0027] Storage module: receiving the file information sent by the first conversion module and the execution code sent by the compilation module, and saving them according to the storage directory;
[0028] Execution module: sends the execution code to the external machine.
[0029] As a further description of the above technical solution: a number of device ends send hotspot codes to the cloud, aggregate and convert the hotspot codes to generate an aggregate file, and transmit the aggregate file back to the number of device ends for compilation;
[0030] The device side also includes:
[0031] Upload module: sends the hotspot code to the cloud;
[0032] Code file receiving module: receiving the aggregated file obtained by the aggregate conversion;
[0033] The cloud comprises:
[0034] Code receiving module: receives hotspot codes sent by several devices;
[0035] Aggregation module: de-duplicates the hotspot codes received by the code receiving module, saves them into a file, and generates an aggregate file;
[0036] A second conversion module: receiving the aggregated file sent by the aggregation module, and converting it into file information;
[0037] Code file sending module: receives the file information sent by the second conversion module, and sends the file information to several device ends.
[0038] It also includes a computer-readable storage medium storing a computer program for running the updating method, wherein the computer program enables a computer to execute the updating method as described in any one of the above technical solutions.
[0039] Also included is an electronic device, comprising:
[0040] one or more processors; memory; and
[0041] One or more programs, wherein the one or more programs are stored in the memory and are configured to be executed by the one or more processors, and the programs include a method for executing the update method described in any one of the above technical solutions.
[0042] The above technical solution has the following advantages or beneficial effects:
[0043] 1. When using the application on the device side, it can collect hotspot codes within a time interval, convert the hotspot codes into file information, and compile the file information into execution code that can be directly executed by an external machine. When the application is running, it can determine whether the hotspot code needs to be updated and optimized based on the execution code. The hotspot code can be dynamically detected and updated, and the external machine can quickly call the execution code to run.
[0044] 2. The hotspot codes collected from several different device terminals can be aggregated into an aggregate file in the cloud, converted into file information, and then sent to other device terminals for compilation. The hotspot codes determined based on the usage of multiple device terminals can be optimized for another device terminal, accurately reflecting the usage of multiple device terminals and being closer to the user's usage habits. BRIEF DESCRIPTION OF THE DRAWINGS
[0045] Figure 1 A flowchart of the updating method proposed by the present invention;
[0046] Figure 2 It is a flow chart of collecting hotspot codes in the present invention;
[0047] Figure 3 This is a schematic diagram of the structure of the device end in the control system proposed by the present invention;
[0048] Figure 4 This is a schematic diagram of the structure of the device side and the cloud side in the control system proposed by the present invention.
[0049] The above drawings have shown clear embodiments of the present application, which will be described in more detail later. These drawings and text descriptions are not intended to limit the scope of the present application in any way, but to illustrate the concept of the present application to those skilled in the art by referring to specific embodiments.
[0050] Legend:
[0051] 1. Detection module; 2. First conversion module; 3. Compilation module; 4. Storage module; 5. Execution module; 6. Upload module; 7. Code file receiving module; 8. Code receiving module; 9. Aggregation module; 10. Second conversion module; 11. Code file sending module. DETAILED DESCRIPTION
[0052] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0053] In the Android system of smart cockpits, the performance of applications has become a hot spot of competition among major manufacturers. The smoothness of user experience is often used as an evaluation indicator of products, such as whether the map navigation is stuck, whether the voice interaction is smooth, whether the application starts quickly, etc. The performance of Android applications can even become an important factor in users' judgment of the quality of a car.
[0054] The existing hotspot code optimization method generates a baselineprofile file from some hotspot codes during the compilation phase of the application and integrates it into the application's apk file. Since the hotspot codes are determined in advance and cannot be updated based on user usage habits, they do not fully represent user usage habits, resulting in a deviation between the optimization of application performance and user usage habits.
[0055] The hotspot code updating method provided in the present application can collect hotspot codes within a time interval when using an application on the device side, convert the hotspot codes into file information, and compile the file information into execution code that can be directly executed by an external machine. When the application is running, it can determine whether the hotspot code needs to be updated and optimized based on the execution code. The hotspot code can be dynamically detected and updated, and the external machine can quickly call the execution code to run.
[0056] In addition, the hotspot codes collected from several different devices can be aggregated into aggregate files in the cloud, converted into file information, and then sent to other devices for compilation. The hotspot codes determined based on the usage of multiple devices can be optimized for another device, accurately reflecting the usage of multiple devices and being closer to the user's usage habits.
[0057] Reference Figure 1 , an embodiment of the present invention provides: a method for updating a hotspot code, comprising:
[0058] S1: The device classifies several applications and collects hot codes of several applications;
[0059] Among them, applications are classified according to their main functions. For example, office applications (such as document editing software, email clients, etc.) are classified into one category; entertainment applications (such as games, video players, etc.) are classified into another category; social applications (such as instant messaging software, social networking platforms, etc.) are classified separately. This helps to understand the characteristics and needs of different types of applications, so as to better analyze and optimize their hot code.
[0060] Or, you can classify apps by how often they are used by users. Frequently used apps may generate more hotspot codes and need to be paid special attention to. You can determine the frequency of app usage through data such as device usage records and the number of app launches. For example, you can classify apps that are frequently used every day into one category and apps that are occasionally used into another category.
[0061] Or, you can classify apps based on how much device resources they use during operation. For example, you can classify apps that use a lot of memory, CPU, or battery resources into one category, and apps that use less resources into another category. You can identify apps that may have a greater impact on device performance so that you can optimize them accordingly.
[0062] When collecting hot code, you can use performance monitoring tools (use device-side performance monitoring tools to track the operation of the application), code analysis tools (use code analysis tools to perform static analysis on the application's source code to find possible hot code areas. These tools can analyze the complexity of the code, loop structure, function call relationships, etc. to determine which parts may be executed frequently), log analysis (add logging functions to the application to record key events and code execution paths during the operation of the application) and machine learning methods (use machine learning algorithms to analyze the application's performance data and automatically identify hot code. It can collect a large amount of application performance data, including CPU usage, memory usage and other indicators, as well as the corresponding code execution paths, and then use machine learning algorithms to train models to predict which code snippets may be hot code).
[0063] S2: The hotspot code is converted through the device side, or the hotspot code is aggregated and converted through the cloud, and the generated file information is transmitted back to the device side;
[0064] Among them, the device side converts the hotspot code. The device side first uses performance monitoring tools, code analysis tools, etc. to determine the hotspot code area in the application; extracts the identified hotspot code from the overall code of the application; converts the hotspot code according to specific conversion rules or algorithms; and generates a file of a specific format for the converted hotspot code and related metadata (such as the application to which the code belongs, conversion time, etc.).
[0065] The cloud aggregates and converts the hotspot codes, and the device uploads the identified hotspot codes to the cloud server. The hotspot codes can be sent to the cloud in a specific format (such as code snippets, data packets, etc.) through a network connection; the cloud server receives hotspot codes from different devices, classifies and stores them. Classification can be performed based on application type, device type, etc. for subsequent aggregation and analysis; the collected hotspot codes are aggregated. This can include counting the frequency of occurrence of the same hotspot codes on different devices, analyzing the commonalities and differences of hotspot codes, etc. Through aggregation, hotspot code patterns across devices can be discovered, providing a basis for subsequent conversion; based on the aggregated hotspot code data, the cloud conducts in-depth analysis to determine the best conversion strategy; the hotspot codes are converted according to the determined conversion strategy; the converted hotspot codes generate file information.
[0066] The method of generating file information and transmitting it back to the device includes:
[0067] Direct download: The device can directly download the converted files from the cloud server through specific network protocols (such as HTTP, FTP, etc.);
[0068] Push notification: The cloud can send push notifications to the device to inform it that new files are available for download. After receiving the notification, the device can actively initiate a download request.
[0069] Regular synchronization: The device can be synchronized with the cloud regularly to check whether there are new conversion files.
[0070] S3: The device side compiles according to the file information to generate an execution code. The device side determines whether the execution code is a hotspot code within the time interval. If not, it returns to step S1 to update the collected hotspot code.
[0071] Among them, the device performs file parsing. After receiving the converted file information from the cloud or locally, it first parses the file. This includes identifying the file format, extracting the code and related metadata;
[0072] Determine the compilation environment: Select the appropriate compilation tools and environment based on the device's operating system and hardware architecture;
[0073] Configure compilation parameters: Set compilation parameters according to the code characteristics and application requirements in the file;
[0074] Call compilation tool: compile the parsed code using the selected compilation tool, depending on the operating environment of the device;
[0075] Handling compilation errors: If an error occurs during the compilation process, the device needs to analyze and handle the error;
[0076] After successful compilation, an executable code file will be generated on the device.
[0077] Hot code refers to the code that is frequently executed during the program running process, which usually has a significant impact on system performance. Due to its frequent execution, the performance of hot code plays a key role in the running efficiency of the entire program. If the hot code is executed inefficiently, it may cause the overall performance of the program to decline. In order to improve program efficiency, developers usually focus on optimizing these code segments. Hot code may change with the running state of the program and the changes in input data. In different user operation scenarios, the hot code may be different.
[0078] In this embodiment, the used applications are detected by the device end, different applications are classified, and within a time interval, the code segments corresponding to the functions executed by the applications and the number of execution times of the code segments are recorded to collect hot code when the application is running.
[0079] Assume that when application A is executed, detection module 1 will record the number of times the function corresponding to the device side operated by the user is executed, and record it in a file, and count the hot code in the file within a time interval to generate a statistical file. Different applications are recorded in different files and do not affect each other. The statistical file persists after the application is installed, and continuously records the long-term usage habits of the user's device-side application.
[0080] The hotspot codes are converted and compiled. When the application is used on the device side, the hotspot codes can be collected within a time interval and converted into file information. The file information is a binary file in the format of a baseline profile. The file information is then compiled into an executable code that can be directly run by an external machine through AOT (Ahead of Time) through the compilation module 3.
[0081] Hotspot codes can also be aggregated in the cloud, and the hotspot codes added by several device ends within a time interval are aggregated into a file to generate an aggregate file, which is converted into file information in the cloud and then sent to other device ends for compilation. The binary file in the format of the baseline profile is compiled by the compilation module 3 AOT (Ahead of Time) to generate an executable code that can be directly run by an external machine.
[0082] The binary files in the format of the baseline profile and the files generated by AOT compilation are stored in the storage module 4. The storage module 4 can be a path in the system. Different applications correspond to different paths. The path needs to provide read and write permissions to the hotspot code storage module 4 and the execution module 5.
[0083] Determine whether the hotspot code needs to be updated. If it is a hotspot code, it will not be interpreted in real time from the apk file, but directly obtain the quickly executable code from the file generated by the AOT compilation saved in the storage module 4, so that the external machine can respond quickly, and the hotspot code can be dynamically detected and updated to accurately reflect the usage of the device.
[0084] Reference Figure 2 , in step S1, including,
[0085] S11: Classify several applications, determine corresponding code segments according to the execution functions of the applications, and record the code segments in folders corresponding to the applications.
[0086] Among them, code analysis tools are used to perform static analysis on the source code of the application. These tools can identify the function call relationship, code structure and module division in the application, and can preliminarily determine the execution function related to a specific function by analyzing information such as the function name, parameters and return value. For example, in an image editing application, functions corresponding to functions such as image cropping and filter application may be found through static analysis.
[0087] When the application is running, use performance monitoring tools or debugging tools to track the execution process of the application. These tools can record information such as the function call stack, execution time, and resource consumption, and can more accurately determine the functions actually executed and the corresponding code segments in specific scenarios. For example, when the user plays, pauses, fast-forwards, and other operations in a video playback application, the monitoring tool can record the function calls related to these operations.
[0088] S12: Collect hot code, count the number of executions of the code segments in the folder within the time interval, and select the hot code according to the number of executions.
[0089] Among them, select an appropriate time interval according to specific needs and application scenarios. This time interval can be a few minutes, a few hours, a day or longer. For example, if you are analyzing an application with high real-time requirements, you can choose a shorter time interval, such as a few minutes or a few hours; if you are analyzing a long-running background service, you can choose a day or longer;
[0090] Before starting the analysis, record the current time as the starting point of the time interval. You can use the device's system time or a dedicated timestamp tool to obtain the accurate time;
[0091] For each code segment that needs to be counted, counting logic can be inserted into the code. This can be achieved by adding a counter variable at the function entry and incrementing the counter each time the function is executed. During the code execution process, the value of the counter variable will increase each time the code segment is executed. The value of the counter can be written to a file or database regularly for analysis after the time interval ends, or a performance monitoring tool or logging tool can be used to automatically record the number of executions of the code segment, which can reduce the modification of the source code.
[0092] After the time interval ends, read the recorded code segment execution count data. The data can be imported into data analysis tools, such as spreadsheet software or a dedicated data analysis library, to perform statistical analysis on the execution count data. Based on the analysis results, determine the criteria for selecting hot code.
[0093] In this embodiment, different applications are classified, and the package name of the application is used as a unique identifier to determine the code segment corresponding to the function executed by the application during operation, and the code segment is recorded in the folder corresponding to the application. The number of executions of the code segment in the folder is counted to obtain the count value of the number of code executions, and the hot code is selected according to the size of the count value. For example, if the time interval is set to one day after the operation, the code X, Y, and Z are ranked at the top, and they are counted as hot codes.
[0094] In step S2, the steps of aggregating and converting the hotspot codes through the cloud include: the cloud aggregates a number of hotspot codes to generate an aggregate file, converts the aggregate file, and generates file information.
[0095] In this embodiment, the cloud receives hotspot codes uploaded from different device ends. These hotspot codes can be sent to the cloud in a specific format (such as code snippets, data packets, etc.) through network transmission, and the received hotspot codes are classified. Classification can be performed according to application type, device type, code function, etc., so as to facilitate subsequent aggregation operations. The classified hotspot codes are stored in a database or file system on the cloud for access and processing at any time. The device end converts the collected hotspot codes into a binary file in the format of a baseline profile through a conversion tool. The conversion tool can be profman, which is a tool for performance analysis and is usually used to process and merge performance data from different sources. The tool is a prior art and will not be described in detail.
[0096] The steps of aggregating hotspot codes through the cloud include: receiving hotspot codes sent by several devices in the cloud, saving the hotspot codes according to application classification, deduplicating the hotspot codes of the same application, saving them in a file, and generating an aggregated file.
[0097] In this embodiment, the cloud-based code receiving module 8 receives hotspot code reports from the device side, and differentiates them according to applications, establishes an application classification system, classifies applications according to different standards, and saves code segments of different applications separately. For example, applications can be divided into different categories such as office software, entertainment applications, and social applications. The hotspot codes of the same application are deduplicated, and a suitable deduplication algorithm is selected to process the hotspot codes, including hash algorithms, comparison algorithms, etc. The hash algorithm can quickly determine whether the hotspot code is repeated by calculating the hash value of the hotspot code. The comparison algorithm can compare the code content line by line to ensure that only completely identical code is considered duplicated. The hotspot codes under the same application category are traversed, and a deduplication algorithm is used to determine whether there is duplicate code. If duplicate code is found, only one copy is retained and other duplicate codes are deleted. Furthermore, the string of the hotspot code is identified. The string of the hotspot code includes the package name, address, value, identifier, status type or message log of the application. The package name is used to confirm which application the hotspot code belongs to. The address is usually the URL or file path of the network request; the value is usually represented by a numeric type such as a constant or configuration parameter. The identifier is used to represent the function name, variable name, etc. of the hotspot code. The message log contains output information, error messages, etc. After classifying by device, deduplication is performed, and the count value of the number of executions of the hotspot code is retained. The deduplicated hotspot code is sorted in a certain order and format. Optionally, it is sorted in the order of collection within a time interval. The hotspot codes of several device ends are aggregated into one file to generate an aggregate file. Metadata such as comments and version information can be added to facilitate subsequent management and maintenance, reducing the amount of data stored in the cloud. Subsequently, the hotspot codes of multiple device ends can be converted at a time, which can reflect the execution times of the code segment in the same application on several device ends and adjust the selection of hotspot codes.
[0098] It can continuously detect the number of executions of code segments applied on the device side to reflect the user's usage habits. By detecting and updating hotspot codes within the cyclic time interval, users can continue to obtain high-performance experience. It can also aggregate the usage habits of multiple users through the cloud to optimize the performance of commonly used hotspot functions more comprehensively and accurately.
[0099] The file information generated in step S1 is transmitted back to the device end and is transmitted back to the storage directory of the device end, wherein the storage directory is established according to the application classification;
[0100] The execution code in step S2 is stored in a storage directory established according to the application classification.
[0101] The storage directory is specifically the path of the storage module 4. A root directory can be first determined in the storage module 4 as the storage root path of the storage module 4. When optimizing the application, the package name information of the application is obtained (this information is unique in the Android system), and then the storage directory is established using this information as the secondary directory name. The file information generated by the conversion of the application and the compiled execution code can be stored in this directory, so that the distinction between different paths corresponding to different applications is realized.
[0102] In step S3, the method for determining whether the executed code is a hotspot code includes: detecting the code segment within the time interval according to a detection threshold or sorting, including setting a detection threshold, detecting the executed code according to the detection threshold, and if it exceeds the detection threshold, determining it is a hotspot code, and if it does not exceed, determining it is not a hotspot code;
[0103] The code segments are sorted according to the number of executions, and at least one or more code segments are selected from large to small to determine whether the execution code is selected. If selected, it is determined to be a hotspot code, and if not selected, it is determined not to be a hotspot code.
[0104] In this embodiment, the detection threshold is a value selected based on actual conditions. Within a time interval, the number of executions of the code segment corresponding to the detected execution code accounts for a percentage of all code executions. In a specific embodiment, the detection threshold is preferably 10%. If the number of executions of the code segment detected exceeds 10%, it is judged as a hotspot code and the execution code is sent directly to an external machine for execution. If it does not exceed 10%, the code segment is no longer a hotspot code and another code segment is selected.
[0105] In another embodiment, the code segments are sorted according to the number of executions, and at least one or more code segments are selected from large to small to determine whether the execution code is selected. If selected, it is determined to be a hotspot code, and if not selected, it is determined not to be a hotspot code.
[0106] In this embodiment, within a time interval, the code segments are sorted according to the count values according to the number of executions, and the top 5 or 10 code segments are selected from large to small as hot code. If the code segment corresponding to the execution code is selected, it is the hot code, and the execution code is directly sent to an external machine for execution. If it is not selected, the code segment is no longer a hot code, and another code segment is selected.
[0107] Reference Figure 3 The present invention further provides an embodiment of a control system, which is applicable to any updating method in the above technical solution, including:
[0108] Convert and compile the code segments on the device to generate machine code;
[0109] The device side includes:
[0110] Detection module 1: collects the code segments on the device side;
[0111] The first conversion module 2: converts the hotspot code into file information;
[0112] Compilation module 3: receives the file information sent by the first conversion module and compiles it into execution code;
[0113] Storage module 4: receiving the file information sent by the first conversion module and the execution code sent by the compilation module, and saving them according to the storage directory;
[0114] Execution module 5: Sends the execution code to an external machine.
[0115] In this embodiment, the code segments and hotspot codes on the device side are collected by the detection module 1, and the hotspot codes are sent to the first conversion module 1 after being classified according to the application. The hotspot codes are converted into file information by the first conversion module 2, and the file information is sent to the compilation module 3 and the storage module 4. The compilation module 3 compiles the file information into execution code and sends it to the storage module 4. The execution module 5 calls the execution code in the storage module 4 when the application is running, and determines whether it is a hotspot code. If so, the execution code is sent to an external machine.
[0116] Reference Figure 4 , several devices send the hotspot codes to the cloud, aggregate and convert the hotspot codes, generate aggregate files, and send the aggregate files back to several devices for compilation;
[0117] The device also includes:
[0118] Upload module 6: Send the hotspot code to the cloud;
[0119] Code file receiving module 7: receiving the aggregated file obtained by the aggregate conversion;
[0120] The cloud includes:
[0121] Code receiving module 8: receiving hotspot codes sent by several devices;
[0122] Aggregation module 9: removes duplicates according to the hotspot codes received by the code receiving module 8, saves them into a file, and generates an aggregate file;
[0123] The second conversion module 10 receives the aggregated file sent by the aggregation module and converts it into file information;
[0124] The code file sending module 11 receives the file information sent by the second conversion module, and sends the file information to a plurality of device ends.
[0125] In this embodiment, the device side sends the hotspot code to the cloud through the upload module 6, the cloud side receives the hotspot code through the code receiving module 8, and sends it to the aggregation module 9. After the hotspot code is deduplicated, it is aggregated to generate an aggregate file, and the aggregate file is sent to the second conversion module 10 to be converted into file information, and the file information is sent to the code file receiving module 7 on the device side through the code file sending module 11, and then sent to the compilation module 3 for compilation.
[0126] It is understandable that the software testing system provided by the embodiment of the present invention corresponds to the above-mentioned testing method, and the explanations, examples, beneficial effects and other parts of its relevant contents can refer to the corresponding contents in the selection method, which will not be repeated here.
[0127] The present invention also includes an embodiment of a computer-readable storage medium storing a computer program for executing the updating method, wherein the computer program causes a computer to execute the following steps:
[0128] S1: The device classifies several applications and collects hot codes of several applications;
[0129] S2: The hotspot code is converted through the device side, or the hotspot code is aggregated and converted through the cloud, and the generated file information is transmitted back to the device side;
[0130] S3: The device side compiles according to the file information to generate an execution code. The device side determines whether the execution code is a hotspot code within the time interval. If not, it returns to step S1 to update the selected hotspot code.
[0131] Among them, the computer-readable storage medium can be a computer storage medium or a communication medium. The communication medium includes any medium that facilitates the transmission of a computer program from one place to another. The computer storage medium can be any available medium that can be accessed by a general-purpose or special-purpose computer. For example, a computer-readable storage medium is coupled to a processor so that the processor can read information from the computer-readable storage medium and write information to the computer-readable storage medium. Of course, the computer-readable storage medium can also be a component of the processor. The processor and the computer-readable storage medium can be located in an application-specific integrated circuit (ASIC). In addition, the ASIC can be located in a user device. Of course, the processor and the computer-readable storage medium can also exist in a communication device as separate components.
[0132] Specifically, the computer-readable storage medium can be implemented by any type of volatile or non-volatile storage device or a combination thereof, such as static random access memory (SRAM), electrically erasable programmable read-only memory (EEPROM), erasable programmable read-only memory (EPROM), programmable read-only memory (PROM), read-only memory (ROM), magnetic memory, flash memory, magnetic disk or optical disk. The storage medium can be any available medium that can be accessed by a general or special-purpose computer.
[0133] The present invention also includes an embodiment of an electronic device, comprising:
[0134] one or more processors; memory; and
[0135] One or more programs, wherein the one or more programs are stored in the memory and configured to be executed by one or more processors, the programs comprising steps for performing the following steps:
[0136] S1: The device classifies several applications and collects hot codes of several applications;
[0137] S2: The hotspot code is converted through the device side, or the hotspot code is aggregated and converted through the cloud, and the generated file information is transmitted back to the device side;
[0138] S3: The device side compiles according to the file information to generate an execution code. The device side determines whether the execution code is a hotspot code within the time interval. If not, it returns to step S1 to update the selected hotspot code.
[0139] Memory is used to store computer programs. The memory may include high-speed random access memory (RAM) and may also include non-volatile memory (NVM), such as at least one disk memory, and may also be a USB flash drive, a mobile hard disk, a read-only memory, a disk or an optical disk.
[0140] The processor is used to execute the computer program stored in the memory. The processor can be a central processing unit (CPU), or other general-purpose processors, digital signal processors (DSP), application-specific integrated circuits (ASIC), etc. The general-purpose processor can be a microprocessor or the processor can be any conventional processor, etc. The steps of the method disclosed in the invention can be directly embodied as being executed by a hardware processor, or can be executed by a combination of hardware and software modules in the processor.
[0141] Optionally, the memory can be independent or integrated with the processor.
[0142] When the memory is a device independent of the processor, the electronic device may further include a bus. The bus is used to connect the memory and the processor. The bus may be an Industry Standard Architecture (ISA) bus, a Peripheral Component Interconnect (PCI) bus, or an Extended Industry Standard Architecture (EISA) bus. The bus may be divided into an address bus, a data bus, a control bus, and the like.
[0143] The division of units is only a logical function division, and there may be other divisions in actual implementation, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed may be an indirect coupling or communication connection through some interface, device or unit, which may be electrical, mechanical or other forms.
[0144] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
[0145] In addition, each functional unit in each embodiment of the present invention may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit.
[0146] If the function is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention, or the part that contributes to the prior art, or the part of the technical solution, can be embodied in the form of a software product. The computer software product is stored in a storage medium, including several instructions for enabling an electronic device (which can be a personal computer, server, or network device, etc.) to perform all or part of the steps of the methods of various embodiments of the present invention. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), disk or optical disk, and other media that can store program codes.
[0147] Those skilled in the art can understand that all or part of the steps of implementing the above-mentioned method embodiments can be completed by hardware related to program instructions. The aforementioned program can be stored in a computer-readable storage medium. When the program is executed, the steps of the above-mentioned method embodiments are executed; and the aforementioned storage medium includes: ROM, RAM, disk or optical disk and other media that can store program codes.
[0148] It should be noted that, through the description of the above embodiments, those skilled in the art can clearly understand that each embodiment can be implemented by means of software plus a necessary general hardware platform. Based on such an understanding, the above technical solution is essentially or the part that contributes to the prior art can be embodied in the form of a software product, which can be stored in a computer-readable storage medium, such as ROM / RAM, a disk, an optical disk, etc., including several instructions to enable a computer device (which can be a personal computer, a server, or a network device, etc.) to execute the methods described in each embodiment or some parts of the embodiment. In this article, relational terms such as first and second are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply that there is any such actual relationship or order between these entities or operations. Moreover, the term "include", "comprise" or any other variant thereof is intended to cover non-exclusive inclusion, so that the process, method, article or device including a series of elements includes not only those elements, but also includes other elements that are not explicitly listed, or also includes elements inherent to such process, method, article or device. Without more constraints, an element defined by the phrase "comprising a..." does not exclude the existence of other identical elements in the process, method, article or apparatus comprising the element.
[0149] Finally, it should be noted that the above is only a preferred embodiment of the present invention and is not intended to limit the present invention. Although the present invention has been described in detail with reference to the aforementioned embodiments, it is still possible for those skilled in the art to modify the technical solutions described in the aforementioned embodiments or to make equivalent substitutions for some of the technical features therein. Any modifications, equivalent substitutions, improvements, etc. made within the spirit and principles of the present invention should be included in the protection scope of the present invention.
Claims
1. A method for updating a hotspot code, characterized in that: include: The device classifies a number of applications and collects hotspot codes of a number of the applications; The hotspot code is converted by the device end, or the hotspot code is aggregated and converted by the cloud end, and the generated file information is transmitted back to the device end; The device end compiles according to the file information to generate an execution code, and the device end determines whether the execution code is a hotspot code within a time interval. If not, the collected hotspot code is updated.
2. The updating method according to claim 1, characterized in that: Categorizing several applications includes, Determine a corresponding code segment according to the execution function of the application, and record the code segment in a folder corresponding to the application, Collecting hotspot codes includes counting the number of executions of the code segments in the folder within a time interval, and selecting the hotspot codes according to the number of executions.
3. The updating method according to claim 1, characterized in that: The steps of aggregating and converting hotspot codes through the cloud include: The cloud aggregates the plurality of hotspot codes to generate an aggregate file, converts the aggregate file, and generates file information.
4. The updating method according to claim 3, characterized in that: The step of aggregating hotspot codes through the cloud includes: The cloud receives the hotspot codes sent by several device ends, saves the hotspot codes according to application classification, deduplicates the hotspot codes of the same application, saves them in a file, and generates the aggregate file.
5. The updating method according to claim 1, characterized in that: The generated file information is transmitted back to the device end to a storage directory of the device end, wherein the storage directory is established according to the application classification; The execution code is stored in a storage directory established according to the application classification.
6. The updating method according to claim 1, characterized in that: The method for determining whether the execution code is a hotspot code comprises: placing the code segment within the time interval, setting a detection threshold, detecting the execution code according to the detection threshold, and determining that it is a hotspot code if it exceeds the detection threshold, and determining that it is not a hotspot code if it does not exceed the detection threshold; Or the code segments are sorted according to the number of executions, and at least one or more code segments are selected from large to small to determine whether the execution code is selected. If selected, it is determined to be a hotspot code; if not selected, it is determined not to be a hotspot code.
7. A control system, characterized in that: The control system is applicable to the updating method according to any one of claims 1 to 6, including: Convert and compile the code segments on the device to generate machine code; The device side includes: Detection module: collects code segments on the device side; The first conversion module: converts the hotspot code into file information; Compilation module: receiving the file information sent by the first conversion module and compiling it into execution code; Storage module: receiving the file information sent by the first conversion module and the execution code sent by the compilation module, and saving them according to the storage directory; Execution module: sends the execution code to the external machine.
8. The control system according to claim 7, characterized in that: Several devices send the hotspot codes to the cloud, aggregate and convert the hotspot codes to generate an aggregate file, and transmit the aggregate file back to the several devices for compilation; The device side also includes: Upload module: sends the hotspot code to the cloud; Code file receiving module: receiving the aggregated file obtained by the aggregate conversion; The cloud comprises: Code receiving module: receives hotspot codes sent by several devices; Aggregation module: de-duplicates the hotspot codes received by the code receiving module, saves them into a file, and generates an aggregate file; A second conversion module: receiving the aggregated file sent by the aggregation module, and converting it into file information; Code file sending module: receives the file information sent by the second conversion module, and sends the file information to several device ends.
9. A computer-readable storage medium, characterized in that: It stores a computer program for running the updating method, wherein the computer program enables a computer to execute the updating method according to any one of claims 1 to 6.
10. An electronic device, characterized in that: include: one or more processors; Memory; as well as One or more programs, wherein the one or more programs are stored in the memory and configured to be executed by the one or more processors, the programs comprising instructions for executing the updating method according to any one of claims 1 to 6.