Data acquisition method and device, storage medium and electronic device
By receiving data acquisition requests and calling the data acquisition process of automated control scripts, the automated acquisition of hardware performance data is realized, solving the problem of low data acquisition efficiency in the prior art, improving the acquisition efficiency and reducing costs.
Patent Information
- Application Number
- CN202111276242.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-10-29
- Publication Date
- 2025-02-14
- Estimated Expiration
- 2041-10-29
AI Technical Summary
The prior art cannot realize the automated collection of hardware performance data, resulting in low data acquisition efficiency.
By receiving data acquisition requests, the data acquisition process running an automated control script is called, and the automated sampling control information is used to achieve automated data acquisition, and finally the output result data of the acquisition process is obtained.
It realizes automatic collection of hardware data, improves data acquisition efficiency, and reduces maintenance and access costs.
Smart Images

Figure CN114003457B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of computers, and in particular to a data acquisition method and device, a storage medium and an electronic device. Background Art
[0002] In order to ensure the normal operation of various applications (Application, referred to as APP) in hardware devices, many application developers often perform performance tests on application clients. The performance testing methods provided by the existing technology often require an additional (referred to as USB) to connect the device, so that developers can use USB as a medium to obtain the hardware performance data to be analyzed, thereby achieving the purpose of fixing performance problems.
[0003] However, when performing performance testing based on the above method, the performance data collection tools currently used are usually not open source, which makes the maintenance and access costs of the performance testing process very high. In other words, the data acquisition method provided by the relevant technology cannot realize automatic collection of hardware performance data, resulting in low data acquisition efficiency.
[0004] To address the above-mentioned problems, no effective solution has been proposed yet. Summary of the invention
[0005] The embodiments of the present invention provide a data acquisition method and device, a storage medium and an electronic device, so as to at least solve the technical problem of low data acquisition efficiency caused by the inability to realize automatic collection of hardware performance data in the prior art.
[0006] According to one aspect of an embodiment of the present invention, there is provided a data acquisition method, comprising: receiving a data acquisition request, wherein the data acquisition request is used to request acquisition of hardware performance data generated by a target device in the process of running a target business; calling a data acquisition process according to the data acquisition request, wherein an automation control script is running in the data acquisition process, and the automation control script contains automation sampling control information configured for the target business; and acquiring result data output by the data acquisition process.
[0007] According to another aspect of an embodiment of the present invention, a data acquisition device is also provided, including: a receiving unit, used to receive a data acquisition request, wherein the data acquisition request is used to request to obtain hardware performance data generated by a target device in the process of running a target business; a calling unit, used to call a data acquisition process according to the data acquisition request, wherein an automation control script is running in the data acquisition process, and the automation control script contains automation sampling control information configured for the target business; an acquisition unit, used to obtain result data output by the data acquisition process.
[0008] According to another aspect of the embodiments of the present invention, a computer-readable storage medium is provided, in which a computer program is stored, wherein the computer program is configured to execute the above data acquisition method when running.
[0009] According to another aspect of the embodiments of the present application, a computer program product is provided, the computer program product comprising a computer program / instruction, the computer instruction being stored in a computer-readable storage medium. A processor of a computer device reads the computer program / instruction from the computer-readable storage medium, and the processor executes the computer program / instruction, so that the computer device executes the above data acquisition method.
[0010] According to another aspect of an embodiment of the present invention, there is provided an electronic device, including a memory and a processor, wherein the memory stores a computer program, and the processor is configured to execute the data acquisition method through the computer program.
[0011] In an embodiment of the present invention, by receiving a data acquisition request, then calling a data acquisition process running an automated control script according to the data acquisition request, and implementing automated data acquisition according to automated sampling control information contained in the automated control script, and finally obtaining the output result data of the acquisition process, the technical effect of automated acquisition of hardware data is achieved, thereby solving the technical problem of low data acquisition efficiency in the prior art. BRIEF DESCRIPTION OF THE DRAWINGS
[0012] The drawings described herein are used to provide a further understanding of the present invention and constitute a part of this application. The exemplary embodiments of the present invention and their descriptions are used to explain the present invention and do not constitute an improper limitation of the present invention. In the drawings:
[0013] Figure 1 is a schematic diagram of an application environment of an optional data acquisition method according to an embodiment of the present invention;
[0014] Figure 2 is a flow chart of an optional data acquisition method according to an embodiment of the present invention;
[0015] Figure 3 is a schematic diagram of an optional data acquisition method according to an embodiment of the present invention;
[0016] Figure 4 is a schematic diagram of another optional data acquisition method according to an embodiment of the present invention;
[0017] Figure 5 is a flowchart of another optional data acquisition method according to an embodiment of the present invention;
[0018] Figure 6is a schematic structural diagram of an optional data acquisition device according to an embodiment of the present invention;
[0019] Figure 7 It is a schematic diagram of the structure of an optional electronic device according to an embodiment of the present invention. DETAILED DESCRIPTION
[0020] In order to enable those skilled in the art to better understand the scheme of the present invention, the technical scheme in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work should fall within the scope of protection of the present invention.
[0021] It should be noted that the terms "first", "second", etc. in the specification and claims of the present invention and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchanged where appropriate, so that the embodiments of the present invention described herein can be implemented in an order other than those illustrated or described herein. In addition, the terms "including" and "having" and any variations thereof are intended to cover non-exclusive inclusions, for example, a process, method, system, product or device that includes a series of steps or units is not necessarily limited to those steps or units that are clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.
[0022] According to one aspect of an embodiment of the present invention, a data collection method is provided. Optionally, as an optional implementation, the data collection method can be but is not limited to being applied to: Figure 1The data acquisition system in the hardware environment shown, wherein the data acquisition system can be but is not limited to a terminal device 102 and a terminal device 112. The terminal device 102 can be a mobile terminal (taking a mobile phone as an example), as the object of the hardware performance test, and the terminal device 112 can be a computer terminal, which is used to write and develop programs for data acquisition and perform hardware performance analysis based on the data acquisition results. The above-mentioned terminal device 102 includes a human-computer interaction screen 104, a processor 106 and a memory 108. Among them, the human-computer interaction screen 104 is used to collect human-computer interaction operations during the test and display the test response interface, the processor 106 is used to run the test program and perform data acquisition operations, and the memory 108 is used to store relevant test data and intermediate data and result data during the data acquisition process. The above-mentioned terminal device 112 may include a database 114 and a processing engine 116. Among them, the database 114 is used to provide basic source code for developing data acquisition executable programs, and the processing engine 116 is used to perform hardware performance analysis based on the result data. Specifically, it can extract time-consuming data frames based on the result data output by the terminal device 102, and perform hardware performance analysis based on the data frames.
[0023] The specific process is as follows: as in step S102, a data acquisition executable program is developed through the terminal device 112. Specifically, an executable file and an automated script for data acquisition can be developed based on the source code of HWCPIPE (HardWare Count Pipe) through the Android NDK (Native Development Kit) tool set. Then, as in steps S104-S108, a data acquisition request is received, and then the data acquisition process is called according to the data acquisition request, and the result data output by the data acquisition process is obtained. It can be understood that the above-mentioned data acquisition request is a data acquisition request generated during the hardware performance test of the terminal 102. At the same time, the above-mentioned data acquisition process is a process generated by running the executable file and the automated script for data acquisition in the terminal to obtain the hardware data during the test. Then, as in step S110, the result data is output. Specifically, the terminal device 102 can output the result data in the CSV (Comma Separated Value) file format to the terminal device 112 through the ADB (Android Debug Bridge) port. Finally, as in step S112, the step of performing hardware performance analysis based on the result data is performed on the terminal device 112.
[0024] As another optional implementation, when the terminal device 102 has a relatively strong computing and processing capability, the above steps S102 and S112 may also be completed by the terminal device 102. This is an example, and this embodiment does not impose any limitation on this.
[0025] It should be noted that the above-mentioned Android NDK (Native Development Kit) is an Android development kit that allows users to use languages such as C and C++ to implement various parts of Android applications in native code. It has the advantages of high operating efficiency, high code security and cross-platform support.
[0026] The above-mentioned HWCPIPE (Hard Ware Count Pipe) is an open-source hardware detection tool released by Arm, which provides a pipeline interface for reading CPU and GPU hardware counters.
[0027] The CSV (Comma Separated Value) file format mentioned above refers to storing tabular data (numbers and text) in plain text form. Plain text means that the file is a sequence of characters and does not contain data that must be interpreted like binary numbers. A CSV file consists of an arbitrary number of records, separated by some kind of line break character, and each record consists of fields. The separator between fields is another character or string, the most common of which is a comma or a tab.
[0028] Optionally, in this embodiment, the terminal device may be a terminal device for running the target business, and may include but is not limited to at least one of the following: a mobile phone (such as an Android phone, an iOS phone, etc.), a laptop, a tablet computer, a PDA, a MID (Mobile Internet Devices), a PAD, a desktop computer, a smart TV, etc. The target client may be a video client, an instant messaging client, a browser client, an educational client, or other clients that support providing shooting game tasks. The network may include but is not limited to: a wired network, a wireless network, wherein the wired network includes: a local area network, a metropolitan area network, and a wide area network, and the wireless network includes: Bluetooth, WIFI, and other networks that implement wireless communication. The server may be a single server, or a server cluster consisting of multiple servers, or a cloud server. The above is only an example, and this embodiment does not impose any limitation on this.
[0029] Through the above-mentioned embodiments provided by the present application, an executable file and an automation script for data acquisition are developed by running the Android NDK (Native Development Kit) tool set on a mobile terminal performing hardware testing and based on the source code of HWCPIPE (Hard Ware Count Pipe), and then based on receiving a data acquisition request, a data acquisition process running an automation control script is called according to the data acquisition request, and automatic data acquisition is implemented according to the automation sampling control information contained in the automation control script, and finally the result data of the output of the acquisition process is obtained, thereby achieving the technical effect of automatic acquisition of hardware data, and further solving the technical problem of low data acquisition efficiency in the prior art.
[0030] Optionally, as an optional implementation, as Figure 2 As shown, the above data collection method includes:
[0031] S202, receiving a data acquisition request, wherein the data acquisition request is used to request to obtain hardware performance data generated by a target device in the process of running a target service;
[0032] S204, calling a data acquisition process according to the data acquisition request, wherein an automation control script is running in the data acquisition process, and the automation control script contains automation sampling control information configured for the target business;
[0033] S206, obtaining result data output by the data collection process.
[0034] It is understandable that the above target devices may include but are not limited to at least one of the following: mobile phones (such as Android phones, iOS phones, etc.), laptops, tablet computers, PDAs, MIDs (Mobile Internet Devices), PADs, desktop computers, smart TVs, etc. At the same time, the above target services may be various application software, including but not limited to at least one of the following: system software such as various operating systems, such as Windows, Linux, Unix, Android, IOS, etc., and may also be patches of operating systems, i.e., hardware drivers; application software such as tool software, game software, management software, etc.
[0035] The hardware performance data is further explained below. It is understandable that the above hardware performance data refers to various data such as status parameters and operation parameters generated by various hardware devices when the above target device is running the target service, which is used to evaluate the functional integrity, performance release degree and operation reliability of the above target device when running the target service.
[0036] Optionally, the calling of the data acquisition process according to the data acquisition request may be a calling of the data acquisition process during the operation of the target business. In other words, the data acquisition process may be called while the target business is running to obtain real-time hardware data during the operation of the target business.
[0037] Based on the above-mentioned call to the data acquisition process during the operation of the target business, the results output by the data acquisition process are obtained. It can be understood that various hardware data sets of the target device during the operation of the target business are obtained through the above-mentioned data acquisition process. It can be understood that the above-mentioned target process can convert the above-mentioned hardware data set into a suitable data file format, such as json, csv, stdf and other file formats, according to the test needs during the process of outputting the result data, so as to facilitate the subsequent analysis of the above-mentioned data set.
[0038] Through the embodiments provided in the present application, by receiving a data acquisition request, then calling a data acquisition process running an automated control script according to the data acquisition request, and implementing automated data acquisition according to the automated sampling control information contained in the automated control script, and finally obtaining the output result data of the acquisition process, the technical effect of automated acquisition of hardware data is achieved, thereby solving the technical problem of low data acquisition efficiency in the prior art.
[0039] As an optional solution, the above-mentioned calling of the data acquisition process according to the data acquisition request includes:
[0040] S1, reading automatic sampling control information, wherein the automatic sampling control information includes a custom sampling frequency and a custom sampling data type;
[0041] S2, among the hardware performance data generated during the operation of the target business, hardware performance data belonging to the custom sampling data type is collected according to the custom sampling frequency.
[0042] It is understandable that in the above embodiment, the automatic sampling control information is defined in the above data acquisition process, wherein the automatic sampling control information includes a custom sampling frequency and a custom sampling data type. The custom sampling frequency indicates the frequency at which the above data acquisition process acquires hardware data. For example, the above process may be defined to acquire hardware data every 1ms during operation according to actual needs, or the above process may be defined to acquire hardware data every 0.01ms during operation according to actual needs. No limitation is made here. At the same time, the above custom sampling data types may include performance indicators related to CPU (Central Processing Unit) and GPU (Graphics Processing Unit), such as Instructions and Shadercycles.
[0043] Through the embodiments provided in the present application, by customizing the sampling frequency and customizing the sampling data type in the data acquisition process so as to more accurately obtain the required hardware data through the data acquisition program, the technical effect of improving the data acquisition efficiency is achieved.
[0044] As an optional solution, among the hardware performance data generated during the operation of the target service, collecting the hardware performance data belonging to the custom sampling data type according to the custom sampling frequency includes:
[0045] S1, obtaining candidate performance data collected from pipeline interfaces corresponding to respective hardware components in a target device, wherein the candidate performance data includes performance data sets generated by each hardware component during the operation of the target service;
[0046] S2, determining at least one target performance data set belonging to a custom sampling data type from the candidate performance data;
[0047] S3, collects the target performance data set according to the custom sampling frequency.
[0048] Next, combine Figure 3 The above scheme is described in detail. Figure 3 As shown, there are multiple hardware components in the target device 305, such as hardware component 301, hardware component 302, hardware component 303, and hardware component 304. Corresponding to the above hardware components 301 to 304, the performance data sets generated corresponding to each hardware component are obtained through pipeline interface 301-1, pipeline interface 301-2, pipeline interface 301-3, and pipeline interface 301-4. For example, Figure 3As shown, a first performance data set 301-2 generated from a hardware component 301 is obtained through a pipeline interface 301-1, and a second performance data set 302-2 generated from a hardware component 302 is obtained through a pipeline interface 302-1, etc. It can be understood that the data sets from different hardware components are the candidate performance data in the above method, and after obtaining the candidate performance data collected from the pipeline interfaces corresponding to each hardware component in the target device, the candidate performance data are stored in the data collection process space 307, and the target performance data set 306 is determined from the collected candidate performance data.
[0049] It is understandable that different numbers and types of performance data sets may be generated for different hardware components in the target device 305. In other words, different hardware components may generate different types of hardware performance data, and different hardware performance data may also generate different amounts of data.
[0050] It is understandable that after obtaining the above candidate performance data, at least one target performance data set is determined from the above candidate performance data according to the custom sampling data type. For example, when the custom sampling data type is Instructions and Shadercycles, a data set with data types of Instructions and Shadercycles is determined from the above candidate performance data as the target performance data set.
[0051] Further, after the target performance data set is determined, the data in the target performance data set is collected according to the custom sampling rate. Specifically, when the custom sampling rate is 1 ms / time, the data generated in the target performance data set is collected once every 1 ms.
[0052] Through the embodiments provided in the present application, by customizing the sampling frequency and customizing the sampling data type in the data acquisition process so as to more accurately obtain the required hardware data through the data acquisition program, the technical effect of improving the data acquisition efficiency is achieved.
[0053] Through the embodiments provided in the present application, by customizing the sampling frequency and customizing the sampling data type in the data acquisition process, the required hardware data can be more accurately acquired through the data acquisition program, thereby achieving the technical effect of improving data acquisition efficiency.
[0054] As an optional solution, the above-mentioned collection of the target performance data set according to the custom sampling frequency includes:
[0055] S1, when the sampling start condition matching the target performance data set is met, start collecting data at the custom sampling frequency;
[0056] S2: When a sampling closing condition matching the target performance data set is reached, the collection of the target performance data set is terminated.
[0057] It is understandable that during the operation of the above data collection process, the operation of the above data collection process can be controlled by the sampling start condition and the sampling close condition, so that when the sampling start condition matching the target performance data set is met, the collection is started according to the custom sampling frequency, and when the sampling close condition matching the target performance data set is met, the collection of the target performance data set is ended. In other words, the operation of the above data collection can execute the start and end logic at any time according to the needs of data collection.
[0058] Through the embodiments provided in the present application, by setting sampling on conditions and sampling off conditions, the technical effect of obtaining required hardware data information at any time is achieved.
[0059] As an optional solution, when the automatic sampling control information includes the sampling result file type and output path, obtaining the result data output by the data acquisition process includes: storing the result data matching the above result file type in the output path of the sampling result file.
[0060] It is understandable that the above-mentioned automatic sampling control information may also include the file type of the sampling result file and the output path of the sampling result file. That is, the file type and output path of the output result file may be determined according to the parameter information of the automatic sampling control information. Optionally, the file type of the above-mentioned result file may be a CSV file.
[0061] Through the embodiments provided in the present application, by defining the file type of the sampling result file and the output path of the sampling result file in the above-mentioned automatic sampling control information, the result file can be matched with the result file analysis process, thereby achieving the technical effect of improving the efficiency of result file analysis.
[0062] As an optional solution, before receiving the performance test request, the above also includes:
[0063] S1, modifying the data collection control strategy of the pipeline interface corresponding to each hardware component in the target device, wherein the data collection control strategy carries customized automatic sampling control information;
[0064] S2, generates automated control scripts based on data collection control strategies.
[0065] Through the embodiments provided by the present application, before using the above data collection process to collect hardware performance data, it is necessary to modify the data collection control strategy of the pipeline interface corresponding to each hardware component in the target device to adapt to the data collection program. At the same time, an automated control script can also be generated based on the data collection control strategy to achieve automated control and collection of hardware data, thereby achieving the technical effect of obtaining the required hardware data information at any time.
[0066] As an optional solution, the above-mentioned automatic control script generation based on data collection control strategy includes:
[0067] S1, compile the interface source code corresponding to the data collection control strategy to obtain an executable file;
[0068] S2, generate automated control scripts based on executable files.
[0069] It can be understood that, as an optional method, the above data collection control strategy can be a collection control strategy defined by Hwcpipe (HardWareCountPipe). Therefore, after the interface source code corresponding to the data collection control strategy is modified, it is compiled using cmake to obtain an executable file. The method for modifying the interface source code corresponding to the data collection control strategy can be specifically to modify the Hwcpipe source code to meet the needs of custom sampling frequency, custom sampling data and custom sampling results.
[0070] After modifying the above Hwcpipe and compiling it with cmake, the executable program HardenPerf is obtained. It can be understood that the above executable program HardenPerf can be used to collect hardware performance data. After obtaining the above executable program HardenPerf, a HardenPerf automation control script is written based on the above executable program HardenPerf, which can also include parameter conditions such as automation condition preparation, opening collection and closing collection.
[0071] It is understandable that the above-mentioned cmake is a compilation tool, which allows developers to write a platform-independent CMakeList.txt file to customize the entire compilation process, and then further generate the required localized Makefile and project files according to the target user's platform, such as Unix Makefile or Windows Visual Studio project.
[0072] Through the embodiments provided in the present application, by modifying and re-packaging the source code of the hardware counter pipeline interface Hwcpipe, and writing an automated control script file based on the encapsulated executable file, it is possible to collect the required hardware performance data at any time according to demand and stop the data collection process at any time, thereby achieving the technical effect of obtaining hardware performance data and reducing maintenance and access costs.
[0073] The following combination Figure 4 , Figure 5 A specific embodiment of the present application is described.
[0074] like Figure 5 As shown in the flowchart, first, step S502 is executed to modify the data collection control strategy;
[0075] Specifically, Figure 4 As shown, the NDK toolkit can be used for development work, and the Hwcpipe source code can be modified to meet the needs of custom sampling data. After modifying the Hwcpipe source code, cmake is used to compile and generate the executable file HardenPerf. It can be understood that during the execution of the executable file HardenPerf, Hwcpipe can be called through the modified data collection control strategy to meet the needs of custom sampling frequency, custom sampling data type and custom sampling result file for hardware performance data collection.
[0076] Then, as in step S504, an automated control script is generated based on the data collection control strategy;
[0077] Specifically, the above-mentioned automation control script is a Python automation script file written based on HardenPerf, which is used to execute on a PC to control the target device (such as a mobile phone) to execute related operation logic, such as preparing performance execution conditions, controlling HardenPerf to open data collection logic, controlling HardenPerf to close data collection logic, etc. Figure 4 As shown, a framework Gautomator for automated testing of mobile games is running on the PC. During the automated testing process using the automated testing framework Gautomator, a Python automated script file written based on HardenPerf can be called to automatically collect the hardware performance of the hardware device running the mobile game. More specifically, the hardware device running the mobile game here can be any mobile phone hardware that is suitable for arm architecture maliGPU driver abi greater than 10.
[0078] Then as in step S506, the target task is executed;
[0079] like Figure 4 As shown, the PC device and mobile phone A are connected through the ADB port, and the target task is run on mobile phone A. Specifically, the above target task can be any unity or ue4 game task.
[0080] It is understood that the ADB (Android Debug Bridge) port is a versatile command line tool that can be used to communicate between devices. ADB commands can be used to perform various device operations (such as installing and debugging applications) and provide access to the Unix shell (which can be used to run various commands on the device). It is a client-server program that includes three components: a client, a daemon (adbd), and a server.
[0081] Then, in step S508, it is determined whether the data collection process is running. If it is determined to be yes, step S510 is executed. If it is determined to be no, the process returns to step S506.
[0082] like Figure 4 As shown, on a PC device running the mobile game automatic testing framework Gautomator, an ADB forward instruction is used to control the push of the executable file HardenPerf to mobile phone A through the ADB port, and whether to run the data collection process is determined according to the control instruction pushed through the ADB port on the PC.
[0083] It is understandable that the logic for determining whether to run the data collection process here can be implemented by the Python automation script file written based on HardenPerf and running on the PC.
[0084] In step S510, when it is determined that the data collection process is running, the automatic sampling control information is read;
[0085] Specifically, the automatic sampling control information here may include a custom sampling frequency, a custom sampling data type, a custom sampling result file type, and an output path of a custom sampling result file.
[0086] It can be understood that the above-mentioned custom sampling frequency is used to determine the hardware data sampling period, the above-mentioned custom sampling data type is used to determine the hardware performance data type that needs to be obtained, the above-mentioned custom sampling result file type is used to determine the output file type of the above-mentioned data acquisition process, and the above-mentioned output path is used to determine the storage path after obtaining the above-mentioned output file.
[0087] like Figure 4As shown, when the data collection process is running according to the control instruction pushed by the PC, the HardenPerf program is run on mobile phone A, and the start and stop of the HardenPerf program are controlled by the Perf_harden() instruction parameter.
[0088] Then, step S512 is executed to determine whether the data belongs to the custom sampling data type. If the acquired data is determined to be of the custom sampling data type, step S514 is executed. If the acquired data is determined not to be of the custom sampling data type, the process returns to step S512.
[0089] In step S514, a target performance data set is determined;
[0090] It is understandable that, in the data collection process, the candidate performance data collected from the pipeline interfaces corresponding to each hardware component in the target device are first obtained, and at least one target performance data set belonging to the custom sampling data type is determined from the candidate performance data. For example, when the custom sampling data type is determined to be instruction, hadercycles, only hardware performance data of the instruction, hadercycles type is obtained, and the data set of the hardware performance data of the instruction, hadercycles type is the target performance data set.
[0091] Then, step S516 is executed to collect data according to the user-defined sampling frequency;
[0092] It is understandable that after determining the target performance data set, the data in the target performance data set is collected according to the custom sampling rate. Specifically, when the custom sampling rate is 1 ms / time, the data generated in the target performance data set is collected once every 1 ms.
[0093] Then, step S518 is executed to determine whether the data collection process is terminated. If it is determined that the data collection process is terminated, step S520 is executed. If it is determined that the data collection process is not terminated, the process returns to step S516.
[0094] It is understandable that the logic for determining whether to end the data collection process can be implemented by the above-mentioned Python automation script file written based on HardenPerf. Figure 4 As shown, a Python automation script file written based on HardenPerf is run on the PC, and control instructions are pushed to mobile phone A through the ADB port to control the start and stop of the HardenPerf program running on the mobile phone.
[0095] When it is determined that the data collection process is finished, step S520 is executed to obtain result data;
[0096] It is understandable that the result data may be determined here according to the custom sampling result file type and the output path of the custom sampling result file. Optionally, the file type of the result file may be a data file in CSV format.
[0097] like Figure 4 As shown, the hardware performance data file in CSV format is collected by the HardenPerf program running in mobile phone A, and is sent back to the Gautomator automatic testing framework running in the terminal through the ADB port for subsequent testing tasks.
[0098] Through the above-mentioned embodiments provided by the present application, an executable file and an automation script for data acquisition are developed by running the Android NDK (Native Development Kit) tool set on a mobile terminal performing hardware testing and based on the source code of HWCPIPE (Hard Ware Count Pipe), and then based on receiving a data acquisition request, a data acquisition process running an automation control script is called according to the data acquisition request, and automatic data acquisition is implemented according to the automation sampling control information contained in the automation control script, and finally the result data of the output of the acquisition process is obtained, thereby achieving the technical effect of automatic acquisition of hardware data, and further solving the technical problem of low data acquisition efficiency in the prior art.
[0099] It should be noted that, for the above-mentioned method embodiments, for the sake of simplicity, they are all described as a series of action combinations, but those skilled in the art should know that the present invention is not limited by the described action sequence, because according to the present invention, certain steps can be performed in other sequences or simultaneously. Secondly, those skilled in the art should also know that the embodiments described in the specification are all preferred embodiments, and the actions and modules involved are not necessarily required by the present invention.
[0100] According to another aspect of the embodiments of the present invention, a data acquisition device for implementing the above data acquisition method is also provided. Figure 6 As shown, the device comprises:
[0101] The receiving unit 602 is used to receive a data acquisition request, wherein the data acquisition request is used to request to obtain hardware performance data generated by the target device in the process of running the target service;
[0102] A calling unit 604 is used to call a data acquisition process according to a data acquisition request, wherein an automation control script is running in the data acquisition process, and the automation control script contains automation sampling control information configured for a target business;
[0103] The acquisition unit 606 is used to acquire the result data output by the data acquisition process.
[0104] Optionally, in this embodiment, the embodiments to be implemented by the above-mentioned various unit modules can refer to the above-mentioned various method embodiments, which will not be repeated here.
[0105] According to another aspect of the embodiments of the present invention, an electronic device for implementing the above data acquisition method is also provided. The electronic device may be Figure 7 The terminal device or server shown in the figure. This embodiment is described by taking the electronic device as a terminal device as an example. Figure 7 As shown, the electronic device includes a memory 702 and a processor 704. The memory 702 stores a computer program, and the processor 704 is configured to execute the steps in any of the above method embodiments through the computer program.
[0106] Optionally, in this embodiment, the electronic device may be located in at least one network device among a plurality of network devices of a computer network.
[0107] Optionally, in this embodiment, the processor may be configured to perform the following steps through a computer program:
[0108] S1, receiving a data acquisition request, wherein the data acquisition request is used to request to obtain hardware performance data generated by a target device in the process of running a target service;
[0109] S2, calling a data collection process according to a data acquisition request, wherein an automation control script is running in the data collection process, and the automation control script contains automation sampling control information configured for the target business;
[0110] S3, obtaining the result data output by the data collection process.
[0111] Alternatively, a person skilled in the art may understand that: Figure 7 The structure shown is for illustration only, and the electronic device may also be a smart phone (such as an Android phone, an iOS phone, etc.), a tablet computer, a PDA, a mobile Internet device (MID), a PAD, and other terminal devices. Figure 7 The electronic device and the electronic equipment described above are not limited in structure. Figure 7More or fewer components (such as network interfaces, etc.) as shown in, or with Figure 7 Different configurations are shown.
[0112] Among them, the memory 702 can be used to store software programs and modules, such as program instructions / modules corresponding to the data acquisition method and device in the embodiments of the present invention. The processor 704 executes various functional applications and data processing by running the software programs and modules stored in the memory 702, that is, to implement the above-mentioned data acquisition method. The memory 702 may include a high-speed random access memory, and may also include a non-volatile memory, such as one or more magnetic storage devices, flash memory, or other non-volatile solid-state memory. In some instances, the memory 702 may further include a memory remotely located relative to the processor 704, and these remote memories may be connected to the terminal via a network. Examples of the above-mentioned networks include, but are not limited to, the Internet, corporate intranets, local area networks, mobile communication networks, and combinations thereof. Among them, the memory 702 can be specifically, but not limited to, used to store various parts of hardware performance data, data acquisition information, and other information. As an example, such as Figure 7 As shown, the memory 702 may include but is not limited to the receiving unit 602, the calling unit 604, and the acquiring unit 606 in the data acquisition device. In addition, it may also include but is not limited to other module units in the data acquisition device, which will not be repeated in this example.
[0113] Optionally, the transmission device 706 is used to receive or send data via a network. Specific examples of the network may include a wired network and a wireless network. In one example, the transmission device 706 includes a network adapter (Network Interface Controller, NIC), which can be connected to other network devices and routers via a network cable so as to communicate with the Internet or a local area network. In one example, the transmission device 706 is a radio frequency (RF) module, which is used to communicate with the Internet wirelessly.
[0114] In addition, the electronic device further includes: a display 708 for displaying the hardware performance data acquisition process in the interface; and a connection bus 710 for connecting various module components in the electronic device.
[0115] In other embodiments, the terminal device or server may be a node in a distributed system, wherein the distributed system may be a blockchain system, and the blockchain system may be a distributed system formed by connecting the multiple nodes through network communication. Among them, the nodes may form a peer-to-peer (P2P, Peer To Peer) network, and any form of computing device, such as a server, terminal and other electronic devices, may become a node in the blockchain system by joining the peer-to-peer network.
[0116] According to one aspect of the present application, a computer program product is provided, the computer program product comprising a computer program / instruction, the computer program / instruction comprising a program code for executing the method shown in the flow chart. In such an embodiment, the computer program can be downloaded and installed from a network through a communication part, and / or installed from a removable medium. When the computer program is executed by a central processing unit, various functions provided by the embodiments of the present application are executed.
[0117] The serial numbers of the above embodiments of the present invention are only for description and do not represent the advantages or disadvantages of the embodiments.
[0118] According to one aspect of the present application, a computer-readable storage medium is provided, and a processor of a computer device reads the computer instructions from the computer-readable storage medium, and the processor executes the computer instructions, so that the computer device executes the above-mentioned data acquisition method.
[0119] Optionally, in this embodiment, the computer-readable storage medium may be configured to store a computer program for performing the following steps:
[0120] S1, receiving a data acquisition request, wherein the data acquisition request is used to request to obtain hardware performance data generated by a target device in the process of running a target service;
[0121] S2, calling a data collection process according to a data acquisition request, wherein an automation control script is running in the data collection process, and the automation control script contains automation sampling control information configured for the target business;
[0122] S3, obtaining the result data output by the data collection process.
[0123] Optionally, in this embodiment, a person of ordinary skill in the art may understand that all or part of the steps in the various methods of the above embodiments may be completed by instructing hardware related to the terminal device through a program, and the program may be stored in a computer-readable storage medium, and the storage medium may include: a flash drive, a read-only memory (ROM), a random access memory (RAM), a disk or an optical disk, etc.
[0124] If the integrated units in the above embodiments are implemented in the form of software functional units and sold or used as independent products, they can be stored in the above computer-readable storage medium. Based on such understanding, the technical solution of the present invention is essentially or the part that contributes to the prior art or all or part of the technical solution can be embodied in the form of a software product, which is stored in a storage medium and includes several instructions for enabling one or more computer devices (which can be personal computers, servers or network devices, etc.) to perform all or part of the steps of the above methods of various embodiments of the present invention.
[0125] In the above embodiments of the present invention, the description of each embodiment has its own emphasis. For parts that are not described in detail in a certain embodiment, reference can be made to the relevant descriptions of other embodiments.
[0126] In the several embodiments provided in the present application, it should be understood that the disclosed client can be implemented in other ways. Among them, the device embodiments described above are only schematic. For example, the division of the above units is only a logical function division. There may be other division methods in actual implementation. For example, multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of units or modules, which can be electrical or other forms.
[0127] The units described above as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
[0128] In addition, each functional unit in each embodiment of the present invention may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of software functional units.
[0129] The above are only preferred embodiments of the present invention. It should be pointed out that, for ordinary technicians in this technical field, several improvements and modifications can be made without departing from the principle of the present invention. These improvements and modifications should also be regarded as the scope of protection of the present invention.
Claims
1. A data acquisition method, characterized in that: include: In response to a data acquisition request, establishing a data connection relationship between the current device and the target device through the ADB port of the current device, wherein the data acquisition request is used to request to obtain hardware performance data generated by the target device during the running of the game task; Sending a target executable file to the target device through the ADB port, wherein the target executable file is obtained by compiling the acquisition code, and the acquisition code is a code containing automatic sampling control information obtained by modifying the Hwcpipe interface source code, and the automatic sampling control information includes a custom sampling frequency and a custom sampling data type; In the process of the target device running the game task, calling a data acquisition process according to the data acquisition request, wherein an automation control script is running in the data acquisition process, and the automation control script is used to determine the automation acquisition conditions and control the progress of the automation acquisition; During the operation of the data acquisition process, candidate performance data returned by hardware components corresponding to each of the plurality of pipeline interfaces in the target device are obtained through a plurality of pipeline interfaces, wherein the candidate performance data is hardware performance data generated during the operation of the game task; According to the target executable file running in the target device, candidate performance data belonging to the custom sampling data type is collected at the custom sampling frequency to obtain result data.
2. The method according to claim 1, characterized in that: The collecting of candidate performance data belonging to the custom sampling data type according to the custom sampling frequency includes: When a sampling start condition matching a target performance data set is met, starting to collect data according to the custom sampling frequency, wherein the target performance data set includes a plurality of the candidate performance data; When a sampling closing condition matching the target performance data set is reached, the collection of the target performance data set is terminated.
3. The method according to claim 1, characterized in that In the case where the automatic sampling control information includes the file type and output path of the sampling result file, obtaining the result data output by the data acquisition process includes: The result data is stored in the output path of the sampling result file.
4. The method according to claim 1, characterized in that Before responding to the data acquisition request, the method further includes: The data collection control strategy of the pipeline interface corresponding to each hardware component in the target device is modified to generate the automation control script based on the data collection control strategy.
5. The method according to claim 4, characterized in that Generating the automation control script based on the data collection control strategy includes: Compiling the interface source code corresponding to the data collection control strategy to obtain the target executable file; The automation control script is written and generated based on the target executable file.
6. A data acquisition device, characterized in that: include: A receiving unit, configured to establish a data connection relationship between the current device and the target device through the ADB port of the current device in response to a data acquisition request, wherein the data acquisition request is used to request to obtain hardware performance data generated by the target device during the running of the game task; A calling unit, configured to call a data acquisition process according to the data acquisition request during the process of the target device running the game task, wherein an automation control script is running in the data acquisition process, and the automation control script is used to determine the automation acquisition conditions and control the progress of the automation acquisition; The apparatus is also used to send a target executable file to the target device through the ADB port, wherein the target executable file is obtained by compiling the acquisition code, and the acquisition code is a code containing automatic sampling control information obtained by modifying the Hwcpipe interface source code, and the automatic sampling control information includes a custom sampling frequency and a custom sampling data type; The device is also used to obtain, during the running of the data acquisition process, candidate performance data returned by hardware components corresponding to each of the multiple pipeline interfaces in the target device through multiple pipeline interfaces, wherein the candidate performance data is hardware performance data generated during the running of the game task; according to the target executable file running in the target device, the candidate performance data belonging to the custom sampling data type is collected at the custom sampling frequency to obtain result data.
7. A computer-readable storage medium, characterized in that: The computer-readable storage medium includes a stored program, wherein the program executes the method described in any one of claims 1 to 5 when executed.
8. A computer program product comprising a computer program / instructions, characterized in that When the computer program / instructions are executed by a processor, the steps of the method according to any one of claims 1 to 5 are implemented.
9. An electronic device, comprising a memory and a processor, characterized in that: A computer program is stored in the memory, and the processor is configured to execute the method according to any one of claims 1 to 5 through the computer program.
Citation Information
Patent Citations
Method and device for collecting performance data of IOS system
CN109298982A