CN111382017A - Fault query method, device, server and storage medium - Google Patents

Fault query method, device, server and storage medium Download PDF

Info

Publication number
CN111382017A
CN111382017A CN201811628533.9A CN201811628533A CN111382017A CN 111382017 A CN111382017 A CN 111382017A CN 201811628533 A CN201811628533 A CN 201811628533A CN 111382017 A CN111382017 A CN 111382017A
Authority
CN
China
Prior art keywords
function
execution time
code
abnormal
time
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.)
Pending
Application number
CN201811628533.9A
Other languages
Chinese (zh)
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.)
Beijing ByteDance Network Technology Co Ltd
Original Assignee
Beijing ByteDance Network Technology 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 Beijing ByteDance Network Technology Co Ltd filed Critical Beijing ByteDance Network Technology Co Ltd
Priority to CN201811628533.9A priority Critical patent/CN111382017A/en
Publication of CN111382017A publication Critical patent/CN111382017A/en
Pending legal-status Critical Current

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING; COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/22Detection or location of defective computer hardware by testing during standby operation or during idle time, e.g. start-up testing
    • G06F11/2205Detection or location of defective computer hardware by testing during standby operation or during idle time, e.g. start-up testing using arrangements specific to the hardware being tested
    • G06F11/2236Detection or location of defective computer hardware by testing during standby operation or during idle time, e.g. start-up testing using arrangements specific to the hardware being tested to test CPU or processors
    • GPHYSICS
    • G06COMPUTING; CALCULATING; COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/22Detection or location of defective computer hardware by testing during standby operation or during idle time, e.g. start-up testing
    • G06F11/26Functional testing

Abstract

The embodiment of the disclosure discloses a fault query method, a fault query device, a server and a storage medium, wherein the method comprises the following steps: measuring the function execution time of at least one function in the code segment to be detected; acquiring a function with abnormal execution time according to the measured function execution time of at least one function; and analyzing the code of the function with the abnormal execution time to obtain a code field causing the abnormal execution time. The embodiment of the invention determines the function with abnormal execution time, analyzes the code field causing the abnormal execution time, and modifies the code field to reduce the execution time of the function so as to reduce the load of the central processing unit, thereby improving the experience of users.

Description

Fault query method, device, server and storage medium
Technical Field
The embodiment of the disclosure relates to the technical field of computers, and in particular relates to a fault query method, a fault query device, a server and a storage medium.
Background
With the development of the internet and intelligent terminals, users can acquire various multimedia information from a network server through the intelligent terminals so as to enrich the life, work and entertainment of the users.
However, during peak periods, the user often encounters a high load of a Central Processing Unit (CPU) in the network server, which results in an increase of 503 errors received by the user, i.e. a partial request of the user is rejected, thereby seriously impairing the user experience. Therefore, a fault query method is urgently needed to query the reason causing the CPU load to be too high, and then, based on the reason, targeted improvement is performed to ensure user experience.
Disclosure of Invention
The embodiment of the disclosure provides a fault query method, a fault query device, a server and a storage medium, wherein a function with abnormal execution time in a code segment running in the server is searched and analyzed, and the function with abnormal execution time is modified to reduce the load of a central processing unit, so that the user experience is improved.
In a first aspect, an embodiment of the present disclosure provides a fault query method, including:
measuring the function execution time of at least one function in the code segment to be detected;
acquiring a function with abnormal execution time according to the measured function execution time of at least one function;
and analyzing the code of the function with the abnormal execution time to obtain a code field causing the abnormal execution time.
Optionally, the obtaining of the function with abnormal execution time according to the measured function execution time of the at least one function includes:
and if the measured function execution time exceeds a preset threshold value, the function is a function with abnormal execution time.
Optionally, the functions include a first type function and a second type function, and if the measured execution time of the function exceeds a preset threshold, the method includes:
if the function execution time of the first type of function obtained through measurement exceeds a first preset threshold value, or if the function execution time of the second type of function obtained through measurement exceeds a second preset threshold value.
Optionally, the method further includes:
and sorting the functions with the execution time exceeding a preset threshold value according to the execution time of the functions, and analyzing codes of the functions with abnormal execution time in sequence according to the execution time of the functions.
Optionally, the measuring the function execution time of at least one function in the code segment to be detected includes:
recording the initial calling time of the at least one function and the termination calling time of the at least one function in the running process of the code segment to be detected, and determining the function execution time of the at least one function according to the time difference between the initial calling time and the termination calling time.
Optionally, before measuring the function execution time of at least one function in the code segment to be detected, the method further includes:
acquiring a pre-constructed function execution time measurement toolkit, and operating the function execution time measurement toolkit;
the measuring the function execution time of at least one function in the code segment to be detected comprises:
the function execution time measurement toolkit measures the function execution time of at least one function in the running code segment to be detected.
Optionally, analyzing the code of the function with the execution time exception to obtain a code field causing the execution time exception includes:
and acquiring code fields with the execution time gradually increased, or acquiring code fields with the external interaction duration exceeding the preset time.
Optionally, the method further includes:
and acquiring the modification of the code field of the execution time exception by the user so as to continue executing according to the modified code.
In a second aspect, an embodiment of the present disclosure provides a fault query apparatus, including:
the measuring module is used for measuring the function execution time of at least one function in the code segment to be detected;
the abnormal function acquisition module is used for acquiring a function with abnormal execution time according to the measured function execution time of at least one function;
and the code analysis module is used for analyzing the codes of the function with the abnormal execution time so as to obtain a code field causing the abnormal execution time.
Optionally, the abnormal function obtaining module is specifically configured to:
and if the measured function execution time exceeds a preset threshold value, the function is a function with abnormal execution time.
Optionally, the functions include a first type function and a second type function, and if the measured execution time of the function exceeds a preset threshold, the method includes:
if the function execution time of the first type of function obtained through measurement exceeds a first preset threshold value, or if the function execution time of the second type of function obtained through measurement exceeds a second preset threshold value.
Optionally, the apparatus further comprises:
and the sorting module is used for sorting the functions with the execution time exceeding the preset threshold according to the execution time of the functions and analyzing the codes of the functions with abnormal execution time in sequence according to the execution time of the functions.
Optionally, the measurement module is specifically configured to:
recording the initial calling time of the at least one function and the termination calling time of the at least one function in the running process of the code segment to be detected, and determining the function execution time of the at least one function according to the time difference between the initial calling time and the termination calling time.
Optionally, the apparatus further comprises:
the measurement tool construction module is used for acquiring a pre-constructed function execution time measurement tool package and operating the function execution time measurement tool package;
correspondingly, the measurement module is used for:
the function execution time measurement toolkit measures the function execution time of at least one function in the running code segment to be detected.
Optionally, the code parsing module is further configured to:
and acquiring code fields with the execution time gradually increased, or acquiring code fields with the external interaction duration exceeding the preset time.
Optionally, the apparatus further comprises:
and the modification module is used for acquiring the modification of the code field with the execution time exception by the user so as to continue executing according to the modified code.
In a third aspect, an embodiment of the present disclosure provides a server, including:
one or more processors;
a memory for storing one or more programs;
when the one or more programs are executed by the one or more processors, the one or more processors are caused to implement the fault querying method according to any one of the first aspect of the embodiments of the present disclosure.
In a fourth aspect, this disclosed embodiment also provides a computer-readable storage medium, on which a computer program is stored, where the computer program, when executed by a processor, implements the fault query method according to any one of the first aspect of this disclosed embodiment.
The embodiment of the disclosure provides a fault query method, a fault query device, a server and a storage medium, wherein the execution time of each function in a code segment is measured, the function with abnormal execution time is determined, and a code field causing the abnormal execution time is analyzed, so that the code field is modified, the load of a central processing unit is reduced, and the user experience is improved.
Drawings
Fig. 1 is a schematic flow chart of a fault query method provided in an embodiment of the present disclosure;
fig. 2 is a schematic flow chart of a fault query method provided in an embodiment of the present disclosure;
fig. 3 is a schematic flow chart of a fault query method provided by the embodiment of the present disclosure;
fig. 4 is a schematic structural diagram of a fault query apparatus provided in an embodiment of the present disclosure;
fig. 5 is a schematic structural diagram of a server according to an embodiment of the present disclosure.
Detailed Description
The present disclosure is described in further detail below with reference to the accompanying drawings and examples. It is to be understood that the specific embodiments described herein are merely illustrative of the disclosure and are not limiting of the disclosure. It should be further noted that, for the convenience of description, only some of the structures relevant to the present disclosure are shown in the drawings, not all of them.
It should be noted that the terms "system" and "network" are often used interchangeably in this disclosure. Reference to "and/or" in embodiments of the present disclosure is intended to "include any and all combinations of one or more of the associated listed items. The terms "first", "second", and the like in the description and claims of the present disclosure and in the drawings are used for distinguishing between different objects and not for limiting a particular order.
It should also be noted that the following embodiments of the present disclosure may be implemented individually, or may be implemented in combination with each other, and the embodiments of the present disclosure are not limited specifically.
Referring to fig. 1, a schematic flow chart of a fault querying method provided by the embodiment of the present disclosure is shown, where the embodiment of the present disclosure is applicable to finding and modifying a situation causing an overload of a central processing unit, and the method may be executed by a fault querying device, where the device may be implemented in a software and/or hardware manner and may be configured in a server, as shown in fig. 1, the method specifically includes the following steps:
s101, measuring the function execution time of at least one function in the code segment to be detected.
At present, the problem of high CPU load is frequently encountered in service practice, wherein the main reason is caused by leakage of codes, and therefore the problem of high CPU load can be determined by detecting the implementation codes of various services. The code segment to be detected is a service implementation code, and the implementation code comprises a plurality of functions, so that the reason of high CPU load can be found only by determining whether the execution time of each function is abnormal.
Illustratively, in the running process of the code segment to be detected, for any function, the starting call time of the function and the terminating call time of the function are recorded, and then the function execution time of the function is determined according to the time difference between the starting call time and the terminating call time of the function. The same can determine the function execution time of all functions in the code segment to be detected.
And S102, acquiring a function with abnormal execution time according to the measured function execution time of at least one function.
In this embodiment, a time threshold may be preset for all functions in the code segment to be detected, the function execution time of each function determined in step S101 is compared with the time threshold, a function whose function execution time is greater than the time threshold is defined as a function with an abnormal execution time, and the function with the abnormal execution time is output, so as to analyze the code segment with the abnormal execution time in the function.
Furthermore, since the normal execution times of different functions are different, the functions are classified according to the normal execution time of each function, and different time thresholds are set for different types. Illustratively, the function type includes a first type and a second type, and the corresponding time thresholds are a first preset threshold and a second preset threshold, respectively. Therefore, if the execution time of any one of the first type functions exceeds a first preset threshold value, the function execution time of the function is determined to be abnormal; and if the measured execution time of any function in the second type of functions exceeds a second preset threshold, determining that the execution time of the function is abnormal.
The first type function may be a list item traversal function, and a time threshold may be set for the function, and of course, for different application scenarios, the specific value of the time threshold may also be adjusted; the second type of function may be a function that performs data input and output operations to the outside, or may set a time threshold for the function, and of course, for different application scenarios, the specific value of the time threshold may also be adjusted, which is not limited in this embodiment.
Further, after determining the function with abnormal function execution time, sorting the functions with abnormal execution time according to the length of the function execution time, illustratively, sorting the functions according to the sequence of the function execution time from long to short, and outputting the sorting result.
S103, analyzing the codes of the function with the abnormal execution time to obtain code fields causing the abnormal execution time.
And analyzing codes in the function with the abnormal execution time in sequence according to the sequencing result of the function with the abnormal execution time output in the step S102 to obtain a code field causing the abnormal execution time. Wherein the code field causing the execution time exception comprises: and the code field with the execution time gradually increased and the code field with the external interaction duration exceeding the preset time.
For the process of determining the code field with the gradually increasing execution time, for example, for a certain list item traversal function, when executing the code field a in the function, data in the list is traversed to query target data, and in the process of executing the service, data is continuously added to the list from a target data source, so that more and more data are in the list, the operation complexity in the subsequent list traversal is increased, and a large amount of time is consumed, so that the code field a is the code field with the gradually increasing execution time, that is, the code field with the abnormal execution time of the function.
For the process of determining the code field with the external interaction duration exceeding the preset time, exemplarily, for a function performing data input and output operations to the outside, a picture processed by the external processor needs to be acquired when the code field B is executed, a large amount of time needs to be waited when the picture is acquired from the external processor due to network delay and the like, and if the waiting time is greater than the preset time, the code field B is determined to be the code field with the external interaction duration exceeding the preset time, that is, the code field causing the execution time abnormality.
According to the method and the device, the execution time of each function in the code segment is measured, the function with the abnormal execution time is determined, and the code field causing the abnormal execution time is analyzed, so that the code field can be modified, the load of a central processing unit is reduced, and the user experience is improved.
Referring to fig. 2, a flowchart of a fault query method provided by the embodiment of the present disclosure is shown, where the embodiment is further optimized based on the foregoing embodiment. As shown in fig. 2, the fault query method includes:
s201, obtaining a pre-constructed function execution time measurement toolkit, and operating the function execution time measurement toolkit.
The function execution time measurement toolkit can be constructed through an analysis tool carried by the current applied programming language or constructed through editing codes. For example, for Python language, the analysis tool cProfile is provided in the standard library, which is dedicated to measuring the execution time of each function, so that the function execution time measurement toolkit can be constructed on the basis of the cProfile. For other programming languages, if there is no tool or function specially analyzing the execution time of the function, the function needs to be constructed by editing the code.
And for the constructed function execution time measurement toolkit, the execution time of each function in the code segment can be realized only by installing the toolkit on a server running the code segment to be detected. In another embodiment, the built function execution time measurement kit can be independently installed on a specific server, and the server detects the function execution time specially.
S202, the function execution time measurement tool package measures the function execution time of at least one function in the code segment to be detected running on the server.
S203, acquiring a function with abnormal execution time according to the measured function execution time of at least one function.
And the function execution time measurement tool kit determines the functions with abnormal function execution time, sorts the functions according to the execution time from long to short, and outputs a sorting result so as to analyze the codes of the functions with abnormal execution time in the following process.
S204, analyzing the codes of the function with the abnormal execution time to obtain code fields causing the abnormal execution time.
According to the method and the device, the function execution time measurement toolkit is constructed and installed, the toolkit measures the execution time of each function in the code segment, the function with abnormal execution time is determined, the code field causing abnormal execution time is analyzed, and therefore modification is conducted on the code field, the load of a central processing unit is reduced, and the user experience is improved.
Referring to fig. 3, a flowchart of a fault query method provided by the embodiment of the present disclosure is shown, where the embodiment is further optimized based on the foregoing embodiment. As shown in fig. 3, the fault query method includes:
s301, a pre-constructed function execution time measurement toolkit is obtained, and the function execution time measurement toolkit is operated.
S302, the function execution time measurement tool package measures the function execution time of at least one function in the code segment to be detected running on the server.
S303, obtaining the function with abnormal execution time according to the measured function execution time of at least one function.
And sorting the functions with abnormal execution time according to the execution time by the function execution time measurement toolkit, and outputting a sorting result.
S304, analyzing the codes of the function with the abnormal execution time to obtain code fields causing the abnormal execution time.
According to the sorting result of the function with abnormal execution time output in step S303, the codes in the function with abnormal execution time are sequentially analyzed to obtain the code field causing the abnormal execution time. Wherein the code field causing the execution time exception comprises: and the code field with the execution time gradually increased and the code field with the external interaction duration exceeding the preset time.
S305, acquiring the modification of the code field with the execution time exception by the user, so as to continue executing according to the modified code.
The class to which the code field causing the execution time exception belongs is modified. For example, for the code field with gradually increasing execution time in the above embodiment, duplicate data in the list may be deleted by adding a deduplication operation, so that the execution time of the function may be reduced subsequently according to the modified code. For the code field with the external interaction time length exceeding the preset time in the above example, the picture acquired from the external processor can be cached locally in advance, and the code is modified to be the required picture directly acquired from the cache, so that waiting for a large amount of time due to network delay and the like is avoided, and the function execution time is reduced.
The embodiment modifies the code field with abnormal execution time in a targeted manner, reduces the execution time of the function, reduces the load of the central processing unit and improves the user experience.
Fig. 4 is a schematic structural diagram of a fault querying device according to an embodiment of the present disclosure, and specifically, the fault querying device may be configured in a server, and includes:
a measuring module 401, configured to measure a function execution time of at least one function in a code segment to be detected;
an abnormal function obtaining module 402, configured to obtain a function with abnormal execution time according to the measured function execution time of the at least one function;
a code parsing module 403, configured to parse a code of the execution time abnormal function to obtain a code field causing the execution time abnormality.
In this embodiment, the abnormal function obtaining module 402 determines a function with abnormal execution time according to the execution time of each function in the code segment measured by the measuring module 401, and the code analyzing module 403 analyzes a code field in which the execution time is abnormal, so as to modify the code field, thereby reducing the load of the central processing unit and improving the user experience.
On the basis of the foregoing embodiment, the abnormal function acquiring module is specifically configured to:
and if the measured function execution time exceeds a preset threshold value, the function is a function with abnormal execution time.
On the basis of the above embodiment, the functions include a first type function and a second type function, and if the measured function execution time exceeds a preset threshold, the method includes:
if the function execution time of the first type of function obtained through measurement exceeds a first preset threshold value, or if the function execution time of the second type of function obtained through measurement exceeds a second preset threshold value.
On the basis of the above embodiment, the apparatus further includes:
and the sorting module is used for sorting the functions with the execution time exceeding the preset threshold according to the execution time of the functions and analyzing the codes of the functions with abnormal execution time in sequence according to the execution time of the functions.
On the basis of the above embodiment, the measurement module is specifically configured to:
recording the initial calling time of the at least one function and the termination calling time of the at least one function in the running process of the code segment to be detected, and determining the function execution time of the at least one function according to the time difference between the initial calling time and the termination calling time.
On the basis of the above embodiment, the apparatus further includes:
the measuring tool building module is used for obtaining a pre-built function execution time measuring tool package and running the function execution time measuring tool package on a server running the code segment to be detected;
on the basis of the above embodiment, the measurement module is configured to:
the function execution time measurement toolkit measures the function execution time of at least one function in the code segment to be detected running on the server.
On the basis of the foregoing embodiment, the code parsing module is further configured to:
and acquiring code fields with the execution time gradually increased, or acquiring code fields with the external interaction duration exceeding the preset time.
On the basis of the above embodiment, the apparatus further includes:
and the modification module is used for acquiring the modification of the code field with the execution time exception by the user so as to continue executing according to the modified code.
The above fault query device provided by the embodiment of the disclosure can execute the steps executed by the server in the fault query method provided by the embodiment of the disclosure, and has the corresponding functional modules and beneficial effects of the execution method.
Referring now to FIG. 5, a block diagram of a server 500 suitable for use in implementing embodiments of the present disclosure is shown. The server shown in fig. 5 is only an example, and should not bring any limitation to the functions and the scope of use of the embodiments of the present disclosure.
As shown in fig. 5, the server 500 may include a processing device (e.g., a central processing unit, a graphics processor, etc.) 501, which may perform various appropriate actions and processes according to a program stored in a Read Only Memory (ROM)502 or a program loaded from a storage device 508 into a Random Access Memory (RAM)503, for example, implement the fault query method provided by the embodiments of the present disclosure, including:
measuring the function execution time of at least one function in the code segment to be detected;
acquiring a function with abnormal execution time according to the measured function execution time of at least one function;
and analyzing the code of the function with the abnormal execution time to obtain a code field causing the abnormal execution time.
In the RAM 503, various programs and data necessary for the operation of the server 500 are also stored. The processing device 501, the ROM502, and the RAM 503 are connected to each other through a bus 504. An input/output (I/O) interface 505 is also connected to bus 504.
Generally, the following devices may be connected to the I/O interface 505: input devices 506 including, for example, a touch screen, touch pad, keyboard, mouse, camera, microphone, accelerometer, gyroscope, etc.; output devices 507 including, for example, a Liquid Crystal Display (LCD), speakers, vibrators, and the like; storage devices 508 including, for example, magnetic tape, hard disk, etc.; and a communication device 509; further, an image pickup device 510 for video shooting, such as a camera, is also included. The communication means 509 may allow the server 500 to perform wireless or wired communication with other devices to exchange data. While fig. 5 illustrates a server 500 having various means, it is to be understood that not all illustrated means are required to be implemented or provided. More or fewer devices may alternatively be implemented or provided.
In particular, according to an embodiment of the present disclosure, the processes described above with reference to the flowcharts may be implemented as computer software programs. For example, embodiments of the present disclosure include a computer program product comprising a computer program embodied on a computer readable medium, the computer program comprising program code for performing the method illustrated in the flow chart. In such an embodiment, the computer program may be downloaded and installed from a network via the communication means 59, or installed from the storage means 508, or installed from the ROM 502. The computer program performs the above-described functions defined in the methods of the embodiments of the present disclosure when executed by the processing device 501.
It should be noted that the computer readable medium in the present disclosure can be a computer readable signal medium or a computer readable storage medium or any combination of the two. A computer readable storage medium may be, for example, but not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination of the foregoing. More specific examples of the computer readable storage medium may include, but are not limited to: an electrical connection having one or more wires, a portable computer diskette, a hard disk, a Random Access Memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing. In the present disclosure, a computer readable storage medium may be any tangible medium that can contain, or store a program for use by or in connection with an instruction execution system, apparatus, or device. In contrast, in the present disclosure, a computer readable signal medium may comprise a propagated data signal with computer readable program code embodied therein, either in baseband or as part of a carrier wave. Such a propagated data signal may take many forms, including, but not limited to, electro-magnetic, optical, or any suitable combination thereof. A computer readable signal medium may also be any computer readable medium that is not a computer readable storage medium and that can communicate, propagate, or transport a program for use by or in connection with an instruction execution system, apparatus, or device. Program code embodied on a computer readable medium may be transmitted using any appropriate medium, including but not limited to: electrical wires, optical cables, RF (radio frequency), etc., or any suitable combination of the foregoing.
The computer readable medium may be embodied in the server; or may exist separately and not be assembled into the server.
The computer readable medium carries one or more programs, and when the one or more programs are executed by the server, the server executes the fault query method provided by the embodiment, where the method includes:
measuring the function execution time of at least one function in the code segment to be detected;
acquiring a function with abnormal execution time according to the measured function execution time of at least one function;
and analyzing the code of the function with the abnormal execution time to obtain a code field causing the abnormal execution time.
Computer program code for carrying out operations for aspects of the present disclosure may be written in any combination of one or more programming languages, including an object oriented programming language such as Java, Smalltalk, C + +, and conventional procedural programming languages, such as the "C" programming language or similar programming languages. The program code may execute entirely on the user's computer, partly on the user's computer, as a stand-alone software package, partly on the user's computer and partly on a remote computer or entirely on the remote computer or server. In the case of a remote computer, the remote computer may be connected to the user's computer through any type of network, including a Local Area Network (LAN) or a Wide Area Network (WAN), or the connection may be made to an external computer (for example, through the Internet using an Internet service provider).
The flowchart and block diagrams in the figures illustrate the architecture, functionality, and operation of possible implementations of systems, methods and computer program products according to various embodiments of the present disclosure. In this regard, each block in the flowchart or block diagrams may represent a module, segment, or portion of code, which comprises one or more executable instructions for implementing the specified logical function(s). It should also be noted that, in some alternative implementations, the functions noted in the block may occur out of the order noted in the figures. For example, two blocks shown in succession may, in fact, be executed substantially concurrently, or the blocks may sometimes be executed in the reverse order, depending upon the functionality involved. It will also be noted that each block of the block diagrams and/or flowchart illustration, and combinations of blocks in the block diagrams and/or flowchart illustration, can be implemented by special purpose hardware-based systems which perform the specified functions or acts, or combinations of special purpose hardware and computer instructions.
The modules described in the embodiments of the present disclosure may be implemented by software or hardware. The name of the module does not in some cases form a limitation of the template itself, for example, the measurement module may also be described as a "module for measuring the function execution time of at least one function in the code segment to be detected".
The foregoing description is only exemplary of the preferred embodiments of the disclosure and is illustrative of the principles of the technology employed. It will be appreciated by those skilled in the art that the scope of the disclosure herein is not limited to the particular combination of features described above, but also encompasses other embodiments in which any combination of the features described above or their equivalents does not depart from the spirit of the disclosure. For example, the above features and (but not limited to) the features disclosed in this disclosure having similar functions are replaced with each other to form the technical solution.

