CN112015612B - Method and device for acquiring stuck information - Google Patents

Method and device for acquiring stuck information Download PDF

Info

Publication number
CN112015612B
CN112015612B CN201910452570.7A CN201910452570A CN112015612B CN 112015612 B CN112015612 B CN 112015612B CN 201910452570 A CN201910452570 A CN 201910452570A CN 112015612 B CN112015612 B CN 112015612B
Authority
CN
China
Prior art keywords
target thread
running
information
thread
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.)
Active
Application number
CN201910452570.7A
Other languages
Chinese (zh)
Other versions
CN112015612A (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.)
Hangzhou Ezviz Network Co Ltd
Original Assignee
Hangzhou Ezviz Network 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 Hangzhou Ezviz Network Co Ltd filed Critical Hangzhou Ezviz Network Co Ltd
Priority to CN201910452570.7A priority Critical patent/CN112015612B/en
Publication of CN112015612A publication Critical patent/CN112015612A/en
Application granted granted Critical
Publication of CN112015612B publication Critical patent/CN112015612B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/30Monitoring
    • G06F11/3003Monitoring arrangements specially adapted to the computing system or computing system component being monitored
    • G06F11/302Monitoring arrangements specially adapted to the computing system or computing system component being monitored where the computing system component is a software system
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/30Monitoring
    • G06F11/3051Monitoring arrangements for monitoring the configuration of the computing system or of the computing system component, e.g. monitoring the presence of processing resources, peripherals, I/O links, software programs
    • 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
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02DCLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
    • Y02D10/00Energy efficient computing, e.g. low power processors, power management or thermal management

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • Computing Systems (AREA)
  • Quality & Reliability (AREA)
  • General Physics & Mathematics (AREA)
  • Computer Hardware Design (AREA)
  • Mathematical Physics (AREA)
  • Telephone Function (AREA)
  • Telephonic Communication Services (AREA)

Abstract

The application relates to a method and a device for acquiring morton information, and belongs to the field of communication. The method comprises the following steps: acquiring acquisition information of a target thread in real time when an application runs, wherein the target thread is used for running the application, and the acquisition information comprises method call stack information and Central Processing Unit (CPU) use information of a terminal; in the running process of the target thread, monitoring whether the target thread is sent out with a card through a message assistant Handler and a message loop Looper of the target thread; and when the target thread is stuck, determining the collected information of the target thread collected in the period of the target thread stuck as stuck information. The accuracy of the acquired morton information can be improved.

Description

