CN110688245A - Information acquisition method, device, storage medium and equipment - Google Patents

Information acquisition method, device, storage medium and equipment Download PDF

Info

Publication number
CN110688245A
CN110688245A CN201910951262.9A CN201910951262A CN110688245A CN 110688245 A CN110688245 A CN 110688245A CN 201910951262 A CN201910951262 A CN 201910951262A CN 110688245 A CN110688245 A CN 110688245A
Authority
CN
China
Prior art keywords
information
preset
system function
application program
function
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.)
Granted
Application number
CN201910951262.9A
Other languages
Chinese (zh)
Other versions
CN110688245B (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.)
Bigo Technology Singapore Pte Ltd
Original Assignee
Guangzhou Baiguoyuan Information 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 Guangzhou Baiguoyuan Information Technology Co Ltd filed Critical Guangzhou Baiguoyuan Information Technology Co Ltd
Priority to CN201910951262.9A priority Critical patent/CN110688245B/en
Publication of CN110688245A publication Critical patent/CN110688245A/en
Application granted granted Critical
Publication of CN110688245B publication Critical patent/CN110688245B/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/07Responding to the occurrence of a fault, e.g. fault tolerance
    • G06F11/0703Error or fault processing not based on redundancy, i.e. by taking additional measures to deal with the error or fault not making use of redundancy in operation, in hardware, or in data representation
    • G06F11/079Root cause analysis, i.e. error or fault diagnosis
    • 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
    • G06F11/3476Data logging

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • General Engineering & Computer Science (AREA)
  • Quality & Reliability (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Computer Hardware Design (AREA)
  • Health & Medical Sciences (AREA)
  • Biomedical Technology (AREA)
  • Debugging And Monitoring (AREA)

Abstract

The embodiment of the invention discloses an information acquisition method, an information acquisition device, a storage medium and equipment. Wherein, the method comprises the following steps: when the fact that the preset application program enters the preset stuck state is detected, a pointer of a first system function of the running-time object is obtained, wherein the first system function comprises a function for backing up running-time information when the application program does not respond, the first system function is called through the running-time object, an output stream is transmitted into the first system function, and information contained in the output stream is obtained, so that stuck context information is obtained. According to the technical scheme provided by the embodiment of the invention, when the application program is detected to be blocked, the function called by the system when the application program has no response event is called to obtain the blocking context information, so that the system limitation can be broken through to obtain more comprehensive blocking context information, and the blocking problem can be accurately positioned and solved.

Description

Information acquisition method, device, storage medium and equipment
Technical Field
The embodiment of the invention relates to the technical field of computers, in particular to an information acquisition method, an information acquisition device, a storage medium and information acquisition equipment.
Background
At present, intelligent terminals become necessary electronic equipment in daily life of most users. With the rapid development of intelligent terminal technology and the internet, the functions in the intelligent terminal are more and more perfect, various application programs can be installed, and the functions realized by the application programs are more and more complex.
In the use process of the intelligent terminal, the fluency of the application program is one of key performances concerned by the user, and the requirement of the complexity of the application program on hardware resources is higher and higher, so that the application program on the intelligent terminal is easy to be blocked or even has no response, and the user experience is seriously influenced. In order to reduce the occurrence of the application program pause as much as possible, it is necessary to acquire and analyze the relevant information when the application program pause occurs.
Disclosure of Invention
The embodiment of the invention provides an information acquisition method, an information acquisition device, a storage medium and equipment, which can optimize a scheme for acquiring related information when an application program is in a pause state.
In a first aspect, an embodiment of the present invention provides an information obtaining method, where the method includes:
when detecting that a preset application program enters a preset stuck state, acquiring a pointer of a first system function of a runtime object, wherein the first system function comprises a function for backing up runtime information when an application program non-response event occurs;
calling the first system function through the runtime object, and transmitting an output stream into the first system function;
and acquiring information contained in the output stream to obtain the stuck context information.
In a second aspect, an embodiment of the present invention provides an information acquiring apparatus, including:
the function pointer acquisition module is used for acquiring a pointer of a first system function of a runtime object when detecting that a preset application program enters a preset stuck state, wherein the first system function comprises a function for backing up runtime information when an application program non-response event occurs;
the function calling module is used for calling the first system function through the runtime object and transmitting an output stream into the first system function;
and the information acquisition module is used for acquiring the information contained in the output stream to obtain the stuck context information.
In a third aspect, an embodiment of the present invention provides a computer-readable storage medium, on which a computer program is stored, where the computer program, when executed by a processor, implements the information obtaining method provided in the embodiment of the present invention.
In a fourth aspect, an embodiment of the present invention provides an intelligent terminal device, which includes a memory, a processor, and a computer program stored in the memory and executable on the processor, where the processor executes the computer program to implement the information acquisition method provided in the embodiment of the present invention.
According to the information acquisition scheme provided by the embodiment of the invention, when the preset application program is detected to enter the preset stuck state, the pointer of the first system function of the runtime object is acquired, wherein the first system function comprises a function for backing up runtime information when the application program does not respond, the first system function is called through the runtime object, the output stream is transmitted to the first system function, and the information contained in the output stream is acquired so as to obtain the stuck context information. By adopting the technical scheme, when the application program is detected to be blocked, the blocking context information is obtained by calling the function called by the system when the application program has no response event, so that the system limitation can be broken through to obtain more comprehensive blocking context information, and the blocking problem can be accurately positioned and solved.
Drawings
Fig. 1 is a schematic flowchart of an information obtaining method according to an embodiment of the present invention;
fig. 2 is a schematic flowchart of an information obtaining method according to a second embodiment of the present invention;
fig. 3 is a schematic flowchart of an information obtaining method according to a third embodiment of the present invention;
fig. 4 is a schematic flowchart of an information obtaining method for a high-version operating system according to a third embodiment of the present invention;
fig. 5 is a schematic flowchart of an information obtaining method for a low-version operating system according to a third embodiment of the present invention;
fig. 6 is a block diagram of an information acquisition apparatus according to a fourth embodiment of the present invention;
fig. 7 is a block diagram of an intelligent terminal device according to a sixth embodiment of the present invention.
Detailed Description
The present invention will be described in further detail with reference to the accompanying drawings and examples. It is to be understood that the specific embodiments described herein are merely illustrative of the invention and are not limiting of the invention. It should be further noted that, for the convenience of description, only some of the structures related to the present invention are shown in the drawings, not all of the structures. In addition, the embodiments and features of the embodiments in the present invention may be combined with each other without conflict.
Before discussing exemplary embodiments in more detail, it should be noted that some exemplary embodiments are described as processes or methods depicted as flowcharts. Although a flowchart may describe the steps as a sequential process, many of the steps can be performed in parallel, concurrently or simultaneously. In addition, the order of the steps may be rearranged. The process may be terminated when its operations are completed, but may have additional steps not included in the figure. The processes may correspond to methods, functions, procedures, subroutines, and the like.
Example one
Fig. 1 is a schematic flowchart of an information obtaining method according to an embodiment of the present invention, where the method may be executed by an information obtaining apparatus, where the apparatus may be implemented by software and/or hardware, and may be generally integrated in an intelligent terminal device. As shown in fig. 1, the method includes:
step 101, when detecting that a preset application program enters a preset stuck state, acquiring a pointer of a first system function of a runtime object, wherein the first system function comprises a function for backing up runtime information when an application program non-response event occurs.
By way of example, the smart terminal device may include a smart phone, a tablet computer, a notebook computer, a smart appliance, and other devices capable of loading an operating system. The embodiment of the invention does not limit the type of the operating system loaded in the intelligent terminal device, and the operating system can be an Android (Android) operating system, a Windows (Windows) operating system, a Linux operating system and the like.
For example, the preset application may include any application installed in the smart terminal device, or may include a preset part of the application. The technical scheme provided by the embodiment of the invention can be realized by utilizing a Software Development Kit (SDK), an application program developer writes the SDK, and accesses the SDK in a preset application program, so that the related functions of the technical scheme provided by the embodiment of the invention are realized in the SDK.
For example, the preset stuck state may be a state in which an abnormal condition occurs in the interface display of the predefined application program, and generally, regarding the display effect, the display may be represented by a phenomenon that the user interface is switched to be stagnated, slow or jumped, the user interface cannot be matched with sound, the content in the user interface is smeared, and the like, and an index for evaluating the stuck state may be set according to an actual requirement, which is not specifically limited in the embodiment of the present invention. Optionally, the stuck state may be evaluated based on a frame rate of the application program, for example, a frame rate of the preset application program in the operation process is obtained, and when it is detected that the current frame rate is smaller than a preset frame rate threshold, it is determined that the preset application program is detected to enter the preset stuck state. The preset frame rate threshold may be freely set, and may be, for example, 30Hz, i.e., 30 frames per second. In addition, the stuck state can be judged according to the drawing time length of the picture, the drawing interval of two adjacent frames of pictures, other items and the like.
In the related art, when an application program is stuck, context information of a main thread of the application program can be acquired through an exposed interface, but the information is not enough for analyzing and solving the stuck problem. In addition, when an Application generates an unresponsive (ANR) event, a trace file, such as a trace. txt file in an Android system, is generated inside the operating system, and information related to a current process when ANR occurs, such as a stack of the current process and some state information of a current virtual machine, is recorded in the trace file, so as to form trace information. However, the application program in the intelligent terminal device, especially the third-party application program, does not have the read-write permission of the file, and therefore, the relevant information in the trace file cannot be acquired for analyzing and positioning the stuck problem.
In the embodiment of the invention, when the preset application program is blocked, the limitation of the system to the application program can be broken through, and a trace information collection scene when the ANR occurs can be simulated, so that the blocking context information can be more comprehensively obtained, and the method and the device can be used for helping the preset application program to specifically solve the blocking problem. When the preset application program is detected to enter the preset stuck state, a pointer of a first system function of a Runtime (Runtime) object is acquired so as to call the first system function subsequently. The first system function includes a function for backing up (dump) runtime information when an application unresponsive event occurs, and in the Android system, the first system function is a dumpfigquit function. For convenience of explanation, the Android system will be described as an example.
Illustratively, Native (Native) methods may be written in advance, a Java Native Interface (JNI) layer call may be performed by calling the Native methods, and then a pointer of the first system function may be obtained. Specifically, a first dynamic link library may be opened, and a pointer of a runtime object in the first dynamic link library and a pointer of a first system function of the runtime object may be obtained. The first dynamic link library may be, for example, libart. And acquiring a pointer of a Runtime object unique to the system through a dlsym function, wherein the dlsym function can acquire the pointer of the Runtime object by accessing a symbol (symbol) table. After acquiring the pointer of the Runtime object, the pointer of the dumpfsigquit function of the Runtime object may be acquired continuously through the dlsym function.
And 102, calling the first system function through the runtime object, and transmitting an output stream into the first system function.
For example, through the call to the first system function, the system when the ANR event occurs in the application may be simulated to obtain the related information of the current process, that is, trace information, by calling the first system function. The output stream can be viewed as an output channel, and the output stream can be a byte output stream or a character output stream, such as OutputStream, Writer, or OutputStream Writer. By transferring the output stream into the first system function, the trace information obtained by calling the first system function can be written into the output stream.
And 103, acquiring information contained in the output stream to obtain the stuck context information.
Illustratively, the morton context information may include relevant information for analyzing morton, such as Java layer stack information, kernel (kernel) stack information, Native (Native) stack information, and other relevant information. Stack call information may be included in the stack information, such as attribute information (e.g., number) of the stack called, location of the call, and time of the call, among others. The stuck context information is included in trace information obtained by calling the first system function, and the stuck context information can be obtained by obtaining the information included in the output stream.
According to the information acquisition method provided by the embodiment of the invention, when the preset application program is detected to enter the preset stuck state, the pointer of the first system function of the runtime object is acquired, wherein the first system function comprises a function for backing up runtime information when the application program does not respond, the first system function is called through the runtime object, the output stream is transmitted into the first system function, and the information contained in the output stream is acquired so as to obtain the stuck context information. By adopting the technical scheme, when the application program is detected to be blocked, the blocking context information is obtained by calling the function called by the system when the application program has no response event, so that the system limitation can be broken through to obtain more comprehensive blocking context information, and the blocking problem can be accurately positioned and solved.
On the basis of the above embodiment, the stuck degree corresponding to the preset stuck state may be lower than the stuck degree corresponding to the application no-response event. The method has the advantages that due to the fact that the stuck degree is relatively serious when the application program has no response event, and when the stuck degree is not serious, the technical scheme provided by the embodiment of the invention can be used for obtaining stuck context information, the process of obtaining trace information when the ANR event occurs is simulated in advance, the stuck context information is further obtained, targeted analysis can be carried out on stuck problems with different degrees, and the stuck problem of the application program is solved more comprehensively.
On the basis of the above embodiment, after obtaining the morton context information, the method further includes: and writing the pause context information into a preset local file, and/or reporting the context information. The method has the advantages that the acquired katton context information can be stored or reported in time, and developers can analyze the katton problem conveniently. For example, the preset local file may be a newly created local file or an existing local file, which is not limited in the embodiment of the present invention. After the card pause context information is obtained, the card pause context information can be written into a preset local file, a preset application program has the permission of reading the preset local file, and the preset local file can be read when the card pause context information needs to be used, for example, a background server corresponding to the preset application program can read the preset local file through the preset application program, and then the card pause context information when the preset application program is in a card pause state is obtained. After the katoon context information is acquired, the katoon context information can also be directly reported, for example, to a background server corresponding to a preset application program, and a developer can analyze the katoon problem and solve the katoon problem according to the reported katoon context information in time. In addition, after the katoon context information is acquired, the katoon context information can be written into a preset local file firstly, and then the preset local file is reported, so that the purpose of reporting the katoon context information is achieved.
Example two
Fig. 2 is a schematic flow chart of an information obtaining method according to a second embodiment of the present invention, where optimization is performed based on the second embodiment, and related steps of creating a sub-process and obtaining morton context information by using the sub-process are added.
Illustratively, when detecting that the preset application program is stuck, obtaining a pointer of a first system function of the runtime object includes: when detecting that a preset application program is blocked, creating a child process of a first process of the preset application program, wherein the first process becomes a parent process, and acquiring a pointer of a first system function of an object in operation by using the child process. The calling the first system function through the runtime object and transmitting an output stream into the first system function includes: and calling the first system function through the runtime object by utilizing the subprocess, and transmitting an output stream into the first system function. The obtaining information contained in the output stream to obtain the stuck context information includes: acquiring information contained in the output stream by using the child process, and acquiring preset types of stack information of all threads of the parent process by using the child process; and obtaining the pause context information according to the information contained in the output stream and the stack information of the preset type. The method has the advantages that the created sub-process can be used for acquiring partial trace information of the main process of the preset application program, and the acquired other stack information is combined to obtain complete stuck context information, so that the multi-process scheme can effectively reduce or even avoid negative effects such as breakdown or secondary sticking on the preset application program.
Further, after obtaining the stuck context information according to the information contained in the output stream and the stack information of the preset type, the method may further include: and transferring the stuck context information to the parent process by utilizing a child process in a cross-process communication mode. The method has the advantages that the blocking context information is transmitted to the parent process, and the parent process can report the blocking context information conveniently in time. The cross-process communication mode may be, for example, an anonymous shared memory mode.
Optionally, as shown in fig. 2, the method may include:
step 201, when detecting that a preset application program enters a preset stuck state, creating a child process of a first process of the preset application program, wherein the first process becomes a parent process.
The first process is a main process of a preset application program and is also a parent process of the created child process. Illustratively, the JNI layer may be called by calling a Native method written in advance, and then creating a sub-process of the current process of the preset application program by using a fork function.
Step 202, opening a first dynamic link library by using a sub-process, and acquiring a pointer of a runtime object in the first dynamic link library and a pointer of a first system function of the runtime object.
Step 203, calling the first system function through the runtime object by using the subprocess, and transmitting an output stream into the first system function.
And step 204, acquiring the information contained in the output stream by utilizing the subprocess.
The execution process of step 202 to step 204 is similar to that of the above embodiment, except that the sub-process is used for completion, and is not described herein again. In addition, since the child process is used to complete the process, when the child process calls the first system function, the output stream only includes part of the morton context information, and the preset type stack information of all threads of the parent process is not included, and needs to be acquired separately through the following steps.
And step 205, acquiring preset types of stack information of all threads of the parent process by using the child process.
Illustratively, the preset type of Stack information includes kernel Stack (kernel Stack) information and Native Stack (Native Stack) information, and the information included in the output stream acquired by the child process includes Java layer Stack (Java Stack) information of all threads of the parent process.
Optionally, the obtaining, by the child process, kernel stack information of all threads of the parent process includes: and acquiring pointers of the thread list objects of the objects in operation through the child process, traversing all threads of the parent process, and acquiring corresponding kernel stack information by reading preset stack file directories corresponding to all processes respectively. The pointer of the ThreadList object can be obtained through runtime- > GetThreadList (), the ForEach function pointer of the ThreadList object is obtained through dlsym, the ForEach function is called to traverse all threads (Thread) of the parent process, and the Kernal Stack of the Thread of the parent process is obtained through reading/proc/ppid/task/tid/Stack.
Optionally, the obtaining, by the child process, kernel stack information of all threads of the parent process includes: and opening a second dynamic link library, acquiring a pointer of a second system function, and acquiring local stack information of all threads of the parent process by calling the second system function, wherein the second system function comprises a Backtrace function. The method comprises the steps of opening a libbtacktrace dynamic link library through dlopen, then obtaining a backstrace function pointer through dlsym, and obtaining Native stacks of all threads of a father process by calling the function pointer to specify the father process and the threads.
And step 206, utilizing the subprocess to obtain the stuck context information according to the information contained in the output stream and the stack information of the preset type.
Illustratively, the acquired incomplete morton context information, the Kernal Stack and the Native Stack may be assembled or summarized by the sub-process to obtain complete morton context information.
And step 207, transmitting the stuck context information to the parent process by utilizing the child process in an anonymous memory sharing mode.
And step 208, writing the morton context information into a preset local file through the parent process and reporting the information.
According to the information acquisition method provided by the embodiment of the invention, when the preset application program is detected to enter the preset stuck state, the child process of the preset application program is firstly created, partial trace information of the main process of the preset application program is acquired by utilizing the child process, and the complete stuck context information is acquired by combining with the acquired other stack information of the parent process, and is transmitted to the parent process, and then the parent process writes the complete stuck context information into a local file and reports the complete stuck context information.
On the basis of the above embodiment, optionally, the version number of the android operating system is lower than a preset version number, and the preset version number can be freely set, for example, the version 8.0. At present, in the world, especially in the third world, there are still many people using low-cost low-end intelligent terminal devices with less advanced hardware facilities, because the complexity of the application program has higher and higher requirements for hardware resources, the probability of the application program being stuck or even having no response on the low-end model is higher, and the version of the operating system generally installed on the low-end model is lower, and based on the factors such as compatibility and performance, for the low-version operating system, the multi-process scheme can be adopted to collect the stuck information of the application program, thereby reducing or even avoiding the negative effects such as breakdown or secondary sticking on the preset application program. For a high-version operating system, the implementation can be realized by adopting the related technical scheme in the first embodiment, that is, the katon context information is directly obtained through the process of the preset application program, so that the information obtaining efficiency can be improved, and the katon problem can be conveniently and timely analyzed.
EXAMPLE III
Fig. 3 is a schematic flow chart of an information obtaining method according to a third embodiment of the present invention, where the third embodiment of the present invention is optimized based on the foregoing embodiments, and different schemes may be adopted to obtain the morton information for different operating system versions.
Optionally, as shown in fig. 3, the method may include:
step 301, detecting that the preset application program enters a preset stuck state.
Step 302, judging whether the version number of the current operating system is lower than a preset version number, if so, executing step 306; otherwise, step 303 is performed.
It should be noted that this step may also be performed before step 301, and in addition, for the case where the version number of the operating system of the smart terminal is known, this step may also be unnecessary, and the morton information is directly obtained by using a corresponding scheme according to the version number.
Illustratively, for the current android operating system, the preset version number may be 8.0.
Step 303, opening the first dynamic link library, and obtaining a pointer of the runtime object in the first dynamic link library and a pointer of the first system function of the runtime object.
Step 304, calling the first system function through the runtime object, and transmitting an output stream into the first system function to obtain information contained in the output stream, so as to obtain the morton context information.
And 305, writing the pause context information into a preset local file and reporting.
Fig. 4 is a flowchart illustrating an information obtaining method for a high-version operating system according to a third embodiment of the present invention, and details of the foregoing steps 303 to 305 are further detailed, and the foregoing steps 303 to 305 can be further understood with reference to fig. 4.
And step 306, creating a sub-process of the current process of the preset application program.
Step 307, opening the first dynamic link library by using the sub-process, and obtaining a pointer of the runtime object in the first dynamic link library and a pointer of the first system function of the runtime object.
And 308, calling the first system function by the aid of the subprocess through the runtime object, and transmitting an output stream into the first system function to acquire information contained in the output stream.
Step 309, obtaining the kernel stack information and the local stack information of all threads of the parent process by using the child process, and summarizing the kernel stack information and the local stack information with the information in the output stream to obtain the morton context information.
And 310, transmitting the stuck context information to the parent process by utilizing the child process in an anonymous memory sharing mode.
And 311, writing the morton context information into a preset local file through the parent process and reporting the morton context information.
Fig. 5 is a flowchart of an information obtaining method for a low-version operating system according to a third embodiment of the present invention, and details of the steps 306 to 311 are further detailed, and the steps 306 to 311 can be further understood with reference to fig. 5.
According to the information acquisition method provided by the embodiment of the invention, different blockage information acquisition modes are selected according to the height of the operating system installed in the intelligent terminal equipment. For a high version, a scheme of simulating an ANR flow of a system can be directly adopted to obtain a runtime object pointer of the system in a dynamic link mode, and a DumpForSigQuit method of the object is called to obtain Trace information for reporting operation, so that the information obtaining efficiency can be ensured; for the low version, the incomplete Trace information of the main process can be obtained in the fork sub-process in a dynamic link mode, the Kernel Stack and the Native Stack of the main process are additionally obtained, finally, the complete Trace information is assembled and transmitted to the main process for reporting operation in a cross-process communication mode, and negative effects such as breakdown or secondary blockage on a preset application program can be reduced or even avoided.
Example four
Fig. 6 is a block diagram of an information obtaining apparatus according to a fourth embodiment of the present invention, where the apparatus may be implemented by software and/or hardware, and may be generally integrated in an intelligent terminal device, and may perform information obtaining by executing an information obtaining method. As shown in fig. 6, the apparatus includes:
a function pointer obtaining module 601, configured to obtain a pointer of a first system function of a runtime object when it is detected that a preset application program enters a preset stuck state, where the first system function includes a function for backing up runtime information when an application program non-response event occurs;
a function calling module 602, configured to call the first system function through the runtime object, and transmit an output stream into the first system function;
an information obtaining module 603, configured to obtain information included in the output stream to obtain the katoon context information.
The information acquisition device provided in the embodiment of the present invention acquires a pointer of a first system function of a runtime object when detecting that a preset application program enters a preset stuck state, where the first system function includes a function for backing up runtime information when an application program non-response event occurs, calls the first system function through the runtime object, and transmits an output stream to the first system function, and acquires information included in the output stream, so as to obtain stuck context information. By adopting the technical scheme, when the application program is detected to be blocked, the blocking context information is obtained by calling the function called by the system when the application program has no response event, so that the system limitation can be broken through to obtain more comprehensive blocking context information, and the blocking problem can be accurately positioned and solved.
Optionally, the preset application program is installed in an android operating system, and the first system function is a dumpsigquit function.
Optionally, the obtaining a pointer of a first system function of the runtime object includes:
and opening a first dynamic link library, and acquiring a pointer of a runtime object in the first dynamic link library and a pointer of a first system function of the runtime object.
Optionally, when detecting that the preset application program is stuck, obtaining a pointer of a first system function of the runtime object includes:
when detecting that a preset application program is blocked, creating a child process of a first process of the preset application program, wherein the first process becomes a parent process;
acquiring a pointer of a first system function of the runtime object by utilizing the subprocess;
the calling the first system function through the runtime object and transmitting an output stream into the first system function includes:
calling the first system function through the runtime object by utilizing the subprocess, and transmitting an output stream into the first system function;
the obtaining information contained in the output stream to obtain the stuck context information includes:
acquiring information contained in the output stream through the subprocess;
acquiring preset types of stack information of all threads of the parent process through the child process;
and obtaining the pause context information according to the information contained in the output stream and the stack information of the preset type.
Optionally, the preset type of stack information includes kernel stack information and local stack information, and information included in the output stream acquired by the child process includes Java layer stack information of all threads of the parent process.
Optionally, the obtaining, by the child process, kernel stack information of all threads of the parent process includes:
and acquiring pointers of the thread list objects of the objects in operation through the child process, traversing all threads of the parent process, and acquiring corresponding kernel stack information by reading preset stack file directories corresponding to all processes respectively.
Optionally, the obtaining, by the child process, kernel stack information of all threads of the parent process includes:
and opening a second dynamic link library, acquiring a pointer of a second system function, and acquiring local stack information of all threads of the parent process by calling the second system function, wherein the second system function comprises a Backtrace function.
Optionally, the apparatus further comprises:
the information delivery module is configured to, after obtaining the stuck context information according to the information included in the output stream and the preset type of stack information, further include: and transferring the stuck context information to the parent process by utilizing the child process in an anonymous memory sharing mode.
Optionally, if the version number of the current operating system is lower than a preset version number, creating a sub-process of the first process of the preset application program.
Optionally, the apparatus further comprises:
and the information processing module is used for writing the pause context information into a preset local file after the pause context information is obtained, and/or reporting the context information.
Optionally, the detecting that the preset application program enters the preset stuck state includes:
acquiring a frame rate of a preset application program in the operation process;
and when the current frame rate is detected to be smaller than a preset frame rate threshold value, determining that the preset application program is detected to enter a preset blocking state.
Optionally, the stuck degree corresponding to the preset stuck state is lower than the stuck degree corresponding to the application no-response event.
EXAMPLE five
Embodiments of the present invention further provide a storage medium containing computer-executable instructions, where the computer-executable instructions are executed by a computer processor to perform the information obtaining method provided by the embodiments of the present invention, and the method includes:
when detecting that a preset application program enters a preset stuck state, acquiring a pointer of a first system function of a runtime object, wherein the first system function comprises a function for backing up runtime information when an application program non-response event occurs;
calling the first system function through the runtime object, and transmitting an output stream into the first system function;
and acquiring information contained in the output stream to obtain the stuck context information.
Storage medium-any of various types of memory devices or storage devices. The term "storage medium" is intended to include: mounting media such as CD-ROM, floppy disk, or tape devices; computer system memory or random access memory such as DRAM, DDRRAM, SRAM, EDORAM, Lanbas (Rambus) RAM, etc.; non-volatile memory such as flash memory, magnetic media (e.g., hard disk or optical storage); registers or other similar types of memory elements, etc. The storage medium may also include other types of memory or combinations thereof. In addition, the storage medium may be located in a first computer system in which the program is executed, or may be located in a different second computer system connected to the first computer system through a network (such as the internet). The second computer system may provide program instructions to the first computer for execution. The term "storage medium" may include two or more storage media that may reside in different locations, such as in different computer systems that are connected by a network. The storage medium may store program instructions (e.g., embodied as a computer program) that are executable by one or more processors.
Of course, the storage medium provided by the embodiment of the present invention contains computer-executable instructions, and the computer-executable instructions are not limited to the information acquisition operation described above, and may also perform related operations in the information acquisition method provided by any corresponding embodiment of the present invention.
EXAMPLE six
The embodiment of the invention provides intelligent terminal equipment, which integrates an information acquisition device provided by the embodiment of the invention. Fig. 7 is a block diagram of an intelligent terminal device according to a sixth embodiment of the present invention. The intelligent terminal device 700 comprises a memory 701, a processor 702 and a computer program which is stored on the memory 701 and can run on the processor 702, and when the processor 702 executes the computer program, the information acquisition method provided by the embodiment of the invention is realized. The method comprises the following steps:
when detecting that a preset application program enters a preset stuck state, acquiring a pointer of a first system function of a runtime object, wherein the first system function comprises a function for backing up runtime information when an application program non-response event occurs;
calling the first system function through the runtime object, and transmitting an output stream into the first system function;
and acquiring information contained in the output stream to obtain the stuck context information.
According to the intelligent terminal device provided by the embodiment of the invention, when the application program is detected to be blocked, the blocking context information is obtained by calling the function called by the system when the application program has no response event, so that the system limitation can be broken through to obtain more comprehensive blocking context information, and the blocking problem can be accurately positioned and solved.
The information acquisition device, the storage medium and the intelligent terminal device provided in the above embodiments can execute the information acquisition method provided in any embodiment of the present invention, and have corresponding functional modules and beneficial effects for executing the method. For technical details that are not described in detail in the above embodiments, reference may be made to the information acquisition method provided in any embodiment of the present invention.
It is to be noted that the foregoing is only illustrative of the preferred embodiments of the present invention and the technical principles employed. It will be understood by those skilled in the art that the present invention is not limited to the particular embodiments described herein, but is capable of various obvious changes, rearrangements and substitutions as will now become apparent to those skilled in the art without departing from the scope of the invention. Therefore, although the present invention has been described in greater detail by the above embodiments, the present invention is not limited to the above embodiments, and may include other equivalent embodiments without departing from the spirit of the present invention, and the scope of the present invention is determined by the scope of the appended claims.

Claims (15)

1. An information acquisition method, comprising:
when detecting that a preset application program enters a preset stuck state, acquiring a pointer of a first system function of a runtime object, wherein the first system function comprises a function for backing up runtime information when an application program non-response event occurs;
calling the first system function through the runtime object, and transmitting an output stream into the first system function;
and acquiring information contained in the output stream to obtain the stuck context information.
2. The method of claim 1, wherein the current operating system is an android operating system and the first system function is a dumpfigsigquit function.
3. The method of claim 1, wherein obtaining the pointer to the first system function of the runtime object comprises:
and opening a first dynamic link library, and acquiring a pointer of a runtime object in the first dynamic link library and a pointer of a first system function of the runtime object.
4. The method of claim 1, wherein obtaining a pointer to a first system function of a runtime object upon detecting that a preset application is stuck comprises:
when detecting that a preset application program is blocked, creating a child process of a first process of the preset application program, wherein the first process becomes a parent process;
acquiring a pointer of a first system function of the runtime object by utilizing the subprocess;
the calling the first system function through the runtime object and transmitting an output stream into the first system function includes:
calling the first system function through the runtime object by utilizing the subprocess, and transmitting an output stream into the first system function;
the obtaining information contained in the output stream to obtain the stuck context information includes:
acquiring information contained in the output stream by using the subprocess;
acquiring preset types of stack information of all threads of the parent process by utilizing the child process;
and obtaining the pause context information according to the information contained in the output stream and the stack information of the preset type.
5. The method according to claim 4, wherein the preset type of stack information includes kernel stack information and local stack information, and information included in the output stream acquired by the child process includes Java layer stack information of all threads of the parent process.
6. The method of claim 5, wherein obtaining kernel stack information for all threads of the parent process using the child process comprises:
and acquiring a pointer of a thread list object of the object in operation by using the child process, traversing all threads of the parent process, and acquiring corresponding kernel stack information by reading preset stack file directories corresponding to all processes respectively.
7. The method of claim 5, wherein obtaining kernel stack information for all threads of the parent process using the child process comprises:
and opening a second dynamic link library by using the child process, acquiring a pointer of a second system function, and acquiring local stack information of all threads of the parent process by calling the second system function, wherein the second system function comprises a Backtrace function.
8. The method according to claim 4, further comprising, after obtaining the stuck context information according to the information contained in the output stream and the stack information of the preset type:
and transferring the stuck context information to the parent process by utilizing the child process in an anonymous memory sharing mode.
9. The method of claim 4, wherein creating the sub-process of the first process of the default application comprises:
and if the version number of the current operating system is lower than the preset version number, creating a sub-process of the first process of the preset application program.
10. The method of any of claims 1-9, further comprising, after obtaining the katoon context information:
and writing the pause context information into a preset local file, and/or reporting the context information.
11. The method of claim 1, wherein the detecting that the predetermined application enters the predetermined stuck state comprises:
acquiring a frame rate of a preset application program in the operation process;
and when the current frame rate is detected to be smaller than a preset frame rate threshold value, determining that the preset application program is detected to enter a preset blocking state.
12. The method of claim 1, wherein the predetermined stuck state corresponds to a lower stuck level than when an application no-response event occurs.
13. An information acquisition apparatus characterized by comprising:
the function pointer acquisition module is used for acquiring a pointer of a first system function of a runtime object when detecting that a preset application program enters a preset stuck state, wherein the first system function comprises a function for backing up runtime information when an application program non-response event occurs;
the function calling module is used for calling the first system function through the runtime object and transmitting an output stream into the first system function;
and the information acquisition module is used for acquiring the information contained in the output stream to obtain the stuck context information.
14. A computer-readable storage medium, on which a computer program is stored which, when being executed by a processor, carries out the method according to any one of claims 1-12.
15. An intelligent terminal device comprising a memory, a processor and a computer program stored on the memory and executable on the processor, characterized in that the processor implements the method according to any of claims 1-12 when executing the computer program.
CN201910951262.9A 2019-10-08 2019-10-08 Information acquisition method, device, storage medium and equipment Active CN110688245B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201910951262.9A CN110688245B (en) 2019-10-08 2019-10-08 Information acquisition method, device, storage medium and equipment

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201910951262.9A CN110688245B (en) 2019-10-08 2019-10-08 Information acquisition method, device, storage medium and equipment

Publications (2)

Publication Number Publication Date
CN110688245A true CN110688245A (en) 2020-01-14
CN110688245B CN110688245B (en) 2023-05-26

Family

ID=69111562

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201910951262.9A Active CN110688245B (en) 2019-10-08 2019-10-08 Information acquisition method, device, storage medium and equipment

Country Status (1)

Country Link
CN (1) CN110688245B (en)

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112286773A (en) * 2020-10-19 2021-01-29 北京字节跳动网络技术有限公司 Method, device, medium and electronic equipment for collecting crash information
CN112650647A (en) * 2020-12-29 2021-04-13 北京字节跳动网络技术有限公司 Information acquisition method, device, equipment and medium
CN113114843A (en) * 2021-03-25 2021-07-13 北京小米移动软件有限公司 Data processing method and device, terminal and storage medium

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN108763012A (en) * 2018-03-13 2018-11-06 广东欧珀移动通信有限公司 Interim card information acquisition method, device and terminal
CN109840177A (en) * 2017-11-24 2019-06-04 腾讯科技(深圳)有限公司 A kind of processing method and relevant device of Caton
CN109902011A (en) * 2019-02-28 2019-06-18 深圳乐信软件技术有限公司 A kind of software Caton monitoring method, device, equipment and storage medium
US20190243964A1 (en) * 2018-02-06 2019-08-08 Jayant Shukla System and method for exploiting attack detection by validating application stack at runtime

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109840177A (en) * 2017-11-24 2019-06-04 腾讯科技(深圳)有限公司 A kind of processing method and relevant device of Caton
US20190243964A1 (en) * 2018-02-06 2019-08-08 Jayant Shukla System and method for exploiting attack detection by validating application stack at runtime
CN108763012A (en) * 2018-03-13 2018-11-06 广东欧珀移动通信有限公司 Interim card information acquisition method, device and terminal
CN109902011A (en) * 2019-02-28 2019-06-18 深圳乐信软件技术有限公司 A kind of software Caton monitoring method, device, equipment and storage medium

Cited By (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112286773A (en) * 2020-10-19 2021-01-29 北京字节跳动网络技术有限公司 Method, device, medium and electronic equipment for collecting crash information
CN112650647A (en) * 2020-12-29 2021-04-13 北京字节跳动网络技术有限公司 Information acquisition method, device, equipment and medium
CN112650647B (en) * 2020-12-29 2023-10-31 北京字节跳动网络技术有限公司 Information acquisition method, device, equipment and medium
CN113114843A (en) * 2021-03-25 2021-07-13 北京小米移动软件有限公司 Data processing method and device, terminal and storage medium
CN113114843B (en) * 2021-03-25 2022-06-10 北京小米移动软件有限公司 Data processing method and device, terminal and storage medium

Also Published As

Publication number Publication date
CN110688245B (en) 2023-05-26

Similar Documents

Publication Publication Date Title
CN109284269B (en) Abnormal log analysis method and device, storage medium and server
US9529692B2 (en) Memory management tools
US8924912B2 (en) Method of recording and replaying call frames for a test bench
CN106681811B (en) Multithreading scheduling method and device based on thread pool
CN108984389B (en) Application program testing method and terminal equipment
CN110688245B (en) Information acquisition method, device, storage medium and equipment
CN108197032B (en) Main thread jamming monitoring method, medium, equipment and system for IOS application
CN108664380B (en) After-execution software debugging system with performance display and debugging method
WO2021208512A1 (en) Method and apparatus for acquiring control information of user interface, terminal and storage medium
CN108874672B (en) Application program exception positioning method, device, equipment and storage medium
CN107608609B (en) Event object sending method and device
WO2018171195A1 (en) Dependency-injection-based android application semi-automatization test method
CN110795311B (en) Event playback method and device
TW201335752A (en) Memory detection system and method
US10997055B2 (en) Methods, circuits, apparatus, systems and associated software modules for evaluating code behavior
US20210157924A1 (en) Coverage of web appliction analysis
US20180189167A1 (en) Methods, circuits, apparatus, systems and associated software modules for evaluating code behavior
CN110597704B (en) Pressure test method, device, server and medium for application program
CN108021495B (en) Code debugging method based on playback
CN110633190B (en) Application program memory monitoring method, device, equipment and storage medium
CN116126581B (en) Memory fault processing method, device, system, equipment and storage medium
US9069897B2 (en) Capturing telemetry data by dynamic language engine
KR20150062654A (en) Method and apparatus for measuring performance of software
CN108197005B (en) Method, medium, equipment and system for monitoring bottom layer operation performance of IOS application
US10496524B2 (en) Separating test coverage in software processes using shared memory

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
TR01 Transfer of patent right
TR01 Transfer of patent right

Effective date of registration: 20231010

Address after: 31a, 15th floor, building 30, maple commercial city, bangrang Road, Brazil

Patentee after: Baiguoyuan Technology (Singapore) Co.,Ltd.

Address before: 511400 floor 5-13, West Tower, building C, 274 Xingtai Road, Shiqiao street, Panyu District, Guangzhou City, Guangdong Province

Patentee before: GUANGZHOU BAIGUOYUAN INFORMATION TECHNOLOGY Co.,Ltd.