Claims (11)

1. A method for querying for a fault, comprising:
measuring the function execution time of at least one function in the code segment to be detected;
acquiring a function with abnormal execution time according to the measured function execution time of at least one function;
and analyzing the code of the function with the abnormal execution time to obtain a code field causing the abnormal execution time.
2. The method according to claim 1, wherein the obtaining the function with abnormal execution time according to the measured function execution time of the at least one function comprises:
and if the measured function execution time exceeds a preset threshold value, the function is a function with abnormal execution time.
3. The method of claim 2, wherein the functions include a first type function and a second type function, and the step of, if the measured execution time of the function exceeds a predetermined threshold, performing the step of:
if the function execution time of the first type of function obtained through measurement exceeds a first preset threshold value, or if the function execution time of the second type of function obtained through measurement exceeds a second preset threshold value.
4. The method of claim 2, wherein the method further comprises:
and sorting the functions with the execution time exceeding a preset threshold value according to the execution time of the functions, and analyzing codes of the functions with abnormal execution time in sequence according to the execution time of the functions.
5. The method according to claim 1, wherein the measuring the function execution time of the at least one function in the code segment to be detected comprises:
recording the initial calling time of the at least one function and the termination calling time of the at least one function in the running process of the code segment to be detected, and determining the function execution time of the at least one function according to the time difference between the initial calling time and the termination calling time.
6. The method according to claim 1, wherein the step of measuring the function execution time of the at least one function in the code segment to be detected further comprises:
acquiring a pre-constructed function execution time measurement toolkit, and operating the function execution time measurement toolkit;
correspondingly, the measuring the function execution time of at least one function in the code segment to be detected includes:
the function execution time measurement toolkit measures the function execution time of at least one function in the running code segment to be detected.
7. The method of claim 1, wherein parsing code of the function that performs the execution time exception to obtain a code field that causes the execution time exception comprises:
and acquiring code fields with the execution time gradually increased, or acquiring code fields with the external interaction duration exceeding the preset time.
8. The method of fault querying according to claim 1, wherein the method further comprises:
and acquiring the modification of the code field of the execution time exception by the user so as to continue executing according to the modified code.
9. A fault querying device, comprising:
the measuring module is used for measuring the function execution time of at least one function in the code segment to be detected;
the abnormal function acquisition module is used for acquiring a function with abnormal execution time according to the measured function execution time of at least one function;
and the code analysis module is used for analyzing the codes of the function with the abnormal execution time so as to obtain a code field causing the abnormal execution time.
10. A server, comprising:
one or more processors;
a memory for storing one or more programs;
when executed by the one or more processors, cause the one or more processors to implement the fault query method of any one of claims 1-8.
11. A computer-readable storage medium, on which a computer program is stored which, when being executed by a processor, carries out the method for fault query according to any one of claims 1-8.
CN201811628533.9A 2018-12-28 2018-12-28 Fault query method, device, server and storage medium Pending CN111382017A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201811628533.9A CN111382017A (en) 2018-12-28 2018-12-28 Fault query method, device, server and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201811628533.9A CN111382017A (en) 2018-12-28 2018-12-28 Fault query method, device, server and storage medium

