CN107943676B - Performance test data processing method and device for operating nonvolatile memory by application - Google Patents

Performance test data processing method and device for operating nonvolatile memory by application Download PDF

Info

Publication number
CN107943676B
CN107943676B CN201610891321.4A CN201610891321A CN107943676B CN 107943676 B CN107943676 B CN 107943676B CN 201610891321 A CN201610891321 A CN 201610891321A CN 107943676 B CN107943676 B CN 107943676B
Authority
CN
China
Prior art keywords
nonvolatile memory
operating
function
file
application
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN201610891321.4A
Other languages
Chinese (zh)
Other versions
CN107943676A (en
Inventor
丁铎
黄闻欣
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Tencent Technology Shenzhen Co Ltd
Original Assignee
Tencent Technology Shenzhen Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Tencent Technology Shenzhen Co Ltd filed Critical Tencent Technology Shenzhen Co Ltd
Priority to CN201610891321.4A priority Critical patent/CN107943676B/en
Publication of CN107943676A publication Critical patent/CN107943676A/en
Application granted granted Critical
Publication of CN107943676B publication Critical patent/CN107943676B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/30Monitoring
    • G06F11/34Recording or statistical evaluation of computer activity, e.g. of down time, of input/output operation ; Recording or statistical evaluation of user activity, e.g. usability assessment
    • G06F11/3466Performance evaluation by tracing or monitoring
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/30Monitoring
    • G06F11/3003Monitoring arrangements specially adapted to the computing system or computing system component being monitored
    • G06F11/3034Monitoring arrangements specially adapted to the computing system or computing system component being monitored where the computing system component is a storage system, e.g. DASD based or network based
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/30Monitoring
    • G06F11/34Recording or statistical evaluation of computer activity, e.g. of down time, of input/output operation ; Recording or statistical evaluation of user activity, e.g. usability assessment
    • G06F11/3452Performance evaluation by statistical analysis

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • Quality & Reliability (AREA)
  • General Physics & Mathematics (AREA)
  • Computer Hardware Design (AREA)
  • Computing Systems (AREA)
  • Life Sciences & Earth Sciences (AREA)
  • Bioinformatics & Cheminformatics (AREA)
  • Bioinformatics & Computational Biology (AREA)
  • Evolutionary Biology (AREA)
  • Probability & Statistics with Applications (AREA)
  • Mathematical Physics (AREA)
  • Debugging And Monitoring (AREA)

Abstract

The invention relates to a performance test data processing method and a device for operating a nonvolatile memory by application, wherein the method comprises the following steps: hooking a system function provided by an operating system and used for operating the nonvolatile memory, so that the system function inputs parameters from the application to be tested and triggers the calling of the self-defined function when the system function is called; operating the nonvolatile memory through the custom function and according to the parameters; collecting performance test data generated by operating a nonvolatile memory through a custom function, and recording the collected performance test data in a log file; the performance test data in the log file is used to analyze the performance index of the application under test operating the nonvolatile memory. According to the method and the device for processing the performance test data of the application operation nonvolatile memory, provided by the invention, the performance test data in the log can express the actual performance of the application operation nonvolatile memory to be tested, and can be used for subsequently analyzing the performance index of the application operation nonvolatile memory to be tested.

Description

Performance test data processing method and device for operating nonvolatile memory by application
Technical Field
The invention relates to the technical field of nonvolatile memory testing, in particular to a method and a device for processing performance test data of an application operation nonvolatile memory.
Background
A computer structure commonly used at present generally includes a volatile memory as an internal memory and a nonvolatile memory as an external memory. Volatile memory can store data temporarily and efficiently, but data is ultimately written to non-volatile memory for long term storage. Non-volatile memory typically includes magnetic memory, which in turn may include core memory, drum memory, and disk memory, and semiconductor memory.
At present, a special test tool is mainly adopted to test performance indexes such as reading and writing speeds of the nonvolatile memory, and actual performance of the nonvolatile memory when the nonvolatile memory is operated is difficult to reflect.
Disclosure of Invention
Based on this, it is necessary to provide a performance test data processing method and apparatus for operating a nonvolatile memory by an application, aiming at the problem that the current test on the nonvolatile memory is difficult to reflect the performance of the application for actually operating the nonvolatile memory.
A performance test data processing method for operating a nonvolatile memory by an application comprises the following steps:
hooking a system function provided by an operating system and used for operating the nonvolatile memory, so that the system function inputs parameters from the application to be tested and triggers the calling of the self-defined function when the system function is called;
operating the non-volatile memory with the custom function and according to the parameters;
collecting performance test data generated by operating the nonvolatile memory through the custom function, and recording the collected performance test data in a log file; the performance test data in the log file is used for analyzing the performance index of the tested application operating the nonvolatile memory.
A performance test data processing apparatus for operating a non-volatile memory by an application, comprising:
the hook module is used for hooking a system function which is provided by an operating system and used for operating the nonvolatile memory, so that the system function inputs parameters and triggers the calling of the self-defined function when being called by the tested application;
the self-defined function execution module is used for operating the nonvolatile memory through the self-defined function according to the parameters; collecting performance test data generated by operating the nonvolatile memory through the custom function, and recording the collected performance test data in a log file; the performance test data in the log file is used for analyzing the performance index of the tested application operating the nonvolatile memory.
According to the method and the device for processing the performance test data of the nonvolatile memory operated by the application, the hook is used for operating the system function of the nonvolatile memory, the system function can call back the custom function when being called by the application to be tested, so that the nonvolatile memory is operated by the custom function, the performance test data generated by the operation is recorded in the log file, and the performance test data in the log file can be used for analyzing the performance index of the application to be tested for operating the nonvolatile memory. In the running process of the application to be tested, if the nonvolatile storage medium is operated, the generated corresponding performance test data can be recorded in the log, and the performance test data in the log can express the actual performance of the application to be tested for operating the nonvolatile memory and can be used for subsequently analyzing the performance index of the application to be tested for operating the nonvolatile memory.
Drawings
FIG. 1 is a diagram of an application environment in which a system for performance testing of non-volatile memory is operated in one embodiment;
FIG. 2 is a diagram illustrating an internal architecture of an electronic device that may be used as a terminal and a server in one embodiment;
FIG. 3 is a flow diagram illustrating a data processing method for performance testing by operating a nonvolatile memory according to an embodiment;
FIG. 4 is a flowchart illustrating the steps of analyzing whether there is a read or write efficiency problem with a tested application based on a log file in one embodiment;
FIG. 5 is a flowchart illustrating steps of performing an automated context test using test cases and controlling hooks to open and cancel in one embodiment;
FIG. 6 is a flowchart illustrating a data processing method for performance testing by operating a nonvolatile memory according to another embodiment;
FIG. 7 is a functional diagram illustrating various functions performed by the application of the Performance test data processing method for operating the nonvolatile memory according to one embodiment;
FIG. 8 is a diagram illustrating the operation of a file in non-volatile storage by a custom function during a single file operation in one embodiment;
FIG. 9 is a block diagram of a performance test data processing apparatus to which the nonvolatile memory is operated according to one embodiment;
FIG. 10 is a block diagram showing a configuration of a performance test data processing apparatus to which the nonvolatile memory is applied in another embodiment;
FIG. 11 is a block diagram showing a configuration of a performance test data processing apparatus to which a nonvolatile memory is operated in accordance with still another embodiment.
Detailed Description
In order to make the objects, technical solutions and advantages of the present invention more apparent, the present invention is described in further detail below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative of the invention and are not intended to limit the invention.
FIG. 1 is a diagram of an application environment in which a system for performance testing of non-volatile memory is operated in one embodiment. Referring to fig. 1, the application operating nonvolatile memory performance test system includes a terminal 110 and a server 120. The terminal 110 has an application under test running thereon. Terminal 110 may be used to hook system functions provided by an operating system on terminal 110 for operating non-volatile memory, such that when a parameter is entered and called by an application under test, the system function triggers a call to a custom function. The terminal 110 may be used to operate the non-volatile memory with the custom function and according to the parameters. The terminal 110 may be configured to collect performance test data generated by operating the nonvolatile memory through the custom function and record the collected performance test data in a log file. The terminal 110 may be configured to output the log file to the server 120; the performance test data in the log file is used to analyze the performance index of the application under test operating the nonvolatile memory. The server 120 may be configured to analyze performance indicators of the non-volatile memory operated by the application under test based on the performance test data in the log file. The server 120 may be replaced by a personal computer, and the functions of the terminal 110 and the server 120 may be implemented on the same electronic device.
Fig. 2 is a schematic diagram of an internal structure of an electronic device that can be used as a terminal and a server in one embodiment. As shown in fig. 2, the electronic device includes a processor, a nonvolatile storage medium, an internal memory, and a network interface, which are connected by a system bus. The performance test data processing device is used for realizing a performance test data processing method for operating the nonvolatile memory by applying. The processor is used for providing calculation and control capability and supporting the operation of the whole electronic equipment. An internal memory in the electronic device provides an environment for the performance test data processing apparatus in the non-volatile storage medium to operate the non-volatile memory by an application, and the internal memory stores computer-readable instructions, which when executed by the processor, cause the processor to execute a performance test data processing method for operating the non-volatile memory by the application. The network interface is used for network communication with the outside, such as outputting or receiving logs. The electronic device may be a mobile terminal, such as a mobile phone, a tablet computer, a personal digital assistant or a wearable device, a personal computer or a server. Those skilled in the art will appreciate that the architecture shown in fig. 2 is a block diagram of only a portion of the architecture associated with the subject application, and does not constitute a limitation on the electronic devices to which the subject application may be applied, and that a particular electronic device may include more or less components than those shown, or may combine certain components, or have a different arrangement of components.
FIG. 3 is a flowchart illustrating a data processing method for performance testing by operating a nonvolatile memory according to an embodiment. The embodiment is mainly illustrated by applying the method to the terminal 110 in the application operation non-volatile memory performance test system in fig. 1. Referring to fig. 3, the method specifically includes the following steps:
s302, hooking a system function provided by the operating system and used for operating the nonvolatile memory, so that the system function triggers the calling of the self-defined function when the system function inputs parameters and is called by the application to be tested.
Where hook (hook) is also referred to as a hook, a program may hook a specified event, and when the hooked event occurs, the program may receive a notification to respond to the event. Non-volatile memory, which may also be referred to as non-volatile storage media, may include magnetic memory, which may in turn include core memory, drum memory, and disk memory, and semiconductor memory.
The operation on the non-volatile storage medium includes at least one of opening a file, reading data, writing data, and closing the file. The system functions for operating the non-volatile memory are provided by the operating system and may be called by the application under test. The system function for operating the nonvolatile memory is a system function for I/O (Iinput/output, i.e., input or output port) operation.
The system function for operating the nonvolatile memory is, for example, a system function FileInputStream for acquiring data from a file by byte, or a system function FileOutputStream for writing data to a file by byte, a system function FileReader for reading data from a file by character, a system function FileWriter for writing data to a file by character, or the like. The parameters of the input system function are, for example, a file descriptor of a file to which write data or read data is applied, a start position of the write data or the read data, a data size of the read data or a data content of the write data, and the like.
The terminal may hook system functions provided by the operating system for operating the non-volatile memory through the application under test. Specifically, the terminal may hook a system function provided by an operating system for operating the non-volatile memory through a Software Development Kit (SDK) integrated by the application under test, and the terminal may perform remote thread injection on the system function through the application under test to hook the system function.
Furthermore, when the terminal hooks the system function, the function address of the system function can be replaced by the function address of the custom function, so that when the tested application calls the input parameter of the system function, the parameter is directly input into the custom function according to the replaced function address to call the custom function.
And S304, operating the nonvolatile memory through the self-defined function according to the parameters.
Specifically, the custom function includes a code of the system function, so that the terminal can operate the nonvolatile memory according to the parameter input by the application to be tested by calling the custom function, thereby realizing the same function as that of the system function operating the nonvolatile memory according to the parameter. One operation on a non-volatile memory typically includes a series of sub-operations, such as opening a file, reading data, and closing a file, or such as opening a file, writing data, and closing a file.
S306, collecting performance test data generated by operating the nonvolatile memory through the custom function, and recording the collected performance test data in a log file. The performance test data in the log file is used to analyze the performance index of the application under test operating the nonvolatile memory.
Wherein the performance test data is data reflecting the performance of the non-volatile memory operated by the application under test. The performance test data may specifically include one or a combination of several of a process name, a thread name, a total amount of data read or written in a single file operation process, a number of times of reading or writing in a single file operation process, and a file name of a file in the nonvolatile memory operated in a single operation process by the application under test.
The log file may be recorded in a CSV (Comma-Separated Values format) format or a txt format. The performance test data generated each time the non-volatile memory is operated is recorded as one record in a log file. The performance index refers to a dimension which quantitatively represents the performance of the tested application operating the nonvolatile memory, such as whether the performance problem of operating the nonvolatile memory through the main thread exists, the reading or writing efficiency is high or low, whether the problem of repeatedly operating files exists, the time consumption of operation is short, and the like.
Specifically, the custom function includes not only the code of the system function but also the custom code. When the terminal calls the custom function, the performance test data generated by operating the nonvolatile memory at this time is recorded in the log file by executing the custom code in the custom function. The terminal can collect performance test data from the input parameters and the values returned by the nonvolatile memory operated by the user-defined function through the user-defined function, and the user-defined function can also actively collect the performance test data related to the nonvolatile memory operated this time, such as the process name and the thread name of the nonvolatile memory operated this time.
Further, the terminal can send the log file to the server, and the server analyzes the performance index of the application to be tested operating the nonvolatile memory according to the performance test data in the log file. The terminal can also export the log file, such as exporting to a USB flash disk, import the log file into a personal computer through the USB flash disk, and analyze the performance index of the application to be tested operating the nonvolatile memory according to the performance test data in the log file by the personal computer. The terminal can also display the log in a visual form to realize the output of the log file.
According to the method for processing the performance test data of the nonvolatile memory operated by the application, the hook is used for operating the system function of the nonvolatile memory, the system function can call back the custom function when being called by the application to be tested, so that the nonvolatile memory is operated by the custom function, the performance test data generated by the operation is recorded in the log file, and the performance test data in the log file can be used for analyzing the performance index of the application to be tested for operating the nonvolatile memory. In the running process of the application to be tested, if the nonvolatile storage medium is operated, the generated corresponding performance test data can be recorded in the log, and the performance test data in the log can express the actual performance of the application to be tested for operating the nonvolatile memory and can be used for subsequently analyzing the performance index of the application to be tested for operating the nonvolatile memory.
In an embodiment, based on the performance test data processing method for operating the nonvolatile memory by using the application in the above embodiment, the operating system is an android operating system; the system function is one or a combination of Open () function, Close (), Read () function and Write () function in the BlockGuardOS.
Specifically, the Android operating system is an open source operating system based on Linux. The android operating system support includes a variety of system functions for operating non-volatile storage, such as FileInputStream, FileOutputStream, FileReader, FileWriter, and the like. If all system functions for operating the nonvolatile memory are hooked, the workload is large and omission is easy. And the system function used for operating the nonvolatile memory in the android operating system finally calls one or a combination of Open () function, Close (), Read () function and Write () function in the BlockGuardOS. Therefore, the function in BlockGuardOS.
The Open () function is used for opening a file in the nonvolatile memory, the Close () function is used for closing the file in the nonvolatile memory, the Read () function is used for reading data from the file opened in the nonvolatile memory, and the Write () function is used for writing data to the file opened in the nonvolatile memory.
In one embodiment, step S306 includes: and acquiring the thread name of the tested application operating volatile memory through a custom function and recording the thread name in a log file. The performance test data processing method for operating the nonvolatile memory by the application further comprises the following steps: and when the main thread name exists in the log file, outputting a performance analysis result which indicates that the tested application has a performance problem of operating the nonvolatile memory through the main thread.
Specifically, the application to be tested may include one or more processes, one process may include one or more threads, the application to be tested initiates a call to the system function through one thread in one process of the application to be tested, and further triggers a call to the custom function, and the custom function records a thread name of the thread initiating the call to the system function this time in one record in the log file, and may also record a process name of a process to which the thread belongs in the one record.
Further, when analyzing according to the log file, the server may search the main thread name in the thread names used by the application under test recorded in the log file when operating the nonvolatile memory, and if the main thread name is found, output a performance analysis result indicating that the application under test has a performance problem of operating the nonvolatile memory by the main thread. The performance analysis result can be output in a visual form or can be output to a specified file. When the application to be tested is started, a process is created by the operating system, meanwhile, a thread in the process also starts to run, the thread is a main thread of the application to be tested, and the thread created by the main thread is a sub-thread of the main thread. The main thread name is typically main.
In this embodiment, since the main thread has more functions, if the main thread directly operates the nonvolatile memory, the main thread functions are affected. Therefore, when the main thread name exists in the log file, the performance problem that the tested application operates the nonvolatile memory through the main thread exists in the positioning tested application, so that a developer is guided to overcome the performance problem that the tested application operates the nonvolatile memory through the main thread, and the performance of the tested application is improved.
In an embodiment, the step of outputting the performance analysis result indicating that the tested application has the performance problem of operating the nonvolatile memory by the main thread when the main thread name exists in the log file may specifically be outputting the performance analysis result indicating that the tested application has the performance problem of operating the nonvolatile memory by the main thread when the main thread name exists in the log file and the process name to which the main thread name belongs is the foreground process.
The foreground process refers to a process capable of directly responding to user operation. The terminal can specifically judge whether the process name of the main thread name is consistent with the package name of the tested application installation package, and if so, the process name can be judged to be the main process name. The performance analysis result can be output in a visual form or can be output to a specified file.
In this embodiment, the foreground process has a function of responding to the user operation, and if the main thread created by the foreground process operates the nonvolatile memory, the functions of the foreground process and the main thread may be affected, which may affect the user experience. Therefore, when the main thread name and the process name to which the main thread name belongs are foreground processes, a performance analysis result indicating that the performance problem of the detected application in operating the nonvolatile memory through the main thread is generated is output, so that a developer is guided to overcome the performance problem of operating the nonvolatile memory through the main thread of the foreground processes, and the performance of the detected application is improved.
In one embodiment, step S306 includes: the method comprises the steps of collecting the thread name adopted by a tested application when the nonvolatile memory is operated, the total amount of data read or written in a single file operation process and the number of times of reading or writing in the single file operation process through a custom function, and correspondingly recording the collected thread name, the total amount of data read or written in the single file operation process and the number of times of reading or writing in the single file operation process in a log file.
In one embodiment, the performance test data processing method for operating the nonvolatile memory by the application further comprises the step of analyzing whether the read or write efficiency problem exists in the application to be tested according to the log file. Referring to fig. 4, the step of analyzing whether the read or write efficiency problem exists in the application under test according to the log file specifically includes the following steps:
s402, when the sub-thread name exists in the log file, acquiring the total amount of data read or written in a single file operation process and the number of times of reading or writing in the single file operation process corresponding to the sub-thread name.
The single file operation process refers to a process from opening a file to closing the file, such as opening the file, reading data from the opened file, and closing the file, and further such as opening the file, writing data to the opened file, and closing the file. Single file operations may be associated and identified by the same file descriptor. Multiple reads or writes may occur during a single file operation. The total amount of data read or written during a single file operation refers to the total amount of data read or written from an open file to a closed file during a single file operation, and can be measured by the number of bytes. The number of reads or writes during a single file operation is the number of reads or writes from opening a file to closing the file during a single file operation.
S404, dividing the total amount of data read or written in the single file operation process by the number of times of reading or writing in the single file operation process to obtain the average value of the amount of data read or written in a single time.
The average value of the single read or write data amount represents the average data amount of each read or write in the single file operation process, and can reflect the read or write efficiency of the application to be tested. If the average value of the single read or write data quantity is larger, the read or write efficiency of the application to be tested is higher; if the average value of the single read or write data is smaller, the read or write efficiency of the application to be tested is lower.
And S406, when the average value of the single read or write data is smaller than a preset value, outputting a performance analysis result indicating that the read or write efficiency problem exists in the sub-thread represented by the sub-thread name.
The preset value is a threshold value for judging the average value of the single read or write data quantity, namely judging the read or write efficiency of the application to be tested. The preset value can be selected according to the requirement, such as 8KB (kilobytes).
Specifically, when the average value of the single read or write data amount is smaller than a preset value, the read or write efficiency of the application to be tested is low, resource waste is caused, and the server can output a performance analysis result indicating that the read or write efficiency problem exists in the sub-thread represented by the name of the sub-thread. When the average value of the single read or write data quantity is larger than or equal to the preset value, the read or write efficiency of the application to be tested is high, and the problem of the read or write efficiency does not exist.
In this embodiment, the single read or write data volume average value may reflect the read or write efficiency of the application to be tested, and when the read or write efficiency of the application to be tested is low, a performance analysis result indicating that the read or write efficiency problem exists in the sub-thread represented by the sub-thread name is output, so that the read or write efficiency problem is accurately located, and a developer is guided to overcome the read or write efficiency problem of the sub-thread.
In one embodiment, step S306 includes: and acquiring the file name of the file in the nonvolatile memory operated by the tested application in the single running process through a custom function, and recording the acquired file name in a log file. The performance test data processing method for operating the nonvolatile memory by the application further comprises the following steps: and when the file name of the repeated record exists in the log file, outputting a performance analysis result indicating that the tested application has the problem of repeatedly operating the file.
Specifically, the application under test is a single running process of the application under test from opening to closing. In the single running process of the application to be tested, the terminal records the file name of the file operated by the application to be tested in the log file through the self-defined function, and each record in the log file records the file name of the file operated. After the terminal sends the log file to the server, the server can compare file names in the log file, and find whether more than one same file name exists in the log file, so as to judge whether the log file has the file name recorded repeatedly. The file name may be obtained by a file descriptor query.
In this embodiment, when the file name of the duplicate record exists, it indicates that the application under test reads or writes the same file for multiple times in a single operation process of the application under test, and the output of the performance analysis result indicating that the application under test has the problem of repeatedly operating the file can guide a developer to overcome the problem of repeatedly operating the file.
In one embodiment, the performance test data processing method for operating the nonvolatile memory by the application further comprises the steps of carrying out automatic scene test by using the test case and controlling the opening and the cancellation of the hook. Referring to fig. 5, the step of performing an automated scene test using a test case and controlling the opening and the cancellation of the hook specifically includes the following steps:
and S502, acquiring and executing the test case.
The Test Case (Test Case) is a set of Test inputs, execution conditions, and expected results compiled for a specified Test target in order to Test whether the program meets the target requirements. The terminal can download the test case from the server and execute the test case. The terminal can also obtain and execute the test case imported into the terminal.
S504, when the test case is executed, the hook opening interface is called to execute the step S302.
S506, executing the scene test code in the test case after the hook opening interface is called.
S508, after the execution of the scene test code is finished, the hook stop interface is called to cancel the execution of the step S302.
Specifically, the test case comprises scenario test code for testing the performance of the tested application operating the non-volatile memory in a specified scenario when executed. When the terminal executes the test case, before executing the scenario test code, the hooking Start interface Start () is called to execute step S302 to hook the system function provided by the operating system for operating the nonvolatile memory, and further, when executing the scenario test code, the performance test data generated by operating the nonvolatile memory when executing the scenario test code may be recorded in the log file. And after the terminal finishes executing the scene test code, calling a hook Stop interface Stop () to cancel the hook of the system function and Stop recording the log. The scenario test code may be, for example, code that tests a particular function, or code that tests a series of combined functions.
In this embodiment, when the test case is used for performing an automated test, the hook opening interface and the hook stopping interface may be used to control the opening and the cancellation of the hook, so as to accurately record the performance test data generated when the application under test operates the nonvolatile memory under a specific scene in the log file, and implement the performance test of operating the nonvolatile memory under a specific scene of the application under test.
FIG. 6 is a flowchart illustrating a data processing method for performance testing by operating a nonvolatile memory according to another embodiment. FIG. 7 is a functional diagram illustrating various functions performed by the application of the Performance test data processing method for operating the nonvolatile memory according to one embodiment. FIG. 8 is a diagram illustrating the operation of a file in non-volatile storage by a custom function during a single file operation in one embodiment. Referring to fig. 6 to 8, the method specifically includes the following steps:
s602, hooking a system function provided by the android operating system and used for operating the nonvolatile memory, so that the system function triggers the calling of the custom function when the system function inputs parameters and is called by the application to be tested. The system functions are Open () function, Close (), Read () function and Write () function in the blockaguardos.
And S604, operating the nonvolatile memory through the self-defined function according to the parameters.
S606, the file name of the file in the nonvolatile memory operated in the single running process of the application to be tested, the thread name of the nonvolatile memory operated by the application to be tested, the total amount of data read or written in the single file operation process and the number of times of reading or writing in the single file operation process are collected through a custom function, and the collected file name, the collected thread name, the total amount of data read or written in the single file operation process and the number of times of reading or writing in the single file operation process are correspondingly recorded in a log file.
Specifically, the terminal can record the file name of the file in the nonvolatile memory operated in the single running process of the application to be tested, the thread name of the nonvolatile memory operated by the application to be tested, the total amount of data read or written in the single file operation process and the number of times of reading or writing in the single file operation process in the same record in the log file, so that the data are correspondingly recorded in the log file.
And S608, when the main thread name exists in the log file, outputting a performance analysis result which indicates that the tested application has the performance problem of operating the nonvolatile memory through the main thread.
S610, when the sub-thread name exists in the log file, the total amount of data read or written in the single file operation process and the number of times of reading or writing in the single file operation process corresponding to the sub-thread name are obtained.
And S612, dividing the total amount of data read or written in the single file operation process by the number of times of reading or writing in the single file operation process to obtain the average value of the amount of data read or written in a single time.
And S614, when the average value of the single read or write data is smaller than the preset value, outputting a performance analysis result indicating that the read or write efficiency problem exists in the sub-thread represented by the sub-thread name.
And S616, when the log file has the file name of the repeated record, outputting a performance analysis result indicating that the tested application has the problem of repeated operation of the file.
In this embodiment, in the running process of the application under test, if the nonvolatile storage medium is operated, the generated corresponding performance test data may be recorded in the log, and the performance test data in the log may express the actual performance of the application under test operating the nonvolatile memory, and may be used to subsequently analyze the performance index of the application under test operating the nonvolatile memory. By analyzing the log file, the performance problem that the tested application operates the nonvolatile memory through the main thread, the reading or writing efficiency problem of the sub-thread and the problem of repeatedly operating the file can be analyzed.
In one embodiment, in step S606, the time consumption of the single file operation and the stack information may also be recorded in the log file. Specifically, the terminal can save a first time stamp of a starting operation file to a log file through a custom function corresponding to an Open () function, save a second time stamp of an ending operation file to the log file through a custom function corresponding to a Close () function, and calculate a difference value between the second time stamp and the first time stamp to obtain the time consumed by a single file operation. Efficiency problems in the single file operation process can be found out through the time consumption of the single file operation, for example, when the time consumption of the single file operation exceeds the preset time length, a performance analysis result which indicates that the performance problem of overtime file operation exists is output. The stack information may describe the field environment when a problem occurs and may be used to assist developers in solving various problems that are discovered.
FIG. 9 is a block diagram of a Performance test data processing apparatus 900 in one embodiment to which the non-volatile memory is operated. Referring to fig. 9, the performance test data processing apparatus 900 to which the nonvolatile memory is operated includes: a hooking module 901 and a custom function execution module 902.
And a hooking module 901, configured to hook a system function provided by an operating system and used for operating the nonvolatile memory, so that when the system function is called by the input parameter of the application under test, the system function triggers the call of the custom function.
A custom function execution module 902 for operating the nonvolatile memory by a custom function and according to the parameters; collecting performance test data generated by operating a nonvolatile memory through a custom function, and recording the collected performance test data in a log file; the performance test data in the log file is used to analyze the performance index of the application under test operating the nonvolatile memory.
According to the performance test data processing device for operating the nonvolatile memory by the application, the hook is used for operating the system function of the nonvolatile memory, the system function can call back the custom function when being called by the application to be tested, so that the nonvolatile memory is operated by the custom function, performance test data generated by operation is recorded in the log file, and the performance test data in the log file can be used for analyzing the performance index of the application to be tested for operating the nonvolatile memory. In the running process of the application to be tested, if the nonvolatile storage medium is operated, the generated corresponding performance test data can be recorded in the log, and the performance test data in the log can express the actual performance of the application to be tested for operating the nonvolatile memory and can be used for subsequently analyzing the performance index of the application to be tested for operating the nonvolatile memory.
In one embodiment, the operating system is an android operating system; the system function is one or a combination of Open () function, Close (), Read () function and Write () function in the BlockGuardOS.
Specifically, the Android operating system is an operating system based on Linux open source code. The android operating system support includes a variety of system functions for operating non-volatile storage, such as FileInputStream, FileOutputStream, FileReader, FileWriter, and the like. If all system functions for operating the nonvolatile memory are hooked, the workload is large and omission is easy. And the system function used for operating the nonvolatile memory in the android operating system finally calls one or a combination of Open () function, Close (), Read () function and Write () function in the BlockGuardOS. Therefore, the function in BlockGuardOS.
FIG. 10 is a block diagram of a performance test data processing apparatus 900 for operating a nonvolatile memory according to another embodiment. Referring to fig. 10, the performance test data processing apparatus 900 to which the nonvolatile memory is operated further includes: a performance analysis module 903.
In one embodiment, the custom function execution module 902 is further configured to collect, through the custom function, a thread name of the volatile memory operated by the application under test and record the thread name in the log file.
The performance analysis module 903 is configured to output a performance analysis result indicating that the application under test has a performance problem of operating the nonvolatile memory by the main thread when the main thread name exists in the log file.
In this embodiment, since the main thread has more functions, if the main thread directly operates the nonvolatile memory, the main thread functions are affected. Therefore, when the main thread name exists in the log file, the performance problem that the tested application operates the nonvolatile memory through the main thread exists in the positioning tested application, so that a developer is guided to overcome the performance problem that the tested application operates the nonvolatile memory through the main thread, and the performance of the tested application is improved.
In an embodiment, the custom function execution module 902 is further configured to collect, through the custom function, a thread name used by the application under test when operating the nonvolatile memory, a total amount of data read or written during a single file operation, and a number of times of reading or writing during a single file operation, and correspondingly record the thread name, the total amount of data read or written during the single file operation, and the number of times of reading or writing during the single file operation in the log file.
The performance analysis module 903 is configured to, when a sub-thread name exists in the log file, obtain a total amount of data read or written in a single file operation process and read or written times in the single file operation process, which correspond to the sub-thread name; dividing the total amount of read or write data in the single file operation process by the number of read or write times in the single file operation process to obtain the average value of the amount of the single read or write data; and when the average value of the single read or write data quantity is smaller than a preset value, outputting a performance analysis result indicating that the read or write efficiency problem exists in the sub-thread represented by the sub-thread name.
In this embodiment, the single read or write data volume average value may reflect the read or write efficiency of the application to be tested, and when the read or write efficiency of the application to be tested is low, a performance analysis result indicating that the read or write efficiency problem exists in the sub-thread represented by the sub-thread name is output, so that the read or write efficiency problem is accurately located, and a developer is guided to overcome the read or write efficiency problem of the sub-thread.
In one embodiment, the custom function execution module 902 is further configured to collect, through the custom function, file names of files in the nonvolatile memory operated by the application under test in a single run, and record the collected file names in a log file.
The performance analysis module 903 is configured to output a performance analysis result indicating that the tested application has a problem of repeatedly operating the file when the file name of the repeated record exists in the log file.
In this embodiment, when the file name of the duplicate record exists, it indicates that the application under test reads or writes the same file for multiple times in a single operation process of the application under test, and the output of the performance analysis result indicating that the application under test has the problem of repeatedly operating the file can guide a developer to overcome the problem of repeatedly operating the file.
FIG. 11 is a block diagram showing a configuration of a performance test data processing apparatus 900 for operating a nonvolatile memory according to still another embodiment. Referring to fig. 11, the performance test data processing apparatus 900 to which the nonvolatile memory is operated further includes: an automated testing module 904, configured to obtain and execute a test case; when the test case is executed, calling a hook opening interface to hook a system function which is provided by an operating system and is used for operating the nonvolatile memory; executing a scene test code in the test case after the hook is called to open the interface; and after the execution of the scene test code is finished, calling the hook stop interface to cancel a system function provided by the hook operating system and used for operating the nonvolatile memory.
In this embodiment, when the test case is used for performing an automated test, the hook opening interface and the hook stopping interface may be used to control the opening and the cancellation of the hook, so as to accurately record the performance test data generated when the application under test operates the nonvolatile memory under a specific scene in the log file, and implement the performance test of operating the nonvolatile memory under a specific scene of the application under test.
It will be understood by those skilled in the art that all or part of the processes of the methods of the embodiments described above can be implemented by a computer program, which can be stored in a non-volatile computer-readable memory, and can include the processes of the embodiments of the methods described above when executed. The Memory may be a magnetic disk, an optical disk, a Read-Only Memory (ROM), etc.
The technical features of the above embodiments can be arbitrarily combined, and for the sake of brevity, all possible combinations of the technical features in the above embodiments are not described, but should be considered as the scope of the present specification as long as there is no contradiction between the combinations of the technical features.
The above examples only show some embodiments of the present invention, and the description thereof is more specific and detailed, but not construed as limiting the scope of the invention. It should be noted that, for a person skilled in the art, several variations and modifications can be made without departing from the inventive concept, which falls within the scope of the present invention. Therefore, the protection scope of the present patent shall be subject to the appended claims.

Claims (16)

1. A performance test data processing method for operating a nonvolatile memory by an application comprises the following steps:
hooking a system function provided by an operating system and used for operating the nonvolatile memory, so that the system function inputs parameters from the application to be tested and triggers the calling of the self-defined function when the system function is called;
operating the non-volatile memory with the custom function and according to the parameters;
collecting performance test data generated by operating the nonvolatile memory through the custom function, and recording the collected performance test data in a log file; the performance test data in the log file is used for analyzing the performance index of the tested application operating the nonvolatile memory; the performance test data comprises a thread name adopted by the application under test when operating the nonvolatile memory;
and when the main thread name exists in the log file, outputting a performance analysis result which indicates that the tested application has a performance problem of operating the nonvolatile memory through the main thread.
2. The method of claim 1, wherein the operating system is an android operating system; the system function is one or a combination of several of an Open () function, a Close () function, a Read () function and a Write () function in a blockguard os.
3. The method according to claim 1, wherein the performance test data comprises one or more of a process name adopted by the application under test in operating the nonvolatile memory, a total amount of data read or written during a single file operation, a number of times of reading or writing during a single file operation, and a file name of a file in the nonvolatile memory operated by the application under test during a single operation.
4. The method of claim 1, wherein the step of collecting performance test data generated by operating the nonvolatile memory through the custom function and recording the collected performance test data in a log file comprises:
and acquiring the thread name adopted by the tested application when the nonvolatile memory is operated through the custom function, and recording the acquired thread name in a log file.
5. The method of claim 1, wherein the step of collecting performance test data generated by operating the nonvolatile memory through the custom function and recording the collected performance test data in a log file comprises:
acquiring the thread name adopted by the application to be tested when operating the nonvolatile memory, the total amount of data read or written in the single file operation process and the number of times of reading or writing in the single file operation process through the self-defined function, and correspondingly recording the acquired thread name, the total amount of data read or written in the single file operation process and the number of times of reading or writing in the single file operation process in a log file;
the method further comprises the following steps:
when a sub-thread name exists in the log file, acquiring the total amount of data read or written in a single file operation process and the number of times of reading or writing in the single file operation process corresponding to the sub-thread name;
dividing the total amount of read or write data in the single file operation process by the number of read or write times in the single file operation process to obtain an average value of the amount of the single read or write data;
and when the average value of the single read or write data quantity is smaller than a preset value, outputting a performance analysis result indicating that the read or write efficiency problem exists in the sub-thread represented by the sub-thread name.
6. The method of claim 1, wherein the step of collecting performance test data generated by operating the nonvolatile memory through the custom function and recording the collected performance test data in a log file comprises:
acquiring the file name of the file in the nonvolatile memory operated by the application to be tested in the single running process through the custom function, and recording the acquired file name in a log file;
the method further comprises the following steps:
and when the log file has the file name of the repeated record, outputting a performance analysis result indicating that the tested application has the problem of repeated operation files.
7. The method of claim 1, further comprising:
acquiring and executing a test case;
when the test case is executed, calling a hook opening interface to execute a system function which is provided by the hook operating system and used for operating the nonvolatile memory;
executing the scene test code in the test case after the hook opening interface is called;
and after the scene test code is executed, calling a hook stopping interface to cancel the step of executing the system function provided by the hook operating system and used for operating the nonvolatile memory.
8. A performance test data processing apparatus for operating a nonvolatile memory by an application, comprising:
the hook module is used for hooking a system function which is provided by an operating system and used for operating the nonvolatile memory, so that the system function inputs parameters and triggers the calling of the self-defined function when being called by the tested application;
the self-defined function execution module is used for operating the nonvolatile memory through the self-defined function according to the parameters; collecting performance test data generated by operating the nonvolatile memory through the custom function, and recording the collected performance test data in a log file; the performance test data in the log file is used for analyzing the performance index of the tested application operating the nonvolatile memory; the performance test data comprises a thread name adopted by the application under test when operating the nonvolatile memory;
and the performance analysis module is used for outputting a performance analysis result which indicates that the tested application has the performance problem of operating the nonvolatile memory through the main thread when the main thread name exists in the log file.
9. The apparatus of claim 8, wherein the operating system is an android operating system; the system function is one or a combination of several of an Open () function, a Close (), a Read () function and a Write () function in a BlockGuardOS.
10. The apparatus of claim 8, wherein the performance test data comprises one or more of a process name used by the application under test in operating the nonvolatile memory, a total amount of data read or written during a single file operation, a number of times of reading or writing during a single file operation, and a file name of a file in the nonvolatile memory operated by the application under test during a single run.
11. The apparatus of claim 8, wherein the custom function execution module is further configured to collect, through the custom function, a thread name adopted by the application under test when operating the nonvolatile memory, and record the collected thread name in a log file.
12. The apparatus according to claim 8, wherein the custom function execution module is further configured to collect, through the custom function, a thread name adopted by the application under test when operating the nonvolatile memory, a total amount of data read or written during a single file operation, and a number of times of reading or writing during a single file operation, and correspondingly record the collected thread name, the total amount of data read or written during a single file operation, and the number of times of reading or writing during a single file operation in a log file;
the performance analysis module is further configured to:
when a sub-thread name exists in the log file, acquiring the total amount of data read or written in a single file operation process and the number of times of reading or writing in the single file operation process corresponding to the sub-thread name; dividing the total amount of read or write data in the single file operation process by the number of read or write times in the single file operation process to obtain an average value of the amount of the single read or write data; and when the average value of the single read or write data quantity is smaller than a preset value, outputting a performance analysis result indicating that the read or write efficiency problem exists in the sub-thread represented by the sub-thread name.
13. The apparatus according to claim 8, wherein the custom function execution module is further configured to collect, through the custom function, file names of files in the non-volatile memory operated by the application under test in a single running process, and record the collected file names in a log file;
the performance analysis module is further configured to:
and when the log file has the file name of the repeated record, outputting a performance analysis result indicating that the tested application has the problem of repeated operation files.
14. The apparatus of claim 8, further comprising:
the automatic test module is used for acquiring and executing a test case; when the test case is executed, a hook opening interface is called to hook a system function which is provided by an operating system and is used for operating the nonvolatile memory; executing the scene test code in the test case after the hook opening interface is called; and after the scene test code is executed, calling a hook stopping interface to cancel a system function which is provided by a hook operating system and used for operating the nonvolatile memory.
15. A computer-readable storage medium, storing a computer program which, when executed by a processor, causes the processor to perform the steps of the method of any one of claims 1 to 7.
16. A computer device comprising a memory and a processor, the memory storing a computer program that, when executed by the processor, causes the processor to perform the steps of the method of any one of claims 1 to 7.
CN201610891321.4A 2016-10-12 2016-10-12 Performance test data processing method and device for operating nonvolatile memory by application Active CN107943676B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201610891321.4A CN107943676B (en) 2016-10-12 2016-10-12 Performance test data processing method and device for operating nonvolatile memory by application

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201610891321.4A CN107943676B (en) 2016-10-12 2016-10-12 Performance test data processing method and device for operating nonvolatile memory by application

Publications (2)

Publication Number Publication Date
CN107943676A CN107943676A (en) 2018-04-20
CN107943676B true CN107943676B (en) 2020-10-30

Family

ID=61928767

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201610891321.4A Active CN107943676B (en) 2016-10-12 2016-10-12 Performance test data processing method and device for operating nonvolatile memory by application

Country Status (1)

Country Link
CN (1) CN107943676B (en)

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102621432A (en) * 2012-04-11 2012-08-01 北京四方继保自动化股份有限公司 Method for automatically testing single board of protective relay device
CN104077110A (en) * 2014-07-09 2014-10-01 肖龙旭 File scheduling method based on system behaviors
CN104200161A (en) * 2014-08-05 2014-12-10 杭州安恒信息技术有限公司 Method for achieving intelligent sandbox file detection and intelligent sandbox detection system based on method
CN105426310A (en) * 2015-11-27 2016-03-23 北京奇虎科技有限公司 Method and apparatus for detecting performance of target process
CN105550104A (en) * 2015-12-08 2016-05-04 北京奇虎科技有限公司 Application program performance test method and device

Family Cites Families (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US8607094B2 (en) * 2009-09-29 2013-12-10 Hyundai Motor Company Operational system test method
US9575876B2 (en) * 2014-06-13 2017-02-21 International Business Machines Corporation Performance testing of software applications

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102621432A (en) * 2012-04-11 2012-08-01 北京四方继保自动化股份有限公司 Method for automatically testing single board of protective relay device
CN104077110A (en) * 2014-07-09 2014-10-01 肖龙旭 File scheduling method based on system behaviors
CN104200161A (en) * 2014-08-05 2014-12-10 杭州安恒信息技术有限公司 Method for achieving intelligent sandbox file detection and intelligent sandbox detection system based on method
CN105426310A (en) * 2015-11-27 2016-03-23 北京奇虎科技有限公司 Method and apparatus for detecting performance of target process
CN105550104A (en) * 2015-12-08 2016-05-04 北京奇虎科技有限公司 Application program performance test method and device

Also Published As

Publication number Publication date
CN107943676A (en) 2018-04-20

Similar Documents

Publication Publication Date Title
CN107193750B (en) Script recording method and device
CN107515808B (en) Log recording method, apparatus, computer device and computer readable storage medium
US9824212B2 (en) Method and system for recognizing advertisement plug-ins
US20210326124A1 (en) Download system of app, determination method of installation type and storage medium
CN109815141B (en) Test method and device
CN110554962A (en) Regression testing process covering method, server and computer readable storage medium
CN112817866A (en) Recording playback method, device, system, computer equipment and storage medium
CN111177113A (en) Data migration method and device, computer equipment and storage medium
CN110515795A (en) A kind of monitoring method of big data component, device, electronic equipment
CN109558145B (en) Installation package volume optimization method and device for android application
CN112241362A (en) Test method, test device, server and storage medium
CN107943676B (en) Performance test data processing method and device for operating nonvolatile memory by application
CN109189672B (en) Automatic testing method for micro-service, server and computer readable storage medium
CN109976970B (en) Method, system and storage medium for prolonging service life of mainboard chip
CN113127314A (en) Method and device for detecting program performance bottleneck and computer equipment
CN108563578B (en) SDK compatibility detection method, device, equipment and readable storage medium
CN112861138A (en) Software security analysis method and analysis device, electronic device, and storage medium
CN113821193B (en) Information generation method, device and storage medium
US9940068B2 (en) Device and method for determining memory leaks
CN114238130A (en) Performance test method, device, equipment and storage medium
CN109710521B (en) Multimedia application performance test method and device, computer equipment and storage medium
CN114064378A (en) Application program time-consuming analysis method, device, equipment and storage medium
CN113190445A (en) Interface test method, interface test device and interface test system
CN111625302A (en) Function time consumption tracking method, device and storage medium
CN114201353A (en) Processing method, device and storage medium for program time-consuming data

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant