CN106959899B - Message blocking detection method, device and computer storage medium - Google Patents

Message blocking detection method, device and computer storage medium Download PDF

Info

Publication number
CN106959899B
CN106959899B CN201710107990.2A CN201710107990A CN106959899B CN 106959899 B CN106959899 B CN 106959899B CN 201710107990 A CN201710107990 A CN 201710107990A CN 106959899 B CN106959899 B CN 106959899B
Authority
CN
China
Prior art keywords
time
message
processing
expected
preset
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
CN201710107990.2A
Other languages
Chinese (zh)
Other versions
CN106959899A (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.)
Advanced New Technologies Co Ltd
Advantageous New Technologies Co Ltd
Original Assignee
Advanced New Technologies 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 Advanced New Technologies Co Ltd filed Critical Advanced New Technologies Co Ltd
Priority to CN201710107990.2A priority Critical patent/CN106959899B/en
Publication of CN106959899A publication Critical patent/CN106959899A/en
Application granted granted Critical
Publication of CN106959899B publication Critical patent/CN106959899B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/46Multiprogramming arrangements
    • G06F9/54Interprogram communication
    • G06F9/546Message passing systems or structures, e.g. queues
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/46Multiprogramming arrangements
    • G06F9/52Program synchronisation; Mutual exclusion, e.g. by means of semaphores
    • G06F9/524Deadlock detection or avoidance

Landscapes

  • Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Debugging And Monitoring (AREA)
  • Telephonic Communication Services (AREA)

Abstract

The embodiment of the application discloses a message blocking detection method, a message blocking detection device and a computer storage medium. The method comprises the following steps: setting an expected start processing time of a message next to a current message when the current message in a message queue is processed; acquiring the actual processing starting time of the next message; calculating a time difference between the expected start processing time and the actual start processing time of the next message; detecting whether the time difference is greater than a preset blocking time threshold; and when the time difference is detected to be larger than the preset blocking time threshold, determining that the message queue is blocked in the processing stage of the current message. By utilizing the method and the device, the position of the blockage in the message queue can be accurately positioned, and the problem of application blockage on the electronic equipment can be solved.

Description

Message blocking detection method, device and computer storage medium
Technical Field
The present application relates to the field of electronic communications technologies, and in particular, to a method and an apparatus for detecting message congestion, and a computer storage medium.
Background
With the rapid development of electronic communication technology, electronic devices such as mobile phones, tablets, computers and the like are widely applied to daily learning, working and life of people, and people can use the electronic devices to process daily events such as financing, information browsing, life affairs and the like.
At present, event feedback, interface drawing, broadcast processing and the like of electronic equipment are generally realized based on a message mechanism, and when a user triggers a certain event, the event enters a corresponding message queue in a message form; the processor then processes the message and returns the result of the processing of the message. However, in practical applications, a plurality of messages to be processed generally exist in a message queue, and electronic equipment generally performs multi-thread processing, so that the message queue is blocked due to overlong processing time of a certain message, resource robbery between threads, and the like, and accordingly, an application on the electronic equipment cannot respond to user operation in time, an application jam phenomenon occurs, and user experience is seriously affected. However, in the prior art, the position of the blockage in the message queue cannot be accurately positioned, so that the phenomenon of application blockage cannot be improved.
Disclosure of Invention
An object of the embodiments of the present application is to provide a method and an apparatus for detecting message blocking, and a computer storage medium, so as to accurately locate a position where blocking occurs in a message queue, thereby solving a problem of application jamming on an electronic device.
In order to solve the above technical problem, the embodiment of the present application is implemented as follows:
a method of message congestion detection, comprising:
setting an expected start processing time of a message next to a current message when the current message in a message queue is processed;
acquiring the actual processing starting time of the next message;
calculating a time difference between the expected start processing time and the actual start processing time of the next message;
detecting whether the time difference is greater than a preset blocking time threshold;
and when the time difference is detected to be larger than the preset blocking time threshold, determining that the message queue is blocked in the processing stage of the current message.
A method of message congestion detection, comprising:
when processing a message in a completion message queue, setting an expected end processing time of a next message of the message;
acquiring the actual processing starting time of the next message;
calculating a time difference between the expected ending processing time and the actual ending execution time of the next message;
detecting whether the time difference is greater than a preset blocking time threshold;
and when the time difference is detected to be larger than the preset blocking time threshold, determining that the message queue is blocked in the processing stage of the next message.
A message blocking detection apparatus, comprising:
the expected start time setting module is used for setting the expected start processing time of the next message of the current message when the current message in the message queue is processed;
an actual start time obtaining module, configured to obtain an actual start processing time of the next message;
a first calculating module for calculating a time difference between an expected start processing time and an actual start processing time of the next message;
the first detection module is used for detecting whether the time difference is greater than a preset blocking time threshold value or not;
a first blocking position determining module, configured to determine that the message queue is blocked in the current message processing stage when the first detecting module detects that the time difference is greater than the preset blocking time threshold.
A message blocking detection apparatus, comprising:
an expected end time setting module, configured to set an expected end processing time of a next message of the messages when processing one message in a message queue;
an actual end time obtaining module, configured to obtain an actual start processing time of the next message;
a second calculating module, configured to calculate a time difference between an expected end processing time and an actual end execution time of the next message;
the second detection module is used for detecting whether the time difference is greater than a preset blocking time threshold value or not;
and the second blocking position determining module is used for determining that the message queue is blocked in the processing stage of the next message when the second detecting module detects that the time difference is greater than the preset blocking time threshold.
A computer storage medium having stored thereon a computer program which, when executed by a processor, performs the steps of:
setting an expected start processing time of a message next to a current message when the current message in a message queue is processed;
acquiring the actual processing starting time of the next message;
calculating a time difference between the expected start processing time and the actual start processing time of the next message;
detecting whether the time difference is greater than a preset blocking time threshold;
and when the time difference is detected to be larger than the preset blocking time threshold, determining that the message queue is blocked in the processing stage of the current message.
A computer storage medium having stored thereon a computer program which, when executed by a processor, performs the steps of:
when processing a message in a completion message queue, setting an expected end processing time of a next message of the message;
acquiring the actual processing starting time of the next message;
calculating a time difference between the expected ending processing time and the actual ending execution time of the next message;
detecting whether the time difference is greater than a preset blocking time threshold;
and when the time difference is detected to be larger than the preset blocking time threshold, determining that the message queue is blocked in the processing stage of the next message.
According to the technical scheme provided by the embodiment of the application, when the current message in the message queue is processed, the expected processing starting time of the next message of the current message is set, after the actual processing starting time of the message is obtained, the time difference between the expected processing starting time and the actual processing starting time of the next message is calculated, and then the message queue is determined to be blocked in the processing stage of the current message corresponding to the time difference larger than the preset blocking time threshold value in a mode of detecting whether the time difference between the expected processing starting time and the actual processing starting time of the message in the message queue is larger than the preset blocking time threshold value. Compared with the prior art, the technical scheme provided by the application can accurately position the message position where the message queue is blocked due to overlong message processing time, resource robbery between threads and the like, and further can solve the problem of application blockage on the electronic equipment.
Drawings
In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings needed to be used in the description of the embodiments or the prior art will be briefly introduced below, it is obvious that the drawings in the following description are only some embodiments described in the present application, and for those skilled in the art, other drawings can be obtained according to the drawings without any creative effort.
Fig. 1 is a schematic flowchart of an embodiment of a message blocking detection method provided in the present application;
FIG. 2 is a statistical schematic diagram of one embodiment of expected and actual start processing times, and time differences, for messages in a message queue, as provided herein;
fig. 3 is a schematic flowchart of another embodiment of a message blocking detection method provided in the present application;
fig. 4 is a schematic structural diagram of an embodiment of a message blocking detection apparatus provided in the present application;
fig. 5 is a schematic structural diagram of another embodiment of a message blocking detection apparatus provided in the present application.
Detailed Description
The embodiment of the application provides a message blocking detection method, a message blocking detection device and a computer storage medium.
In order to make those skilled in the art better understand the technical solutions in the present application, the technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the drawings in the embodiments of the present application, and it is obvious that the described embodiments are only a part of the embodiments of the present application, and not all of the embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present application.
The following describes specific implementations of embodiments of the present application in detail with reference to several specific examples.
An embodiment of a message blocking detection method according to the present application is first described below. Fig. 1 is a flow diagram of one embodiment of a message jamming detection method provided herein, which provides the method operation steps described in the embodiments or flow diagrams, but may include more or less operation steps based on conventional or non-inventive labor. The order of steps recited in the embodiments is merely one manner of performing the steps in a multitude of orders and does not represent the only order of execution. In actual implementation, the system or client product may execute sequentially or in parallel (e.g., in the context of parallel processors or multi-threaded processing) according to the embodiments or methods shown in the figures. Specifically, as shown in fig. 1, the method may include:
s110: when processing a current message in a message queue, an expected start processing time for a next message to the current message is set.
In an embodiment of the present application, when processing a current message in a message queue, a desired start processing time of a next message to the current message may be set. Specifically, the expected processing start time may be a time for starting processing of a message under a preset non-blocking condition, and specifically, the time for starting processing of the message may be a time for starting acquiring a thread for executing the message (in an actual application, the message may acquire the thread after acquiring the thread for multiple times due to resource preemption among threads). In addition, in practical application, the messages in the message queue are sequentially processed according to the time of entering the message queue, and correspondingly, the time for starting processing a certain message may also be the time for finishing processing the previous message of the certain message.
In a specific embodiment, the expected start processing time may be a current time at which the expected start processing time is set plus a time after the first preset message execution time. In practical applications, after the message enters the message queue, the response processing message is generally instant in the absence of the blocking, and accordingly, in another specific embodiment, the expected processing start time may be set to be the time when the message enters the message queue plus the time after the execution time of the first preset message.
Specifically, the first preset message execution time may be a time from the beginning of the message execution to the end of the message execution in a non-blocking situation preset in combination with an actual application situation, minus a time that the current message has been executed when the current time of the expected start processing time is set. In addition, for different types of messages, the required time for executing the message may also be different, and correspondingly, the first preset message execution time may be set in combination with the type of the current message.
In addition, it should be noted that the expected processing start time in the embodiment of the present application is not limited to the aforementioned time obtained by adding the current time of the expected processing start time to the preset message execution required time or the time obtained by adding the message into the message queue to the preset message execution required time, and in practical applications, other times may be set in combination with specific application scenario requirements, for example, when a user triggers a certain event through a preset operation, and a response to the event corresponding to the message needs to be in an application scenario after a preset time period, the expected processing start time may be the time obtained by adding the current time of the expected processing start time to the preset message execution required time and the time after the preset time period, and the like.
In some embodiments, the desired start processing time described herein may be a point in time; in other embodiments, the expected processing start time may be a relative time, for example, assuming that the total processing time of a certain message queue is 60ms, the total time required for processing the first two messages (the messages in the message queue are sequentially processed according to the time of entering the message queue) without blocking is 8ms, and correspondingly, the expected processing start time of the third message in the message queue may be set to 8 ms.
S120: and acquiring the actual starting processing time of the next message.
In this embodiment of the present application, the actual processing start time of the next message may be obtained. In practical application, a system of the electronic device may provide an external interface for counting message processing time in the application, and when the message processing time needs to be counted, the actual message processing start time may be obtained in a log printing manner after the corresponding setting is performed on the interface for counting message processing time.
Specifically, for example, in the Android system, it is assumed that a current message queue is a message queue corresponding to an application in the Android system, an interface (Printer interface) capable of counting message processing time is provided externally by the Looper class of the Android, and accordingly, the actual processing time of the message is obtained by performing log printing after the Printer interface is set correspondingly.
It should be noted that the manner of acquiring the actual processing start time in the embodiments of the present application is not limited to the above-described manner, and other manners may be included in practical applications.
In some embodiments, the actual start processing time may be a time point; in other embodiments, the actual start processing time may be a relative duration.
S130: a time difference between the expected start processing time and the actual start processing time of the next message is calculated.
In practical application, when no blockage occurs in the message queue, the expected starting processing time of the messages in the message queue is the same as the actual starting processing time; accordingly, after acquiring the actual start processing time of the next message, a time difference between the expected start processing time and the actual start processing time of the next message may be calculated in conjunction with the set expected start processing time of the message.
In some embodiments, before calculating the time difference between the expected processing start time and the actual processing start time of the next message in step S130, the method may further include:
comparing the expected starting processing time and the actual starting processing time of the next message, and when the actual starting processing time is larger than the expected starting processing time, executing the step of calculating the time difference between the expected starting processing time and the actual starting processing time of the next message.
In some embodiments, whether the corresponding message starts processing in time may be determined by comparing the actual start processing time and the expected start processing time of the message in the message queue, and when the actual start processing time is greater than the expected start processing time, it may be determined that the corresponding message does not start processing in time, and accordingly, the step of calculating the time difference between the expected start processing time and the actual start processing time of the next message may be performed. In addition, by comparing the actual processing start time of the message in the message queue with the expected processing start time, the message which is processed on time can be excluded, and the subsequent calculation amount can be reduced.
S140: detecting whether the time difference is greater than a preset blocking time threshold.
In the embodiment of the present application, the preset blocking time threshold may be a preset critical value that can ensure the smoothness of the interface. In practical application, when the refresh frame rate applied to a general electronic device is 60 frames, the interface fluency during the use process of a user can be ensured, and correspondingly, when the refresh frame rate is 60 frames, the difference value between frames is 16.6ms, so that when the time difference between the expected processing start time and the actual processing start time of the message in the message queue is greater than 16.6ms, the applied katon phenomenon occurs. Accordingly, in a specific embodiment, the preset blocking time threshold may be set to a value greater than or equal to 0 and less than or equal to 16.6 ms.
In addition, it should be noted that the preset blocking time threshold in the embodiment of the present application is not limited to the above numerical value greater than or equal to 0 and less than or equal to 16.6ms, and in practical application, other numerical values capable of ensuring the fluency of the interface may be set according to practical application conditions and a refresh frame rate applied to the electronic device.
In this embodiment of the present application, a position where a message queue is blocked may be located from the message queue by detecting whether a time difference between an expected processing start time and an actual processing start time of a message in the message queue is greater than a preset blocking time threshold, and correspondingly, when it is detected that the time difference is greater than the preset blocking time threshold, step S150 may be executed.
S150: and when the time difference is detected to be larger than the preset blocking time threshold, determining that the message queue is blocked in the processing stage of the current message.
In practical application, the messages in the message queue are sequentially arranged and processed according to the time of entering the message queue. In this embodiment of the present application, when it is detected that the time difference is greater than the preset blocking time threshold, it may be determined that the message corresponding to the time difference greater than the preset blocking time threshold does not start to be processed in time, and a block occurs in the message queue before the message is processed.
In particular, a processing stage of a message may be understood as a time from the beginning of the processing of the message to the end of the processing of the message. In particular, the method may include starting to obtain thread resources for the message, executing the message after obtaining the thread resources, and completing the message.
By utilizing the steps S110 to S150, the position of the message causing the message queue blockage can be accurately positioned from the message queue, and corresponding improvement can be carried out subsequently, so that the problem of application blockage on the electronic equipment is solved.
In practical application, the corresponding message processing time is too long due to the complex logic of the program itself, and the like, thereby causing the message queue to be blocked. Accordingly, in some embodiments, the method may further comprise:
acquiring the execution time of the message corresponding to the blocking of the message queue;
judging whether the execution time is larger than a preset execution time threshold value or not
And when the execution time is judged to be greater than the preset execution time threshold, determining that the execution of the message corresponding to the execution time greater than the preset execution time threshold causes the message queue to be blocked.
Specifically, in an embodiment, the preset execution time threshold may be a preset critical message processing time for ensuring smooth interface. By obtaining the processing time of the message causing the blocking and judging whether the processing time is greater than the preset execution time threshold value, whether the message causes the program blocking and applies the stuck phenomenon due to the fact that the execution time of the message is too long can be determined. Correspondingly, when the execution time of the message is judged to be greater than the preset execution time threshold, the message queue can be judged to be blocked due to the execution of the message, and an application pause phenomenon is caused.
Specifically, the execution time of the message may be the time when the message acquisition execution thread resource starts executing the message until the message acquisition execution thread resource finishes executing the message.
In practical applications, due to resource preemption among threads, a message is not started to be executed in time, and a message queue is blocked. Accordingly, in some embodiments, the method may further comprise:
and when the execution time is judged to be less than or equal to the preset execution time threshold, determining that the message queue is blocked due to resource preemption among threads at the processing stage of the message corresponding to the execution time less than or equal to the preset execution time threshold.
Specifically, when the execution time of the message is judged to be less than or equal to the preset execution time threshold, it can be determined that the message itself is executed without causing the message queue to be blocked, and accordingly, it can be determined that the message queue is blocked due to resource preemption among threads occurring in the processing stage of the message, which causes the application pause phenomenon.
In some embodiments, the method may further comprise:
and acquiring the time difference corresponding to the messages in the message queue, and performing statistical analysis processing on the time difference corresponding to the messages in the message queue to obtain the blocking information of the message queue.
Specifically, the performing statistical analysis on the time difference corresponding to the message in the message queue to obtain the blocking information of the message queue may include: counting the numerical value of the time difference corresponding to the messages in the message queue, and when the time difference is the largest, obtaining the blocking message which is most blocked when the message corresponding to the time difference starts to be processed and occurs in the message processing period processed before the message which is most blocked; and may include: counting the numerical value of the time difference corresponding to the messages in the message queue, and according to the variation trend of the numerical value, obtaining the blocking messages of which the time difference is in an increasing trend, the blocking phenomenon of the message queue tends to be serious, and the blocking phenomenon of the message queue tends to be reduced when the time difference is in a decreasing trend.
Fig. 2 is a statistical schematic diagram of an embodiment of expected processing start time and actual processing start time of a message in a message queue and a time difference provided by the present application, as shown in fig. 2. As can be seen from the figure, d1 is 0ms, d2 is 12ms, d3 is 18ms, and d4 is 24ms, and accordingly, it can be determined that the processing of the message 2, the message 3, and the message 4 is not started in time, and accordingly, it can be determined that the processing stages of the message 2 and the message 3 are blocked, assuming that the preset blocking time threshold is 16 ms; meanwhile, the time difference between the expected processing starting time and the actual processing starting time of the message 4 is the largest, which indicates that the blockage is the most serious in the processing stage of the message 3; and the change trend of the numerical value of the time difference corresponding to the message is an increasing trend, which indicates that the blocking phenomenon of the message queue tends to be serious.
Therefore, in the embodiment of the message blocking detection method, when a current message in a message queue is processed, an expected starting processing time of a next message of the current message is set, after an actual starting processing time of the message is obtained, a time difference between the expected starting processing time and the actual starting processing time of the next message is calculated, and then, whether the message queue is blocked in a processing stage of the current message corresponding to the time difference larger than a preset blocking time threshold is determined by detecting whether the time difference between the expected starting processing time and the actual starting processing time of the message in the message queue is larger than the preset blocking time threshold. Subsequently, by acquiring the processing time of the blocking message and judging whether the processing time is greater than a preset execution time threshold, the blocking can be effectively distinguished as being caused by overlong processing time of the message or resource robbery between threads, so that subsequent targeted improvement is facilitated, and the problem of application blockage on the electronic equipment is solved. Compared with the prior art, the technical scheme provided by the application can accurately position the message position where the message queue is blocked due to overlong message processing time, resource robbery between threads and the like, and further can solve the problem of application blockage on the electronic equipment.
Another embodiment of a message blocking detection method of the present application is described below. Fig. 3 is a flow diagram of another embodiment of a message jamming detection method provided herein, which provides the method operation steps as described in the embodiments or flowcharts, but may include more or less operation steps based on conventional or non-inventive labor. The order of steps recited in the embodiments is merely one manner of performing the steps in a multitude of orders and does not represent the only order of execution. In actual implementation, the system or client product may execute sequentially or in parallel (e.g., in the context of parallel processors or multi-threaded processing) according to the embodiments or methods shown in the figures. Specifically, as shown in fig. 3, the method may include:
s310: when processing a message in the completion message queue, an expected end processing time for a next message of the message is set.
In an embodiment of the present application, when processing a message in a completion message queue, an expected end processing time of a next message of the message may be set. Specifically, the expected end processing time may be a time for ending processing of a message under a preset non-blocking condition.
In a specific embodiment, the expected end processing time may be a current time at which the expected end processing time is set plus a time after a second preset message execution time. In practical applications, after the message enters the message queue, the response processing message is generally instant under the condition of no blocking, and correspondingly, the expected ending processing time may be set as the time when the message enters the message queue plus the time after the execution time of the second preset message. Specifically, the second preset message execution time may be a time from the beginning of the message execution to the end of the message execution under a non-blocking condition preset in combination with an actual application condition. In addition, for different types of messages, the processing time of the message may also be different, and correspondingly, the second preset message execution time may be set in combination with the type of the next message.
In addition, it should be noted that the expected ending processing time in the embodiment of the present application is not limited to the time obtained by adding the current time of the expected ending processing time to the second preset message execution time or the time obtained by adding the message into the message queue to the second preset message execution time, and in an actual application, other times may be set in combination with specific application scenario requirements, for example, when a user triggers a certain event through a preset operation, and a response to the event corresponding to the message needs to be in an application scenario after a preset time period, the expected starting processing time may be set to be the time obtained by adding the current time of the expected ending processing time to the second preset message execution time and the time after the preset time period, but the expected ending processing time in the embodiment of the present application is not limited to the above.
In some embodiments, the desired end processing time may be a point in time; in other embodiments, the expected ending processing time may be a relative time, for example, assuming that the total processing time of a certain message queue is 60ms, the total time required for processing the first two messages (the messages in the message queue are arranged in sequence according to the time of entering the message queue) without blocking is 8ms, and correspondingly, the expected starting processing time for the second message in the message queue to end processing may be set to 8 ms.
S320: and acquiring the actual starting processing time of the next message.
In this embodiment of the present application, the actual processing start time of the next message may be obtained. In practical application, a system of the electronic device may provide an external interface for counting message processing time in the application, and when the message processing time needs to be counted, the actual message processing start time may be obtained in a log printing manner after the corresponding setting is performed on the interface for counting message processing time.
Specifically, for example, in the Android system, it is assumed that a current message queue is a message queue corresponding to an application in the Android system, an interface (Printer interface) capable of counting message processing time is provided externally by the Looper class of the Android, and accordingly, the actual message processing end time can be obtained by performing log printing after the Printer interface is set correspondingly.
It should be noted that the manner of acquiring the actual end processing time in the embodiments of the present application is not limited to the above-described manner, and other manners may be included in practical applications.
In some embodiments, the actual ending processing time may be a time point; in other embodiments, the actual end processing time may be a relative duration.
S330: calculating a time difference between the expected end processing time and the actual end execution time of the next message.
In practical application, under the condition that no blockage occurs in a message queue, messages in the message queue can start to be processed on time and finish the processing on time, and correspondingly, the expected ending processing time of the messages is the same as the actual ending processing time; accordingly, after the actual ending process time of the message in the message queue is acquired, the time difference between the expected ending process time and the actual ending execution time of the next message may be calculated in combination with the set expected ending process time of the message.
In some embodiments, before calculating the time difference between the expected end processing time and the actual end execution time of the next message in step S330, the method may further include:
comparing the expected starting processing time and the actual starting processing time of the next message, and when the actual starting processing time is larger than the expected starting processing time, executing the step of calculating the time difference between the expected ending processing time and the actual ending execution time of the next message.
In some embodiments, whether the corresponding message is processed on time may be determined by comparing an actual end processing time and an expected end processing time of the message in the message queue, and when the actual end processing time is greater than the expected end processing time, it may be determined that the corresponding message is not processed on time, and accordingly, the step of calculating a time difference between the expected end processing time and the actual end execution time of the next message may be performed. In addition, by comparing the actual ending processing time with the expected ending processing time of the messages in the message queue, the messages which are processed on time can be eliminated, and the subsequent calculation amount is reduced.
S340: detecting whether the time difference is greater than a preset blocking time threshold.
In the embodiment of the present application, the preset blocking time threshold may be a preset critical value that can ensure the smoothness of the interface. In practical application, when the refresh frame rate applied to a general electronic device is 60 frames, the interface fluency during the use process of a user can be ensured, and correspondingly, when the refresh frame rate is 60 frames, the difference value between frames is 16.6ms, so that when the time difference between the expected ending processing time and the actual ending processing time of the message in the message queue is greater than 16.6ms, the applied katon phenomenon occurs. Accordingly, in a specific embodiment, the preset blocking time threshold may be set to a value greater than or equal to 0 and less than or equal to 16.6 ms.
In addition, it should be noted that the preset blocking time threshold in the embodiment of the present application is not limited to the above numerical value greater than or equal to 0 and less than or equal to 16.6ms, and in practical application, other numerical values capable of ensuring the fluency of the interface may be set according to practical application conditions and a refresh frame rate applied to the electronic device.
In the embodiment of the present application, a position where a message queue is blocked may be located from the message queue by detecting whether a time difference between an expected end processing time and an actual end processing time of a message in the message queue is greater than a preset blocking time threshold, and correspondingly, when it is detected that the time difference is greater than the preset blocking time threshold, step S350 may be executed.
S350: and when the time difference is detected to be larger than the preset blocking time threshold, determining that the message queue is blocked in the processing stage of the next message.
In this embodiment of the present application, when it is detected that the time difference is greater than the preset blocking time threshold, it may be determined that the message corresponding to the time difference greater than the preset blocking time threshold is not processed in time, and accordingly, it may be determined that the message queue is blocked at the message processing stage corresponding to the time difference greater than the preset blocking time threshold.
In particular, a processing stage of a message may be understood as a time from the beginning of the processing of the message to the end of the processing of the message. In particular, the method may include the steps of starting to obtain thread resources for the message, executing the message after obtaining the thread resources, and completing the message
By utilizing the steps S310 to S350 of the application, the position of the message causing the message queue blockage can be accurately positioned from the message queue, and corresponding improvement can be carried out subsequently, so that the problem of application blockage on the electronic equipment is solved.
In practical application, the corresponding message processing time is too long due to the complex logic of the program itself, and the like, thereby causing the program to be blocked. Accordingly, in some embodiments, the method may further comprise:
acquiring the execution time of the message corresponding to the blocking of the message queue;
judging whether the execution time is greater than a preset execution time threshold value;
and when the execution time is judged to be greater than the preset execution time threshold, determining that the execution of the message corresponding to the execution time greater than the preset execution time threshold causes the message queue to be blocked.
Specifically, in an embodiment, the preset execution time threshold may be a preset critical message processing time for ensuring smooth interface. By obtaining the processing time of the message causing the blocking and judging whether the processing time is greater than the preset execution time threshold value, whether the message causes the program blocking and applies the stuck phenomenon due to the fact that the execution time of the message is too long can be determined. Correspondingly, when the execution time of the message is judged to be greater than the preset execution time threshold, the message queue can be judged to be blocked due to the execution of the message, and an application pause phenomenon is caused.
Specifically, the execution time of the message may be the time when the message acquisition execution thread resource starts executing the message until the message acquisition execution thread resource finishes executing the message.
In practical applications, due to resource preemption among threads, a message is not started to be executed in time, and a message queue is blocked. Accordingly, in some embodiments, the method may further comprise:
and when the execution time is judged to be less than or equal to the preset execution time threshold, determining that the message queue is blocked due to resource preemption among threads at the processing stage of the message corresponding to the execution time less than or equal to the preset execution time threshold.
Specifically, when the execution time of the message is judged to be less than or equal to the preset execution time threshold, it can be determined that the message itself is executed without causing the message queue to be blocked, and accordingly, it can be determined that the message queue is blocked due to resource preemption among threads occurring in the processing stage of the message, which causes the application pause phenomenon.
In some embodiments, the method may further comprise:
and acquiring the time difference corresponding to the messages in the message queue, and performing statistical analysis processing on the time difference corresponding to the messages in the message queue to obtain the blocking information of the message queue.
Specifically, the performing statistical analysis on the time difference corresponding to the message in the message queue to obtain the blocking information of the message queue may include: counting the numerical value of the time difference corresponding to the messages in the message queue, and when the time difference is the largest, obtaining the blocking message which is most blocked when the message corresponding to the time difference starts to be processed and occurs in the message processing period processed before the message which is most blocked; and may include: counting the numerical value of the time difference corresponding to the messages in the message queue, and according to the variation trend of the numerical value, obtaining the blocking messages of which the time difference is in an increasing trend, the blocking phenomenon of the message queue tends to be serious, and the blocking phenomenon of the message queue tends to be reduced when the time difference is in a decreasing trend.
Therefore, in the embodiment of the message blocking detection method, when one message in a message queue is processed, the expected ending processing time of the next message of the message is set, after the actual ending processing time of the message is obtained, the time difference between the expected ending processing time and the actual ending execution time of the next message is calculated, then, whether the time difference between the expected ending processing time and the actual ending processing time of the message in the message queue is greater than a preset blocking time threshold value or not is detected, and the message queue is determined to be blocked in the processing stage of the next message corresponding to the time difference greater than the preset blocking time threshold value. Subsequently, by acquiring the execution time of the blocking message and judging whether the execution time is greater than a preset execution time threshold, the blocking can be effectively distinguished as being caused by overlong execution time of the message or resource robbery between threads, so that subsequent targeted improvement is facilitated, and the problem of application blockage on the electronic equipment is solved. Compared with the prior art, the technical scheme provided by the application can accurately position the message position where the message queue is blocked due to overlong message processing time, resource robbery between threads and the like, and further can solve the problem of application blockage on the electronic equipment.
Another aspect of the present application further provides a message congestion detection apparatus, fig. 4 is a schematic structural diagram of an embodiment of the message congestion detection apparatus provided in the present application, and as shown in fig. 4, the apparatus 400 may include:
an expected start time setting module 410, which can be used for setting an expected start processing time of a next message of a current message when the current message in a message queue is processed;
an actual start time obtaining module 420, configured to obtain an actual start processing time of the next message;
a first calculating module 430, operable to calculate a time difference between the expected start processing time and the actual start processing time of the next message;
a first detection module 440, configured to detect whether the time difference is greater than a preset blocking time threshold;
the first blocking position determining module 450 may be configured to determine that the message queue is blocked in the processing stage of the current message when the first detecting module 440 detects that the time difference is greater than the preset blocking time threshold.
In another embodiment, the apparatus 400 may further include:
a first comparing module, configured to compare the expected processing start time and the actual processing start time of the next message before the first calculating module 430 calculates the time difference between the expected processing start time and the actual processing start time of the next message, and when the actual processing start time is greater than the expected processing start time, the first calculating module 430 calculates the time difference between the expected processing start time and the actual processing start time of the next message.
In another embodiment, the apparatus 400 may further include:
the first blocking information obtaining module may be configured to obtain a time difference of the messages in the message queue, which is obtained by the calculation of the first calculating module, and perform statistical analysis processing on the time difference corresponding to the messages in the message queue to obtain blocking information of the message queue.
In another embodiment, the apparatus 400 may further include:
a first execution time obtaining module, configured to obtain an execution time of a message corresponding to a congestion occurring in the message queue;
the first determining module may be configured to determine whether the execution time is greater than a preset execution time threshold
The first blocking determination module may be configured to determine that, when the first determination module determines that the execution time is greater than the preset execution time threshold, the execution of the message corresponding to the execution time greater than the preset execution time threshold causes a blocking of a message queue.
In another embodiment, the apparatus 400 may further include:
and the second blocking determining module is used for determining that the message queue is blocked due to resource preemption among threads at the processing stage of the message corresponding to the execution time less than or equal to the preset execution time threshold when the first judging module judges that the execution time is less than or equal to the preset execution time threshold.
Fig. 5 is a schematic structural diagram of another embodiment of the message congestion detection apparatus provided in the present application, and as shown in fig. 5, the apparatus 500 shown in the present application may include:
an expected end time setting module 510, which may be configured to set an expected end processing time of a message next to a message when processing the message in the completion message queue;
an actual ending time obtaining module 520, configured to obtain an actual starting processing time of the next message;
a second calculating module 530, configured to calculate a time difference between the expected ending processing time and the actual ending execution time of the next message;
a second detecting module 540, configured to detect whether the time difference is greater than a preset blocking time threshold;
the second blocking position determining module 550 may be configured to determine that the message queue is blocked in the processing stage of the next message when the second detecting module 540 detects that the time difference is greater than the preset blocking time threshold.
In another embodiment, the apparatus 500 may further include:
a fourth detecting module, configured to compare the expected start processing time and the actual start processing time of the next message before the second calculating module 530 calculates the time difference between the expected end processing time and the actual end execution time of the next message, and when the actual start processing time is greater than the expected start processing time, the second calculating module 530 may calculate the time difference between the expected end processing time and the actual end execution time of the next message.
In another embodiment, the apparatus 500 may further include:
the second blocking information obtaining module may be configured to obtain a time difference corresponding to the message in the message queue, which is obtained by the calculation of the second calculating module, and perform statistical analysis processing on the time difference corresponding to the message in the message queue to obtain the blocking information of the message queue.
In another embodiment, the apparatus 500 may further include:
a second execution time obtaining module, configured to obtain an execution time of a message corresponding to a congestion occurring in the message queue;
the second judging module may be configured to judge whether the execution time is greater than a preset execution time threshold;
the third blocking determination module may be configured to determine that, when the second determination module determines that the execution time is greater than the preset execution time threshold, the message queue is blocked due to the execution of the message corresponding to the execution time greater than the preset execution time threshold.
In another embodiment, the apparatus 500 may further include:
the fourth blocking determination module may be configured to determine that the message queue is blocked due to resource preemption among threads occurring in a processing stage of the message corresponding to the execution time that is less than or equal to the preset execution time threshold when the second determination module determines that the execution time is less than or equal to the preset execution time threshold.
Another aspect of the present application further provides a computer storage medium having a computer program stored thereon, which when executed by a processor, performs the steps of:
setting an expected start processing time of a message next to a current message when the current message in a message queue is processed;
acquiring the actual processing starting time of the next message;
calculating a time difference between the expected start processing time and the actual start processing time of the next message;
detecting whether the time difference is greater than a preset blocking time threshold;
and when the time difference is detected to be larger than the preset blocking time threshold, determining that the message queue is blocked in the processing stage of the current message.
Yet another aspect of the present application provides another embodiment of a computer storage medium having a computer program stored thereon, which when executed by a processor, performs the steps of:
when processing a message in a completion message queue, setting an expected end processing time of a next message of the message;
acquiring the actual processing starting time of the next message;
calculating a time difference between the expected ending processing time and the actual ending execution time of the next message;
detecting whether the time difference is greater than a preset blocking time threshold;
and when the time difference is detected to be larger than the preset blocking time threshold, determining that the message queue is blocked in the processing stage of the next message.
Therefore, in the embodiment of the method, the apparatus, or the computer storage medium for detecting message blocking according to the present application, when processing a current message in a message queue, an expected starting processing time of a next message of the current message is set, after an actual starting processing time of the message is obtained, a time difference between the expected starting processing time and the actual starting processing time of the next message is calculated, and then, it is determined that the message queue is blocked in a processing stage of the current message corresponding to a time difference larger than a preset blocking time threshold value by detecting whether the time difference between the expected starting processing time and the actual starting processing time of the message in the message queue is larger than the preset blocking time threshold value. Compared with the prior art, the technical scheme provided by the application can accurately position the message position where the message queue is blocked due to overlong message processing time, resource robbery between threads and the like, and further can solve the problem of application blockage on the electronic equipment.
In the 90 s of the 20 th century, improvements in a technology could clearly distinguish between improvements in hardware (e.g., improvements in circuit structures such as diodes, transistors, switches, etc.) and improvements in software (improvements in process flow). However, as technology advances, many of today's process flow improvements have been seen as direct improvements in hardware circuit architecture. Designers almost always obtain the corresponding hardware circuit structure by programming an improved method flow into the hardware circuit. Thus, it cannot be said that an improvement in the process flow cannot be realized by hardware physical modules. For example, a Programmable Logic Device (PLD), such as a Field Programmable Gate Array (FPGA), is an integrated circuit whose Logic functions are determined by programming the Device by a user. A digital system is "integrated" on a PLD by the designer's own programming without requiring the chip manufacturer to design and fabricate application-specific integrated circuit chips. Furthermore, nowadays, instead of manually making an Integrated Circuit chip, such Programming is often implemented by "logic compiler" software, which is similar to a software compiler used in program development and writing, but the original code before compiling is also written by a specific Programming Language, which is called Hardware Description Language (HDL), and HDL is not only one but many, such as abel (advanced Boolean Expression Language), ahdl (alternate Hardware Description Language), traffic, pl (core universal Programming Language), HDCal (jhdware Description Language), lang, Lola, HDL, laspam, hardward Description Language (vhr Description Language), vhal (Hardware Description Language), and vhigh-Language, which are currently used in most common. It will also be apparent to those skilled in the art that hardware circuitry that implements the logical method flows can be readily obtained by merely slightly programming the method flows into an integrated circuit using the hardware description languages described above.
The controller may be implemented in any suitable manner, for example, the controller may take the form of, for example, a microprocessor or processor and a computer-readable medium storing computer-readable program code (e.g., software or firmware) executable by the (micro) processor, logic gates, switches, an Application Specific Integrated Circuit (ASIC), a programmable logic controller, and an embedded microcontroller, examples of which include, but are not limited to, the following microcontrollers: ARC 625D, Atmel AT91SAM, Microchip PIC18F26K20, and Silicone Labs C8051F320, the memory controller may also be implemented as part of the control logic for the memory. Those skilled in the art will also appreciate that, in addition to implementing the controller as pure computer readable program code, the same functionality can be implemented by logically programming method steps such that the controller is in the form of logic gates, switches, application specific integrated circuits, programmable logic controllers, embedded microcontrollers and the like. Such a controller may thus be considered a hardware component, and the means included therein for performing the various functions may also be considered as a structure within the hardware component. Or even means for performing the functions may be regarded as being both a software module for performing the method and a structure within a hardware component.
The apparatuses, modules or units illustrated in the above embodiments may be implemented by a computer chip or an entity, or implemented by a product with certain functions. One typical implementation device is a computer. In particular, the computer may be, for example, a personal computer, a laptop computer, a cellular telephone, a camera phone, a smartphone, a personal digital assistant, a media player, a navigation device, an email device, a game console, a tablet computer, a wearable device, or a combination of any of these devices.
For convenience of description, the above devices are described as being divided into various units by function, and are described separately. Of course, the functionality of the units may be implemented in one or more software and/or hardware when implementing the present application.
As will be appreciated by one skilled in the art, embodiments of the present invention may be provided as a method, apparatus, or computer program product. Accordingly, the present invention may take the form of an entirely hardware embodiment, an entirely software embodiment or an embodiment combining software and hardware aspects. Furthermore, the present invention may take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, and the like) having computer-usable program code embodied therein.
The present invention is described with reference to flowchart illustrations and/or block diagrams of methods, apparatus (devices), and computer program products according to embodiments of the invention. It will be understood that each flow and/or block of the flow diagrams and/or block diagrams, and combinations of flows and/or blocks in the flow diagrams and/or block diagrams, can be implemented by computer program instructions. These computer program instructions may be provided to a processor of a general purpose computer, special purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, create means for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be stored in a computer-readable memory that can direct a computer or other programmable data processing apparatus to function in a particular manner, such that the instructions stored in the computer-readable memory produce an article of manufacture including instruction means which implement the function specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be loaded onto a computer or other programmable data processing apparatus to cause a series of operational steps to be performed on the computer or other programmable apparatus to produce a computer implemented process such that the instructions which execute on the computer or other programmable apparatus provide steps for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
In a typical configuration, a computing device includes one or more processors (CPUs), input/output interfaces, network interfaces, and memory.
The memory may include forms of volatile memory in a computer readable medium, Random Access Memory (RAM) and/or non-volatile memory, such as Read Only Memory (ROM) or flash memory (flash RAM). Memory is an example of a computer-readable medium.
Computer-readable media, including both non-transitory and non-transitory, removable and non-removable media, may implement information storage by any method or technology. The information may be computer readable instructions, data structures, modules of a program, or other data. Examples of computer storage media include, but are not limited to, phase change memory (PRAM), Static Random Access Memory (SRAM), Dynamic Random Access Memory (DRAM), other types of Random Access Memory (RAM), Read Only Memory (ROM), Electrically Erasable Programmable Read Only Memory (EEPROM), flash memory or other memory technology, compact disc read only memory (CD-ROM), Digital Versatile Discs (DVD) or other optical storage, magnetic cassettes, magnetic tape magnetic disk storage or other magnetic storage devices, or any other non-transmission medium that can be used to store information that can be accessed by a computing device. As defined herein, a computer readable medium does not include a transitory computer readable medium such as a modulated data signal and a carrier wave.
It should also be noted that the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising an … …" does not exclude the presence of other like elements in a process, method, article, or apparatus that comprises the element.
As will be appreciated by one skilled in the art, embodiments of the present application may be provided as a method, apparatus or computer program product. Accordingly, the present application may take the form of an entirely hardware embodiment, an entirely software embodiment or an embodiment combining software and hardware aspects. Furthermore, the present application may take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, and the like) having computer-usable program code embodied therein.
The application may be described in the general context of computer-executable instructions, such as program modules, being executed by a computer. Generally, program modules include routines, programs, objects, components, data structures, etc. that perform particular tasks or implement particular abstract data types. The application may also be practiced in distributed computing environments where tasks are performed by remote processing devices that are linked through a communications network. In a distributed computing environment, program modules may be located in both local and remote computer storage media including memory storage devices.
The embodiments in the present specification are described in a progressive manner, and the same and similar parts among the embodiments are referred to each other, and each embodiment focuses on the differences from the other embodiments. In particular, for the apparatus and computer storage medium embodiments, since they are substantially similar to the method embodiments, the description is relatively simple, and reference may be made to some descriptions of the method embodiments for relevant points.
The above description is only an example of the present application and is not intended to limit the present application. Various modifications and changes may occur to those skilled in the art. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present application should be included in the scope of the claims of the present application.