Publications (1)

Publication Number Publication Date
CN111382017A true CN111382017A (en) 2020-07-07

Family

ID=71215043

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201811628533.9A Pending CN111382017A (en) 2018-12-28 2018-12-28 Fault query method, device, server and storage medium

Country Status (1)

Country Link
CN (1) CN111382017A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114185813A (en) * 2022-02-14 2022-03-15 成都爱瑞无线科技有限公司 Test vector generation method, device, test method, system and storage medium

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114185813A (en) * 2022-02-14 2022-03-15 成都爱瑞无线科技有限公司 Test vector generation method, device, test method, system and storage medium
CN114185813B (en) * 2022-02-14 2022-04-19 成都爱瑞无线科技有限公司 Test vector generation method, device, test method, system and storage medium

Similar Documents

Publication Publication Date Title
US8671397B2 (en) Selective data flow analysis of bounded regions of computer software applications
US8856764B2 (en) Distributed static analysis of computer software applications
US9454375B2 (en) Parallel program analysis and branch prediction
US10481964B2 (en) Monitoring activity of software development kits using stack trace analysis
US9223552B2 (en) Compiling optimization of an application and compiler thereof
US10929265B2 (en) Optimizing automated interactions with web applications
US20120054724A1 (en) Incremental static analysis
CN111382017A (en) Fault query method, device, server and storage medium
US8819635B2 (en) Confidence-based static analysis
CN111258797A (en) Memory leak detection method, device, medium and electronic equipment
CN107342917B (en) Method and apparatus for detecting network device performance
CN110908882A (en) Performance analysis method and device of application program, terminal equipment and medium
CN110059064B (en) Log file processing method and device and computer readable storage medium
CN111200744B (en) Multimedia playing control method and device and intelligent equipment
CN114064376A (en) Page monitoring method and device, electronic equipment and medium
CN112463200A (en) Development kit processing method and device, electronic device and storage medium
CN114090058A (en) Service verification method, device, equipment, computer readable storage medium and product
CN112948209A (en) Application program use result generation method and device, electronic equipment and storage medium
CN113641544A (en) Method, apparatus, device, medium and product for detecting application status
CN114116517A (en) Front-end item analysis method, device, medium and electronic equipment
CN113342633A (en) Performance test method and device
CN112379967A (en) Simulator detection method, device, equipment and medium
CN111045926A (en) Application program jamming detection method, device, medium and electronic equipment
CN114090514A (en) Log retrieval method and device for distributed system
CN115373932A (en) Component operation monitoring method and device

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