Method and device for acquiring stuck information
Technical Field
The present application relates to the field of communications, and in particular, to a method and an apparatus for acquiring morton information.
Background
At present, the smart phone is widely applied, can be installed with various applications, and meets different requirements of people. The intelligent mobile phone may have a stuck problem in the process of running the application, at this time, stuck information corresponding to the stuck problem needs to be acquired and reported to the server, and the stuck information is used for reflecting the situation of running the application of the intelligent mobile phone, so that a technician can continuously optimize the application according to the stuck information.
When the smart phone runs an application, an operating system of the smart phone can refresh an application interface every 16 milliseconds, and log information is output every time the application interface is refreshed; when the smart phone is stuck in the process of running the application, the operating system does not refresh the interface of the application and output log information in the stuck period, and the operating system does not refresh the interface and output the log information until the stuck problem is over and the smart phone resumes running the application. Therefore, logs output by the operating system can be monitored, if log information output by the operating system is not monitored for a long time, the fact that the smart phone is stuck when running the application is judged, the log information output by the operating system when the smart phone is recovered is obtained and serves as stuck information, and the stuck information is reported to the server side.
When the smart phone is recovered, the log information output by the operating system can only reflect the current running condition of the smart phone, and at the moment, the smart phone is recovered to be normal, so that the acquired card pause information possibly cannot reflect the running condition of the smart phone when the card pause occurs, that is to say, the currently acquired card pause information is inaccurate.
Disclosure of Invention
The embodiment of the application provides a method and a device for acquiring stuck information, so that the accuracy of the acquired stuck information is improved. The technical scheme is as follows:
in one aspect, an embodiment of the present application provides a method for acquiring morton information, where the method includes:
acquiring acquisition information of a target thread in real time when an application runs, wherein the target thread is used for running the application, and the acquisition information comprises method call stack information and Central Processing Unit (CPU) use information of a terminal;
in the running process of the target thread, monitoring whether the target thread is sent out with a card through a message assistant Handler and a message loop Looper of the target thread;
and when the target thread is stuck, determining the acquisition information of the target thread acquired in the period of the target thread stuck as stuck information.
Optionally, the monitoring, by using the message helper Handler and the message loop Looper of the target thread, whether the target thread is stuck or not includes:
acquiring the running time of the running task of the target thread through the Handler and the Looper of the target thread;
and when the running time exceeds a preset time threshold corresponding to the target thread, determining that the target thread is stuck.
Optionally, the Looper is configured to send a first message to the Handler when the target thread starts to run the task, and send a second message to the Handler when the target thread finishes running the task;
the Handler is used for acquiring the current time as the starting time of the target thread running task when receiving the first message, and acquiring the current time as the ending time of the target thread running task when receiving the second message;
the obtaining the running time of the target thread running task through the Handler and the Looper of the target thread comprises the following steps:
and acquiring the running time of the running task of the target thread according to the starting time and the ending time acquired by the Handler.
Optionally, before monitoring whether the target thread is stuck by the Handler of the target thread, the method further includes:
and determining a thread pool to which the target thread belongs, and acquiring a preset time threshold corresponding to the target thread according to the corresponding relation between the thread pool and the preset time threshold.
Optionally, the target thread is a main thread running the application or a non-main thread running the application.
On the other hand, an embodiment of the present application provides an apparatus for acquiring morton information, where the apparatus includes:
the system comprises an acquisition module, a processing module and a processing module, wherein the acquisition module is used for acquiring acquisition information of a target thread in real time when an application runs, the target thread is used for running the application, and the acquisition information comprises method call stack information and CPU (central processing unit) use information of a terminal;
the monitoring module is used for monitoring whether the target thread is stuck through a message assistant Handler and a message loop Looper of the target thread in the running process of the target thread;
and the determining module is used for determining the acquisition information of the target thread acquired in the target thread jamming period as jamming information when the target thread is jammed.
Optionally, the monitoring module is configured to:
acquiring the running time of the running task of the target thread through the Handler and the Looper of the target thread;
and when the running time exceeds a preset time threshold corresponding to the target thread, determining that the target thread is stuck.
Optionally, the Looper is configured to send a first message to the Handler when the target thread starts to run the task, and send a second message to the Handler when the target thread finishes running the task;
the Handler is used for acquiring the current time as the starting time of the target thread running task when receiving the first message, and acquiring the current time as the ending time of the target thread running task when receiving the second message;
and the monitoring module is used for acquiring the running time of the running task of the target thread according to the starting time and the ending time acquired by the Handler.
Optionally, the apparatus further includes:
and the obtaining module is used for determining a thread pool to which the target thread belongs and obtaining a preset time threshold corresponding to the target thread from the corresponding relation between the thread pool and the preset time threshold according to the thread pool.
Optionally, the target thread is a main thread running the application or a non-main thread running the application.
In another aspect, the present application provides a non-transitory computer-readable storage medium for storing a computer program which is loaded and executed by a processor to implement the instructions of the method of one or any of the alternatives of the one aspect.
The technical scheme provided by the embodiment of the application can have the following beneficial effects:
the acquisition information of the target thread is acquired in real time, and when the target thread is monitored to be stuck in the running process of the target thread, the acquisition information of the target thread acquired in the stuck period is determined as stuck information, so that the acquired stuck information can reflect the running condition of the terminal when the stuck occurs, namely the accuracy of the acquired stuck information is higher.
It is to be understood that both the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the application.
Drawings
The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present application and together with the description, serve to explain the principles of the application.
Fig. 1 is a flowchart of a method for acquiring morton information according to an embodiment of the present disclosure;
FIG. 2 is a flowchart of another method for obtaining morton information according to an embodiment of the present disclosure;
fig. 3 is a schematic structural diagram of an apparatus for acquiring morton information according to an embodiment of the present disclosure;
fig. 4 is a schematic structural diagram of a terminal according to an embodiment of the present application.
Specific embodiments of the present application have been shown by way of example in the drawings and will be described in more detail below. These drawings and written description are not intended to limit the scope of the inventive concepts in any manner, but rather to illustrate the inventive concepts to those skilled in the art by reference to specific embodiments.
Detailed Description
Reference will now be made in detail to the exemplary embodiments, examples of which are illustrated in the accompanying drawings. When the following description refers to the accompanying drawings, like numbers in different drawings represent the same or similar elements unless otherwise indicated. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with the present application. Rather, they are merely examples of apparatus and methods consistent with certain aspects of the application, as detailed in the appended claims.
Referring to fig. 1, an embodiment of the present application provides a method for acquiring morton information, where the method includes:
step 101: the method comprises the steps of collecting collection information of target threads in real time when an application runs, wherein at least one target thread belongs to the application currently running in a terminal, and the collection information at least comprises method call stack information and Central Processing Unit (CPU) use information of the terminal.
In this step, the collected information of one target thread or the collected information of a plurality of target threads may be collected. The target thread may be the main thread of the application or may be a non-main thread. When collecting the collecting information of one target thread, the target thread is the main thread of the application, and when collecting the collecting information of a plurality of target threads, the plurality of threads comprise the main thread of the application and one or more non-main threads.
In this step, when the application runs, the collection information of the target thread may be collected periodically. Optionally, a sampling thread may be provided, and the acquisition thread is used to periodically acquire the acquisition information of the target thread. The period length of acquisition is often short, for example, the period length may be several milliseconds, tens of milliseconds or several seconds, and the like, so as to realize real-time acquisition of the acquisition information of the target thread.
Step 102: and monitoring whether the target thread is sent out with a card by a Handler (message assistant) and a Looper (message loop) of the target thread during the running process of the target thread.
Step 103: when the target thread is stuck, the stuck information is determined according to the collected information of the target thread collected in the stuck period of the target thread.
In the embodiment of the application, as the acquisition information of the target thread is acquired in real time, in the running process of the target thread, when the target thread is monitored to be stuck, the acquisition information of the target thread acquired in the stuck period is determined as the stuck information, so that the acquired stuck information can reflect the running condition of the terminal when the stuck occurs, that is to say, the accuracy of the acquired stuck information is higher.
Referring to fig. 2, an embodiment of the present application provides a method for acquiring stuck information when a process of an application runs and a thread of the application is stuck, including:
step 201: and acquiring the acquisition information of a target thread in real time when the application runs, wherein the target thread belongs to the application currently running in the terminal, and the acquisition information comprises method call stack information and CPU (Central processing Unit) use information of the terminal.
Optionally, the collected information may further include memory use information of the terminal. The terminal can be a mobile phone or a tablet computer and the like.
Optionally, the mobile phone may be an Android mobile phone.
The terminal is running an application using a plurality of threads, including a main thread and at least one non-main thread. When a technician develops an application, at least one thread can be designated as a target thread from the plurality of threads, and the designated at least one thread at least comprises the main thread and also comprises at least one non-main thread. So for any one target thread, the target thread may be a main thread and/or a non-main thread.
When the terminal starts to run the application, a sampling thread is created, and when the terminal runs the application, the sampling thread is used for acquiring acquisition information corresponding to a target thread in real time.
Optionally, the sampling thread may periodically collect the collection information corresponding to the target thread. The period length of the acquisition may be 10 milliseconds, 15 milliseconds, 20 milliseconds, or the like.
When the target thread runs the application task, the target thread can call the function, and when the function is called, the stack frame of the function is saved in the stack. The getStackTrace method can be called by the sampling thread, and the method call stack information corresponding to the target thread can be acquired from the stack by using the getStackTrace method. The method call stack information corresponding to the target thread comprises information such as a currently running method identifier of the target thread and a parent method identifier of the currently running method.
The operating system of the terminal can store the current CPU usage information, the current memory usage information and other contents of the terminal in a system file of the terminal in real time, and can acquire the current CPU usage information and the current memory usage information from the system file through the sampling thread.
Optionally, the CPU usage information may be CPU usage rate, and the memory usage information may be memory occupancy rate.
Optionally, for the mobile phone, the storage directory of the system file for storing the CPU usage information and the memory usage information may be proc/stat below the system file. Therefore, in this step, the system file can be read based on the storage directory, and the current CPU use information and the current memory use information can be obtained from the system file.
Optionally, the thread identifier of the target thread and the acquisition information corresponding to the target thread may be correspondingly stored in the corresponding relationship between the thread identifier and the acquisition information.
When the acquisition information corresponding to the target thread is acquired for the first time, the thread identifier of the target thread and the acquisition information corresponding to the target thread can be correspondingly stored in the corresponding relationship between the thread identifier and the acquisition information. And then, acquiring the acquisition information corresponding to the target thread again, acquiring a record comprising the thread identifier of the target thread in the corresponding relation between the thread identifier and the acquisition information, and adding the acquisition information corresponding to the target thread acquired again in the record comprising the thread identifier of the target thread.
Step 202: and in the running process of the target thread, the running time of the target thread running task is obtained through the Handler and the Looper of the target thread.
Before the step is executed, looper and Handler can be created for the target thread, and the target thread, looper and Handler can be bound.
Optionally, when the application starts to run, if the target thread is the main thread and the main thread has a Looper, a Handler is created for the target thread at this time, and the target thread, the Looper of the target thread, and the Handler are bound. And if the target thread is a non-main thread, creating a Looper and a Handler for the target thread, and binding the target thread, the Looper and the Handler of the target thread.
Due to the fact that the target thread, the Looper and the Handler are bound, the Looper can monitor that the target thread sends a first message to the Handler bound with the Looper when the target thread starts to run tasks belonging to the application, and at the moment, the Handler receives the first message and obtains the current time as the starting time of the target thread for running the tasks. The Looper can monitor that the target thread sends a second message to the Handler bound with the target thread when the target thread finishes running the tasks belonging to the application, and at the moment, the Handler receives the second message and acquires the current time as the finish time of the target thread running the tasks.
In this step, the start time and the end time of the target thread running the task may be obtained from the Handler of the target thread, and the running time of the target thread running the task may be obtained according to the start time and the end time of the task.
Step 203: when the running time exceeds the preset time threshold corresponding to the target thread, it is determined that the target thread is stuck, and step 204 is executed.
Optionally, before executing this step, a thread pool to which the target thread belongs may be determined, and according to the thread pool, a preset time threshold corresponding to the target thread is obtained in a corresponding relationship between a preset thread pool and a preset time threshold.
Optionally, the preset time threshold corresponding to the target thread may be obtained when the application starts to run.
The preset time threshold corresponding to each thread pool in the corresponding relationship between the preset thread pool and the preset time threshold is preset by a technician. And when the thread runs the task, if the thread is not blocked, the maximum running time required by the thread to run the task does not exceed the preset time threshold corresponding to the thread pool.
After the target thread starts to run the task, the terminal is blocked when the target thread runs due to the fact that resources such as a CPU of the terminal are consumed, the target thread may be suspended by the terminal after the target thread is blocked, the target thread is started to run continuously until the terminal is recovered, the target thread continues to run the task, and when the running task is finished, the finish time of the target thread running the task is obtained through a Handler corresponding to the target thread. Therefore, when the target thread runs the task and is stuck, the running time required by the running task is longer, and therefore in this step, when the running time exceeds the preset time threshold corresponding to the target thread, the target thread is determined to be stuck.
And in the time when the target thread is blocked, the terminal continues to run the sampling thread, continues to acquire acquisition information corresponding to the target thread through the sampling thread, and adds the acquired acquisition information corresponding to the target thread to a record comprising the thread identifier of the target thread in the corresponding relationship between the thread identifier and the acquisition information. And storing the acquisition information according to the sequence of acquisition time in the record comprising the thread identifier of the target thread.
Step 204: and determining the pause period corresponding to the target thread according to the acquisition information corresponding to the target thread, wherein the target thread is paused in the corresponding pause period.
In this step, a plurality of pieces of acquisition information corresponding to the target thread may be obtained from the correspondence between the thread identifier and the acquisition information according to the thread identifier of the target thread. And determining the running time of each method of the running of the target thread according to the current running method identification included in each acquisition information, and determining the longest preset running time as the pause period corresponding to the target thread.
The plurality of pieces of collected information are arranged according to the sequence of the collection time, and the collected information is collected periodically, so that the collection time corresponding to each piece of collected information can be calculated according to the sequence of each piece of collected information and the collection period length, at least one piece of collected information can be obtained from the plurality of pieces of collected information, the collection times corresponding to any two adjacent pieces of collected information in the at least one piece of collected information differ by one period length, the method identifications included in each piece of collected information are the same, and the running time of the method corresponding to the method identification can be calculated according to the collection time corresponding to the first piece of collected information and the collection time corresponding to the last piece of collected information in the at least one piece of collected information, namely the running time of the method is the time period from the collection time corresponding to the first piece of collected information to the collection time corresponding to the last piece of collected information.
Step 205: and determining the acquisition information corresponding to the target thread acquired in the stuck period as stuck information.
Because the acquisition time corresponding to each acquisition information can be calculated, the acquisition information of which the acquisition time is in the pause period can be determined as pause information, and then the pause information is sent to the server, so that a technician can check the pause information at the server and optimize the application according to the pause information.
In the embodiment of the application, as the acquisition information of the target thread is acquired in real time, in the running process of the target thread, when the target thread is monitored to be stuck, the acquisition time corresponding to each acquisition information can be acquired, the stuck period of the target thread can be determined based on the acquisition time corresponding to each acquisition information, then the acquisition information of the target thread acquired in the stuck period is determined as the stuck information, the stuck information acquired in this way can reflect the running condition of the terminal when the stuck occurs, that is, the accuracy of the acquired stuck information is higher.
The following are embodiments of the apparatus of the present application that may be used to perform embodiments of the method of the present application. For details which are not disclosed in the embodiments of the apparatus of the present application, reference is made to the embodiments of the method of the present application.
Referring to fig. 3, an embodiment of the present application provides an apparatus 300 for acquiring morton information, where the apparatus 300 includes:
the acquisition module 301 is configured to acquire acquisition information of a target thread in real time when an application runs, where the target thread is used for running the application, and the acquisition information includes method call stack information and CPU usage information of a terminal;
a monitoring module 302, configured to monitor, by using a helper Handler and a Looper of the target thread, whether the target thread is sent to a card pause or not in the running process of the target thread;
the determining module 303 is configured to determine, when the target thread is stuck, acquired information of the target thread acquired during a period in which the target thread is stuck as stuck information.
Optionally, the monitoring module 302 is configured to:
acquiring the running time of the running task of the target thread through the Handler and the Looper of the target thread;
and when the running time exceeds a preset time threshold corresponding to the target thread, determining that the target thread is stuck.
Optionally, the Looper is configured to send a first message to the Handler when the target thread starts to run the task, and send a second message to the Handler when the target thread finishes running the task;
the Handler is used for acquiring the current time as the starting time of the target thread running task when receiving the first message, and acquiring the current time as the ending time of the target thread running task when receiving the second message;
the monitoring module 302 is configured to obtain the running time of the target thread running task according to the start time and the end time obtained by the Handler.
Optionally, the apparatus 300 further includes:
and the obtaining module is used for determining a thread pool to which the target thread belongs and obtaining a preset time threshold corresponding to the target thread from the corresponding relation between the thread pool and the preset time threshold according to the thread pool.
Optionally, the target thread is a main thread running the application or a non-main thread running the application.
In this embodiment of the application, because the acquisition module 301 acquires the acquisition information of the target thread in real time, in the running process of the target thread, when the monitoring module 302 monitors that the target thread is stuck, the determination module 303 determines the acquisition information of the target thread acquired in a stuck period as stuck information, and thus the acquired stuck information can reflect the running condition of the terminal when the stuck occurs, that is, the accuracy of the acquired stuck information is high.
With regard to the apparatus in the above-described embodiment, the specific manner in which each module performs the operation has been described in detail in the embodiment related to the method, and will not be elaborated here.
Fig. 4 shows a block diagram of a terminal 400 according to an exemplary embodiment of the present invention. The terminal 400 may be a portable mobile terminal such as: a smartphone, a tablet, a laptop, or a desktop computer. The terminal 400 may also be referred to by other names such as user equipment, portable terminal, laptop terminal, desktop terminal, etc.
In general, the terminal 400 includes: a processor 401 and a memory 402.
Processor 401 may include one or more processing cores such as a 4-core processor, an 8-core processor, and the like. The processor 401 may be implemented in at least one hardware form of a DSP (Digital Signal Processing), an FPGA (Field-Programmable Gate Array), and a PLA (Programmable Logic Array). The processor 401 may also include a main processor and a coprocessor, where the main processor is a processor for Processing data in an awake state, and is also called a Central Processing Unit (CPU); a coprocessor is a low power processor for processing data in a standby state. In some embodiments, the processor 401 may be integrated with a GPU (Graphics Processing Unit), which is responsible for rendering and drawing the content required to be displayed by the display screen. In some embodiments, the processor 401 may further include an AI (Artificial Intelligence) processor for processing computing operations related to machine learning.
Memory 402 may include one or more computer-readable storage media, which may be non-transitory. Memory 402 may also include high speed random access memory, as well as non-volatile memory, such as one or more magnetic disk storage devices, flash memory storage devices. In some embodiments, a non-transitory computer readable storage medium in memory 402 is used to store at least one instruction for execution by processor 401 to implement the method of obtaining morton information provided by the method embodiments herein.
In some embodiments, the terminal 400 may further optionally include: a peripheral interface 403 and at least one peripheral. The processor 401, memory 402 and peripheral interface 403 may be connected by bus or signal lines. Each peripheral may be connected to the peripheral interface 403 via a bus, signal line, or circuit board. Specifically, the peripheral device includes: at least one of radio frequency circuitry 404, touch screen display 405, camera 406, audio circuitry 407, positioning components 408, and power supply 409.
The peripheral interface 403 may be used to connect at least one peripheral related to I/O (Input/Output) to the processor 401 and the memory 402. In some embodiments, processor 401, memory 402, and peripheral interface 403 are integrated on the same chip or circuit board; in some other embodiments, any one or two of the processor 401, the memory 402 and the peripheral interface 403 may be implemented on a separate chip or circuit board, which is not limited by this embodiment.
The Radio Frequency circuit 404 is used for receiving and transmitting RF (Radio Frequency) signals, also called electromagnetic signals. The radio frequency circuitry 404 communicates with communication networks and other communication devices via electromagnetic signals. The rf circuit 404 converts an electrical signal into an electromagnetic signal for transmission, or converts a received electromagnetic signal into an electrical signal. Optionally, the radio frequency circuit 404 includes: an antenna system, an RF transceiver, one or more amplifiers, a tuner, an oscillator, a digital signal processor, a codec chipset, a subscriber identity module card, and so forth. The radio frequency circuitry 404 may communicate with other terminals via at least one wireless communication protocol. The wireless communication protocols include, but are not limited to: the world wide web, metropolitan area networks, intranets, generations of mobile communication networks (2G, 3G, 4G, and 5G), wireless local area networks, and/or WiFi (Wireless Fidelity) networks. In some embodiments, the rf circuit 404 may further include NFC (Near Field Communication) related circuits, which are not limited in this application.
The display screen 405 is used to display a UI (User Interface). The UI may include graphics, text, icons, video, and any combination thereof. When the display screen 405 is a touch display screen, the display screen 405 also has the ability to capture touch signals on or over the surface of the display screen 405. The touch signal may be input to the processor 401 as a control signal for processing. At this point, the display screen 405 may also be used to provide virtual buttons and/or a virtual keyboard, also referred to as soft buttons and/or a soft keyboard. In some embodiments, the display screen 405 may be one, providing the front panel of the terminal 400; in other embodiments, the display screen 405 may be at least two, respectively disposed on different surfaces of the terminal 400 or in a folded design; in still other embodiments, the display 405 may be a flexible display disposed on a curved surface or a folded surface of the terminal 400. Even further, the display screen 405 may be arranged in a non-rectangular irregular pattern, i.e. a shaped screen. The Display screen 405 may be made of LCD (Liquid Crystal Display), OLED (Organic Light-Emitting Diode), and other materials.
The camera assembly 406 is used to capture images or video. Optionally, camera assembly 406 includes a front camera and a rear camera. Generally, a front camera is disposed at a front panel of the terminal, and a rear camera is disposed at a rear surface of the terminal. In some embodiments, the number of the rear cameras is at least two, and each rear camera is any one of a main camera, a depth-of-field camera, a wide-angle camera and a telephoto camera, so that the main camera and the depth-of-field camera are fused to realize a background blurring function, and the main camera and the wide-angle camera are fused to realize panoramic shooting and VR (Virtual Reality) shooting functions or other fusion shooting functions. In some embodiments, camera head assembly 406 may also include a flash. The flash lamp can be a monochrome temperature flash lamp or a bicolor temperature flash lamp. The double-color-temperature flash lamp is a combination of a warm-light flash lamp and a cold-light flash lamp, and can be used for light compensation at different color temperatures.
The audio circuit 407 may include a microphone and a speaker. The microphone is used for collecting sound waves of a user and the environment, converting the sound waves into electric signals, and inputting the electric signals into the processor 401 for processing, or inputting the electric signals into the radio frequency circuit 404 to realize voice communication. The microphones may be provided in plural numbers, respectively, at different portions of the terminal 400 for the purpose of stereo sound collection or noise reduction. The microphone may also be an array microphone or an omni-directional acquisition microphone. The speaker is used to convert electrical signals from the processor 401 or the radio frequency circuit 404 into sound waves. The loudspeaker can be a traditional film loudspeaker or a piezoelectric ceramic loudspeaker. When the speaker is a piezoelectric ceramic speaker, the speaker can be used for purposes such as converting an electric signal into a sound wave audible to a human being, or converting an electric signal into a sound wave inaudible to a human being to measure a distance. In some embodiments, the audio circuitry 407 may also include a headphone jack.
The positioning component 408 is used to locate the current geographic position of the terminal 400 for navigation or LBS (Location Based Service). The Positioning component 408 can be a Positioning component based on the Global Positioning System (GPS) in the united states, the beidou System in china, or the galileo System in russia.
The power supply 409 is used to supply power to the various components in the terminal 400. The power source 409 may be alternating current, direct current, disposable or rechargeable. When the power source 409 includes a rechargeable battery, the rechargeable battery may be a wired rechargeable battery or a wireless rechargeable battery. The wired rechargeable battery is a battery charged through a wired line, and the wireless rechargeable battery is a battery charged through a wireless coil. The rechargeable battery may also be used to support fast charge technology.
In some embodiments, the terminal 400 also includes one or more sensors 410. The one or more sensors 410 include, but are not limited to: acceleration sensor 411, gyro sensor 412, pressure sensor 413, fingerprint sensor 414, optical sensor 415, and proximity sensor 416.
The acceleration sensor 411 may detect the magnitude of acceleration in three coordinate axes of the coordinate system established with the terminal 400. For example, the acceleration sensor 411 may be used to detect components of the gravitational acceleration in three coordinate axes. The processor 401 may control the touch display screen 405 to display the user interface in a landscape view or a portrait view according to the gravitational acceleration signal collected by the acceleration sensor 411. The acceleration sensor 411 may also be used for acquisition of motion data of a game or a user.
The gyro sensor 412 may detect a body direction and a rotation angle of the terminal 400, and the gyro sensor 412 may cooperate with the acceleration sensor 411 to acquire a 3D motion of the terminal 400 by the user. From the data collected by the gyro sensor 412, the processor 401 may implement the following functions: motion sensing (such as changing the UI according to a user's tilting operation), image stabilization at the time of photographing, game control, and inertial navigation.
The pressure sensor 413 may be disposed on a side bezel of the terminal 400 and/or a lower layer of the touch display screen 405. When the pressure sensor 413 is disposed on the side frame of the terminal 400, a user's holding signal to the terminal 400 can be detected, and the processor 401 performs left-right hand recognition or shortcut operation according to the holding signal collected by the pressure sensor 413. When the pressure sensor 413 is arranged at the lower layer of the touch display screen 405, the processor 401 controls the operability control on the UI interface according to the pressure operation of the user on the touch display screen 405. The operability control comprises at least one of a button control, a scroll bar control, an icon control and a menu control.
The fingerprint sensor 414 is used for collecting a fingerprint of the user, and the processor 401 identifies the identity of the user according to the fingerprint collected by the fingerprint sensor 414, or the fingerprint sensor 414 identifies the identity of the user according to the collected fingerprint. Upon identifying that the user's identity is a trusted identity, processor 401 authorizes the user to perform relevant sensitive operations including unlocking the screen, viewing encrypted information, downloading software, paying, and changing settings, etc. The fingerprint sensor 414 may be disposed on the front, back, or side of the terminal 400. When a physical key or vendor Logo is provided on the terminal 400, the fingerprint sensor 414 may be integrated with the physical key or vendor Logo.
The optical sensor 415 is used to collect the ambient light intensity. In one embodiment, the processor 401 may control the display brightness of the touch display screen 405 based on the ambient light intensity collected by the optical sensor 415. Specifically, when the ambient light intensity is high, the display brightness of the touch display screen 405 is increased; when the ambient light intensity is low, the display brightness of the touch display screen 405 is turned down. In another embodiment, the processor 401 may also dynamically adjust the shooting parameters of the camera assembly 406 according to the ambient light intensity collected by the optical sensor 415.
A proximity sensor 416, also known as a distance sensor, is typically disposed on the front panel of the terminal 400. The proximity sensor 416 is used to collect the distance between the user and the front surface of the terminal 400. In one embodiment, when the proximity sensor 416 detects that the distance between the user and the front surface of the terminal 400 gradually decreases, the processor 401 controls the touch display screen 405 to switch from the bright screen state to the dark screen state; when the proximity sensor 416 detects that the distance between the user and the front surface of the terminal 400 gradually becomes larger, the processor 401 controls the touch display screen 405 to switch from the breath screen state to the bright screen state.
Those skilled in the art will appreciate that the configuration shown in fig. 4 is not intended to be limiting of terminal 400 and may include more or fewer components than those shown, or some components may be combined, or a different arrangement of components may be used.
Other embodiments of the present application will be apparent to those skilled in the art from consideration of the specification and practice of the application disclosed herein. This application is intended to cover any variations, uses, or adaptations of the invention following, in general, the principles of the application and including such departures from the present disclosure as come within known or customary practice within the art to which the invention pertains. It is intended that the specification and examples be considered as exemplary only, with a true scope and spirit of the application being indicated by the following claims.
It will be understood that the present application is not limited to the precise arrangements described above and shown in the drawings and that various modifications and changes may be made without departing from the scope thereof. The scope of the application is limited only by the appended claims.

Claims (8)

1. A method of obtaining morton information, the method comprising:
acquiring acquisition information of a target thread in real time when an application runs, wherein the target thread is used for running the application, the acquisition information comprises method call stack information and CPU (central processing unit) use information of a terminal, and the method call stack information comprises a method identifier of the current running of the target thread;
in the running process of the target thread, the running time of the target thread running task is obtained through a Handler and a Looper of the target thread;
when the running time exceeds a preset time threshold corresponding to the target thread, determining that the target thread is stuck;
determining the running time of each method of the running of the target thread according to the method identification included in each piece of collected information, and determining the running time of the longest preset number of methods as the pause period corresponding to the target thread; determining the collected information of the target thread collected in the period of the target thread generating the jamming as the jamming information;
wherein, the determining the running time of each method of the target thread running according to the method identification included in each collected information includes:
acquiring at least one piece of acquired information from the acquired information, wherein each piece of acquired information in the at least one piece of acquired information comprises the same method identifier;
and calculating the running time of the method corresponding to the method identifier according to the acquisition time corresponding to the first acquisition information and the acquisition time corresponding to the last acquisition information in the at least one acquisition information.
2. The method of claim 1, wherein the Looper is configured to send a first message to the Handler when the target thread starts running a task and send a second message to the Handler when the target thread finishes running the task;
the Handler is used for acquiring the current time as the starting time of the target thread running task when receiving the first message, and acquiring the current time as the ending time of the target thread running task when receiving the second message;
the obtaining the running time of the target thread running task through the Handler and the Looper of the target thread comprises the following steps:
and acquiring the running time of the running task of the target thread according to the starting time and the ending time acquired by the Handler.
3. The method as claimed in claim 1 or 2, wherein before determining that the target thread is stuck when the running time exceeds a preset time threshold corresponding to the target thread, the method further comprises:
and determining a thread pool to which the target thread belongs, and acquiring a preset time threshold corresponding to the target thread according to the corresponding relation between the thread pool and the preset time threshold.
4. The method of claim 1 or 2, wherein the target thread is a main thread running the application or a non-main thread running the application.
5. An apparatus for obtaining morton information, the apparatus comprising:
the system comprises an acquisition module, a processing module and a processing module, wherein the acquisition module is used for acquiring acquisition information of a target thread in real time when an application runs, the target thread is used for running the application, the acquisition information comprises method call stack information and CPU (central processing unit) use information of a terminal, and the method call stack information comprises a method identifier of the current running of the target thread;
the monitoring module is used for acquiring the running time of the running task of the target thread through a Handler and a Looper of the target thread in the running process of the target thread; when the running time exceeds a preset time threshold corresponding to the target thread, determining that the target thread is stuck;
the determining module is used for determining the running time of each method of the running of the target thread according to the method identification included in each piece of collected information, and determining the longest running time of the preset number of methods as the pause period corresponding to the target thread; determining the collected information of the target thread collected in the period of the target thread generating the jamming as the jamming information;
wherein, the determining the running time of each method of the target thread running according to the method identification included in each collected information includes:
acquiring at least one piece of acquired information from the acquired information, wherein each piece of acquired information in the at least one piece of acquired information comprises the same method identifier;
and calculating the running time of the method corresponding to the method identifier according to the acquisition time corresponding to the first acquisition information and the acquisition time corresponding to the last acquisition information in the at least one acquisition information.
6. The apparatus of claim 5, wherein the Looper is configured to send a first message to the Handler when the target thread starts running a task and send a second message to the Handler when the target thread finishes running the task;
the Handler is used for acquiring the current time as the starting time of the target thread running task when receiving the first message, and acquiring the current time as the ending time of the target thread running task when receiving the second message;
and the monitoring module is used for acquiring the running time of the running task of the target thread according to the starting time and the ending time acquired by the Handler.
7. The apparatus of claim 5 or 6, wherein the apparatus further comprises:
and the obtaining module is used for determining a thread pool to which the target thread belongs and obtaining a preset time threshold corresponding to the target thread from the corresponding relation between the thread pool and the preset time threshold according to the thread pool.
8. The apparatus of claim 5 or 6, wherein the target thread is a main thread running the application or a non-main thread running the application.
CN201910452570.7A 2019-05-28 2019-05-28 Method and device for acquiring stuck information Active CN112015612B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201910452570.7A CN112015612B (en) 2019-05-28 2019-05-28 Method and device for acquiring stuck information

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201910452570.7A CN112015612B (en) 2019-05-28 2019-05-28 Method and device for acquiring stuck information

Publications (2)

Publication Number Publication Date
CN112015612A CN112015612A (en) 2020-12-01
CN112015612B true CN112015612B (en) 2023-04-14

Family

ID=73501035

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201910452570.7A Active CN112015612B (en) 2019-05-28 2019-05-28 Method and device for acquiring stuck information

Country Status (1)

Country Link
CN (1) CN112015612B (en)

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113626244B (en) * 2021-08-26 2024-05-28 广州市百果园网络科技有限公司 ANR abnormal data collection method, display method, device and equipment

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106776253A (en) * 2016-12-08 2017-05-31 武汉斗鱼网络科技有限公司 A kind of interface interim card monitoring method and device
CN107273278A (en) * 2017-06-02 2017-10-20 广东欧珀移动通信有限公司 Interim card determines method, device and terminal
CN108512695A (en) * 2018-03-12 2018-09-07 腾讯音乐娱乐科技(深圳)有限公司 The method and device of interim card is applied in monitoring

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106776253A (en) * 2016-12-08 2017-05-31 武汉斗鱼网络科技有限公司 A kind of interface interim card monitoring method and device
CN107273278A (en) * 2017-06-02 2017-10-20 广东欧珀移动通信有限公司 Interim card determines method, device and terminal
CN108512695A (en) * 2018-03-12 2018-09-07 腾讯音乐娱乐科技(深圳)有限公司 The method and device of interim card is applied in monitoring

Also Published As

Publication number Publication date
CN112015612A (en) 2020-12-01

Similar Documents

Publication Publication Date Title
CN110308956B (en) Application interface display method and device and mobile terminal
CN108897659B (en) Method, device and storage medium for modifying log level
CN110007981B (en) Method and device for starting application program, electronic equipment and medium
CN110784370B (en) Method and device for testing equipment, electronic equipment and medium
CN109828915B (en) Method, device, equipment and storage medium for debugging application program
CN110677713B (en) Video image processing method and device and storage medium
CN109783176B (en) Page switching method and device
CN111191227A (en) Method and device for preventing malicious code from executing
CN108401194B (en) Time stamp determination method, apparatus and computer-readable storage medium
CN110263695B (en) Face position acquisition method and device, electronic equipment and storage medium
CN111986700A (en) Method, device, equipment and storage medium for triggering non-contact operation
CN111881423A (en) Method, device and system for limiting function use authorization
CN110321059B (en) Data processing method, device and computer readable storage medium
CN112015612B (en) Method and device for acquiring stuck information
CN108647127B (en) Application power consumption monitoring method and device
CN112181915A (en) Method, device, terminal and storage medium for executing service
CN110941458B (en) Method, device, equipment and storage medium for starting application program
CN110471613B (en) Data storage method, data reading method, device and system
CN108519913B (en) Application program running state management method and device, storage medium and terminal
CN112202966B (en) Communication information notification method and device and computer readable storage medium
CN111708581A (en) Application starting method, device, equipment and computer storage medium
CN111190751A (en) Task processing method and device based on song list, computer equipment and storage medium
CN111246240A (en) Method and apparatus for storing media data
CN111008381B (en) Terminal detection method, device, terminal and storage medium
CN113345478B (en) Player time acquisition method, device, storage medium and player

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