A data processing method and device, electronic equipment and storage medium
By analyzing and statistically analyzing the compilation log files of application engineering projects, the problem of accurately measuring compilation time in large projects is solved, enabling more efficient development process management and reducing waiting time and manpower costs.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- WUBA
- Filing Date
- 2022-09-20
- Publication Date
- 2026-04-24
AI Technical Summary
In the process of building application projects, especially large projects, developers need to wait for the build to complete, resulting in long unnecessary times, which affects efficiency and increases labor costs. Existing technologies make it difficult to accurately measure and optimize the compilation process time.
By obtaining the compilation log files of the models in the project, we can analyze and statistically analyze the execution time of different stages and source files in the compilation process. We can also use integrated development tools such as Xcode to record compilation time information, achieve detailed time statistics for the compilation preparation, static library creation and compilation execution stages, and display the results in image visualization.
It improves the accuracy of the total compilation time, helps developers identify optimization goals, reduces unnecessary waiting time, improves development efficiency, and reduces labor costs.
Smart Images

Figure CN115543266B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of computer technology, and in particular to a data processing method, apparatus, electronic device, and storage medium. Background Technology
[0002] With the rapid development of technology, applications are becoming increasingly important in people's lives and work. In order to better serve users, major manufacturers often develop applications with various functions.
[0003] During application development, an application project can be created in the development environment of the terminal. The application's computer program code is then written within this project. After the application's computer program code is completed, the application project can be built to obtain the application's executable file. The process of building the application project includes compilation and linking. Summary of the Invention
[0004] This application discloses a data processing method, apparatus, electronic device, and storage medium.
[0005] In a first aspect, this application discloses a data processing method applied to an electronic device, wherein the electronic device is equipped with an integrated development tool, the method comprising:
[0006] For any one of the at least one models in the project created in the integrated development tool, after the model is built, obtain the compilation log file of the model;
[0007] Based on the compilation log file of the model, obtain the first execution time consumed by each preparation step in the compilation preparation phase during the compilation process of the model; based on each first execution time, obtain the first time consumed in the compilation preparation phase.
[0008] Based on the compilation log file of the model, obtain the second execution time of each creation step in the static library creation stage during the compilation of the model, and obtain the second execution time in the static library creation stage based on each second execution time;
[0009] Obtain the compilation log files of each source file in the model; based on the compilation log files of each source file, obtain the compilation start time when compiling each source file in the model starts and the compilation end time when compiling each source file ends during the compilation process; based on each compilation start time and each compilation end time, obtain the third time consumed in the compilation execution phase during the compilation process of the model.
[0010] The total time spent compiling the model is obtained based on the first time spent, the second time spent, and the third time spent.
[0011] In an optional implementation, obtaining the first execution time consumed in the compilation preparation phase based on each first execution time includes:
[0012] The sum of the execution times of each first execution is calculated to obtain the first execution time.
[0013] In one optional implementation, obtaining the second execution time consumed during the static library creation phase based on each second execution time includes:
[0014] The sum of the individual second execution times is calculated to obtain the second execution time.
[0015] In an optional implementation, obtaining the third time consumed during the compilation execution phase of the model compilation process, based on each compilation start time and each compilation end time, includes:
[0016] Select the earliest compilation start time among all compilation start times, and select the latest compilation end time among all compilation end times;
[0017] The difference between the latest compilation end time and the earliest compilation start time is calculated to obtain the third time consumed.
[0018] In an optional implementation, the method further includes:
[0019] Obtain the stage identifier of the compilation preparation stage, the stage identifier of the static library creation stage, and the stage identifier of the compilation execution stage;
[0020] Based on the stage identifiers of the compilation preparation stage, the static library creation stage, and the compilation execution stage, the first time consumption, the second time consumption, and the third time consumption are displayed using image-based visualization.
[0021] In an optional implementation, the method further includes:
[0022] Obtain the model identifiers of each model in the project;
[0023] The total time spent compiling each model is visualized using images based on the model identifiers.
[0024] In one alternative implementation, the process of compiling source files includes a front-end compilation stage for the source files, a middle-end compilation stage for the source files, and a back-end compilation stage for the source files.
[0025] The method further includes:
[0026] For any source file in the model, based on the compilation log file of the source file, obtain the front-end execution time consumed in the front-end compilation stage during the compilation process of the source file, the mid-end execution time consumed in the mid-end compilation stage during the compilation process of the source file, and the back-end execution time consumed in the back-end compilation stage during the compilation process of the source file.
[0027] Based on the front-end execution time, the mid-end execution time, and the back-end execution time, obtain the fourth time consumed during the compilation of the source file.
[0028] In an optional implementation, the method further includes:
[0029] Obtain the stage identifier of the front-end compilation stage, the stage identifier of the mid-end compilation stage, and the stage identifier of the back-end compilation stage;
[0030] Based on the stage identifiers of the front-end compilation stage, the mid-end compilation stage, and the back-end compilation stage, the execution time of the front-end, the mid-end, and the back-end is visualized using images.
[0031] In an optional implementation, the method further includes:
[0032] Obtain the source file identifier of each source file in the model;
[0033] Based on the source file identifiers of each source file in the model, the fourth time consumed during the compilation of each source file in the model is visualized using an image.
[0034] Secondly, this application discloses a data processing apparatus applied to an electronic device, wherein the electronic device is equipped with an integrated development tool, the apparatus comprising:
[0035] The first acquisition module is used to acquire the compilation log file of any one of the at least one models in the engineering project created in the integrated development tool after the model has been built.
[0036] The second acquisition module is used to acquire, based on the model's compilation log file, the first execution time consumed by each preparation step in the compilation preparation phase during the compilation of the model; and to acquire the first time consumed in the compilation preparation phase based on each first execution time.
[0037] The third acquisition module is used to acquire, based on the compilation log file of the model, the second execution time consumed by each creation step in the static library creation stage during the compilation of the model, and to acquire the second time consumed in the static library creation stage based on each second execution time.
[0038] The fourth acquisition module is used to acquire the compilation log files of each source file in the model respectively; the fifth acquisition module is used to acquire, based on the compilation log files of each source file, the compilation start time when the compilation of each source file in the model starts and the compilation end time when the compilation of each source file ends respectively during the compilation process; and based on each compilation start time and each compilation end time, acquire the third time consumed in the compilation execution phase during the compilation process of the model.
[0039] The sixth acquisition module is used to acquire the total time spent in compiling the model based on the first time spent, the second time spent, and the third time spent.
[0040] In one optional implementation, the second acquisition module includes:
[0041] The first calculation unit is used to calculate the sum of the various first execution times to obtain the first time consumed.
[0042] In one optional implementation, the third acquisition module includes:
[0043] The second calculation unit is used to calculate the sum of the various second execution times to obtain the second time consumed.
[0044] In one optional implementation, the fifth acquisition module includes:
[0045] The selection unit is used to select the earliest compilation start time among various compilation start times, and the latest compilation end time among various compilation end times.
[0046] The third calculation unit is used to calculate the difference between the latest compilation end time and the earliest compilation start time to obtain the third time consumed.
[0047] In an alternative implementation, the apparatus further includes:
[0048] The seventh acquisition module is used to acquire the stage identifier of the compilation preparation stage, the stage identifier of the static library creation stage, and the stage identifier of the compilation execution stage;
[0049] The first display module is used to perform image-based visualization of the first time consumption, the second time consumption, and the third time consumption based on the stage identifier of the compilation preparation stage, the stage identifier of the static library creation stage, and the stage identifier of the compilation execution stage.
[0050] In an alternative implementation, the apparatus further includes:
[0051] The eighth acquisition module is used to acquire the model identifiers of each model in the project.
[0052] The second display module is used to visualize the total time spent in compiling each model separately based on the model identifier.
[0053] In one alternative implementation, the process of compiling source files includes a front-end compilation stage for the source files, a middle-end compilation stage for the source files, and a back-end compilation stage for the source files.
[0054] The device further includes:
[0055] The ninth acquisition module is used to acquire, for any source file in the model, the front-end execution time consumed in the front-end compilation stage during the compilation of the source file, the mid-end execution time consumed in the mid-end compilation stage during the compilation of the source file, and the back-end execution time consumed in the back-end compilation stage during the compilation of the source file, based on the compilation log file of the source file.
[0056] The tenth acquisition module is used to acquire the fourth time spent in compiling the source file based on the front-end execution time, the mid-end execution time, and the back-end execution time.
[0057] In an alternative implementation, the apparatus further includes:
[0058] The eleventh acquisition module is used to acquire the stage identifier of the front-end compilation stage, the stage identifier of the mid-end compilation stage, and the stage identifier of the back-end compilation stage.
[0059] The third display module is used to perform image-based visualization of the front-end execution time, the mid-end execution time, and the back-end execution time based on the stage identifiers of the front-end compilation stage, the mid-end compilation stage, and the back-end compilation stage.
[0060] In an alternative implementation, the apparatus further includes:
[0061] The twelfth acquisition module is used to acquire the source file identifiers of each source file in the model;
[0062] The fourth display module is used to visualize the fourth time consumed during the compilation of each source file in the model based on the source file identifier of each source file in the model.
[0063] Thirdly, this application discloses an electronic device comprising: a processor; and a memory for storing processor-executable instructions; wherein the processor is configured to perform the method as described in any of the preceding aspects.
[0064] Fourthly, this application discloses a non-transitory computer-readable storage medium, wherein when instructions in the storage medium are executed by a processor of an electronic device, the electronic device is enabled to perform the methods described in any of the preceding aspects.
[0065] Fifthly, this application discloses a computer program product in which, when the instructions in the computer program product are executed by a processor of an electronic device, the electronic device is enabled to perform the method described in any of the preceding aspects.
[0066] The technical solution provided in this application may include the following beneficial effects:
[0067] In this application, the compilation log file of the model is obtained. Based on the compilation log file, the first execution time consumed by each preparation step in the compilation preparation phase of the model compilation process is obtained, and the first total execution time consumed in the compilation preparation phase of the model compilation process is obtained based on each first execution time. Based on the compilation log file, the second execution time consumed by each creation step in the static library creation phase of the model compilation process is obtained, and the second total execution time consumed in the static library creation phase of the model compilation process is obtained based on each second execution time. The compilation log files of each source file in the model are obtained. Based on the compilation log files of each source file, the compilation start time when compiling each source file in the model and the compilation end time when compiling each source file in the model are obtained. Based on each compilation start time and each compilation end time, the third total execution time consumed in the compilation execution phase of the model compilation process is obtained. Based on the first, second, and third total execution times, the total execution time consumed in the model compilation process is obtained.
[0068] On the one hand, this application statistically analyzes the total time spent compiling each model in a project, providing a more granular statistical approach by focusing on each model separately. This allows developers to understand the total time spent compiling each model individually, enabling them to analyze and optimize each model to improve the overall project performance. For example, if the total time spent compiling a particular model is significantly longer than that spent compiling other models, it often indicates that the model has room for optimization, such as optimizing the computer program code within it. This allows for the precise identification of models in the project that require optimization.
[0069] On the other hand, the compilation process of this model includes three stages: compilation preparation stage, compilation execution stage, and static library creation stage. When calculating the total time spent in compiling any model in the project, the time spent in the compilation preparation stage, the time spent in the static library creation stage, and the time spent in the compilation execution stage are calculated separately.
[0070] Furthermore, the first execution time consumed in the compilation preparation phase of compiling the model is calculated based on the first execution time consumed in executing each preparation step in the compilation preparation phase of compiling the model; the second execution time consumed in the static library creation phase of compiling the model is calculated based on the second execution time consumed in executing each creation step in the static library creation phase of compiling the model; and the third execution time consumed in the compilation execution phase of compiling the model is calculated based on the compilation start time when compiling each source file in the model starts and the compilation end time when compiling each source file ends.
[0071] Therefore, in the compilation preparation stage of compiling the model, the first execution time consumed by each preparation step in the compilation preparation stage does not include the time consumed by waiting to execute some steps in the compilation of other models. Thus, based on the first execution time consumed by each preparation step in the compilation preparation stage of compiling the model, the first time consumed in the compilation preparation stage of compiling the model can be more accurately calculated.
[0072] Furthermore, regarding the static library creation phase during the compilation of the model, the second execution time for each creation step within this phase does not include the "time spent waiting to execute steps during the compilation of other models." Therefore, based on the second execution time for each creation step during the static library creation phase, the second total execution time spent in the static library creation phase during the compilation of the model can be more accurately calculated.
[0073] In summary, by first improving the accuracy of the time spent at different stages of the model compilation process, and then calculating the total time spent in compiling the model based on the time spent at each stage, the accuracy of the total time spent in compiling the model can be improved. Attached Figure Description
[0074] Figure 1 This is a flowchart of the steps of a data processing method according to this application.
[0075] Figure 2 This is a flowchart of the steps of a data processing method according to this application.
[0076] Figure 3 This is a structural block diagram of a data processing device according to this application.
[0077] Figure 4 This is a block diagram of an electronic device according to this application.
[0078] Figure 5 This is a block diagram of an electronic device according to this application. Detailed Implementation
[0079] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some, not all, of the embodiments of the present invention. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.
[0080] The inventors discovered that the process of building an application's engineering project takes a considerable amount of time.
[0081] For some small engineering projects, the construction process is short, and developers are not aware of the time it takes.
[0082] However, for some large-scale engineering projects, the building process, whether in the development scenario or in the subsequent update scenario, is time-consuming. Because the building process is lengthy and developers need to be continuously involved (e.g., developers must wait for the build to complete before they can do other things), it results in a significant amount of unnecessary waiting time for developers, wasting their work time and, in severe cases, affecting their morale and increasing labor costs.
[0083] Therefore, a requirement was proposed to statistically analyze the time taken to build application projects, so that developers can refer to the time taken to build the project to rationally allocate their work, avoid long and unnecessary waiting times, avoid affecting the mood of developers, save time, and reduce labor costs.
[0084] To calculate the time taken to build an application project, one approach is to separately calculate the time taken for each step, since the build process includes compilation and linking.
[0085] Regarding the compilation process, the inventors analyzed the application's engineering projects and found that the engineering projects in the application often include multiple different models, and these multiple models are often developed separately by multiple developers.
[0086] In this way, the total time spent compiling each model can be calculated separately, which can be used as a reference for the developers of each model.
[0087] For example, for any given model, a compilation log file can be obtained. This log file records compilation time information. From this information, the start time when the model compilation began and the end time when compilation was completed can be extracted. The difference between the start and end times can then be calculated and used as the total compilation time. The same process applies to every other model.
[0088] However, the inventors discovered that the total time spent compiling each model separately was often quite long. Given this, it can be inferred that the development project was inefficient.
[0089] Therefore, the need to improve the efficiency of development projects has been proposed.
[0090] To improve the efficiency of project development, the total time spent compiling each model separately can be reduced.
[0091] To reduce the total time spent compiling each model separately, the inventors conducted a statistical analysis of the separate compilation of each model in the project and found that the models are compiled in parallel. Furthermore, for any given model, the compilation process includes multiple stages, such as the compilation preparation stage, the compilation execution stage, and the static library creation stage.
[0092] In addition, the inventors analyzed the compilation log files of the model's compilation process and found that at any stage of the model's compilation process, multiple steps involved in that stage need to be executed sequentially.
[0093] Furthermore, the inventors discovered that sometimes adjacent steps involved in this stage are not executed consecutively. For example, in this stage of the model compilation process, after executing one step involved in this stage, a period of time is required before executing the next step involved in this stage that is adjacent to and follows that step. During this gap period, no step involved in this stage of the model compilation process is executed.
[0094] The inventors further analyzed the reason why, "in this stage of the model compilation process, after executing one step involved in that stage, a certain period of time is required before executing the next step involved in that stage, which is located after and adjacent to that step," and found that:
[0095] Sometimes, the next step requires certain libraries or components from other models. However, these libraries or components can only be configured after certain steps in the compilation process of other models have been completed, so that they can be used as dependencies.
[0096] Thus, for this model, after executing a step involved in this stage, it is necessary to wait for the completion of some steps in the compilation process of other models (to complete the configuration of some libraries or components in other models) before executing the next step involved in this stage of the compilation process of this model, which is located after and adjacent to this step.
[0097] This is equivalent to delaying the start time of the next step that follows and is adjacent to the previous step in the process of compiling the model, which in turn delays the completion time of the next step that follows and is adjacent to the previous step in the process of compiling the model, and thus delays the completion time of the current stage in the process of compiling the model.
[0098] Therefore, the total time spent compiling the model calculated in the above way will be greater than the actual time spent compiling the model.
[0099] If the total time spent compiling each model separately is long, it can be inferred that the development project is inefficient, and efforts should be made to improve its efficiency. However, if the total time spent compiling each model separately is short, it can be inferred that the development project is not inefficient, and efforts to improve its efficiency are unnecessary.
[0100] The reason why the total time spent compiling the model, which was mistakenly calculated in the above way, is long is because of the need to improve the efficiency of the development project. If the total time spent compiling the model is short, there would be no need to improve the efficiency of the development project.
[0101] Therefore, there is a need to improve the accuracy of the total time spent compiling the model.
[0102] To improve the accuracy of the total time spent compiling the model, refer to Figure 1 The diagram illustrates a flowchart of a data processing method according to this application, which is applied to an electronic device in which an integrated development tool is deployed.
[0103] Integrated development tools can include Xcode, which can be used to develop applications for macOS, iOS, watchOS, and tvOS.
[0104] Developers can create application projects in integrated development tools and write application computer program code in the project projects. Depending on the actual business requirements of the application, the project project can include at least one model of the application, such as multiple models. Each model can include multiple source files, and each source file can include computer program code corresponding to its respective business.
[0105] Thus, the computer program code of the application in the project includes: the computer program code in the source files of each model of the application in the project, etc.
[0106] After the computer program code for the application is written in the engineering project, the engineering project can be built. The process of building the engineering project includes building each model in the engineering project separately.
[0107] The process of building a model includes compiling the model and linking it.
[0108] Compilation can be understood as the process in computer science of converting source code written in one programming language into another compiled language (target language).
[0109] Linking can be understood as the process of linking one or more contents generated by a compiler or assembler into an executable file. The linking process is usually implemented by a linker.
[0110] Specifically, for any one of the at least one models in an engineering project created in the integrated development tool, after the model is built, the total time spent compiling the model can be obtained through the following process to improve the accuracy of the total time spent compiling the model. The same applies to each of the other models in the at least one model in an engineering project created in the integrated development tool.
[0111] The specific process includes:
[0112] In step S101, the compilation log file of the model is obtained.
[0113] After the application project is built, the project will contain compilation log files for each model.
[0114] Different models in an engineering project correspond to different compilation log files. The compilation log files of a model record log information during the compilation process, such as the compilation time information of the model.
[0115] The compilation model process includes three stages: compilation preparation stage, compilation execution stage, and static library creation stage.
[0116] The compilation preparation stage can include processes such as lexical analysis, syntax analysis, index creation, and dependency establishment for strings in the project.
[0117] The compilation and execution phase can include the process of semantic analysis of the project and the generation of intermediate code.
[0118] The static library creation phase can include the process of writing important or common code from a project into a static library file.
[0119] Before building the project, you can set the parameter ftime-trace in the OtherCFlags and OtherC++Flags options in the project build settings of the integrated development tool.
[0120] This parameter is used for compiler instrumentation. For example, during the construction of an engineering project, when compiling the model in the project, the compilation time information of the model will be recorded in the integrated development tool. This includes the stage identifier of each stage (such as the model compilation preparation stage, compilation execution stage, and static library creation stage), the start time, end time, and duration of each stage. It can also include the start time and end time of each preparation step in the compilation preparation stage and the start time and end time of each creation step in the static library creation stage. The compilation log file of the model is output, and the format of the compilation log file can include JSON format, etc.
[0121] In this application, a compiler is a program that translates "one language (usually a high-level language)" into "another language (usually a low-level language)". The main workflow of a compiler is: source code → reprocessor → compiler → object code → linker → executables.
[0122] Compilers include LLVM (Low Level Virtual Machine), and front-end compilers for C / C++ / Objective-C (an object-oriented programming language extended from C) based on LLVM, such as front-end compilers like Clang.
[0123] Clang is a front-end compiler for the C / C++ / Objective-C programming language, which is based on LLVM (Low Level Virtual Machine).
[0124] Compilers can also include Xcode. Xcode is an Integrated Development Environment (IDE) that runs on the macOS operating system and is developed by Apple Inc. Xcode is the fastest way to develop macOS and iOS applications. Xcode has a unified user interface design, and coding, testing, and debugging can all be done within a single window.
[0125] One step is to first open the Xcode integrated development environment and create a derived data directory. The derived data directory can be a top-level directory of the Xcode integrated development environment, etc.
[0126] In one example, the default path for creating the derived data directory could be:
[0127] ~ / Library / Developer / Xcode / DerivedData / <Project Name>-<Project Identifier>, etc.
[0128] Different projects have different names and different logos.
[0129] Then you can find the intermediate output directory (e.g., . / project_name / Intermediates.noindex) in the derived data directory, which contains the compilation log files of each model in the project and the compilation log files of each source file in each model.
[0130] Then you can obtain the name of the project, and look for the intermediate product directory in the created derived data directory based on the name of the project. Then you can look for the "Pods.Project Name" directory in the intermediate product directory.
[0131] Then, locate the directories of each model in the project in the "Pods.Project Name" directory, and then locate the compilation log files of each model in each model's directory.
[0132] For example, for any given model, you can obtain the model's name, and then obtain the log files in the model's directory that are of type log, and use them as the model's compilation log files.
[0133] Compilation log files can include xcactivitylog, etc.
[0134] In step S102, based on the compilation log file of the model, the first execution time consumed by each preparation step in the compilation preparation stage of the model compilation process is obtained, and the first time consumed in the compilation preparation stage of the model compilation process is obtained based on each first execution time.
[0135] In this application, during the compilation preparation phase of compiling the model, multiple preparation steps related to compilation preparation are often executed sequentially.
[0136] In this application, the start and end times of each preparation step during the compilation preparation phase of the model can be obtained from the model's compilation log file.
[0137] For example, after obtaining the compilation log file of the model, the compilation log file can be imported into a preset data table for parsing. The stage identifiers of each stage in the compilation process of the model can be obtained from the compilation log file. From this, the stage identifier of the compilation preparation stage can be extracted. Then, based on the stage identifier of the compilation preparation stage, the start and end times of each preparation step in the compilation preparation stage of the model compilation process can be extracted from the compilation log file.
[0138] Then, based on the start and end times of each preparation step executed during the compilation preparation phase of compiling the model, the first execution time consumed by each preparation step during the compilation preparation phase can be calculated.
[0139] For example, for any preparation step executed during the compilation preparation phase of compiling the model, the difference between the end time and the start time of that preparation step during the compilation preparation phase can be calculated to obtain the first execution time consumed by that preparation step during the compilation preparation phase. The same operation is performed for each other preparation step executed during the compilation preparation phase of compiling the model.
[0140] In one embodiment of this application, the various preparation steps executed in the compilation preparation stage during the compilation of the model often have a logical sequence relationship. Thus, the execution of each preparation step in the compilation preparation stage during the compilation of the model is often performed serially.
[0141] Thus, the sum of the first execution times consumed by each preparation step in the compilation preparation phase of compiling the model can be calculated to obtain the first execution time consumed in the compilation preparation phase of compiling the model.
[0142] In step S103, based on the compilation log file of the model, the second execution time consumed by each creation step in the static library creation stage during the compilation of the model is obtained, and the second time consumed in the static library creation stage during the compilation of the model is obtained based on each second execution time.
[0143] In this application, during the static library creation phase of compiling the model, multiple creation steps related to static library creation are often executed sequentially.
[0144] In this application, the start and end times of each creation step during the static library creation phase of the model compilation process can be obtained from the model's compilation log file.
[0145] For example, after obtaining the compilation log file of the model, the compilation log file of the model can be imported into a preset data table for parsing. The stage identifiers of each stage in the compilation process of the model can be obtained from the compilation log file. From this, the stage identifier of the static library creation stage can be extracted. Then, based on the stage identifier of the static library creation stage, the start and end times of each creation step in the static library creation stage of the compilation process of the model can be extracted from the compilation log file.
[0146] Then, based on the start and end times of each creation step in the static library creation phase during the compilation of the model, the second execution time consumed by each creation step in the static library creation phase during the compilation of the model can be calculated.
[0147] For example, for any creation step executed during the static library creation phase of compiling the model, the difference between the end time and the start time of that creation step during the static library creation phase can be calculated to obtain the second execution time consumed by that creation step during the static library creation phase of compiling the model. The same operation is performed for each other creation step executed during the static library creation phase of compiling the model.
[0148] In one embodiment of this application, the various creation steps executed during the static library creation phase of compiling the model often have a logical sequence. Thus, the execution of each creation step during the static library creation phase of compiling the model is often performed serially.
[0149] Thus, the sum of the second execution times consumed by each creation step in the static library creation phase during the compilation of the model can be calculated to obtain the second execution time consumed in the static library creation phase during the compilation of the model.
[0150] In step S104, the compilation log files of each source file in the model are obtained respectively.
[0151] In this application, during the compilation execution phase of the compilation model, each source file in the model can be compiled. The compilation process of the source files includes three phases: the front-end compilation phase, the middle-end compilation phase, and the back-end compilation phase.
[0152] After the compilation execution phase of the model is completed, the project will record the compilation log files of each source file in the model.
[0153] In this model, different source files correspond to different compilation log files. The compilation log files of the source files record log information during the compilation process, such as the compilation time information of the source files.
[0154] Before building the project, you can set the parameter ftime-trace in the OtherCFlags and OtherC++Flags options in the project build settings of the integrated development tool.
[0155] This parameter is used for compiler instrumentation. For example, during the construction of an engineering project, when compiling the source files in the model of the engineering project, the compilation time information of the source files will be recorded in the integrated development tool. This includes the stage identifier of each stage (such as the front-end compilation stage, middle-end compilation stage, and back-end compilation stage of the source files), the start time, end time, and duration of each stage, and the compilation log file of the source files will be output. The format of the compilation log file of the source files can include JSON format, etc.
[0156] In this way, at least the compilation start time when compiling the source files in the compilation model begins and the compilation end time when compiling the source files ends can be extracted from the compilation log file of the source files.
[0157] One step is to first open the Xcode integrated development environment and create a derived data directory. The derived data directory can be a top-level directory of the Xcode integrated development environment, etc.
[0158] In one example, the default path for creating the derived data directory could be:
[0159] ~ / Library / Developer / Xcode / DerivedData / <Project Name>-<Project Identifier>, etc.
[0160] Different projects have different names and different logos.
[0161] Then you can find the intermediate output directory (e.g., . / project_name / Intermediates.noindex) in the derived data directory, which contains the compilation log files of each model in the project and the compilation log files of each source file in each model.
[0162] Then you can obtain the name of the project, and look for the intermediate product directory in the created derived data directory based on the name of the project. Then you can look for the "Pods.Project Name" directory in the intermediate product directory.
[0163] Then, find the directories of each model in the project in the "Pods.Project Name" directory. For any model among multiple models, you can find the compilation log files of each source file in the model's directory according to the name of each source file in the model.
[0164] For example, for any source file in the model, a log file containing the name of the source file in the model and of type log can be obtained in the directory of the model and used as the compilation log file of the source file in the model.
[0165] Compilation log files can include xcactivitylog, etc.
[0166] In step S105, based on the compilation log files of each source file, the compilation start time when compiling each source file in the model begins and the compilation end time when compiling each source file ends are obtained respectively. Based on each compilation start time and each compilation end time, the third time consumed in the compilation execution phase during the compilation process of the model is obtained.
[0167] In this application, for any one of the multiple source files in the model, the compilation start time and compilation end time of that source file during the compilation process can be obtained from the compilation log file of that source file. The same operation is performed for each of the other source files in the model.
[0168] Then, based on the compilation start time when compiling each source file in the model begins and the compilation end time when compiling each source file ends, the third time consumed in the compilation execution phase during the compilation process of the model can be calculated.
[0169] For example, the earliest compilation start time can be selected from the compilation start time when the compilation of each source file in the model begins, and the latest compilation end time can be selected from the compilation end time when the compilation of each source file in the model ends. Then, the difference between the latest compilation end time and the earliest compilation start time can be calculated to obtain the third time consumption.
[0170] In step S106, the total time spent in compiling the model is obtained based on the first time spent, the second time spent, and the third time spent.
[0171] In one embodiment of this application, the compilation model process includes three stages: compilation preparation stage, compilation execution stage, and static library creation stage.
[0172] The compilation preparation phase and the compilation execution phase can be adjacent, and the compilation execution phase and the static library creation phase can be adjacent. Thus, the total time spent in compiling the model can be obtained by summing the first time spent in the compilation preparation phase, the third time spent in the compilation execution phase, and the second time spent in the static library creation phase.
[0173] For example, suppose the first time spent in the compilation preparation phase of compiling the model is 30 seconds, the third time spent in the compilation execution phase of compiling the model is 20 seconds, and the second time spent in the static library creation phase of compiling the model is 10 seconds. The total time spent in compiling the model can be 60 seconds.
[0174] In this application, steps S101 and S104 can be executed in parallel.
[0175] After step S101 is completed, steps S102 and S103 can be performed in parallel.
[0176] After completing step S104, step S105 can be executed.
[0177] After completing steps S102, S103, and S105, step S106 can be executed.
[0178] In this application, the compilation log file of the model is obtained. Based on the compilation log file, the first execution time consumed by each preparation step in the compilation preparation phase of the model compilation process is obtained, and the first total execution time consumed in the compilation preparation phase of the model compilation process is obtained based on each first execution time. Based on the compilation log file, the second execution time consumed by each creation step in the static library creation phase of the model compilation process is obtained, and the second total execution time consumed in the static library creation phase of the model compilation process is obtained based on each second execution time. The compilation log files of each source file in the model are obtained. Based on the compilation log files of each source file, the compilation start time when compiling each source file in the model and the compilation end time when compiling each source file in the model are obtained. Based on each compilation start time and each compilation end time, the third total execution time consumed in the compilation execution phase of the model compilation process is obtained. Based on the first, second, and third total execution times, the total execution time consumed in the model compilation process is obtained.
[0179] On the one hand, this application statistically analyzes the total time spent compiling each model in a project, providing a more granular statistical approach by focusing on each model separately. This allows developers to understand the total time spent compiling each model individually, enabling them to analyze and optimize each model to improve the overall project performance. For example, if the total time spent compiling a particular model is significantly longer than that spent compiling other models, it often indicates that the model has room for optimization, such as optimizing the computer program code within it. This allows for the precise identification of models in the project that require optimization.
[0180] On the other hand, the compilation process of this model includes three stages: compilation preparation stage, compilation execution stage, and static library creation stage. When calculating the total time spent in compiling any model in the project, the time spent in the compilation preparation stage, the time spent in the static library creation stage, and the time spent in the compilation execution stage are calculated separately.
[0181] Furthermore, the first execution time consumed in the compilation preparation phase of compiling the model is calculated based on the first execution time consumed in executing each preparation step in the compilation preparation phase of compiling the model; the second execution time consumed in the static library creation phase of compiling the model is calculated based on the second execution time consumed in executing each creation step in the static library creation phase of compiling the model; and the third execution time consumed in the compilation execution phase of compiling the model is calculated based on the compilation start time when compiling each source file in the model starts and the compilation end time when compiling each source file ends.
[0182] Therefore, in the compilation preparation stage of compiling the model, the first execution time consumed by each preparation step in the compilation preparation stage does not include the time consumed by waiting to execute some steps in the compilation of other models. Thus, based on the first execution time consumed by each preparation step in the compilation preparation stage of compiling the model, the first time consumed in the compilation preparation stage of compiling the model can be more accurately calculated.
[0183] Furthermore, regarding the static library creation phase during the compilation of this model, the second execution time for each creation step within this phase does not include the "time spent waiting to execute steps during the compilation of other models." Therefore, based on the second execution time for each creation step within the static library creation phase, the second execution time consumed during the static library creation phase can be more accurately calculated.
[0184] In summary, by first improving the accuracy of the time spent at different stages of the model compilation process, and then calculating the total time spent in compiling the model based on the time spent at each stage, the accuracy of the total time spent in compiling the model can be improved.
[0185] Furthermore, after calculating the total time spent in compiling each model separately, the total time spent in compiling each model separately can be visualized.
[0186] For example, the model identifiers of each model in an engineering project can be obtained. Different models have different model identifiers. Then, based on the model identifiers of each model, the total time spent in compiling each model can be visualized using images.
[0187] For example, GoogleTrace format files can be generated based on the model identifiers of each model and the total time spent compiling each model separately. Flame graphs can then be drawn based on these GoogleTrace format files, allowing developers to understand the total time spent compiling each model separately through the flame graphs.
[0188] This allows developers to analyze engineering projects based on visualized time-sharing charts, and subsequently optimize them. For example, if the total time spent compiling a certain model is significantly longer than the total time spent compiling other models, it often indicates that the model has room for optimization; for instance, the computer program code within the model can be optimized.
[0189] Furthermore, for any one of the at least one models included in the engineering project, after obtaining the first time consumed in the compilation preparation phase, the second time consumed in the static library creation phase, and the third time consumed in the compilation execution phase, the time consumed in the compilation preparation phase, the second time consumed in the static library creation phase, and the third time consumed in the compilation execution phase can be visualized. This allows developers to analyze the model based on the visualized time graph and then optimize the model.
[0190] For example, if the third time spent in the compilation execution phase of the model is longer than the first time spent in the compilation preparation phase and the second time spent in the static library creation phase, then the computer program code in the model involving the compilation execution phase has room for optimization.
[0191] For example, the stage identifiers of the compilation preparation stage, the static library creation stage, and the compilation execution stage can be obtained, and each of these stages is different from the others. Then, based on the stage identifiers of the compilation preparation stage, the static library creation stage, and the compilation execution stage, the first, second, and third execution times can be visualized using images.
[0192] For example, a GoogleTrace format file can be generated based on the stage identifiers of the compilation preparation stage, the static library creation stage, and the compilation execution stage, as well as the first time spent in the compilation preparation stage, the second time spent in the static library creation stage, and the third time spent in the compilation execution stage. A flame graph can then be generated based on the GoogleTrace format file, allowing developers to understand the first time spent in the compilation preparation stage, the second time spent in the static library creation stage, and the third time spent in the compilation execution stage through the flame graph.
[0193] For example, if the first time spent in the compilation preparation phase of the model is longer than the second time spent in the static library creation phase and the third time spent in the compilation execution phase, then the computer program code in the model involving the compilation preparation phase has room for optimization.
[0194] For example, if the second time spent in the static library creation phase during the compilation of the model is longer than the first time spent in the compilation preparation phase and the third time spent in the compilation execution phase, then the computer program code in the model involving the static library creation phase has room for optimization.
[0195] In this application, the process of compiling source files includes a front-end compilation stage, a mid-end compilation stage, and a back-end compilation stage.
[0196] Furthermore, for any source file in the model, the fourth time spent compiling that source file can be obtained, and the same applies to every other source file in the model.
[0197] See Figure 2 The specific process includes:
[0198] In step S201, based on the compilation log file of the source file, the front-end execution time consumed in the front-end compilation stage during the compilation of the source file, the mid-end execution time consumed in the mid-end compilation stage during the compilation of the source file, and the back-end execution time consumed in the back-end compilation stage during the compilation of the source file are obtained.
[0199] The compilation log file of the source file may include: the front-end execution time consumed in the front-end compilation stage during the compilation of the source file, the intermediate execution time consumed in the intermediate compilation stage during the compilation of the source file, and the back-end execution time consumed in the back-end compilation stage during the compilation of the source file.
[0200] In this way, the front-end execution time consumed in the front-end compilation stage, the mid-end execution time consumed in the mid-end compilation stage, and the back-end execution time consumed in the back-end compilation stage can be directly extracted from the compilation log file of the source file.
[0201] In step S202, the fourth time consumed during the compilation of the source file is obtained based on the front-end execution time, the middle-end execution time, and the back-end execution time.
[0202] In one embodiment of this application, the process of compiling the source file model includes three stages: a front-end compilation stage, a mid-end compilation stage, and a back-end compilation stage. The front-end compilation stage and the mid-end compilation stage can be adjacent to each other, and the mid-end compilation stage and the back-end compilation stage can be adjacent to each other.
[0203] Thus, for any one of the multiple source files in this model, the fourth execution time consumed in the compilation process of the source file can be obtained by summing the front-end execution time consumed in the front-end compilation stage, the mid-end execution time consumed in the mid-end compilation stage, and the back-end execution time consumed in the back-end compilation stage.
[0204] The same operation is performed on each of the other source files in the multiple source files in this model.
[0205] Furthermore, after calculating the fourth time spent in compiling each source file in the model, the fourth time spent in compiling each source file in the model can be visualized.
[0206] For example, the source file identifiers of each source file in the model can be obtained; different source files have different source file identifiers. Based on the source file identifiers of each source file in the model, the fourth time consumed in the process of compiling each source file in the model can be visualized based on images.
[0207] For example, a GoogleTrace format file can be generated based on the source file identifiers of each source file in the model and the fourth time spent in compiling each source file in the model. A flame graph can then be drawn based on the GoogleTrace format file, allowing developers to understand the fourth time spent in compiling each source file in the model through the flame graph.
[0208] This allows developers to analyze the model based on a visual time graph and then optimize it. For example, if the fourth time spent compiling a certain source file in the model is longer and significantly longer than the fourth time spent compiling other source files in the model, then the source file often has room for optimization. For example, the computer program code in the source file can be optimized.
[0209] Furthermore, for any one of the multiple source files in this model, after obtaining the front-end execution time consumed in the front-end compilation stage, the mid-end execution time consumed in the mid-end compilation stage, and the back-end execution time consumed in the back-end compilation stage, these execution times can be visualized. This allows developers to analyze the source file based on the visualized time graph and then optimize it.
[0210] For example, we can obtain the stage identifiers for the front-end compilation stage, the mid-end compilation stage, and the back-end compilation stage, ensuring that each of these stages is unique. Then, based on these stage identifiers, we can perform image-based visualization of the front-end execution time, mid-end execution time, and back-end execution time.
[0211] For example, a GoogleTrace format file can be generated based on the stage identifiers of the front-end compilation stage, the mid-end compilation stage, the back-end compilation stage, the front-end execution time consumed in the front-end compilation stage, the mid-end execution time consumed in the mid-end compilation stage, and the back-end execution time consumed in the back-end compilation stage. A flame graph can then be generated based on the GoogleTrace format file, allowing developers to understand the front-end execution time consumed in the front-end compilation stage, the mid-end execution time consumed in the mid-end compilation stage, and the back-end execution time consumed in the back-end compilation stage during the compilation of the source file.
[0212] For example, if the front-end execution time in the front-end compilation stage of compiling the source file is longer than the mid-end execution time in the mid-end compilation stage and the back-end execution time in the back-end compilation stage, then the computer program code in the source file involving the front-end compilation stage has room for optimization.
[0213] For example, if the intermediate execution time in the intermediate compilation stage of compiling the source file is longer than the front-end execution time in the front-end compilation stage and the back-end execution time in the back-end compilation stage, then the computer program code in the source file involving the intermediate compilation stage has room for optimization.
[0214] For example, if the backend execution time in the backend compilation stage of compiling the source file is longer than the frontend execution time in the frontend compilation stage and the backend execution time in the backend compilation stage, then the computer program code in the source file involving the backend compilation stage has room for optimization.
[0215] It should be noted that, for the sake of simplicity, the method embodiments are all described as a series of actions. However, those skilled in the art should understand that this application is not limited to the described order of actions, because according to this application, some steps can be performed in other orders or simultaneously. Secondly, those skilled in the art should also understand that the embodiments described in the specification are all optional embodiments, and the actions involved are not necessarily required by this application.
[0216] Reference Figure 3This diagram illustrates a structural block diagram of a data processing apparatus according to this application, applied to an electronic device, wherein an integrated development tool is deployed in the electronic device, and the apparatus includes:
[0217] The first acquisition module 11 is used to acquire the compilation log file of any one of the at least one models in the engineering project created in the integrated development tool after the model has been built.
[0218] The second acquisition module 12 is used to acquire, according to the compilation log file of the model, the first execution time consumed by each preparation step in the compilation preparation stage during the compilation process of the model; and to acquire the first time consumed in the compilation preparation stage according to each first execution time.
[0219] The third acquisition module 13 is used to acquire, according to the compilation log file of the model, the second execution time consumed by each creation step in the static library creation stage during the compilation of the model, and to acquire the second time consumed in the static library creation stage according to each second execution time.
[0220] The fourth acquisition module 14 is used to acquire the compilation log files of each source file in the model respectively; the fifth acquisition module 15 is used to acquire, according to the compilation log files of each source file, the compilation start time when the compilation of each source file in the model starts and the compilation end time when the compilation of each source file ends respectively during the compilation process; and to acquire, according to each compilation start time and each compilation end time, the third time consumed in the compilation execution phase during the compilation process of the model.
[0221] The sixth acquisition module 16 is used to acquire the total time spent in compiling the model based on the first time spent, the second time spent, and the third time spent.
[0222] In one optional implementation, the second acquisition module includes:
[0223] The first calculation unit is used to calculate the sum of the various first execution times to obtain the first time consumed.
[0224] In one optional implementation, the third acquisition module includes:
[0225] The second calculation unit is used to calculate the sum of the various second execution times to obtain the second time consumed.
[0226] In one optional implementation, the fifth acquisition module includes:
[0227] The selection unit is used to select the earliest compilation start time among various compilation start times, and the latest compilation end time among various compilation end times.
[0228] The third calculation unit is used to calculate the difference between the latest compilation end time and the earliest compilation start time to obtain the third time consumed.
[0229] In an alternative implementation, the apparatus further includes:
[0230] The seventh acquisition module is used to acquire the stage identifier of the compilation preparation stage, the stage identifier of the static library creation stage, and the stage identifier of the compilation execution stage;
[0231] The first display module is used to perform image-based visualization of the first time consumption, the second time consumption, and the third time consumption based on the stage identifier of the compilation preparation stage, the stage identifier of the static library creation stage, and the stage identifier of the compilation execution stage.
[0232] In an alternative implementation, the apparatus further includes:
[0233] The eighth acquisition module is used to acquire the model identifiers of each model in the project.
[0234] The second display module is used to visualize the total time spent in compiling each model separately based on the model identifier.
[0235] In one alternative implementation, the process of compiling source files includes a front-end compilation stage for source files, a middle-end compilation stage for source files, and a back-end compilation stage for source files.
[0236] The device further includes:
[0237] The ninth acquisition module is used to acquire, for any source file in the model, the front-end execution time consumed in the front-end compilation stage during the compilation of the source file, the mid-end execution time consumed in the mid-end compilation stage during the compilation of the source file, and the back-end execution time consumed in the back-end compilation stage during the compilation of the source file, based on the compilation log file of the source file.
[0238] The tenth acquisition module is used to acquire the fourth time spent in compiling the source file based on the front-end execution time, the mid-end execution time, and the back-end execution time.
[0239] In an alternative implementation, the apparatus further includes:
[0240] The eleventh acquisition module is used to acquire the stage identifier of the front-end compilation stage, the stage identifier of the mid-end compilation stage, and the stage identifier of the back-end compilation stage.
[0241] The third display module is used to perform image-based visualization of the front-end execution time, the mid-end execution time, and the back-end execution time based on the stage identifiers of the front-end compilation stage, the mid-end compilation stage, and the back-end compilation stage.
[0242] In an alternative implementation, the apparatus further includes:
[0243] The twelfth acquisition module is used to acquire the source file identifiers of each source file in the model;
[0244] The fourth display module is used to visualize the fourth time consumed during the compilation of each source file in the model based on the source file identifier of each source file in the model.
[0245] In this application, the compilation log file of the model is obtained. Based on the compilation log file, the first execution time consumed by each preparation step in the compilation preparation phase of the model compilation process is obtained, and the first total execution time consumed in the compilation preparation phase of the model compilation process is obtained based on each first execution time. Based on the compilation log file, the second execution time consumed by each creation step in the static library creation phase of the model compilation process is obtained, and the second total execution time consumed in the static library creation phase of the model compilation process is obtained based on each second execution time. The compilation log files of each source file in the model are obtained. Based on the compilation log files of each source file, the compilation start time when compiling each source file in the model and the compilation end time when compiling each source file in the model are obtained. Based on each compilation start time and each compilation end time, the third total execution time consumed in the compilation execution phase of the model compilation process is obtained. Based on the first, second, and third total execution times, the total execution time consumed in the model compilation process is obtained.
[0246] On the one hand, this application statistically analyzes the total time spent compiling each model in a project, providing a more granular statistical approach by focusing on each model separately. This allows developers to understand the total time spent compiling each model individually, enabling them to analyze and optimize each model to improve the overall project performance. For example, if the total time spent compiling a particular model is significantly longer than that spent compiling other models, it often indicates that the model has room for optimization, such as optimizing the computer program code within it. This allows for the precise identification of models in the project that require optimization.
[0247] On the other hand, the compilation process of this model includes three stages: compilation preparation stage, compilation execution stage, and static library creation stage. When calculating the total time spent in compiling any model in the project, the time spent in the compilation preparation stage, the time spent in the static library creation stage, and the time spent in the compilation execution stage are calculated separately.
[0248] Furthermore, the first execution time consumed in the compilation preparation phase of compiling the model is calculated based on the first execution time consumed in executing each preparation step in the compilation preparation phase of compiling the model; the second execution time consumed in the static library creation phase of compiling the model is calculated based on the second execution time consumed in executing each creation step in the static library creation phase of compiling the model; and the third execution time consumed in the compilation execution phase of compiling the model is calculated based on the compilation start time when compiling each source file in the model starts and the compilation end time when compiling each source file ends.
[0249] Therefore, in the compilation preparation stage of compiling the model, the first execution time consumed by each preparation step in the compilation preparation stage does not include the time consumed by waiting to execute some steps in the compilation of other models. Thus, based on the first execution time consumed by each preparation step in the compilation preparation stage of compiling the model, the first time consumed in the compilation preparation stage of compiling the model can be more accurately calculated.
[0250] Furthermore, regarding the static library creation phase during the compilation of this model, the second execution time for each creation step within this phase does not include the "time spent waiting to execute steps during the compilation of other models." Therefore, based on the second execution time for each creation step within the static library creation phase, the second execution time consumed during the static library creation phase can be more accurately calculated.
[0251] In summary, by first improving the accuracy of the time spent at different stages of the model compilation process, and then calculating the total time spent in compiling the model based on the time spent at each stage, the accuracy of the total time spent in compiling the model can be improved.
[0252] As the device embodiment is basically similar to the method embodiment, the description is relatively simple, and relevant parts can be found in the description of the method embodiment.
[0253] Optionally, embodiments of the present invention also provide an electronic device, including: a processor, a memory, and a computer program stored in the memory and executable on the processor. When the computer program is executed by the processor, it implements the various processes of the above method embodiments and achieves the same technical effects. To avoid repetition, it will not be described again here.
[0254] This invention also provides a computer-readable storage medium storing a computer program. When the computer program is executed by a processor, it implements the various processes of the above-described method embodiments and achieves the same technical effects. To avoid repetition, it will not be described again here. The computer-readable storage medium may be a read-only memory (ROM), a random access memory (RAM), a magnetic disk, or an optical disk, etc.
[0255] Figure 4 This is a block diagram illustrating an electronic device 800. For example, the electronic device 800 may be a mobile phone, computer, digital broadcasting terminal, messaging device, game console, tablet device, medical device, fitness equipment, personal digital assistant, etc.
[0256] Reference Figure 4The electronic device 800 may include one or more of the following components: a processing component 802, a memory 804, a power supply component 806, a multimedia component 808, an audio component 810, an input / output (I / O) interface 812, a sensor component 814, and a communication component 816.
[0257] Processing component 802 typically controls the overall operation of electronic device 800, such as operations associated with display, telephone calls, data communication, camera operation, and recording operations. Processing component 802 may include one or more processors 820 to execute instructions to complete all or part of the steps of the methods described above. Furthermore, processing component 802 may include one or more modules to facilitate interaction between processing component 802 and other components. For example, processing component 802 may include a multimedia module to facilitate interaction between multimedia component 808 and processing component 802.
[0258] Memory 804 is configured to store various types of data to support the operation of device 800. Examples of this data include instructions for any application or method operating on electronic device 800, contact data, phonebook data, messages, images, videos, etc. Memory 804 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 storage, flash memory, magnetic disk, or optical disk.
[0259] Power supply component 806 provides power to various components of electronic device 800. Power supply component 806 may include a power management system, one or more power supplies, and other components associated with generating, managing, and distributing power to electronic device 800.
[0260] Multimedia component 808 includes a screen that provides an output interface between the electronic device 800 and the user. In some embodiments, the screen may include a liquid crystal display (LCD) and a touch panel (TP). If the screen includes a touch panel, the screen may be implemented as a touchscreen to receive input signals from the user. The touch panel includes one or more touch sensors to sense touches, swipes, and gestures on the touch panel. The touch sensors may sense not only the boundaries of the touch or swipe action but also the duration and pressure associated with the touch or swipe operation. In some embodiments, multimedia component 808 includes a front-facing camera and / or a rear-facing camera. When the device 800 is in an operating mode, such as a shooting mode or a video mode, the front-facing camera and / or the rear-facing camera may receive external multimedia data. Each front-facing camera and rear-facing camera may be a fixed optical lens system or have focal length and optical zoom capabilities.
[0261] Audio component 810 is configured to output and / or input audio signals. For example, audio component 810 includes a microphone (MIC) configured to receive external audio signals when electronic device 800 is in an operating mode, such as call mode, recording mode, and voice recognition mode. The received audio signals may be further stored in memory 804 or transmitted via communication component 816. In some embodiments, audio component 810 also includes a speaker for outputting audio signals.
[0262] I / O interface 812 provides an interface between processing component 802 and peripheral interface modules, such as keyboards, click wheels, buttons, etc. These buttons may include, but are not limited to, home buttons, volume buttons, power buttons, and lock buttons.
[0263] Sensor assembly 814 includes one or more sensors for providing state assessments of various aspects of electronic device 800. For example, sensor assembly 814 may detect the on / off state of device 800, the relative positioning of components such as the display and keypad of electronic device 800, changes in position of electronic device 800 or a component of electronic device 800, the presence or absence of user contact with electronic device 800, orientation or acceleration / deceleration of electronic device 800, and temperature changes of electronic device 800. Sensor assembly 814 may include a proximity sensor configured to detect the presence of nearby objects without any physical contact. Sensor assembly 814 may also include a light sensor, such as a CMOS or CCD image sensor, for use in imaging applications. In some embodiments, sensor assembly 814 may also include an accelerometer, gyroscope, magnetometer, pressure sensor, or temperature sensor.
[0264] Communication component 816 is configured to facilitate wired or wireless communication between electronic device 800 and other devices. Electronic device 800 can access wireless networks based on communication standards, such as WiFi, carrier networks (such as 2G, 3G, 4G, or 5G), or combinations thereof. In one exemplary embodiment, communication component 816 receives broadcast signals or broadcast operation information from an external broadcast management system via a broadcast channel. In one exemplary embodiment, communication component 816 also includes a near-field communication (NFC) module to facilitate short-range communication. For example, the NFC module may be implemented based on radio frequency identification (RFID) technology, Infrared Data Association (IrDA) technology, ultra-wideband (UWB) technology, Bluetooth (BT) technology, and other technologies.
[0265] In an exemplary embodiment, the electronic device 800 may be implemented by one or more application-specific integrated circuits (ASICs), digital signal processors (DSPs), digital signal processing devices (DSPDs), programmable logic devices (PLDs), field-programmable gate arrays (FPGAs), controllers, microcontrollers, microprocessors, or other electronic components to perform the methods described above.
[0266] In an exemplary embodiment, a non-transitory computer-readable storage medium including instructions is also provided, such as a memory 804 including instructions, which can be executed by a processor 820 of an electronic device 800 to perform the above-described method. For example, the non-transitory computer-readable storage medium may be a ROM, random access memory (RAM), CD-ROM, magnetic tape, floppy disk, and optical data storage device, etc.
[0267] Figure 5 This is a block diagram of an electronic device 1900 shown in this application. For example, the electronic device 1900 can be provided as a server.
[0268] Reference Figure 5 The electronic device 1900 includes a processing component 1922, which further includes one or more processors, and memory resources represented by memory 1932 for storing instructions, such as application programs, that can be executed by the processing component 1922. The application programs stored in memory 1932 may include one or more modules, each corresponding to a set of instructions. Furthermore, the processing component 1922 is configured to execute instructions to perform the methods described above.
[0269] Electronic device 1900 may also include a power supply component 1926 configured to perform power management of electronic device 1900, a wired or wireless network interface 1950 configured to connect electronic device 1900 to a network, and an input / output (I / O) interface 1958. Electronic device 1900 can operate on an operating system stored in memory 1932, such as Windows Server™, Mac OS X™, Unix™, Linux™, FreeBSD™, or similar.
[0270] It should be noted that, in this document, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Unless otherwise specified, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes that element.
[0271] Through the above description of the embodiments, those skilled in the art can clearly understand that the methods of the above embodiments can be implemented by means of software plus necessary general-purpose hardware platforms. Of course, they can also be implemented by hardware, but in many cases the former is a better implementation method. Based on this understanding, the technical solution of the present invention, in essence, or the part that contributes to the prior art, can be embodied in the form of a software product. This computer software product is stored in a storage medium (such as ROM / RAM, magnetic disk, optical disk), and includes several instructions to cause a terminal (which may be a mobile phone, computer, server, air conditioner, or network device, etc.) to execute the methods described in the various embodiments of the present invention.
[0272] The embodiments of the present invention have been described above with reference to the accompanying drawings. However, the present invention is not limited to the specific embodiments described above. The specific embodiments described above are merely illustrative and not restrictive. Those skilled in the art can make many other forms under the guidance of the present invention without departing from the spirit and scope of the claims, and all of these forms are within the protection scope of the present invention.
[0273] Those skilled in the art will recognize that the units and algorithm steps of the various examples described in conjunction with the embodiments disclosed in this invention can be implemented in electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are implemented in hardware or software depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application, but such implementations should not be considered beyond the scope of this invention.
[0274] Those skilled in the art will clearly understand that, for the sake of convenience and brevity, the specific working processes of the systems, devices, and units described above can be referred to the corresponding processes in the foregoing method embodiments, and will not be repeated here.
[0275] In the embodiments provided in this application, it should be understood that the disclosed apparatus and methods can be implemented in other ways. For example, the apparatus embodiments described above are merely illustrative. For instance, the division of units is only a logical functional division, and in actual implementation, there may be other division methods. For example, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed. Furthermore, the coupling or direct coupling or communication connection shown or discussed may be through some interfaces; the indirect coupling or communication connection between apparatuses or units may be electrical, mechanical, or other forms.
[0276] The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the units can be selected to achieve the purpose of this embodiment according to actual needs.
[0277] In addition, the functional units in the various embodiments of the present invention can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit.
[0278] If the aforementioned functions are implemented as software functional units and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of this invention, essentially, or the part that contributes to the prior art, or a portion of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of this invention. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, ROM, RAM, magnetic disks, or optical disks.
[0279] The above description is merely a specific embodiment of the present invention, but the scope of protection of the present invention is not limited thereto. Any variations or substitutions that can be easily conceived by those skilled in the art within the technical scope disclosed in the present invention should be included within the scope of protection of the present invention. Therefore, the scope of protection of the present invention should be determined by the scope of the claims.
Claims
1. A data processing method, characterized in that, Applied to electronic devices in which integrated development tools are deployed, the method includes: For any one of the at least one models in the project created in the integrated development tool, after the model is built, obtain the compilation log file of the model; the compilation log file includes the stage identifier of the compilation preparation stage and the stage identifier of the static library creation stage; Based on the compilation log file of the model, obtain the first execution time consumed by each preparation step in the compilation preparation stage during the compilation process of the model; the first execution time is calculated by extracting the start time and end time of each preparation step in the compilation preparation stage during the compilation process of the model based on the stage identifier of the compilation preparation stage; obtain the first time consumed in the compilation preparation stage based on each first execution time; Based on the compilation log file of the model, obtain the second execution time for each creation step in the static library creation phase during the compilation of the model. The second execution time is calculated based on the start and end times of each creation step in the static library creation phase during the compilation of the model, extracted from the phase identifier of the static library creation phase. Obtain the second execution time consumed in the static library creation phase based on each second execution time. Obtain the compilation log files of each source file in the model; based on the compilation log files of each source file, obtain the compilation start time when compiling each source file in the model starts and the compilation end time when compiling each source file ends during the compilation process; based on each compilation start time and each compilation end time, obtain the third time consumed in the compilation execution phase during the compilation process of the model. The total time spent compiling the model is obtained based on the first time spent, the second time spent, and the third time spent.
2. The method according to claim 1, characterized in that, The step of obtaining the first execution time consumed in the compilation preparation phase based on each first execution time includes: The sum of the execution times of each first execution is calculated to obtain the first execution time.
3. The method according to claim 1, characterized in that, The step of obtaining the second execution time consumed in the static library creation phase based on each second execution time includes: The sum of the individual second execution times is calculated to obtain the second execution time.
4. The method according to claim 1, characterized in that, The third time consumed during the compilation execution phase of the model compilation process, based on each compilation start time and each compilation end time, includes: Select the earliest compilation start time among all compilation start times, and select the latest compilation end time among all compilation end times; The difference between the latest compilation end time and the earliest compilation start time is calculated to obtain the third time consumed.
5. The method according to claim 1, characterized in that, The method further includes: Obtain the stage identifier of the compilation preparation stage, the stage identifier of the static library creation stage, and the stage identifier of the compilation execution stage; Based on the stage identifiers of the compilation preparation stage, the static library creation stage, and the compilation execution stage, the first time consumption, the second time consumption, and the third time consumption are displayed using image-based visualization.
6. The method according to claim 1, characterized in that, The method further includes: Obtain the model identifiers of each model in the project; The total time spent compiling each model is visualized using images based on the model identifiers.
7. The method according to claim 1, characterized in that, The process of compiling source files includes a front-end compilation stage, a middle-end compilation stage, and a back-end compilation stage. The method further includes: For any source file in the model, based on the compilation log file of the source file, obtain the front-end execution time consumed in the front-end compilation stage during the compilation process of the source file, the mid-end execution time consumed in the mid-end compilation stage during the compilation process of the source file, and the back-end execution time consumed in the back-end compilation stage during the compilation process of the source file. Based on the front-end execution time, the mid-end execution time, and the back-end execution time, obtain the fourth time consumed during the compilation of the source file.
8. The method according to claim 7, characterized in that, The method further includes: Obtain the stage identifier of the front-end compilation stage, the stage identifier of the mid-end compilation stage, and the stage identifier of the back-end compilation stage; Based on the stage identifiers of the front-end compilation stage, the mid-end compilation stage, and the back-end compilation stage, the execution time of the front-end, the mid-end, and the back-end is visualized using images.
9. The method according to claim 7, characterized in that, The method further includes: Obtain the source file identifier of each source file in the model; Based on the source file identifiers of each source file in the model, the fourth time consumed during the compilation of each source file in the model is visualized using an image.
10. A data processing apparatus, characterized in that, Applied to electronic devices, wherein integrated development tools are deployed in the electronic devices, the device includes: The first acquisition module is used to acquire the compilation log file of any one of the at least one models in the project created in the integrated development tool after the model has been built; the compilation log file includes a stage identifier for the compilation preparation stage and a stage identifier for the static library creation stage. The second acquisition module is used to acquire, based on the compilation log file of the model, the first execution time consumed by each preparation step in the compilation preparation stage during the compilation process of compiling the model; the first execution time is calculated by extracting the start time and end time of each preparation step in the compilation preparation stage during the compilation process of compiling the model based on the stage identifier of the compilation preparation stage; and the first time consumed in the compilation preparation stage is acquired based on each first execution time. The third acquisition module is used to acquire, based on the compilation log file of the model, the second execution time consumed by each creation step in the static library creation stage during the compilation of the model, wherein the second execution time is calculated by extracting the start and end times of each creation step in the static library creation stage during the compilation of the model based on the stage identifier of the static library creation stage; and to acquire the second time consumed in the static library creation stage based on each second execution time. The fourth acquisition module is used to acquire the compilation log files of each source file in the model respectively; the fifth acquisition module is used to acquire, based on the compilation log files of each source file, the compilation start time when the compilation of each source file in the model starts and the compilation end time when the compilation of each source file ends respectively during the compilation process; and based on each compilation start time and each compilation end time, acquire the third time consumed in the compilation execution phase during the compilation process of the model. The sixth acquisition module is used to acquire the total time spent in compiling the model based on the first time spent, the second time spent, and the third time spent.
11. The apparatus according to claim 10, characterized in that, The second acquisition module includes: The first calculation unit is used to calculate the sum of the various first execution times to obtain the first time consumed.
12. The apparatus according to claim 10, characterized in that, The third acquisition module includes: The second calculation unit is used to calculate the sum of the various second execution times to obtain the second time consumed.
13. The apparatus according to claim 10, characterized in that, The fifth acquisition module includes: The selection unit is used to select the earliest compilation start time among various compilation start times, and the latest compilation end time among various compilation end times. The third calculation unit is used to calculate the difference between the latest compilation end time and the earliest compilation start time to obtain the third time consumed.
14. The apparatus according to claim 10, characterized in that, The device further includes: The seventh acquisition module is used to acquire the stage identifier of the compilation preparation stage, the stage identifier of the static library creation stage, and the stage identifier of the compilation execution stage; The first display module is used to perform image-based visualization of the first time consumption, the second time consumption, and the third time consumption based on the stage identifier of the compilation preparation stage, the stage identifier of the static library creation stage, and the stage identifier of the compilation execution stage.
15. The apparatus according to claim 10, characterized in that, The device further includes: The eighth acquisition module is used to acquire the model identifiers of each model in the project. The second display module is used to visualize the total time spent in compiling each model separately based on the model identifier.
16. The apparatus according to claim 10, characterized in that, The process of compiling source files includes a front-end compilation stage, a middle-end compilation stage, and a back-end compilation stage. The device further includes: The ninth acquisition module is used to acquire, for any source file in the model, the front-end execution time consumed in the front-end compilation stage during the compilation of the source file, the mid-end execution time consumed in the mid-end compilation stage during the compilation of the source file, and the back-end execution time consumed in the back-end compilation stage during the compilation of the source file, based on the compilation log file of the source file. The tenth acquisition module is used to acquire the fourth time spent in compiling the source file based on the front-end execution time, the mid-end execution time, and the back-end execution time.
17. The apparatus according to claim 16, characterized in that, The device further includes: The eleventh acquisition module is used to acquire the stage identifier of the front-end compilation stage, the stage identifier of the mid-end compilation stage, and the stage identifier of the back-end compilation stage. The third display module is used to perform image-based visualization of the front-end execution time, the mid-end execution time, and the back-end execution time based on the stage identifiers of the front-end compilation stage, the mid-end compilation stage, and the back-end compilation stage.
18. The apparatus according to claim 16, characterized in that, The device further includes: The twelfth acquisition module is used to acquire the source file identifiers of each source file in the model; The fourth display module is used to visualize the fourth time consumed during the compilation of each source file in the model based on the source file identifier of each source file in the model.
19. An electronic device, characterized in that, include: A processor, a memory, and a computer program stored in the memory and executable on the processor, wherein the computer program, when executed by the processor, implements the method as described in any one of claims 1 to 9.
20. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a computer program that, when executed by a processor, implements the method as described in any one of claims 1 to 9.
Citation Information
Patent Citations
Compiling duration statistical method and device, electronic equipment and readable medium
CN114328149A