Claims (22)

1. A method for message congestion detection, comprising:
setting an expected start processing time of a message next to a current message when the current message in a message queue is processed; the expected starting processing time is the time obtained by adding the current time of the expected starting processing time to the execution time of a first preset message;
acquiring the actual processing starting time of the next message;
calculating a time difference between the expected start processing time and the actual start processing time of the next message;
detecting whether the time difference is greater than a preset blocking time threshold;
and when the time difference is detected to be larger than the preset blocking time threshold, determining that the message queue is blocked in the processing stage of the current message.
2. The method of claim 1, wherein prior to calculating the time difference between the expected start processing time and the actual start processing time for the next message, the method further comprises:
comparing the expected starting processing time and the actual starting processing time of the next message, and when the actual starting processing time is larger than the expected starting processing time, executing the step of calculating the time difference between the expected starting processing time and the actual starting processing time of the next message.
3. The method according to claim 1 or 2, characterized in that the method further comprises:
and acquiring the time difference of the messages in the message queue, and performing statistical analysis processing on the time difference corresponding to the messages in the message queue to obtain the blocking information of the message queue.
4. The method according to claim 1 or 2, characterized in that the method further comprises:
acquiring the execution time of the message corresponding to the blocking of the message queue;
judging whether the execution time is greater than a preset execution time threshold value;
and when the execution time is judged to be greater than the preset execution time threshold, determining that the execution of the message corresponding to the execution time greater than the preset execution time threshold causes the message queue to be blocked.
5. The method of claim 4, further comprising:
and when the execution time is judged to be less than or equal to the preset execution time threshold, determining that the message queue is blocked due to resource preemption among threads at the processing stage of the message corresponding to the execution time less than or equal to the preset execution time threshold.
6. A method for message congestion detection, comprising:
when processing a message in a completion message queue, setting an expected end processing time of a next message of the message; the expected ending processing time is the time obtained by adding the current time of the expected ending processing time to the execution time of a second preset message;
acquiring the actual processing starting time of the next message;
calculating a time difference between the expected ending processing time and the actual ending execution time of the next message;
detecting whether the time difference is greater than a preset blocking time threshold;
and when the time difference is detected to be larger than the preset blocking time threshold, determining that the message queue is blocked in the processing stage of the next message.
7. The method of claim 6, wherein prior to calculating the time difference between the expected ending processing time and the actual ending execution time for the next message, the method further comprises:
comparing the expected starting processing time and the actual starting processing time of the next message, and when the actual starting processing time is larger than the expected starting processing time, executing the step of calculating the time difference between the expected ending processing time and the actual ending execution time of the next message.
8. The method according to claim 6 or 7, characterized in that the method further comprises:
and acquiring the time difference corresponding to the messages in the message queue, and performing statistical analysis processing on the time difference corresponding to the messages in the message queue to obtain the blocking information of the message queue.
9. The method according to claim 6 or 7, characterized in that the method further comprises:
acquiring the execution time of the message corresponding to the blocking of the message queue;
judging whether the execution time is greater than a preset execution time threshold value;
and when the execution time is judged to be greater than the preset execution time threshold, determining that the execution of the message corresponding to the execution time greater than the preset execution time threshold causes the message queue to be blocked.
10. The method of claim 9, further comprising:
and when the execution time is judged to be less than or equal to the preset execution time threshold, determining that the message queue is blocked due to resource preemption among threads at the processing stage of the message corresponding to the execution time less than or equal to the preset execution time threshold.
11. A message blocking detection apparatus, comprising:
the expected start time setting module is used for setting the expected start processing time of the next message of the current message when the current message in the message queue is processed; the expected starting processing time is the time obtained by adding the current time of the expected starting processing time to the execution time of a first preset message;
an actual start time obtaining module, configured to obtain an actual start processing time of the next message;
a first calculating module for calculating a time difference between an expected start processing time and an actual start processing time of the next message;
the first detection module is used for detecting whether the time difference is greater than a preset blocking time threshold value or not;
a first blocking position determining module, configured to determine that the message queue is blocked in the current message processing stage when the first detecting module detects that the time difference is greater than the preset blocking time threshold.
12. The apparatus of claim 11, further comprising:
a first comparing module, configured to compare the expected processing start time with the actual processing start time of the next message before the first calculating module calculates the time difference between the expected processing start time and the actual processing start time of the next message, and when the actual processing start time is greater than the expected processing start time, the first calculating module calculates the time difference between the expected processing start time and the actual processing start time of the next message.
13. The apparatus of claim 11 or 12, further comprising:
and the first blocking information acquisition module is used for acquiring the time difference of the messages in the message queue, which is calculated by the first calculation module, and performing statistical analysis processing on the time difference corresponding to the messages in the message queue to obtain the blocking information of the message queue.
14. The apparatus of claim 11 or 12, further comprising:
a first execution time obtaining module, configured to obtain an execution time of a message corresponding to a congestion occurring in the message queue;
a first judging module for judging whether the execution time is greater than a preset execution time threshold
A first blocking determining module, configured to determine that, when the first determining module determines that the execution time is greater than the preset execution time threshold, the message queue is blocked due to the execution of the message corresponding to the execution time greater than the preset execution time threshold.
15. The apparatus of claim 14, further comprising:
and the second blocking determining module is used for determining that the message queue is blocked due to resource preemption among threads at the processing stage of the message corresponding to the execution time less than or equal to the preset execution time threshold when the first judging module judges that the execution time is less than or equal to the preset execution time threshold.
16. A message blocking detection apparatus, comprising:
an expected end time setting module, configured to set an expected end processing time of a next message of the messages when processing one message in a message queue; the expected ending processing time is the time obtained by adding the current time of the expected ending processing time to the execution time of a second preset message;
an actual start time obtaining module, configured to obtain an actual start processing time of the next message;
a second calculating module, configured to calculate a time difference between an expected end processing time and an actual end execution time of the next message;
the second detection module is used for detecting whether the time difference is greater than a preset blocking time threshold value or not;
and the second blocking position determining module is used for determining that the message queue is blocked in the processing stage of the next message when the second detecting module detects that the time difference is greater than the preset blocking time threshold.
17. The apparatus of claim 16, further comprising:
a fourth detecting module, configured to compare the expected start processing time and the actual start processing time of the next message before the second calculating module calculates the time difference between the expected end processing time and the actual end execution time of the next message, and when the actual start processing time is greater than the expected start processing time, the second calculating module calculates the time difference between the expected end processing time and the actual end execution time of the next message.
18. The apparatus of claim 16 or 17, further comprising:
and the second blocking information acquisition module is used for acquiring the time difference corresponding to the messages in the message queue, which is calculated by the second calculation module, and performing statistical analysis processing on the time difference corresponding to the messages in the message queue to obtain the blocking information of the message queue.
19. The apparatus of claim 16 or 17, further comprising:
a second execution time obtaining module, configured to obtain an execution time of a message corresponding to a congestion occurring in the message queue;
the second judgment module is used for judging whether the execution time is greater than a preset execution time threshold value;
a third blocking determination module, configured to determine that, when the second determination module determines that the execution time is greater than the preset execution time threshold, the execution of the message corresponding to the execution time greater than the preset execution time threshold causes a message queue to be blocked.
20. The apparatus of claim 19, further comprising:
and the fourth blocking determination module is configured to determine that the message queue is blocked due to resource preemption among threads occurring in the processing stage of the message corresponding to the execution time that is less than or equal to the preset execution time threshold when the second determination module determines that the execution time is less than or equal to the preset execution time threshold.
21. A computer storage medium having a computer program stored thereon, the program, when executed by a processor, performing the steps of:
setting an expected start processing time of a message next to a current message when the current message in a message queue is processed; the expected starting processing time is the time obtained by adding the current time of the expected starting processing time to the execution time of a first preset message;
acquiring the actual processing starting time of the next message;
calculating a time difference between the expected start processing time and the actual start processing time of the next message;
detecting whether the time difference is greater than a preset blocking time threshold;
and when the time difference is detected to be larger than the preset blocking time threshold, determining that the message queue is blocked in the processing stage of the current message.
22. A computer storage medium having a computer program stored thereon, the program, when executed by a processor, performing the steps of:
when processing a message in a completion message queue, setting an expected end processing time of a next message of the message; the expected ending processing time is the time obtained by adding the current time of the expected ending processing time to the execution time of a second preset message;
acquiring the actual processing starting time of the next message;
calculating a time difference between the expected ending processing time and the actual ending execution time of the next message;
detecting whether the time difference is greater than a preset blocking time threshold;
and when the time difference is detected to be larger than the preset blocking time threshold, determining that the message queue is blocked in the processing stage of the next message.
CN201710107990.2A 2017-02-27 2017-02-27 Message blocking detection method, device and computer storage medium Active CN106959899B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201710107990.2A CN106959899B (en) 2017-02-27 2017-02-27 Message blocking detection method, device and computer storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201710107990.2A CN106959899B (en) 2017-02-27 2017-02-27 Message blocking detection method, device and computer storage medium

Publications (2)

Publication Number Publication Date
CN106959899A CN106959899A (en) 2017-07-18
CN106959899B true CN106959899B (en) 2021-01-01

Family

ID=59469976

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201710107990.2A Active CN106959899B (en) 2017-02-27 2017-02-27 Message blocking detection method, device and computer storage medium

Country Status (1)

Country Link
CN (1) CN106959899B (en)

Families Citing this family (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109428915B (en) * 2017-08-25 2021-06-29 北京国双科技有限公司 Data acquisition method and device
CN109324946A (en) * 2018-09-10 2019-02-12 天津字节跳动科技有限公司 Operational monitoring method, apparatus, electronic equipment and computer readable storage medium
CN110046045B (en) * 2019-04-03 2021-07-30 百度在线网络技术(北京)有限公司 Voice wake-up data packet processing method and device
CN110262878B (en) * 2019-05-06 2024-03-08 平安科技(深圳)有限公司 Timed task processing method, device, equipment and computer readable storage medium
CN111163018B (en) * 2019-12-02 2022-08-26 华为技术有限公司 Network equipment and method for reducing transmission delay thereof

Citations (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN105873123A (en) * 2016-03-21 2016-08-17 卡斯柯信号有限公司 Detecting method of GSM-R wireless message delay of interurban railway

Patent Citations (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN105873123A (en) * 2016-03-21 2016-08-17 卡斯柯信号有限公司 Detecting method of GSM-R wireless message delay of interurban railway

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
消息传递模型下的等待阻塞;苗浩等;《小型微型计算机系统》;20050731;第26卷(第7期);第1183-1186页 *

Also Published As

Publication number Publication date
CN106959899A (en) 2017-07-18

Similar Documents

Publication Publication Date Title
CN106959899B (en) Message blocking detection method, device and computer storage medium
CN107577694B (en) Data processing method and device based on block chain
US10445132B2 (en) Method and apparatus for switching applications
US20140304625A1 (en) Page returning
US20090113436A1 (en) Techniques for switching threads within routines
US20150205479A1 (en) Noise elimination in a gesture recognition system
CN110635962B (en) Abnormity analysis method and device for distributed system
CN111447239B (en) Video stream playing control method, device and storage medium
CN109766167B (en) Method, device, system and equipment for distributing timed tasks
CN112035341A (en) Automatic testing method and device
CN111727420A (en) Method and device for detecting temperature state of touch screen, touch chip and electronic equipment
CN111625456B (en) Clamping positioning method and device
CN103823711A (en) Method and device for providing relative timing in Java virtual machine
CN111753328A (en) Private data leakage risk detection method and system
CN110968483A (en) Service data acquisition method and device and electronic equipment
CN114710318B (en) Method, device, equipment and medium for limiting high-frequency access of crawler
CN108647113B (en) Disaster recovery method and server
CN110908792B (en) Data processing method and device
CN108665870B (en) Display processing method and device
CN109903165B (en) Model merging method and device
CN106814940B (en) Numerical value input method and device
CN113342405B (en) Service recovery method, device and equipment
CN106331577B (en) Method and device for adjusting codes
CN116893663B (en) Main control abnormality detection method and device, storage medium and electronic equipment
CN115344410B (en) Method and device for judging event execution sequence, storage medium and electronic equipment

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

Effective date of registration: 20201016

Address after: Cayman Enterprise Centre, 27 Hospital Road, George Town, Grand Cayman Islands

Applicant after: Innovative advanced technology Co.,Ltd.

Address before: Cayman Enterprise Centre, 27 Hospital Road, George Town, Grand Cayman Islands

Applicant before: Advanced innovation technology Co.,Ltd.

Effective date of registration: 20201016

Address after: Cayman Enterprise Centre, 27 Hospital Road, George Town, Grand Cayman Islands

Applicant after: Advanced innovation technology Co.,Ltd.

Address before: Greater Cayman, British Cayman Islands

Applicant before: Alibaba Group Holding Ltd.

TA01 Transfer of patent application right
GR01 Patent grant
GR01 Patent grant