WO2022188576A1 - Performance issue locating method and apparatus, and electronic device and storage medium - Google Patents

Performance issue locating method and apparatus, and electronic device and storage medium Download PDF

Info

Publication number
WO2022188576A1
WO2022188576A1 PCT/CN2022/074602 CN2022074602W WO2022188576A1 WO 2022188576 A1 WO2022188576 A1 WO 2022188576A1 CN 2022074602 W CN2022074602 W CN 2022074602W WO 2022188576 A1 WO2022188576 A1 WO 2022188576A1
Authority
WO
WIPO (PCT)
Prior art keywords
scheduling
message
scheduling information
target message
scheduled
Prior art date
Application number
PCT/CN2022/074602
Other languages
French (fr)
Chinese (zh)
Inventor
徐磊
Original Assignee
北京字节跳动网络技术有限公司
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 北京字节跳动网络技术有限公司 filed Critical 北京字节跳动网络技术有限公司
Publication of WO2022188576A1 publication Critical patent/WO2022188576A1/en

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/07Responding to the occurrence of a fault, e.g. fault tolerance
    • G06F11/0703Error or fault processing not based on redundancy, i.e. by taking additional measures to deal with the error or fault not making use of redundancy in operation, in hardware, or in data representation
    • G06F11/079Root cause analysis, i.e. error or fault diagnosis
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/07Responding to the occurrence of a fault, e.g. fault tolerance
    • G06F11/0703Error or fault processing not based on redundancy, i.e. by taking additional measures to deal with the error or fault not making use of redundancy in operation, in hardware, or in data representation
    • G06F11/0766Error or fault reporting or storing

Definitions

  • the present disclosure relates to the field of information technology, and in particular, to a method, apparatus, electronic device and storage medium for locating performance problems.
  • the operating system of an electronic device often limits an application's ability to obtain system resources. Therefore, in the case of performance problems such as application freezes, application not responding (Application Not Responding, ANR), and application flashbacks, it is difficult to obtain key information from the operating system that can locate the problem, so that the problem cannot be located. the reason for the appearance. In order to locate the problem, it is necessary to reproduce the problem in some cases, but the reproduction process is time-consuming, and the application freezes for a long time, which affects the user's use.
  • the embodiments of the present disclosure provide a performance problem location method, apparatus, electronic device, and storage medium.
  • An embodiment of the present disclosure provides a method for locating a performance problem, and the method includes:
  • the performance problem is located according to scheduling information of a plurality of historical messages that have been scheduled when the performance problem occurs.
  • the embodiment of the present disclosure also provides a performance problem location device, including:
  • the response module is configured to, in response to a performance problem occurring in the application, determine scheduling information of multiple historical messages that have been scheduled when the performance problem occurs according to a message scheduling sequence diagram, and the message scheduling sequence diagram is used to display the multiple historical messages. scheduling information of a historical message;
  • a problem locating module configured to locate the performance problem according to scheduling information of a plurality of historical messages that have been scheduled when the performance problem occurs.
  • Embodiments of the present disclosure also provide an electronic device, the electronic device comprising:
  • a storage device for storing a plurality of programs
  • the multiple processors When the multiple programs are executed by the multiple processors, the multiple processors implement the above-described method for locating performance problems.
  • Embodiments of the present disclosure also provide a computer-readable storage medium on which a computer program is stored, and when the program is executed by a processor, implements the above-described method for locating a performance problem.
  • scheduling information of a plurality of historical messages that have been scheduled when the performance problem occurs is determined according to a message scheduling sequence diagram, and the message scheduling sequence
  • the graph is used to display the scheduling information of the multiple historical messages; according to the scheduling information of the multiple historical messages that have been scheduled when the performance problem occurs, the performance problem is located, which is essentially a process of running the application program.
  • the scheduling information of each message generated in the system is recorded and stored to form a message scheduling sequence diagram.
  • FIG. 1 is an application scenario diagram of a method for locating a performance problem provided by an embodiment of the present disclosure
  • FIG. 2 is a flowchart of a method for locating a performance problem according to an embodiment of the present disclosure
  • FIG. 3 is a schematic diagram of a correspondence between a message and scheduling information according to an embodiment of the present disclosure
  • FIG. 4 is a schematic diagram of a corresponding relationship between another message and scheduling information according to an embodiment of the present disclosure
  • FIG. 5 is a schematic diagram of a corresponding relationship between another message and scheduling information according to an embodiment of the present disclosure
  • FIG. 6 provides a message scheduling sequence diagram according to an embodiment of the present disclosure
  • FIG. 7 is a schematic diagram of a method for locating a performance problem according to an embodiment of the present disclosure.
  • FIG. 8 is a flowchart of a method for generating a message scheduling sequence diagram according to an embodiment of the present disclosure
  • FIG. 9 is a flowchart of another method for generating a message scheduling sequence diagram according to an embodiment of the present disclosure.
  • FIG. 10 is a schematic diagram of a counter update provided by an embodiment of the present disclosure.
  • 11-12 are schematic diagrams of two other types of counter updates provided by the embodiments of the present disclosure.
  • FIG. 13-14 are schematic diagrams of two other types of counter updates provided by the embodiments of the present disclosure.
  • FIG. 15 is a flowchart of a method for implementing S320 according to an embodiment of the present disclosure.
  • FIG. 16 is a flowchart of a method for implementing S330 according to an embodiment of the present disclosure
  • FIG. 17 is a flowchart of another method for implementing S330 provided by an embodiment of the present disclosure.
  • Figure 19 and Figure 20 are a kind of scheduling information display effect diagram formed by adopting the method provided in Figure 18;
  • 21 is a schematic structural diagram of a device for locating performance problems according to an embodiment of the present disclosure.
  • FIG. 22 is a schematic structural diagram of an electronic device according to an embodiment of the disclosure.
  • FIG. 1 is an application scenario diagram of a method for locating a performance problem provided by an embodiment of the present disclosure.
  • the performance problem location method provided by the present disclosure can be applied to the application environment shown in FIG. 1 .
  • the performance problem location system includes a server and multiple terminals (eg, terminal 1, terminal 2, terminal 3, and terminal 4). Each terminal and the server are connected through network communication.
  • Several applications are installed on each terminal. Exemplarily, it is assumed that when a user uses a certain application in the terminal 1, the application has a performance problem.
  • any terminal or a server can execute the performance problem locating method provided by the present disclosure. It should be emphasized that if the performance problem locating method provided by the present disclosure is executed by a terminal, in practice, the terminal having a performance problem and the terminal executing the performance problem locating method provided by the present disclosure may be the same terminal or different terminals.
  • the server can be implemented by an independent server or a server cluster composed of multiple servers.
  • Terminals may include, but are not limited to, smart phones, palmtop computers, tablet computers, wearable devices with display screens, desktop computers, notebook computers, all-in-one computers, smart home devices, and the like.
  • FIG. 2 is a flowchart of a method for locating a performance problem provided by an embodiment of the present disclosure.
  • the method may be executed by a performance problem locating apparatus, and the apparatus may be implemented in software and/or hardware, and the apparatus may be configured in an electronic device. , for example in a terminal or server.
  • the method is described below by taking an example that the method is executed by a terminal having a performance problem.
  • the method may specifically include:
  • Application programs may be installed in the terminal, and the number and functions of the application programs installed in the terminal are not specifically limited here.
  • the application may experience performance problems, such as freeze, ANR, crash, etc.
  • the terminal can detect in real time whether a performance problem occurs in the application.
  • the message scheduling sequence diagram is a graph that can visually display the scheduling information of each historical message during the running process of the application.
  • the method further includes: acquiring a target message to be scheduled in a message queue corresponding to the application, where the target message is any historical message in a plurality of historical messages; During the process, the scheduling information of the target message is recorded; according to the scheduling information of the target message, a message scheduling sequence diagram is generated.
  • the terminal may generate a message corresponding to the application, and put the message into the message queue corresponding to the application.
  • This embodiment does not limit the specific conditions or specific scenarios for the terminal to generate the message.
  • this embodiment does not limit the number of messages buffered in the message queue.
  • the terminal may display the user interface of the application, so that the user can perform operations on the user interface.
  • the terminal may generate a message corresponding to the application program according to the user's operation on the user interface, and put the message in a message queue corresponding to the application program.
  • the terminal may schedule the messages in the message queue in sequence, specifically, the main thread in the terminal may schedule the messages in the message queue in sequence.
  • FIG. 3 is a schematic diagram of a correspondence between a message and scheduling information according to an embodiment of the present disclosure.
  • the message queue includes message 1 , message 2 , message 3 , message 4 , and message 5 .
  • this embodiment does not limit the specific messages and the number of messages buffered in the message queue.
  • the specific messages buffered in the message queue and the number of buffered messages may vary with time. For example, after the terminal completes the scheduling of the message 1 in the message queue, the terminal can delete the message 1 from the message queue, so that the specific message and the number of messages in the message queue are changed. Similarly, when the terminal generates a new message, such as message 6, the terminal can add the message 6 to the message queue, so that the specific message and the number of messages in the message queue change.
  • the terminal may record the scheduling information of the message 1 . Further, the terminal may store the scheduling information of the message 1 in a storage space.
  • the scheduling information of the message 1 may include, for example, at least one of the scheduling start time, the scheduling end time, and the scheduling time of the message 1 . It can be understood that the scheduling information of the message 1 may also include other information, for example, identification information of the message 1 and the like. The identification information may specifically be at least one of the type and name of the message.
  • the schedule start time can be set to include CPU time and/or wall time (WALL).
  • CPU time and wall time are two different dimensions of time.
  • Wall time includes the waiting time of message scheduling and the execution time of message scheduling. Among them, there may be multiple waiting times.
  • the CPU time includes the execution time of the message scheduling.
  • the scheduled end time can be set to include CPU time and/or wall time (WALL).
  • the scheduling information and the message can be stored one-to-one, one-to-many, or a combination of one-to-one and one-to-many.
  • the terminal can schedule each message in the message queue in turn, and the terminal can record the scheduling information of each message in turn. That is to say, when the terminal finishes scheduling a message, the terminal can record and store the scheduling information of the message in the storage space, so that each scheduled message can correspond to one scheduling information respectively.
  • scheduling information and messages are stored one-to-one.
  • the scheduling information corresponding to the messages 1 , 2 , 3 , 4 , and 5 that have been scheduled are stored in the storage space. It can be understood that this embodiment does not limit the type of the storage space and the location of the storage space in the terminal.
  • the terminal is not limited to storing the scheduling information of the message in the storage space when a message is scheduled.
  • the terminal may store the scheduling information of the multiple messages in the storage space when the multiple messages are scheduled.
  • the scheduling information of the multiple messages may include the total number of the multiple messages, the total scheduling time of the multiple messages, and the like. It can be understood that the scheduling information of the multiple messages may also include other information, for example, the scheduling start time of the first scheduled message among the multiple messages, and the scheduling of the last scheduled message among the multiple messages. End time, identification information of the first scheduled message among the multiple messages, identification information of the last scheduled message among the multiple messages, and the like.
  • FIG. 4 is a schematic diagram of another correspondence between messages and scheduling information according to an embodiment of the present disclosure.
  • scheduling information and messages are stored one-to-many.
  • the terminal may store the scheduling information of the message 1 and the message 2 in the storage space to form a piece of scheduling information.
  • the terminal may store the scheduling information of message 3, message 4 and message 5 in the storage space after scheduling message 3, message 4 and message 5 to form a piece of scheduling information.
  • FIG. 5 is a schematic diagram of another correspondence between messages and scheduling information according to an embodiment of the present disclosure.
  • the scheduling information and the message are stored in a combination of one-to-one storage and one-to-many storage.
  • the terminal may store the scheduling information of the message 1 in the storage space after scheduling the message 1 to form a piece of scheduling information.
  • the terminal may store the scheduling information of the message 2 and the message 3 in the storage space to form a piece of scheduling information.
  • the terminal may store the scheduling information of message 4 and message 5 in the storage space after scheduling message 4 and message 5 to form a piece of scheduling information.
  • the storage space of scheduling information and the message queue are two different storage spaces.
  • the message can be deleted from the message queue.
  • the scheduling information of the message needs to be stored in the storage space of the scheduling information and is not deleted.
  • the above-mentioned "generating a message scheduling sequence diagram according to the scheduling information of the target message” is essentially to generate a message scheduling sequence diagram according to the scheduling information stored in the scheduling information storage space.
  • FIG. 6 is a message scheduling sequence diagram provided by an embodiment of the present disclosure.
  • arrows indicate a time axis
  • the time axis includes a plurality of rectangular boxes arranged in sequence.
  • Each box represents a piece of scheduling information.
  • the boxes can be divided into three types according to the filling graph: the first type is the filling point of the boxes 1-53, which is the first identifier, indicating the scheduling information of the message that has been scheduled when the application has a performance problem; the second type is the filling point.
  • the box with type unfilled is the second identifier, indicating the scheduling information of the message being scheduled when the application has performance problems;
  • the third type is the box 1-3 filled with slashes, which is the third identifier, indicating the application Messages that have not yet started scheduling when the program has performance problems.
  • the scheduling information of the historical messages that have been scheduled when the performance problem occurs includes the scheduling information of the messages that have been scheduled when the performance problem occurs in the application program, and the scheduling information of the message that is being scheduled when the performance problem occurs in the application program. . Therefore, referring to FIG. 6 , when this step is performed, the scheduling information to be determined is the scheduling information corresponding to the first identifier and the second identifier.
  • each of the first identifiers and each of the second identifiers displays the detailed content of the scheduling information by means of a display frame (an oval image in the figure).
  • MSG represents a message corresponding to the scheduling information.
  • MSG 1 indicates that the scheduling information corresponds to 1 message.
  • MSGS 33 indicates that the scheduling information corresponds to 33 messages, which is the combined result of the 33 messages.
  • Wall in the display box indicates the total wall time scheduling time of all messages corresponding to the scheduling information.
  • the CPU in the display box indicates the total CPU time of all messages corresponding to the scheduling information.
  • IDLE means system sleep.
  • the scheduling information corresponding to the messages whose scheduling takes a long time may be further displayed with special effects.
  • the scheduling of the first message corresponding to box 1 takes a very long time. Therefore, the display box corresponding to box 1 is filled with vertical stripes to distinguish it from other display boxes. This setting is convenient for quickly determining which messages are scheduled to take a long time, further shortening the time for locating performance problems, and improving work efficiency.
  • the size of the first identifier is related to scheduling information of historical messages corresponding to the first identifier; the size of the second identifier is related to scheduling information of historical messages corresponding to the second identifier.
  • the length of the first identifier in the direction of the arrow is positively correlated with the scheduling time of the historical message corresponding to the first identifier.
  • the message scheduling sequence diagram includes unscheduled messages (corresponding to the third identifier) when a performance problem occurs in the application program.
  • the message scheduling sequence diagram can be set to include only the scheduling information (corresponding to the first identifier) of the message that has been scheduled when the application program has a performance problem, and the scheduling information (corresponding to the second identifier) of the message being scheduled, Does not include unscheduled messages.
  • this step in response to a performance problem that occurs in the application, determine the type of performance problem that occurs in the application; Scheduling information for multiple historical messages scheduled. This setting is convenient to reduce the amount of scheduling information to be viewed, to quickly find the scheduling information that needs to be focused on, and to improve positioning efficiency.
  • this step may also be, in response to a performance problem occurring in the application program, according to the message scheduling sequence diagram, it is determined from the moment when the performance problem occurs in the application program, a number of historical records that have been scheduled within a preset retrospective time range are determined. Scheduling information for the message.
  • the preset retrospective duration can be determined according to the experience of the research and development personnel, which is not limited in this disclosure. This setting is convenient to reduce the amount of scheduling information to be viewed, to quickly find the scheduling information that needs to be focused on, and to improve positioning efficiency.
  • different types of performance problems can be set, and the preset retrospective durations are different.
  • Determining the scheduling information of multiple historical messages that have been scheduled within a preset retrospective time range from the moment when the application program has a performance problem according to the message scheduling sequence diagram it also includes: determining the performance problem of the application program. Type; determine the preset traceback duration based on the type of performance issue.
  • S120 Locate the performance problem according to scheduling information of multiple historical messages that have been scheduled when the performance problem occurs.
  • FIG. 7 is a schematic diagram of a method for locating a performance problem provided by an embodiment of the present disclosure.
  • a horizontal arrow represents a time axis, and a plurality of rectangles filled with diagonal lines are drawn above the time axis, and one rectangle represents one message.
  • the intersection of the left edge of each rectangle with the timeline represents the scheduled start time of the message.
  • the intersection of the right edge of each rectangle and the time axis indicates the scheduled end time of the message.
  • the scheduling start time of message 1 is a
  • the scheduling end time is b.
  • message 1, message 2, message 3, and message 4 have been scheduled and completed before the moment when the application has a performance problem.
  • Message 5 is the message being dispatched at the moment when the performance problem occurs.
  • the reason for the performance problem of the terminal may be caused by a problem in the process of message scheduling that has been scheduled; it may also be caused by a problem in the process of message scheduling being scheduled;
  • the problem in the process of message scheduling that is scheduled to be completed is caused by the combined effect of the problem in the process of message scheduling being scheduled.
  • the terminal schedules information A since in the terminal, multiple messages in the message queue are scheduled in sequence, for example, the terminal schedules information A, then schedules information B, reschedules information C, and reschedules information D.
  • the message B or the message C may have been time-consuming, but it does not cause problems such as freezing and ANR. Problems such as freezing and ANR may not occur until the terminal schedules message D, and message D may not be time-consuming. In this case, it is a problem in the scheduling process of the message B and the message C that causes the performance problem of the terminal.
  • the steps include: determining the historical messages whose scheduling time is greater than or equal to a preset duration among the multiple historical messages; historical information to locate performance problems.
  • message scheduling takes a long time, which is often a symptom of performance problems. This setting is convenient for reducing the amount of scheduling information that needs to be viewed, enabling R&D personnel to quickly find the scheduling information that needs to be focused on, and improving positioning efficiency.
  • the scheduling information of multiple historical messages that have been scheduled when the performance problem occurs is determined according to a message scheduling sequence diagram in response to a performance problem occurring in an application, and the message scheduling sequence diagram is used to display Scheduling information of multiple historical messages; locate the performance problem according to the scheduling information of multiple historical messages that have been scheduled when the performance problem occurs.
  • the essence is to record the scheduling information of each message generated during the running of the application. Store and form a message scheduling sequence diagram.
  • FIG. 8 is a flowchart of a method for generating a message scheduling sequence diagram according to an embodiment of the present disclosure.
  • FIG. 8 corresponds to the situation of “one-to-one storage of scheduling information and messages” in the foregoing content.
  • the steps in FIG. 8 are executed before S110 in FIG. 2 , that is, before the terminal detects whether the application program has a performance problem.
  • the method for implementing recording scheduling information includes:
  • S210 Acquire a target message to be scheduled in a message queue corresponding to the application, where the target message is any historical message among multiple historical messages.
  • the target message to be scheduled can be understood as an unscheduled message generated by the terminal according to the operation after the user operates the user interface of the terminal application program.
  • the message may include user instructions and/or non-user instructions. Among them, user instructions and non-user instructions may be associated.
  • the target message may be the message that has been scheduled when the application has a performance problem, or it may be the message that is being dispatched when the application has a performance problem. Scheduled message.
  • the target message since there is no performance problem in the application program when this step is performed, it is actually impossible to distinguish whether the current target message is the message that has been scheduled or the message that is being scheduled when the performance problem occurs in the application program.
  • the target message is the message being scheduled when the application program has performance problems (eg, the target message is message 5 in FIG. 7 )
  • the application program has performance problems before the message scheduling is completed.
  • it may be set to wait for the end of the target message scheduling, and record the end time of the target message scheduling.
  • the terminal takes the time when the performance problem occurs as the scheduling end time of the target message. The reason for this setting is that once the terminal has a performance problem, the second message scheduling operation will be suspended, and there is no scheduling end time.
  • S240 Determine the scheduling time of the target message according to the scheduling start time of the target message and the scheduling end time of the target message.
  • a difference is made between the scheduling end time of the target message and the scheduling start time of the target message, and the difference is used as the scheduling time of the target message.
  • S250 Record scheduling information of the target message, where the scheduling information includes at least one of a scheduling start time, a scheduling end time, and a scheduling time-consuming.
  • the essence of this setting is that for each target message, the corresponding scheduling information is generated, and the target message and the scheduling information are stored one-to-one, which can ensure that the scheduling information corresponding to each target message is complete, without omission, and can be checked. .
  • FIG. 9 is a flowchart of another method for generating a message scheduling sequence diagram according to an embodiment of the present disclosure.
  • FIG. 9 corresponds to the situation of “one-to-many storage of scheduling information and messages” in the foregoing content.
  • the overall inventive concept of realizing "one-to-many storage of scheduling information and messages" is to combine multiple messages whose scheduling time is very short, and count the total time-consuming of multiple messages whose scheduling time is very short.
  • a piece of scheduling information may only include the identification information of part of the messages, the total time spent, and the number of messages to be merged.
  • the reference time can be preset; when scheduling the Nth target message, record the scheduling start time and scheduling end time of the Nth target message; According to the scheduling start time and scheduling end time of the Nth target message, determine the scheduling time of the Nth target message. If the scheduling time of the Nth target message is greater than the reference time, the scheduling information of the Nth target message Make separate records. If the scheduling time of the N-th target message is less than or equal to the reference time-consuming, schedule the N+1-th target message, and determine the scheduling time of the N+1-th target message.
  • the scheduling information of the N+1 th target message and the scheduling information of the N+1 th target message are separately recorded. If the scheduling time of the N+1-th target message is less than or equal to the reference time-consuming, schedule the N+2-th target message, ... until the scheduling time of the N+n-th target message is greater than the reference time-consuming, the For N target messages, the scheduling information of the N+n-1th target message is merged and recorded. Exemplarily, if the scheduling information of the Nth target message to the N+n-1th target message is combined and recorded, the scheduling information at this time includes the scheduling start time of the Nth target message, the N+n-1th target message. The scheduling end time of the message, the total scheduling time from the scheduling of the Nth target message to the end of the N+n-1th target message, and the Nth target message to the N+n-1th target The identification information of the target message of several parts in the message.
  • Fig. 9 is another method for realizing "one-to-many storage of scheduling information and messages". This method needs to be done with the help of a counter. To this end, optionally, it is set that the sub-thread is used to control the counter to be updated at a set time interval, and the main thread only reads the counter readings respectively at the start time and the end time of scheduling the target message.
  • SetTimeout is used to set the sleep time of the child thread, and make the sleep time of the child thread equal to the time interval between two consecutive updates of the counter.
  • the sleep time of the child thread is set to 30s.
  • the sub-thread is in the dormant state, the counter is not updated. If the sub-thread is dormant, the sub-thread will use Update Tick to update the counter immediately after the sub-thread is woken up. After the child thread updates the counter, it goes to sleep again.
  • Timeout Verify can be used to correct the sleep time of the child thread.
  • the sleep time of the child thread is 5 minutes.
  • the child thread should wake up at 10:00 and 10:05 respectively and update the counter. But in practice, for some reasons, the child thread may be woken up at 10:01. Obviously, this will delay the update time of the counter.
  • the sleep time of the child thread is modified so that it becomes 4 minutes. This ensures that at 10:05, the child thread can be woken up. This setting can ensure the accuracy of the scheduling information recorded subsequently.
  • the monitoring period specifically refers to the time period during which the main thread reads and updates the counter for two consecutive times.
  • FIG. 10 is a schematic diagram of a counter update provided by an embodiment of the present disclosure.
  • the counter is updated 4 times in total. Since the main thread only reads the counter information at the start time and end time of scheduling the target message, the information "counter reading is 0" is the start time of the main thread's scheduling of message 1 read. The information "counter reading is 1" is read by the main thread at the end of message 1 scheduling. Therefore, the time period between the start time and the end time of the message 1 scheduling is taken as the monitoring period J1. The message "counter reads 2" is not read by the main thread.
  • the information "counter reading is 3" is read by the main thread at the beginning of message 2 scheduling. Therefore, the time period between the end time of message 1 scheduling and the start time of message 2 scheduling is taken as the monitoring period J2.
  • the monitoring period J1 is smaller than the time interval T 0 between two adjacent updates.
  • the monitoring period J2 is greater than the time interval T 0 between two adjacent updates.
  • the steps in FIG. 9 are executed before S110 in FIG. 2 , that is, before the terminal detects whether the application program has a performance problem.
  • the method for generating a message scheduling sequence diagram includes:
  • S310 Acquire a target message to be scheduled in a message queue corresponding to the application, where the target message is any historical message among multiple historical messages.
  • the first monitoring period corresponds to a time period from when the terminal starts to schedule the target message and detects that the counter is updated to the last time that the terminal detects that the counter is updated.
  • 11-12 are schematic diagrams of other two types of counter updates provided by the embodiments of the present disclosure.
  • the first monitoring period mainly corresponds to two situations: Case 1, referring to Figure 11, the target message is message 5, and the first monitoring period is from the start time of a historical message scheduling to the start time of the target message scheduling Time period; Case 2, see FIG. 12 , the time period from the end moment of a historical message scheduling to the start moment of the target message scheduling.
  • a plurality of historical messages that have been scheduled during the first monitoring period refers to the historical messages of the entire scheduling process during the first monitoring period.
  • message 2, message 3 and message 4 are all multiple historical messages that have been scheduled within the first monitoring period. According to this step, the scheduling information of message 2, message 3 and message 4 needs to be recorded.
  • the second monitoring period corresponds to a time period from when the terminal finishes scheduling the target message and detects that the counter is updated to the last time that the terminal detects that the counter is updated.
  • FIGS. 13-14 are schematic diagrams of other two types of counter updates provided by embodiments of the present disclosure.
  • the second monitoring period mainly corresponds to two cases: Case 1, see Figure 13, the time period from the start time of a historical message scheduling to the end time of the target message scheduling; Case 2, see Figure 14, from The time period between the end time of a historical message schedule and the end time of the target message schedule.
  • "historical messages that have been scheduled during the second monitoring period” refer to the historical messages that complete the entire process of scheduling within the second monitoring period. Exemplarily, in FIG. 13 and FIG.
  • message 2, message 3, message 4 and message 5 are all historical messages that have been scheduled within the second monitoring period. Since in FIG. 13 and FIG. 14 , the target message is message 5, it is obvious that the multiple historical messages that have been scheduled in the second monitoring period include the target message. According to this step, the scheduling information of message 2, message 3, message 4 and message 5 needs to be recorded.
  • the essence of this setting is to classify the monitoring period (divided into the first monitoring period and the second monitoring period) according to the characteristics of the monitoring period, and adopt different strategies for different monitoring periods to merge the scheduling information of multiple historical messages Record. It can improve statistical efficiency, storage efficiency, reduce storage space occupancy, reduce the amount of operations to read and write from storage space, and even reduce the chance of performance problems caused by memory jitter caused by a large number of memory applications and releases.
  • FIG. 15 is a flowchart of a method for implementing S320 according to an embodiment of the present disclosure. Referring to Fig. 15, the method for implementing S320 may be:
  • S323. Record the scheduling information of multiple historical messages that have been scheduled within the first monitoring period before starting scheduling; wherein, the first monitoring period corresponds to the time from when the target message is scheduled to be updated when the counter is detected to be updated to the last time when the counter is detected. Between updates; the scheduling information of the multiple historical messages includes the total number of the multiple historical messages and the total scheduling time of the multiple historical messages.
  • the scheduling information of multiple historical messages that have been scheduled in the first monitoring period is recorded;
  • the scheduling information of multiple historical messages that have been scheduled within the first monitoring period is recorded, and the sleep time of the system during the first monitoring period is recorded.
  • the target message is message 4
  • the terminal starts scheduling information 4 it detects whether the counter is updated relative to the time at which the scheduling of message 3 ends. Since the counter has not been updated relative to the scheduling end time of message 3, the main thread schedules message 4.
  • the target message is message 5
  • the terminal when the terminal starts scheduling information 5, it detects whether the counter is updated relative to the time at which the scheduling of message 4 ends. Since the counter is updated relative to the scheduling end time of message 4, it is determined that the first monitoring period ends this time.
  • the terminal records the scheduling information of all historical messages (ie, message 2, message 3, and message 4) that have been scheduled within the first monitoring period of this time.
  • the scheduling of message 4 ends.
  • the time length from the moment to the scheduling start moment of the message 5 is greater than 2T 0 . This shows that, during this period of time, there is a situation in which the system sleeps. In this case, optionally, the scheduling information of message 2, message 3 and message 4 is combined and recorded, and the sleep time of the system in the first monitoring period is recorded.
  • the above solution can capture the sleep time of the system, which can avoid inaccurate recording of scheduling information of each message due to system sleep, thereby leading to inaccurate positioning of subsequent performance problems.
  • FIG. 16 is a flowchart of a method for implementing S330 according to an embodiment of the present disclosure. Referring to FIG. 16, the method for implementing S330 may be:
  • the scheduling information of the multiple historical messages includes the total number of the multiple historical messages and the total scheduling time of the multiple historical messages.
  • the scheduling information of multiple historical messages that have been scheduled in the second monitoring period is recorded;
  • the scheduling information of the target message and the scheduling information of the historical messages other than the target message that have been scheduled in the second monitoring period are recorded.
  • the target message is message 4
  • scheduling information 4 when scheduling information 4 is ended, it is detected whether the counter is updated relative to the scheduling start time of message 4. Since the counter is not updated relative to the scheduling start time of message 4, the main thread obtains the next message (ie, message 5) of the target message from the message queue.
  • the target message is message 5
  • scheduling information 5 when scheduling information 5 is ended, it is detected whether the counter is updated relative to the scheduling start time of message 5. Since the counter is updated relative to the scheduling start time of message 5, it is determined that the second monitoring period ends this time.
  • the terminal records the scheduling information of all historical messages (ie, message 2, message 3, message 4, and message 5) that have been scheduled within the second monitoring period.
  • the specific judgment method may be as follows: using the reading of the counter at the end of the second monitoring period to subtract the reading of the counter at the beginning of the second monitoring period to determine whether the difference is greater than 2, if it is greater than 2, it means that the number of updates of the counter is greater than 2. Otherwise, the counter is updated less than or equal to 2 times.
  • the scheduling of message 5 takes time. greater than 2T 0 .
  • the scheduling information of message 2, message 3, and message 4 is combined and recorded, and the scheduling information of message 4 is recorded separately.
  • FIG. 17 is a flowchart of another method for implementing S330 according to an embodiment of the present disclosure.
  • FIG. 17 is a specific example of FIG. 16 .
  • the method for implementing S330 may be:
  • the preset type includes at least one of the following: Activity, Service, Receiver, and Provider.
  • Activity is used to display the UI and user interaction interface, such as opening the various interfaces displayed by the application.
  • Service a component used to satisfy and support background work, such as playing music in the background.
  • Receiver A component used to monitor system behavior changes, such as mobile phone on and off screen, network switching and other state changes.
  • Provider A component used to provide data management within an application or other applications, such as address book management.
  • the essence of this step is to record the scheduling information of a special type of target message separately.
  • different types of target messages have different chances of causing performance problems in an application.
  • Research has shown that there are certain special types of targeted messages that have a high chance of causing performance problems in applications.
  • the scheduling information for special types of target messages is recorded separately by setting. This can ensure that the scheduling information of special types of target messages can be highlighted when locating performance problems later, shortening the locating time.
  • S3325 Record the scheduling information of the multiple historical messages that have been scheduled in the second monitoring period before ending the scheduling; wherein, the second monitoring period corresponds to the time from the time when the scheduling target message is ended that the counter is updated to the last time that the counter is detected. Between updates; the scheduling information of the multiple historical messages includes the total number of the multiple historical messages and the total scheduling time of the multiple historical messages.
  • the essence of the above technical solution is that when the terminal finishes scheduling the target message, it firstly detects whether the target message is a special type of target message. If so, the scheduling information of the special type of target message is recorded separately.
  • different types of target messages have different chances of causing performance problems in an application.
  • Research has shown that there are certain types of targeted messages that have a very high chance of causing performance problems in applications.
  • the scheduling information for special types of target messages is recorded separately by setting. This can ensure that the scheduling information of special types of target messages can be highlighted when locating performance problems later, shortening the locating time.
  • the CPU time and/or the wall time (WALL) may not be read at all.
  • the essence is The scheduling time of the first information is compared with the time interval T 0 between two adjacent updates, and based on the comparison result, the scheduling time in each scheduling information is determined.
  • it can also be set in the process of executing the above-mentioned methods for completing the one-to-many storage of scheduling information and messages by means of a counter, after each detection of an update of the counter, reading the CPU time and/or the wall time (WALL time). ), and based on the read CPU time and/or wall time (WALL) and the time interval T 0 between two adjacent updates, jointly determine the scheduling time in each scheduling information.
  • the scheduling time-consuming determination in the scheduling information is more accurate, which is helpful for accurately locating the performance problem in the future.
  • FIG. 18 is a flowchart of another method for locating a performance problem in an embodiment of the present disclosure.
  • FIG. 19 and FIG. 20 are effect diagrams for displaying scheduling information formed by using the method provided in FIG. 18 .
  • the method further includes:
  • S510 Display a message scheduling sequence diagram, where the message scheduling sequence diagram includes multiple first identifiers and second identifiers, the first identifier is used to identify scheduling information of multiple historical messages that have been scheduled when the performance problem occurs, and the second identifier is used for Scheduling information to identify historical messages that were being scheduled when performance issues occurred.
  • the method also includes:
  • the arrows indicate a time axis including a plurality of sequentially arranged rectangular boxes.
  • the boxes can be divided into three types according to the filling graph: the first type is the filling point of the boxes 1-53, which are the first identification, indicating the scheduling information of the historical messages that have been scheduled when the performance problem occurs; the second type The unfilled box is the second mark, indicating the scheduling information of the historical message being scheduled when the performance problem occurs; the third type is the box 1-3 filled with slashes, which is the third mark, indicating when the performance problem occurs Scheduling information for unscheduled historical messages.
  • the user When the user wants to know the scheduling information of the first message corresponding to the block 11 in the first identifier, the user performs the first operation on the block 11 .
  • the first operation may specifically be clicking, sliding, or the like.
  • a display box corresponding to block 11 appears in the display interface.
  • the display box displays the details of the scheduling information. Since the third identifier represents scheduling information of historical messages that were not scheduled when the performance problem occurred, when the user operates the third identifier, a display frame corresponding to the third identifier appears in the display interface.
  • the content of the display box is empty, or it indicates that there is no scheduling information.
  • This setting is especially suitable for situations where the size of the user display interface is limited, and all scheduling information cannot be fully displayed at the same time.
  • the display method of the scheduling information is given.
  • One reason why the scheduling information needs to be displayed is that although the terminal can complete the performance problem location by itself, in some scenarios, users or R&D personnel also want to know the scheduling situation of historical messages before and after the performance problem occurs.
  • the method further includes: the first terminal sends a message scheduling sequence diagram in response to the performance problem occurring in the application program to the second terminal.
  • the second terminal determines the scheduling information of the multiple historical messages that have been scheduled when the performance problem occurs according to the message scheduling sequence diagram; and locates the performance problem according to the scheduling information of the multiple historical messages that have been scheduled when the performance problem occurs.
  • the reason for this setting is that, in practice, there may be a performance problem in the first terminal. However, other personnel who cannot access the first terminal want to know the reasons for the performance problems of the first terminal. At this time, the above solution can be adopted to make the personnel unable to access the first terminal but holding the second device to obtain the performance of the first terminal. Scheduling information before and after the problem, and locating performance problems.
  • FIG. 20 is a schematic structural diagram of a device for locating performance problems in an embodiment of the present disclosure.
  • the device for locating a performance problem provided by the embodiment of the present disclosure may be configured in a terminal, or may be configured in a server.
  • the performance problem locating device specifically includes:
  • the response module 610 is configured to, in response to a performance problem occurring in the application, determine the scheduling information of multiple historical messages that have been scheduled when the performance problem occurs according to the message scheduling sequence diagram, and the message scheduling sequence diagram is used to display the scheduling of multiple historical messages information;
  • the problem locating module 620 is configured to locate the performance problem according to the scheduling information of a plurality of historical messages that have been scheduled when the performance problem occurs.
  • problem location module 620 is specifically used for:
  • the performance problem is located according to the historical messages whose scheduling time is greater than or equal to a preset time length among the plurality of historical messages.
  • the method further includes a message scheduling sequence diagram generation module, the message scheduling sequence diagram generation module includes a target message acquisition unit, a scheduling information recording unit, and a message scheduling sequence diagram generation unit;
  • the target message acquisition unit is used to acquire the target message to be scheduled in the message queue corresponding to the application program before a performance problem occurs in the application program, and the target message is any one of the multiple historical messages historical news;
  • a scheduling information recording unit configured to record the scheduling information of the target message in the process of scheduling the target message
  • a message scheduling sequence diagram generating unit configured to generate the message scheduling sequence diagram according to the scheduling information of the target message.
  • scheduling information recording unit is specifically used for:
  • the scheduling start time of the target message and the scheduling end time of the target message determine the scheduling time-consuming of the target message
  • Scheduling information of the target message is recorded, where the scheduling information includes at least one of the scheduling start time, the scheduling end time, and the scheduling time-consuming.
  • the scheduling information recording unit includes a first monitoring period scheduling information recording subunit and/or a second monitoring period scheduling information recording subunit;
  • the first monitoring period scheduling information recording subunit is configured to, when starting to schedule the target message, record the scheduling information of a plurality of historical messages that have been scheduled within the first monitoring period before the start of scheduling, the first monitoring A plurality of historical messages that have been scheduled within the period are messages before the target message;
  • the second monitoring period scheduling information recording subunit is configured to record the scheduling information of multiple historical messages that have been scheduled in the second monitoring period before the end of the scheduling when the target message is scheduled, and the second monitoring A number of historical messages that have been scheduled within a period include the target message.
  • first monitoring period scheduling information recording subunit is specifically used for:
  • the first monitoring period corresponds to the period from when the target message is scheduled to be updated when the counter is detected to be updated to the last time the counter is detected to be updated;
  • the scheduling information of the multiple historical messages includes the The total number of the multiple historical messages and the total scheduling time of the multiple historical messages.
  • the first monitoring period scheduling information recording subunit when performing recording the scheduling information of multiple historical messages that have been scheduled in the first monitoring period before the start of scheduling, includes:
  • the scheduling information of the multiple historical messages that have been scheduled within the first monitoring period is recorded.
  • the first monitoring period scheduling information recording subunit when performing recording the scheduling information of multiple historical messages that have been scheduled in the first monitoring period before the start of scheduling, further includes:
  • the second monitoring period scheduling information recording subunit is specifically configured to: when the target message is scheduled to end, detect whether the counter is updated;
  • the next message of the target message is obtained from the message queue
  • the second monitoring period corresponds to the period from when the target message is scheduled to be updated and the counter is detected to be updated last time;
  • the scheduling information of the multiple historical messages includes the The total number of the multiple historical messages and the total scheduling time of the multiple historical messages.
  • the second monitoring period scheduling information recording subunit when performing recording the scheduling information of multiple historical messages that have been scheduled in the second monitoring period before the end scheduling, includes:
  • the scheduling information of a plurality of historical messages that have been scheduled in the second monitoring period is recorded.
  • the second monitoring period scheduling information recording subunit when performing recording the scheduling information of multiple historical messages that have been scheduled in the second monitoring period before the end scheduling, further includes:
  • the scheduling information of the target message is recorded, and the scheduled information other than the target message in the second monitoring period is recorded. Scheduling information for historical messages.
  • the second monitoring period scheduling information recording subunit is also used for:
  • the message type of the target message is not a preset type, detecting whether the counter is updated;
  • the scheduling information of the target message is recorded.
  • the device for locating performance problems provided by the embodiments of the present disclosure can execute the steps performed by the terminal or the server in the method for locating performance problems provided by the method embodiments of the present disclosure, and the execution steps and beneficial effects are not repeated here.
  • FIG. 22 is a schematic structural diagram of an electronic device according to an embodiment of the disclosure. Referring specifically to FIG. 22 below, it shows a schematic structural diagram of the electronic device 1000 suitable for implementing the embodiment of the present disclosure.
  • the electronic device 1000 in the embodiment of the present disclosure may include, but is not limited to, such as a mobile phone, a notebook computer, a digital broadcast receiver, a PDA (personal digital assistant), a PAD (tablet computer), a PMP (portable multimedia player), a vehicle-mounted terminal ( Mobile terminals such as in-vehicle navigation terminals), wearable electronic devices, etc., and stationary terminals such as digital TVs, desktop computers, smart home devices, and the like.
  • the electronic device shown in FIG. 22 is only an example, and should not impose any limitation on the function and scope of use of the embodiments of the present disclosure.
  • an electronic device 1000 may include a processing device (eg, a central processing unit, a graphics processor, etc.) 1001, which may be loaded into random access according to a program stored in a read only memory (ROM) 1002 or from a storage device 1008
  • a program in the memory (RAM) 1003 executes various appropriate actions and processes to implement the performance problem locating method of the embodiment as described in the present disclosure.
  • RAM 1003 various programs and data required for the operation of the electronic device 1000 are also stored.
  • the processing device 1001, the ROM 1002, and the RAM 1003 are connected to each other through a bus 1004.
  • An input/output (I/O) interface 1005 is also connected to the bus 1004 .
  • the following devices can be connected to the I/O interface 1005: input devices 1006 including, for example, a touch screen, touchpad, keyboard, mouse, camera, microphone, accelerometer, gyroscope, etc.; including, for example, a liquid crystal display (LCD), speakers, vibration
  • An output device 1007 such as a computer
  • a storage device 1008 including, for example, a magnetic tape, a hard disk, etc.
  • the communication means 1009 may allow the electronic device 1000 to communicate wirelessly or by wire with other devices to exchange data. While FIG. 22 shows the electronic device 1000 having various means, it should be understood that not all of the illustrated means are required to be implemented or provided. More or fewer devices may alternatively be implemented or provided.
  • embodiments of the present disclosure include a computer program product comprising a computer program carried on a non-transitory computer readable medium, the computer program comprising program code for performing the method shown in the flowchart, thereby achieving the above The described performance problem location method.
  • the computer program may be downloaded and installed from the network via the communication device 1009, or from the storage device 1008, or from the ROM 1002.
  • the processing apparatus 1001 the above-mentioned functions defined in the methods of the embodiments of the present disclosure are executed.
  • the computer-readable medium mentioned above in the present disclosure may be a computer-readable signal medium or a computer-readable storage medium, or any combination of the above two.
  • the computer-readable storage medium can be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus or device, or a combination of any of the above. More specific examples of computer readable storage media may include, but are not limited to, electrical connections with one or more wires, portable computer disks, hard disks, random access memory (RAM), read only memory (ROM), erasable Programmable read only memory (EPROM or flash memory), fiber optics, portable compact disk read only memory (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination of the foregoing.
  • a computer-readable storage medium may be any tangible medium that contains or stores a program that can be used by or in conjunction with an instruction execution system, apparatus, or device.
  • a computer-readable signal medium may include a data signal propagated in baseband or as part of a carrier wave with computer-readable program code embodied thereon. Such propagated data signals may take a variety of forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination of the foregoing.
  • a computer-readable signal medium can also be any computer-readable medium other than a computer-readable storage medium that can transmit, propagate, or transport the program for use by or in connection with the instruction execution system, apparatus, or device .
  • Program code embodied on a computer readable medium may be transmitted using any suitable medium including, but not limited to, electrical wire, optical fiber cable, RF (radio frequency), etc., or any suitable combination of the foregoing.
  • the client and server can use any currently known or future developed network protocol such as HTTP (HyperText Transfer Protocol) to communicate, and can communicate with digital data in any form or medium Communication (eg, a communication network) interconnects.
  • HTTP HyperText Transfer Protocol
  • Examples of communication networks include local area networks (“LAN”), wide area networks (“WAN”), the Internet (eg, the Internet), and peer-to-peer networks (eg, ad hoc peer-to-peer networks), as well as any currently known or future development network of.
  • the above-mentioned computer-readable medium may be included in the above-mentioned electronic device; or may exist alone without being assembled into the electronic device.
  • the above-mentioned computer-readable medium carries one or more programs, and when the above-mentioned one or more programs are executed by the electronic device, the electronic device:
  • the performance problem is located according to scheduling information of a plurality of historical messages that have been scheduled when the performance problem occurs.
  • the electronic device may also perform other steps described in the above embodiments.
  • Computer program code for performing operations of the present disclosure may be written in one or more programming languages, including but not limited to object-oriented programming languages—such as Java, Smalltalk, C++, and This includes conventional procedural programming languages - such as the "C" language or similar programming languages.
  • the program code may execute entirely on the user's computer, partly on the user's computer, as a stand-alone software package, partly on the user's computer and partly on a remote computer, or entirely on the remote computer or server.
  • the remote computer may be connected to the user's computer through any kind of network, including a local area network (LAN) or a wide area network (WAN), or may be connected to an external computer (eg, using an Internet service provider through Internet connection).
  • LAN local area network
  • WAN wide area network
  • each block in the flowchart or block diagrams may represent a module, segment, or portion of code that contains one or more logical functions for implementing the specified functions executable instructions.
  • the functions noted in the blocks may occur out of the order noted in the figures. For example, two blocks shown in succession may, in fact, be executed substantially concurrently, or the blocks may sometimes be executed in the reverse order, depending upon the functionality involved.
  • each block of the block diagrams and/or flowchart illustrations, and combinations of blocks in the block diagrams and/or flowchart illustrations can be implemented in dedicated hardware-based systems that perform the specified functions or operations , or can be implemented in a combination of dedicated hardware and computer instructions.
  • the units involved in the embodiments of the present disclosure may be implemented in a software manner, and may also be implemented in a hardware manner. Among them, the name of the unit does not constitute a limitation of the unit itself under certain circumstances.
  • exemplary types of hardware logic components include: Field Programmable Gate Arrays (FPGAs), Application Specific Integrated Circuits (ASICs), Application Specific Standard Products (ASSPs), Systems on Chips (SOCs), Complex Programmable Logical Devices (CPLDs) and more.
  • FPGAs Field Programmable Gate Arrays
  • ASICs Application Specific Integrated Circuits
  • ASSPs Application Specific Standard Products
  • SOCs Systems on Chips
  • CPLDs Complex Programmable Logical Devices
  • a machine-readable medium may be a tangible medium that may contain or store a program for use by or in connection with the instruction execution system, apparatus or device.
  • the machine-readable medium may be a machine-readable signal medium or a machine-readable storage medium.
  • Machine-readable media may include, but are not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, devices, or devices, or any suitable combination of the foregoing.
  • machine-readable storage media would include one or more wire-based electrical connections, portable computer disks, hard disks, random access memory (RAM), read only memory (ROM), erasable programmable read only memory (EPROM or flash memory), fiber optics, compact disk read only memory (CD-ROM), optical storage, magnetic storage, or any suitable combination of the foregoing.
  • RAM random access memory
  • ROM read only memory
  • EPROM or flash memory erasable programmable read only memory
  • CD-ROM compact disk read only memory
  • magnetic storage or any suitable combination of the foregoing.
  • Embodiments of the present disclosure further provide a computer-readable storage medium, where a computer program is stored in the storage medium.
  • a computer program is stored in the storage medium.
  • the computer program is executed by a processor, the method of any of the foregoing embodiments in FIG. 1 to FIG. 20 can be implemented, and The implementation manner and beneficial effects are similar, and are not repeated here.

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Quality & Reliability (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Health & Medical Sciences (AREA)
  • Biomedical Technology (AREA)
  • Management, Administration, Business Operations System, And Electronic Commerce (AREA)

Abstract

Disclosed is a performance issue locating method. The method comprises: in response to a performance issue occurring in an application program, determining, according to a message scheduling time sequence diagram, scheduling information of a plurality of historical messages that have been scheduled when the performance issue occurs, wherein the message scheduling time sequence diagram is used for showing the scheduling information of the plurality of historical messages; and locating the performance issue according to the scheduling information of the plurality of historical messages that have been scheduled when the performance issue occurs. By means of the present method, the problem in the prior art of, when a performance issue, such as lagging, application not responding and an application program crash, occurs in an application program, it being difficult to acquire, from an operating system, key information that can be used to locate the issue is solved. Further disclosed are a performance issue locating apparatus, and an electronic device and a storage medium.

Description

性能问题定位方法、装置、电子设备和存储介质Performance problem location method, device, electronic device and storage medium
优先权信息priority information
本申请要求于2021年03月10日提交的,申请名称为“性能问题定位方法、装置、电子设备和存储介质”的、中国专利申请号“202110261774.X”的优先权,该申请的全部内容通过引用结合在本申请中。This application claims the priority of the Chinese patent application number "202110261774.X" filed on March 10, 2021, and the application name is "Performance Problem Location Method, Device, Electronic Device and Storage Medium", the entire content of the application Incorporated herein by reference.
技术领域technical field
本公开涉及信息技术领域,尤其涉及一种性能问题定位方法、装置、电子设备和存储介质。The present disclosure relates to the field of information technology, and in particular, to a method, apparatus, electronic device and storage medium for locating performance problems.
背景技术Background technique
随着信息技术的发展,电子设备已经成为日常生活中不可或缺的设备。例如,用户可以在电子设备上安装各种不同功能的应用程序(Application,APP)程序。通过不同功能的应用程序,用户可以享受到不同功能的服务。With the development of information technology, electronic equipment has become an indispensable equipment in daily life. For example, a user may install various application (Application, APP) programs with different functions on the electronic device. Through applications with different functions, users can enjoy services with different functions.
但是,电子设备的操作系统通常会限制应用程序获取系统资源的能力。从而在应用程序出现卡顿、应用无响应(Application Not Responding,ANR)、应用程序闪退等性能问题的情况下,很难从操作系统中获取到能够定位该问题的关键信息,从而无法定位问题出现的原因。为了能够定位问题,有些情况下需要对问题进行复现,但是复现过程比较耗时,应用程序卡顿时间过长,影响用户使用。However, the operating system of an electronic device often limits an application's ability to obtain system resources. Therefore, in the case of performance problems such as application freezes, application not responding (Application Not Responding, ANR), and application flashbacks, it is difficult to obtain key information from the operating system that can locate the problem, so that the problem cannot be located. the reason for the appearance. In order to locate the problem, it is necessary to reproduce the problem in some cases, but the reproduction process is time-consuming, and the application freezes for a long time, which affects the user's use.
发明内容SUMMARY OF THE INVENTION
为了解决上述技术问题或者至少部分地解决上述技术问题,本公开实施例提供了一种性能问题定位方法、装置、电子设备和存储介质。In order to solve the above technical problem or at least partially solve the above technical problem, the embodiments of the present disclosure provide a performance problem location method, apparatus, electronic device, and storage medium.
本公开实施例提供了一种性能问题定位方法,所述方法包括:An embodiment of the present disclosure provides a method for locating a performance problem, and the method includes:
响应于应用程序出现的性能问题,根据消息调度时序图确定所述性能问题出现时已经被调度的多个历史消息的调度信息,所述消息调度时序图用于显示所述多个历史消息的调度信息;In response to a performance problem occurring in the application, determine scheduling information of multiple historical messages that have been scheduled when the performance problem occurs according to a message scheduling sequence diagram, where the message scheduling sequence diagram is used to display the scheduling of the multiple historical messages information;
根据所述性能问题出现时已经被调度的多个历史消息的调度信息,对所述性能问题进行定位。The performance problem is located according to scheduling information of a plurality of historical messages that have been scheduled when the performance problem occurs.
本公开实施例还提供了一种性能问题定位装置,包括:The embodiment of the present disclosure also provides a performance problem location device, including:
响应模块,用于响应于应用程序出现的性能问题,根据消息调度时序图确定所述性能问题出现时已经被调度的多个历史消息的调度信息,所述消息调度时序图用于显示所述多个历史消息的调度信息;The response module is configured to, in response to a performance problem occurring in the application, determine scheduling information of multiple historical messages that have been scheduled when the performance problem occurs according to a message scheduling sequence diagram, and the message scheduling sequence diagram is used to display the multiple historical messages. scheduling information of a historical message;
问题定位模块,用于根据所述性能问题出现时已经被调度的多个历史消息的调度信息,对所述性能问题进行定位。A problem locating module, configured to locate the performance problem according to scheduling information of a plurality of historical messages that have been scheduled when the performance problem occurs.
本公开实施例还提供了一种电子设备,所述电子设备包括:Embodiments of the present disclosure also provide an electronic device, the electronic device comprising:
多个处理器;multiple processors;
存储装置,用于存储多个程序;a storage device for storing a plurality of programs;
当所述多个程序被所述多个处理器执行,使得所述多个处理器实现如上所述的性能问题定位方法。When the multiple programs are executed by the multiple processors, the multiple processors implement the above-described method for locating performance problems.
本公开实施例还提供了一种计算机可读存储介质,其上存储有计算机程序,该程序被处理器执行时实现如上所述的性能问题定位方法。Embodiments of the present disclosure also provide a computer-readable storage medium on which a computer program is stored, and when the program is executed by a processor, implements the above-described method for locating a performance problem.
本公开实施例提供的技术方案与现有技术相比至少具有如下优点:Compared with the prior art, the technical solutions provided by the embodiments of the present disclosure have at least the following advantages:
本公开实施例提供的性能问题定位方法,通过响应于应用程序出现的性能问题,根据消息调度时序图确定所述性能问题出现时已经被调度的多个历史消息的调度信息,所述消息调度时序图用于显示所述多个历史消息的调度信息;根据所述性能问题出现时已经被调度的多个历史消息的调度信息,对所述性能问题进行定位,其实质是,对应用程序运行过程中生成的各消息的调度信息进行记录存储,形成消息调度时序图,当应用程序出现性能问题时,依据消息调度时序图,对发生性能问题之时、之前的消息调度情况进行追溯,将追溯结果作为定位性能问题的关键信息,予以使用,进而确定导致出现性能问题的原因。其可以解决现有技术中,在应用程序出现卡顿、应用无响应、应用程序闪退等性能问题的情况下,很难从操作系统中获取到能够定位该问题的关键信息的问题。In the performance problem location method provided by the embodiments of the present disclosure, in response to a performance problem occurring in an application program, scheduling information of a plurality of historical messages that have been scheduled when the performance problem occurs is determined according to a message scheduling sequence diagram, and the message scheduling sequence The graph is used to display the scheduling information of the multiple historical messages; according to the scheduling information of the multiple historical messages that have been scheduled when the performance problem occurs, the performance problem is located, which is essentially a process of running the application program. The scheduling information of each message generated in the system is recorded and stored to form a message scheduling sequence diagram. When a performance problem occurs in the application program, according to the message scheduling sequence diagram, the previous message scheduling situation at the time of the performance problem is traced back, and the traced result will be traced. Use it as key information for locating performance issues to determine the cause of performance issues. It can solve the problem in the prior art that it is difficult to obtain key information capable of locating the problem from the operating system when performance problems such as application program freeze, application unresponsiveness, and application program flashback occur in the prior art.
附图说明Description of drawings
结合附图并参考以下具体实施方式,本公开各实施例的上述和其他特征、优点及方面将变得更加明显。贯穿附图中,相同或相似的附图标记表示相同或相似的元素。应当理解附图是示意性的,原件和元素不一定按照比例绘制。The above and other features, advantages and aspects of various embodiments of the present disclosure will become more apparent when taken in conjunction with the accompanying drawings and with reference to the following detailed description. Throughout the drawings, the same or similar reference numbers refer to the same or similar elements. It should be understood that the drawings are schematic and that the originals and elements are not necessarily drawn to scale.
图1为本公开实施例提供的一种性能问题定位方法应用场景图;FIG. 1 is an application scenario diagram of a method for locating a performance problem provided by an embodiment of the present disclosure;
图2为本公开实施例提供的一种性能问题定位方法的流程图;FIG. 2 is a flowchart of a method for locating a performance problem according to an embodiment of the present disclosure;
图3为本公开实施例提供的一种消息与调度信息的对应关系示意图;3 is a schematic diagram of a correspondence between a message and scheduling information according to an embodiment of the present disclosure;
图4为本公开实施例提供的另一种消息与调度信息的对应关系示意图;FIG. 4 is a schematic diagram of a corresponding relationship between another message and scheduling information according to an embodiment of the present disclosure;
图5为本公开实施例提供的又一种消息与调度信息的对应关系示意图;FIG. 5 is a schematic diagram of a corresponding relationship between another message and scheduling information according to an embodiment of the present disclosure;
图6为本公开实施例提供的一种消息调度时序图;FIG. 6 provides a message scheduling sequence diagram according to an embodiment of the present disclosure;
图7为本公开实施例提供的一种性能问题定位方法的原理图;FIG. 7 is a schematic diagram of a method for locating a performance problem according to an embodiment of the present disclosure;
图8为本公开实施例提供的一种生成消息调度时序图的方法的流程图;8 is a flowchart of a method for generating a message scheduling sequence diagram according to an embodiment of the present disclosure;
图9为本公开实施例提供的另一种生成消息调度时序图的方法的流程图;FIG. 9 is a flowchart of another method for generating a message scheduling sequence diagram according to an embodiment of the present disclosure;
图10为本公开实施例提供的一种计数器更新的示意图;10 is a schematic diagram of a counter update provided by an embodiment of the present disclosure;
图11-图12为本公开实施例提供的另外两种计数器更新的示意图;11-12 are schematic diagrams of two other types of counter updates provided by the embodiments of the present disclosure;
图13-图14为本公开实施例提供的另外两种计数器更新的示意图;13-14 are schematic diagrams of two other types of counter updates provided by the embodiments of the present disclosure;
图15为本公开实施例提供的一种用于实现S320的方法的流程图;FIG. 15 is a flowchart of a method for implementing S320 according to an embodiment of the present disclosure;
图16为本公开实施例提供的一种用于实现S330的方法的流程图;FIG. 16 is a flowchart of a method for implementing S330 according to an embodiment of the present disclosure;
图17为本公开实施例提供的另一种用于实现S330的方法的流程图;FIG. 17 is a flowchart of another method for implementing S330 provided by an embodiment of the present disclosure;
图18为本公开实施例中的另一种性能问题定位方法的流程图;18 is a flowchart of another method for locating performance problems in an embodiment of the present disclosure;
图19和图20为采用图18提供的方法所形成的一种调度信息展示效果图;Figure 19 and Figure 20 are a kind of scheduling information display effect diagram formed by adopting the method provided in Figure 18;
图21为本公开实施例中的一种性能问题定位装置的结构示意图;21 is a schematic structural diagram of a device for locating performance problems according to an embodiment of the present disclosure;
图22为本公开实施例中的一种电子设备的结构示意图。FIG. 22 is a schematic structural diagram of an electronic device according to an embodiment of the disclosure.
具体实施方式Detailed ways
下面将参照附图更详细地描述本公开的实施例。虽然附图中显示了本公开的某些实施例,然而应当理解的是,本公开可以通过各种形式来实现,而且不应该被解释为限于这里阐述的实施例,相反提供这些实施例是为了更加透彻和完整地理解本公开。应当理解的是,本公开的附图及实施例仅用于示例性作用,并非用于限制本公开的保护范围。Embodiments of the present disclosure will be described in more detail below with reference to the accompanying drawings. While certain embodiments of the present disclosure are shown in the drawings, it should be understood that the present disclosure may be embodied in various forms and should not be construed as limited to the embodiments set forth herein, but rather are provided for the purpose of A more thorough and complete understanding of the present disclosure. It should be understood that the drawings and embodiments of the present disclosure are only for exemplary purposes, and are not intended to limit the protection scope of the present disclosure.
应当理解,本公开的方法实施方式中记载的各个步骤可以按照不同的顺序执行,和/或并行执行。此外,方法实施方式可以包括附加的步骤和/或省略执行示出的步骤。本公开的范围在此方面不受限制。It should be understood that the various steps described in the method embodiments of the present disclosure may be performed in different orders and/or in parallel. Furthermore, method embodiments may include additional steps and/or omit performing the illustrated steps. The scope of the present disclosure is not limited in this regard.
本文使用的术语“包括”及其变形是开放性包括,即“包括但不限于”。术语“基于”是“至少部分地基于”。其他术语的相关定义将在下文描述中给出。As used herein, the term "including" and variations thereof are open-ended inclusions, ie, "including but not limited to". The term "based on" is "based at least in part on." Relevant definitions of other terms will be given in the description below.
需要注意,本公开中提及的“第一”、“第二”等概念仅用于对不同的装置、模块或单元进行区分,并非用于限定这些装置、模块或单元所执行的功能的顺序或者相互依存关系。It should be noted that concepts such as "first" and "second" mentioned in the present disclosure are only used to distinguish different devices, modules or units, and are not used to limit the order of functions performed by these devices, modules or units or interdependence.
本公开实施方式中的多个装置之间所交互的消息或者信息的名称仅用于说明性的目的,而并不是用于对这些消息或信息的范围进行限制。The names of messages or information exchanged between multiple devices in the embodiments of the present disclosure are only for illustrative purposes, and are not intended to limit the scope of these messages or information.
图1为本公开实施例提供的一种性能问题定位方法应用场景图。本公开提供的性能问题定位方法可应用于图1所示的应用环境中。参见图1,该性能问题定位系统包括服务器与多个终端(如终端1、终端2、终端3和终端4)。各终端与服务器均通过网络通讯连接。各终端上均安装有多个应用程序。示例性地,假设某用户使用终端1中的某个应用程序时,该应用程序出现性能问题,此时可以由任意终端或者由服务器执行本公开提供的性能问题定位方法。需要强调的是,若本公开提供的性能问题定位方法由终端执行,在实际中,出现性能问题的终端以及执行本公开提供的性能问题定位方法的终端可以为同一终端,也可以为不同终端。FIG. 1 is an application scenario diagram of a method for locating a performance problem provided by an embodiment of the present disclosure. The performance problem location method provided by the present disclosure can be applied to the application environment shown in FIG. 1 . Referring to FIG. 1 , the performance problem location system includes a server and multiple terminals (eg, terminal 1, terminal 2, terminal 3, and terminal 4). Each terminal and the server are connected through network communication. Several applications are installed on each terminal. Exemplarily, it is assumed that when a user uses a certain application in the terminal 1, the application has a performance problem. At this time, any terminal or a server can execute the performance problem locating method provided by the present disclosure. It should be emphasized that if the performance problem locating method provided by the present disclosure is executed by a terminal, in practice, the terminal having a performance problem and the terminal executing the performance problem locating method provided by the present disclosure may be the same terminal or different terminals.
其中,服务器可以用独立的服务器或是多个服务器组成的服务器集群来实现。终端可以包括但不限于智能手机、掌上电脑、平板电脑、带显示屏的可穿戴设备、台式机、笔记本电脑、一体机、智能家居设备等。The server can be implemented by an independent server or a server cluster composed of multiple servers. Terminals may include, but are not limited to, smart phones, palmtop computers, tablet computers, wearable devices with display screens, desktop computers, notebook computers, all-in-one computers, smart home devices, and the like.
图2为本公开实施例提供的一种性能问题定位方法的流程图,该方法可以由性能问题定位装置执行,该装置可以采用软件和/或硬件的方式实现,该装置可配置于电子设备中,例如终端或服务器中。为了便于理解,下面以该方法由出现性能问题的终端执行为例进行说明。FIG. 2 is a flowchart of a method for locating a performance problem provided by an embodiment of the present disclosure. The method may be executed by a performance problem locating apparatus, and the apparatus may be implemented in software and/or hardware, and the apparatus may be configured in an electronic device. , for example in a terminal or server. For ease of understanding, the method is described below by taking an example that the method is executed by a terminal having a performance problem.
如图2所示,该方法具体可以包括:As shown in Figure 2, the method may specifically include:
S110、响应于应用程序出现的性能问题,根据消息调度时序图确定性能问题出现时已经被调度的多个历史消息的调度信息,消息调度时序图用于显示多个历史消息的调度信息。S110. In response to a performance problem occurring in the application, determine scheduling information of multiple historical messages that have been scheduled when the performance problem occurs according to a message scheduling sequence diagram, where the message scheduling sequence diagram is used to display the scheduling information of multiple historical messages.
终端中可以安装有应用程序,此处并不对终端中安装的应用程序的个数和功能做具体限定。在应用程序运行过程中,应用程序可能会出现性能问题,例如,卡顿、ANR、闪退(Crash)等。具体的,在应用程序运行过程中,终端可以实时检测应用程序是否出现性能问题。Application programs may be installed in the terminal, and the number and functions of the application programs installed in the terminal are not specifically limited here. During the running of the application, the application may experience performance problems, such as freeze, ANR, crash, etc. Specifically, during the running process of the application, the terminal can detect in real time whether a performance problem occurs in the application.
消息调度时序图是一种可以直观地展示应用程序运行过程中,各历史消息的调度信息的图形。在实际中,消息调度时序图的具体生成方法有多种,本申请对此不作限制。可选地,在应用程序出现性能问题之前,方法还包括:获取应用程序对应的消息队列中待调度的目标消息,目标消息为多个历史消息中的任一历史消息;在对目标消息进行调度的过程中,记录目标消息的调度信息;根据目标消息的调度信息,生成消息调度时序图。The message scheduling sequence diagram is a graph that can visually display the scheduling information of each historical message during the running process of the application. In practice, there are various specific methods for generating the message scheduling sequence diagram, which are not limited in this application. Optionally, before a performance problem occurs in the application, the method further includes: acquiring a target message to be scheduled in a message queue corresponding to the application, where the target message is any historical message in a plurality of historical messages; During the process, the scheduling information of the target message is recorded; according to the scheduling information of the target message, a message scheduling sequence diagram is generated.
具体地,在应用程序运行过程中,终端可以生成应用程序对应的消息,并将该消息放入该应用程序对应的消息队列中。本实施例并不限定终端生成消息的具体条件或具体场景。此外,本实施例也不限定消息队列中缓存的消息的个数。例如,在应用程序运行过程中,终端可以显示该应用程序的用户界面,从而使得用户可以在该用户界面上进行操作。具体的,终端可以根据用户在该用户界面上的操作生成该应用程序对应的消息,并将该消息放入该应用程序对应的消息队列中。进一步地,终端可以对该消息队列中的消息依次进行调度,具体地,可以是终端中的主线程对该消息队列中的消息依次进行调度。Specifically, during the running process of the application, the terminal may generate a message corresponding to the application, and put the message into the message queue corresponding to the application. This embodiment does not limit the specific conditions or specific scenarios for the terminal to generate the message. In addition, this embodiment does not limit the number of messages buffered in the message queue. For example, during the running process of the application, the terminal may display the user interface of the application, so that the user can perform operations on the user interface. Specifically, the terminal may generate a message corresponding to the application program according to the user's operation on the user interface, and put the message in a message queue corresponding to the application program. Further, the terminal may schedule the messages in the message queue in sequence, specifically, the main thread in the terminal may schedule the messages in the message queue in sequence.
在本实施例中,终端在对消息队列中的每个消息进行调度的过程中,记录每个消息的调度信息。图3为本公开实施例提供的一种消息与调度信息的对应关系示意图。在图3中,消息队列中包括消息1、消息2、消息3、消息4、消息5。可以理解的是,本实施例并不限定该消息队列中缓存的具体消息和消息个数。另外,该消息队列中缓存的具体消息、以及缓存的消息个数可能是随时间变化的。例如,当终端对消息队列中的消息1调度完成后,终端可以将该消息1从该消息队列中删除掉,从而使得该消息队列中的具体消息和消息个数发生变化。同理,当终端生成新的消息,例如消息6时,终端可以将该消息6添加到该消息队列中,从而使得该消息队列中的具体消息和消息个数发生变化。In this embodiment, the terminal records the scheduling information of each message in the process of scheduling each message in the message queue. FIG. 3 is a schematic diagram of a correspondence between a message and scheduling information according to an embodiment of the present disclosure. In FIG. 3 , the message queue includes message 1 , message 2 , message 3 , message 4 , and message 5 . It can be understood that this embodiment does not limit the specific messages and the number of messages buffered in the message queue. In addition, the specific messages buffered in the message queue and the number of buffered messages may vary with time. For example, after the terminal completes the scheduling of the message 1 in the message queue, the terminal can delete the message 1 from the message queue, so that the specific message and the number of messages in the message queue are changed. Similarly, when the terminal generates a new message, such as message 6, the terminal can add the message 6 to the message queue, so that the specific message and the number of messages in the message queue change.
继续参见图3,终端在对该消息队列中的消息1进行调度的过程中,终端可以记录消息1的调度信息。进一步,终端可以将消息1的调度信息存储到一个存储空间。其中,消息1的调度信息例如可以包括消息1的调度开始时间、调度结束时间、调度耗时中的至少一种。可以理解的是,消息1的调度信息还可以包括其他信息,例如,消息1的标识信息等。标识信息具体可以为消息的类型和名称中的至少一种。Continuing to refer to FIG. 3 , in the process of scheduling the message 1 in the message queue, the terminal may record the scheduling information of the message 1 . Further, the terminal may store the scheduling information of the message 1 in a storage space. The scheduling information of the message 1 may include, for example, at least one of the scheduling start time, the scheduling end time, and the scheduling time of the message 1 . It can be understood that the scheduling information of the message 1 may also include other information, for example, identification information of the message 1 and the like. The identification information may specifically be at least one of the type and name of the message.
可选地,可以设置调度开始时间包括CPU时间和/或墙上时间(WALL)。其中,CPU时间和墙上时间是两个不同维度的时间。墙上时间包括消息调度的等待时间和消息调度的执行时间。其中,等待时间可能有多个。CPU时间包括消息调度的执行时间。Optionally, the schedule start time can be set to include CPU time and/or wall time (WALL). Among them, CPU time and wall time are two different dimensions of time. Wall time includes the waiting time of message scheduling and the execution time of message scheduling. Among them, there may be multiple waiting times. The CPU time includes the execution time of the message scheduling.
类似地,可以设置调度结束时间包括CPU时间和/或墙上时间(WALL)。Similarly, the scheduled end time can be set to include CPU time and/or wall time (WALL).
进一步地,在实际设置时,调度信息与消息可以一对一存储,也可以一对多存储,或者,采用一对一存储和一对多存储相结合的方式进行存储。Further, in the actual setting, the scheduling information and the message can be stored one-to-one, one-to-many, or a combination of one-to-one and one-to-many.
若采用一对一存储,终端可以对该消息队列中的每个消息依次进行调度,同 时终端可以依次记录每个消息的调度信息。也就是说,在终端每调度完一个消息的情况下,终端即可将该消息的调度信息记录并存储到该存储空间中,从而使得每个已经被调度的消息可以分别对应一个调度信息。示例性地,图3中,调度信息与消息一对一存储。继续参见图3,已经被调度的消息1、消息2、消息3、消息4、消息5分别对应的调度信息存储在该存储空间中。可以理解的是,本实施例并不限定该存储空间的类型、以及该存储空间在终端中的位置。If one-to-one storage is adopted, the terminal can schedule each message in the message queue in turn, and the terminal can record the scheduling information of each message in turn. That is to say, when the terminal finishes scheduling a message, the terminal can record and store the scheduling information of the message in the storage space, so that each scheduled message can correspond to one scheduling information respectively. Exemplarily, in FIG. 3 , scheduling information and messages are stored one-to-one. Continuing to refer to FIG. 3 , the scheduling information corresponding to the messages 1 , 2 , 3 , 4 , and 5 that have been scheduled are stored in the storage space. It can be understood that this embodiment does not limit the type of the storage space and the location of the storage space in the terminal.
若采用一对多存储,终端不限于在调度完一个消息的情况下,将该消息的调度信息存储到该存储空间中。例如,终端可以在调度完多个消息的情况下,将该多个消息的调度信息存储到该存储空间中。其中,该多个消息的调度信息可以包括该多个消息的总个数、该多个消息总的调度耗时等。可以理解的是,该多个消息的调度信息还可以包括其他信息,例如,该多个消息中第一个被调度的消息的调度开始时间、该多个消息中最后一个被调度的消息的调度结束时间、该多个消息中第一个被调度的消息的标识信息、该多个消息中最后一个被调度的消息的标识信息等。图4为本公开实施例提供的另一种消息与调度信息的对应关系示意图。图4中,调度信息与消息一对多存储。参见图4,终端可以在调度完消息1和消息2的情况下,将消息1和消息2的调度信息存储到该存储空间中,形成一条调度信息。终端可以在调度完消息3、消息4和消息5的情况下,将消息3、消息4和消息5的调度信息存储到该存储空间中,形成一条调度信息。If one-to-many storage is adopted, the terminal is not limited to storing the scheduling information of the message in the storage space when a message is scheduled. For example, the terminal may store the scheduling information of the multiple messages in the storage space when the multiple messages are scheduled. The scheduling information of the multiple messages may include the total number of the multiple messages, the total scheduling time of the multiple messages, and the like. It can be understood that the scheduling information of the multiple messages may also include other information, for example, the scheduling start time of the first scheduled message among the multiple messages, and the scheduling of the last scheduled message among the multiple messages. End time, identification information of the first scheduled message among the multiple messages, identification information of the last scheduled message among the multiple messages, and the like. FIG. 4 is a schematic diagram of another correspondence between messages and scheduling information according to an embodiment of the present disclosure. In Figure 4, scheduling information and messages are stored one-to-many. Referring to FIG. 4 , after scheduling the message 1 and the message 2, the terminal may store the scheduling information of the message 1 and the message 2 in the storage space to form a piece of scheduling information. The terminal may store the scheduling information of message 3, message 4 and message 5 in the storage space after scheduling message 3, message 4 and message 5 to form a piece of scheduling information.
图5为本公开实施例提供的又一种消息与调度信息的对应关系示意图。图5中,调度信息与消息采用一对一存储和一对多存储相结合的方式进行存储。参加图5,终端可以在调度完消息1的情况下,将消息1的调度信息存储到该存储空间中,形成一条调度信息。终端可以在调度完消息2和消息3的情况下,将消息2和消息3的调度信息存储到该存储空间中,形成一条调度信息。同理,终端可以在调度完消息4和消息5的情况下,将消息4和消息5的调度信息存储到该存储空间中,形成一条调度信息。FIG. 5 is a schematic diagram of another correspondence between messages and scheduling information according to an embodiment of the present disclosure. In FIG. 5 , the scheduling information and the message are stored in a combination of one-to-one storage and one-to-many storage. Referring to FIG. 5 , the terminal may store the scheduling information of the message 1 in the storage space after scheduling the message 1 to form a piece of scheduling information. After scheduling the message 2 and the message 3, the terminal may store the scheduling information of the message 2 and the message 3 in the storage space to form a piece of scheduling information. Similarly, the terminal may store the scheduling information of message 4 and message 5 in the storage space after scheduling message 4 and message 5 to form a piece of scheduling information.
由于在实际中,应用程序运行过程中,消息调度极为频繁,而且大多数情况耗时都在毫秒甚至微秒量级。通过采用调度信息与消息一对多存储,或者,采用一对一存储和一对多存储相结合的方式进行存储,可以提高统计效率、存储效率、降低存储空间占用率、缩减从存储空间中再去读写的运算量,甚至降低因大量的内存申请和释放而造成内存抖动,引发性能问题的几率。In practice, during the running of the application, the message scheduling is extremely frequent, and in most cases, the time-consuming is in the order of milliseconds or even microseconds. By adopting one-to-many storage of scheduling information and messages, or by adopting a combination of one-to-one storage and one-to-many storage for storage, it is possible to improve statistical efficiency, storage efficiency, reduce storage space occupancy rate, and reduce the amount of data collected from storage space. The amount of operations to read and write can even reduce the chance of memory jitter caused by a large number of memory application and release, causing performance problems.
需要强调的是,在本公开中,调度信息的存储空间和消息队列是两个不同的 存储空间。当消息被调度完成时,该消息就可以从消息队列中删除掉。但该消息的调度信息需要保存在调度信息的存储空间,并不删除。It should be emphasized that, in the present disclosure, the storage space of scheduling information and the message queue are two different storage spaces. When the message is dispatched, the message can be deleted from the message queue. However, the scheduling information of the message needs to be stored in the storage space of the scheduling information and is not deleted.
上述“根据目标消息的调度信息,生成消息调度时序图”,实质是根据调度信息存储空间中存储的调度信息,生成消息调度时序图。The above-mentioned "generating a message scheduling sequence diagram according to the scheduling information of the target message" is essentially to generate a message scheduling sequence diagram according to the scheduling information stored in the scheduling information storage space.
图6为本公开实施例提供的一种消息调度时序图。示例性地,参见图6,在图6中,箭头表示时间轴,该时间轴包括多个顺序排列的矩形方框。每一个方框代表一条调度信息。根据填充图形可以将方框分为三个类型:第一类型为填充点的方框1-53,为第一标识,表示应用程序出现性能问题之时已调度完毕的消息的调度信息;第二类型为无填充的方框,为第二标识,表示应用程序出现性能问题之时正在调度的消息的调度信息;第三类型为填充斜线的方框1-3,为第三标识,表示应用程序出现性能问题之时还未开始调度的消息。FIG. 6 is a message scheduling sequence diagram provided by an embodiment of the present disclosure. Illustratively, referring to FIG. 6 , in FIG. 6 , arrows indicate a time axis, and the time axis includes a plurality of rectangular boxes arranged in sequence. Each box represents a piece of scheduling information. The boxes can be divided into three types according to the filling graph: the first type is the filling point of the boxes 1-53, which is the first identifier, indicating the scheduling information of the message that has been scheduled when the application has a performance problem; the second type is the filling point. The box with type unfilled is the second identifier, indicating the scheduling information of the message being scheduled when the application has performance problems; the third type is the box 1-3 filled with slashes, which is the third identifier, indicating the application Messages that have not yet started scheduling when the program has performance problems.
本步骤中,性能问题出现时已经被调度的历史消息的调度信息,包括应用程序出现性能问题之时已调度完毕的消息的调度信息,以及应用程序出现性能问题之时正在调度的消息的调度信息。因此,参见图6,在执行本步骤时,需要确定的调度信息是第一标识和第二标识对应的调度信息。In this step, the scheduling information of the historical messages that have been scheduled when the performance problem occurs, includes the scheduling information of the messages that have been scheduled when the performance problem occurs in the application program, and the scheduling information of the message that is being scheduled when the performance problem occurs in the application program. . Therefore, referring to FIG. 6 , when this step is performed, the scheduling information to be determined is the scheduling information corresponding to the first identifier and the second identifier.
可选地,在图6中,每一个第一标识和每一个第二标识借助于一个展示框(图中椭圆形图像),展示该调度信息的详细内容。其中,MSG表示该调度信息对应的消息。例如填充有点的方框1对应的展示框中,“MSG 1”表示该调度信息对应1个消息。填充有点的方框7对应的展示框中,“MSGS 33”表示该调度信息对应33个消息,为33个消息的合并结果。展示框中Wall表示该调度信息对应的所有消息的墙上时间总调度耗时。展示框中CPU表示该调度信息对应的所有消息的CPU时间总调度耗时。填充有点的方框5对应的展示框中,“IDLE”表示系统休眠。Optionally, in FIG. 6 , each of the first identifiers and each of the second identifiers displays the detailed content of the scheduling information by means of a display frame (an oval image in the figure). Wherein, MSG represents a message corresponding to the scheduling information. For example, in the display box corresponding to box 1 filled with dots, "MSG 1" indicates that the scheduling information corresponds to 1 message. In the display box corresponding to the box 7 filled with dots, "MSGS 33" indicates that the scheduling information corresponds to 33 messages, which is the combined result of the 33 messages. Wall in the display box indicates the total wall time scheduling time of all messages corresponding to the scheduling information. The CPU in the display box indicates the total CPU time of all messages corresponding to the scheduling information. In the display box corresponding to box 5 filled with dots, "IDLE" means system sleep.
可选地,继续参见图6,可以进一步将调度耗时长的消息对应的调度信息以特殊效果显示。例如,方框1对应的第一消息调度耗时非常长,因此,将方框1对应的展示框填充竖线条纹,以与其他展示框区别。这样设置便于快速确定哪些消息的调度耗时长,进一步缩短定位性能问题的时间,提高工作效率。Optionally, continuing to refer to FIG. 6 , the scheduling information corresponding to the messages whose scheduling takes a long time may be further displayed with special effects. For example, the scheduling of the first message corresponding to box 1 takes a very long time. Therefore, the display box corresponding to box 1 is filled with vertical stripes to distinguish it from other display boxes. This setting is convenient for quickly determining which messages are scheduled to take a long time, further shortening the time for locating performance problems, and improving work efficiency.
在上述技术方案的基础上,可选地,第一标识的尺寸与第一标识对应的历史消息的调度信息相关;第二标识的尺寸与第二标识对应的历史消息的调度信息相关。示例性地,图6中,第一标识沿箭头方向的长度与第一标识对应的历史消息的调度耗时正相关。这样设置可以进一步快速确定哪些消息的调度耗时长,进一步缩短定位性能问题的时间,提高工作效率。Based on the above technical solution, optionally, the size of the first identifier is related to scheduling information of historical messages corresponding to the first identifier; the size of the second identifier is related to scheduling information of historical messages corresponding to the second identifier. Exemplarily, in FIG. 6 , the length of the first identifier in the direction of the arrow is positively correlated with the scheduling time of the historical message corresponding to the first identifier. This setting can further quickly determine which messages take a long time to schedule, further shorten the time for locating performance problems, and improve work efficiency.
需要说明的是,在图6中,该消息调度时序图包括应用程序出现性能问题之时未被调度的消息(对应第三标识)。这仅是本申请的一个具体示例,而非对本申请的限制。在实际中,可以设置该消息调度时序图仅包括应用程序出现性能问题之时已调度完毕的消息的调度信息(对应第一标识),以及正在调度的消息的调度信息(对应第二标识),不包括未被调度的消息。It should be noted that, in FIG. 6 , the message scheduling sequence diagram includes unscheduled messages (corresponding to the third identifier) when a performance problem occurs in the application program. This is only a specific example of the present application, rather than a limitation of the present application. In practice, the message scheduling sequence diagram can be set to include only the scheduling information (corresponding to the first identifier) of the message that has been scheduled when the application program has a performance problem, and the scheduling information (corresponding to the second identifier) of the message being scheduled, Does not include unscheduled messages.
本步骤的具体实现方式有多种,示例性地,响应于应用程序出现的性能问题,确定应用程序出现的性能问题的类型;根据性能问题的类型以及消息调度时序图确定性能问题出现时已经被调度的多个历史消息的调度信息。这样设置便于缩小需查看的调度信息的信息量,便于快速找到需要着重关注的调度信息,提高定位效率。There are various specific implementation manners of this step. Exemplarily, in response to a performance problem that occurs in the application, determine the type of performance problem that occurs in the application; Scheduling information for multiple historical messages scheduled. This setting is convenient to reduce the amount of scheduling information to be viewed, to quickly find the scheduling information that needs to be focused on, and to improve positioning efficiency.
或者,本步骤的具体实现方式还可以为,响应于应用程序出现的性能问题,根据消息调度时序图确定从应用程序出现性能问题时刻起,预设追溯时长范围内的已经被调度的多个历史消息的调度信息。预设追溯时长,可以根据研发人员经验确定,本公开对此不作限制。这样设置便于缩小需查看的调度信息的信息量,便于快速找到需要着重关注的调度信息,提高定位效率。Alternatively, the specific implementation of this step may also be, in response to a performance problem occurring in the application program, according to the message scheduling sequence diagram, it is determined from the moment when the performance problem occurs in the application program, a number of historical records that have been scheduled within a preset retrospective time range are determined. Scheduling information for the message. The preset retrospective duration can be determined according to the experience of the research and development personnel, which is not limited in this disclosure. This setting is convenient to reduce the amount of scheduling information to be viewed, to quickly find the scheduling information that needs to be focused on, and to improve positioning efficiency.
可选地,可以设置不同类型的性能问题,预设追溯时长不同。在执行“根据消息调度时序图确定从应用程序出现性能问题时刻起,预设追溯时长范围内的已经被调度的多个历史消息的调度信息”之前,还包括:确定应用程序出现的性能问题的类型;根据性能问题的类型,确定预设追溯时长。Optionally, different types of performance problems can be set, and the preset retrospective durations are different. Before executing "Determining the scheduling information of multiple historical messages that have been scheduled within a preset retrospective time range from the moment when the application program has a performance problem according to the message scheduling sequence diagram", it also includes: determining the performance problem of the application program. Type; determine the preset traceback duration based on the type of performance issue.
S120、根据性能问题出现时已经被调度的多个历史消息的调度信息,对性能问题进行定位。S120. Locate the performance problem according to scheduling information of multiple historical messages that have been scheduled when the performance problem occurs.
图7为本公开实施例提供的一种性能问题定位方法的原理图。在图7中,水平箭头表示时间轴,在时间轴的上方绘制有多个填充有斜线的长方形,一个长方形表示一个消息。每个长方形左端边线与时间轴的交点表示该消息的调度开始时间。每个长方形右端边线与时间轴的交点表示该消息的调度结束时间。示例性地,消息1的调度开始时间为a、调度结束时间为b。如图7中的,消息1、消息2、消息3和消息4在应用程序出现性能问题的时刻之前,已经被调度完成。消息5是性能问题出现时刻正在被调度的消息。FIG. 7 is a schematic diagram of a method for locating a performance problem provided by an embodiment of the present disclosure. In FIG. 7 , a horizontal arrow represents a time axis, and a plurality of rectangles filled with diagonal lines are drawn above the time axis, and one rectangle represents one message. The intersection of the left edge of each rectangle with the timeline represents the scheduled start time of the message. The intersection of the right edge of each rectangle and the time axis indicates the scheduled end time of the message. Exemplarily, the scheduling start time of message 1 is a, and the scheduling end time is b. As shown in Figure 7, message 1, message 2, message 3, and message 4 have been scheduled and completed before the moment when the application has a performance problem. Message 5 is the message being dispatched at the moment when the performance problem occurs.
一般情况下,造成终端出现性能问题的原因,可能是已经被调度完成的消息调度的过程中出现问题造成的;也可能是正在被调度的消息调度的过程中出现问题造成的;也有可能是已经被调度完成的消息调度的过程出现的问题和正在被调 度的消息调度的过程出现的问题共同作用导致的。In general, the reason for the performance problem of the terminal may be caused by a problem in the process of message scheduling that has been scheduled; it may also be caused by a problem in the process of message scheduling being scheduled; The problem in the process of message scheduling that is scheduled to be completed is caused by the combined effect of the problem in the process of message scheduling being scheduled.
示例性地,由于终端中,消息队列中的多个消息顺次调度,例如,终端调度信息A后调度信息B、再调度信息C、再调度信息D。其中,终端在调度信息B或调度信息C的时候,消息B或消息C可能已经比较耗时了,但是并没有导致卡顿、ANR等问题出现。可能等到终端调度信息D的时候,卡顿、ANR等问题才出现,而消息D可能并不耗时。此种情况下,是消息B消息C调度的过程中出现问题造成终端出现性能问题。Exemplarily, since in the terminal, multiple messages in the message queue are scheduled in sequence, for example, the terminal schedules information A, then schedules information B, reschedules information C, and reschedules information D. Wherein, when the terminal schedules the information B or the information C, the message B or the message C may have been time-consuming, but it does not cause problems such as freezing and ANR. Problems such as freezing and ANR may not occur until the terminal schedules message D, and message D may not be time-consuming. In this case, it is a problem in the scheduling process of the message B and the message C that causes the performance problem of the terminal.
本步骤的具体实现方法有多种,可选地,包括:确定多个历史消息中调度耗时大于或等于预设时长的历史消息;根据多个历史消息中调度耗时大于或等于预设时长的历史消息,对性能问题进行定位。研究表明消息调度耗时长,其往往是出现性能问题的表象结果。这样设置便于缩小需要查看的调度信息的信息量,便于研发人员快速找到需要着重关注的调度信息,提高定位效率。There are various specific implementation methods for this step. Optionally, the steps include: determining the historical messages whose scheduling time is greater than or equal to a preset duration among the multiple historical messages; historical information to locate performance problems. Studies have shown that message scheduling takes a long time, which is often a symptom of performance problems. This setting is convenient for reducing the amount of scheduling information that needs to be viewed, enabling R&D personnel to quickly find the scheduling information that needs to be focused on, and improving positioning efficiency.
本公开实施例提供的性能问题定位方法,通过响应于应用程序出现的性能问题,根据消息调度时序图确定性能问题出现时已经被调度的多个历史消息的调度信息,消息调度时序图用于显示多个历史消息的调度信息;根据性能问题出现时已经被调度的多个历史消息的调度信息,对性能问题进行定位,其实质是,对应用程序运行过程中生成的各消息的调度信息进行记录存储,形成消息调度时序图,当应用程序出现性能问题时,依据消息调度时序图,对发生性能问题之时、之前的消息调度情况进行追溯,将追溯结果作为定位性能问题的关键信息,予以使用,进而确定导致出现性能问题的原因。其可以解决现有技术中,在应用程序出现卡顿、应用无响应、应用程序闪退等性能问题的情况下,很难从操作系统中获取到能够定位该问题的关键信息的问题。In the method for locating performance problems provided by the embodiments of the present disclosure, the scheduling information of multiple historical messages that have been scheduled when the performance problem occurs is determined according to a message scheduling sequence diagram in response to a performance problem occurring in an application, and the message scheduling sequence diagram is used to display Scheduling information of multiple historical messages; locate the performance problem according to the scheduling information of multiple historical messages that have been scheduled when the performance problem occurs. The essence is to record the scheduling information of each message generated during the running of the application. Store and form a message scheduling sequence diagram. When a performance problem occurs in the application program, according to the message scheduling sequence diagram, trace the previous message scheduling situation when the performance problem occurred, and use the traceback result as the key information for locating the performance problem. to determine the cause of the performance issue. It can solve the problem in the prior art that it is difficult to obtain key information capable of locating the problem from the operating system when performance problems such as application program freeze, application unresponsiveness, and application program flashback occur in the prior art.
图8为本公开实施例提供的一种生成消息调度时序图的方法的流程图。图8对应前述内容中“调度信息与消息一对一存储”的情况。图8中各步骤于图2中S110之前执行,即终端检测应用程序是否出现性能问题之前执行。参见图8,该实现记录调度信息的方法包括:FIG. 8 is a flowchart of a method for generating a message scheduling sequence diagram according to an embodiment of the present disclosure. FIG. 8 corresponds to the situation of “one-to-one storage of scheduling information and messages” in the foregoing content. The steps in FIG. 8 are executed before S110 in FIG. 2 , that is, before the terminal detects whether the application program has a performance problem. Referring to FIG. 8 , the method for implementing recording scheduling information includes:
S210、获取应用程序对应的消息队列中待调度的目标消息,目标消息为多个历史消息中的任一历史消息。S210: Acquire a target message to be scheduled in a message queue corresponding to the application, where the target message is any historical message among multiple historical messages.
其中,待调度的目标消息可理解为,用户在对终端应用程序的用户界面进行操作后,终端根据该操作生成的未被调度的消息。该消息可以包括用户指令和/或非用户指令。其中,用户指令和非用户指令可能是相关联的。The target message to be scheduled can be understood as an unscheduled message generated by the terminal according to the operation after the user operates the user interface of the terminal application program. The message may include user instructions and/or non-user instructions. Among them, user instructions and non-user instructions may be associated.
需要说明的是,结合上文内容,本领域技术人员可以理解,在本步骤中,目标消息可能为应用程序出现性能问题之时已调度完毕的消息,也可能为应用程序出现性能问题之时正在调度的消息。但是在实际中,由于在执行本步骤时,应用程序未出现性能问题,实际上无法区分当前目标消息为应用程序出现性能问题之时已调度完毕的消息还是正在调度的消息。It should be noted that, in combination with the above content, those skilled in the art can understand that in this step, the target message may be the message that has been scheduled when the application has a performance problem, or it may be the message that is being dispatched when the application has a performance problem. Scheduled message. However, in practice, since there is no performance problem in the application program when this step is performed, it is actually impossible to distinguish whether the current target message is the message that has been scheduled or the message that is being scheduled when the performance problem occurs in the application program.
S220、在开始调度目标消息时,记录目标消息的调度开始时间。S220. When starting to schedule the target message, record the scheduling start time of the target message.
S230、在结束调度目标消息时,记录目标消息的调度结束时间。S230. When the scheduling of the target message is ended, record the scheduling end time of the target message.
在实际中,在目标消息为应用程序出现性能问题之时正在调度的消息(如目标消息为图7中的消息5)时,由于在该消息调度未完成时,应用程序已出现性能问题。针对这种情况,可选地,可以设置等待目标消息调度结束,记录目标消息调度结束时间。或者,可选地,终端在性能问题出现时,将性能问题出现时刻作为目标消息的调度结束时间。这样设置的原因是,有可能出现终端一旦出现性能问题以后,第二消息调度操作将暂停,没有调度结束时间。In practice, when the target message is the message being scheduled when the application program has performance problems (eg, the target message is message 5 in FIG. 7 ), because the application program has performance problems before the message scheduling is completed. In view of this situation, optionally, it may be set to wait for the end of the target message scheduling, and record the end time of the target message scheduling. Or, optionally, when the performance problem occurs, the terminal takes the time when the performance problem occurs as the scheduling end time of the target message. The reason for this setting is that once the terminal has a performance problem, the second message scheduling operation will be suspended, and there is no scheduling end time.
S240、根据目标消息的调度开始时间和目标消息的调度结束时间,确定目标消息的调度耗时。S240. Determine the scheduling time of the target message according to the scheduling start time of the target message and the scheduling end time of the target message.
可选地,将目标消息的调度结束时间与目标消息的调度开始时间作差,将差值作为目标消息的调度耗时。Optionally, a difference is made between the scheduling end time of the target message and the scheduling start time of the target message, and the difference is used as the scheduling time of the target message.
S250、记录目标消息的调度信息,调度信息包括调度开始时间、调度结束时间和调度耗时中的至少一种。S250. Record scheduling information of the target message, where the scheduling information includes at least one of a scheduling start time, a scheduling end time, and a scheduling time-consuming.
S260、根据目标消息的调度信息,生成消息调度时序图。S260. Generate a message scheduling sequence diagram according to the scheduling information of the target message.
这样设置的实质是,针对每一个目标消息,均生成与之对应的调度信息,目标消息与调度信息一对一存储,这样可以确保各目标消息对应的调度信息完整、无遗漏,且均可查。The essence of this setting is that for each target message, the corresponding scheduling information is generated, and the target message and the scheduling information are stored one-to-one, which can ensure that the scheduling information corresponding to each target message is complete, without omission, and can be checked. .
图9为本公开实施例提供的另一种生成消息调度时序图的方法的流程图。图9对应前述内容中“调度信息与消息一对多存储”的情况。FIG. 9 is a flowchart of another method for generating a message scheduling sequence diagram according to an embodiment of the present disclosure. FIG. 9 corresponds to the situation of “one-to-many storage of scheduling information and messages” in the foregoing content.
实现“调度信息与消息一对多存储”的整体发明构思是,将调度耗时很短的多个消息进行合并,统计多个调度耗时很短的消息的总耗时。在这种情况下,一个调度信息可以仅包括部分消息的标识信息,总耗时以及被合并的消息的个数。The overall inventive concept of realizing "one-to-many storage of scheduling information and messages" is to combine multiple messages whose scheduling time is very short, and count the total time-consuming of multiple messages whose scheduling time is very short. In this case, a piece of scheduling information may only include the identification information of part of the messages, the total time spent, and the number of messages to be merged.
实现“调度信息与消息一对多存储”的方法有多种,例如,可以预先设置参考耗时;在调度第N个目标消息时,记录第N个目标消息的调度开始时间和调度结束时间;根据第N个目标消息的调度开始时间和调度结束时间,确定第N个目 标消息的调度耗时,若第N个目标消息的调度耗时大于参考耗时,对第N个目标消息的调度信息进行单独记录。若第N个目标消息的调度耗时小于或等于参考耗时,调度第N+1个目标消息,确定第N+1个目标消息的调度耗时。若第N+1个目标消息的调度耗时大于参考耗时,对第N个目标消息的调度信息和第N+1个目标消息的调度信息分别进行单独记录。若第N+1个目标消息的调度耗时小于或等于参考耗时,调度第N+2个目标消息,……,直至第N+n个目标消息的调度耗时大于参考耗时,将第N个目标消息,至第N+n-1个目标消息的调度信息合并记录。示例性地,若将第N个目标消息至第N+n-1个目标消息的调度信息合并记录,此时调度信息包括第N个目标消息的调度开始时间、第N+n-1个目标消息的调度结束时间,从调度第N个目标消息的调度开始至第N+n-1个目标消息的调度结束的总调度耗时,以及第N个目标消息至第N+n-1个目标消息中部分几个的目标消息的标识信息。There are many ways to achieve "one-to-many storage of scheduling information and messages". For example, the reference time can be preset; when scheduling the Nth target message, record the scheduling start time and scheduling end time of the Nth target message; According to the scheduling start time and scheduling end time of the Nth target message, determine the scheduling time of the Nth target message. If the scheduling time of the Nth target message is greater than the reference time, the scheduling information of the Nth target message Make separate records. If the scheduling time of the N-th target message is less than or equal to the reference time-consuming, schedule the N+1-th target message, and determine the scheduling time of the N+1-th target message. If the scheduling time of the N+1 th target message is greater than the reference time, the scheduling information of the N th target message and the scheduling information of the N+1 th target message are separately recorded. If the scheduling time of the N+1-th target message is less than or equal to the reference time-consuming, schedule the N+2-th target message, ... until the scheduling time of the N+n-th target message is greater than the reference time-consuming, the For N target messages, the scheduling information of the N+n-1th target message is merged and recorded. Exemplarily, if the scheduling information of the Nth target message to the N+n-1th target message is combined and recorded, the scheduling information at this time includes the scheduling start time of the Nth target message, the N+n-1th target message. The scheduling end time of the message, the total scheduling time from the scheduling of the Nth target message to the end of the N+n-1th target message, and the Nth target message to the N+n-1th target The identification information of the target message of several parts in the message.
图9为实现“调度信息与消息一对多存储”的另一种方法。该方法需要借助计数器完成。为此,可选地,设置利用子线程控制计数器以设定时间间隔进行更新,主线程仅在对目标消息进行调度的开始时刻和结束时刻分别读计数器读数。Fig. 9 is another method for realizing "one-to-many storage of scheduling information and messages". This method needs to be done with the help of a counter. To this end, optionally, it is set that the sub-thread is used to control the counter to be updated at a set time interval, and the main thread only reads the counter readings respectively at the start time and the end time of scheduling the target message.
可选地,利用SetTimeout对子线程设置休眠时间,并且使得子线程的休眠时间等于计数器相邻两次更新的时间间隔。示例性地,若希望计数器每隔30s更新一次,则设置子线程的休眠时间为30s。当子线程处于休眠状态时,不进行计数器更新,若子线程休眠结束,子线程被唤醒后立即利用Update Tick更新计数器。子线程更新计数器之后,再次进入休眠状态。Optionally, SetTimeout is used to set the sleep time of the child thread, and make the sleep time of the child thread equal to the time interval between two consecutive updates of the counter. Exemplarily, if the counter is expected to be updated every 30s, the sleep time of the child thread is set to 30s. When the sub-thread is in the dormant state, the counter is not updated. If the sub-thread is dormant, the sub-thread will use Update Tick to update the counter immediately after the sub-thread is woken up. After the child thread updates the counter, it goes to sleep again.
进一步地,可以利用Timeout Verify修正子线程的休眠时间。示例性地,若按照预先设置,子线程的休眠时间为5分钟。子线程应当于10:00和10:05分别被唤醒并更新计数器。但在实际中,因为某些原因,可能出现子线程于10:01才被唤醒,显然,这会使得计数器更新时间后延。为此,可选地,在子线程于10:01才被唤醒后将子线程的休眠时间进行修正,以使其变为4分钟。这样可以确保在10:05,子线程能够被唤醒。这样设置可以确保后续所记录的调度信息的准确性。Further, Timeout Verify can be used to correct the sleep time of the child thread. Exemplarily, if preset, the sleep time of the child thread is 5 minutes. The child thread should wake up at 10:00 and 10:05 respectively and update the counter. But in practice, for some reasons, the child thread may be woken up at 10:01. Obviously, this will delay the update time of the counter. To this end, optionally, after the child thread is woken up at 10:01, the sleep time of the child thread is modified so that it becomes 4 minutes. This ensures that at 10:05, the child thread can be woken up. This setting can ensure the accuracy of the scheduling information recorded subsequently.
由于主线程仅在对目标消息进行调度的开始时刻和结束时刻读取计数器读数。为此,设置监控期的概念。监控期具体指,主线程读取到计数器连续两次发生更新的时间段。Since the main thread only reads the counter readings at the start and end moments of scheduling the target message. For this, the concept of monitoring period is set up. The monitoring period specifically refers to the time period during which the main thread reads and updates the counter for two consecutive times.
这里需要说明的是,在本公开中,监控期不一定等于计数器实际相邻两次更新的时间间隔。示例性地,图10为本公开实施例提供的一种计数器更新的示意图。 参见图10,计数器共更新4次,由于主线程仅在对目标消息进行调度的开始时刻和结束时刻读计数器信息,因此“计数器读数为0”这一信息是主线程在消息1调度的开始时刻读取到的。“计数器读数为1”这一信息是主线程在消息1调度的结束时刻读取到的。因此将消息1调度的开始时刻至结束时刻之间的时间段作为监控期J1。“计数器读数为2”这一信息,主线程并未读取到。“计数器读数为3”这一信息是主线程在消息2调度的开始时刻读取到的。因此将消息1调度的结束时刻至消息2调度的开始时刻之间的时间段,作为监控期J2。在图10中,监控期J1小于相邻两次更新的时间间隔T 0。监控期J2大于相邻两次更新的时间间隔T 0It should be noted here that, in the present disclosure, the monitoring period is not necessarily equal to the time interval between two actual updates of the counter. Exemplarily, FIG. 10 is a schematic diagram of a counter update provided by an embodiment of the present disclosure. Referring to Figure 10, the counter is updated 4 times in total. Since the main thread only reads the counter information at the start time and end time of scheduling the target message, the information "counter reading is 0" is the start time of the main thread's scheduling of message 1 read. The information "counter reading is 1" is read by the main thread at the end of message 1 scheduling. Therefore, the time period between the start time and the end time of the message 1 scheduling is taken as the monitoring period J1. The message "counter reads 2" is not read by the main thread. The information "counter reading is 3" is read by the main thread at the beginning of message 2 scheduling. Therefore, the time period between the end time of message 1 scheduling and the start time of message 2 scheduling is taken as the monitoring period J2. In FIG. 10 , the monitoring period J1 is smaller than the time interval T 0 between two adjacent updates. The monitoring period J2 is greater than the time interval T 0 between two adjacent updates.
图9中各步骤于图2中S110之前执行,即在终端检测应用程序是否出现性能问题之前执行。参见图9,该消息调度时序图生成方法包括:The steps in FIG. 9 are executed before S110 in FIG. 2 , that is, before the terminal detects whether the application program has a performance problem. Referring to FIG. 9, the method for generating a message scheduling sequence diagram includes:
S310、获取应用程序对应的消息队列中待调度的目标消息,目标消息为多个历史消息中的任一历史消息。S310: Acquire a target message to be scheduled in a message queue corresponding to the application, where the target message is any historical message among multiple historical messages.
S320、在开始调度目标消息时,记录开始调度之前的第一监控期内已经被调度的多个历史消息的调度信息,第一监控期内已经被调度的多个历史消息是目标消息之前的消息。S320. When starting to schedule the target message, record the scheduling information of the multiple historical messages that have been scheduled in the first monitoring period before starting the scheduling, and the multiple historical messages that have been scheduled in the first monitoring period are the messages before the target message .
其中,第一监控期对应于从终端开始调度目标消息时检测到计数器发生更新到终端上一次检测到计数器发生更新之间的时间段。图11-图12为本公开实施例提供的另外两种计数器更新的示意图。在实际中,第一监控期主要对应两种情况:情况一,参见图11,目标消息为消息5,第一监控期为从一个历史消息调度的开始时刻到目标消息调度的开始时刻之间的时间段;情况二,参见图12,从一个历史消息调度的结束时刻到目标消息调度的开始时刻之间的时间段。无论是这两种情况的哪一种,“第一监控期内已经被调度的多个历史消息”均是指在第一监控期内完成调度的整个过程的历史消息。示例性地,在图11和图12中,消息2、消息3和消息4均为第一监控期内已经被调度的多个历史消息。根据本步骤,需要对消息2、消息3和消息4的调度信息进行记录。The first monitoring period corresponds to a time period from when the terminal starts to schedule the target message and detects that the counter is updated to the last time that the terminal detects that the counter is updated. 11-12 are schematic diagrams of other two types of counter updates provided by the embodiments of the present disclosure. In practice, the first monitoring period mainly corresponds to two situations: Case 1, referring to Figure 11, the target message is message 5, and the first monitoring period is from the start time of a historical message scheduling to the start time of the target message scheduling Time period; Case 2, see FIG. 12 , the time period from the end moment of a historical message scheduling to the start moment of the target message scheduling. No matter which of the two cases, "a plurality of historical messages that have been scheduled during the first monitoring period" refers to the historical messages of the entire scheduling process during the first monitoring period. Exemplarily, in FIG. 11 and FIG. 12 , message 2, message 3 and message 4 are all multiple historical messages that have been scheduled within the first monitoring period. According to this step, the scheduling information of message 2, message 3 and message 4 needs to be recorded.
S330、在结束调度目标消息时,记录结束调度之前的第二监控期内已经被调度的多个历史消息的调度信息,第二监控期内已经被调度的多个历史消息包括目标消息。S330. When ending the scheduling of the target message, record the scheduling information of the multiple historical messages that have been scheduled within the second monitoring period before ending the scheduling, and the multiple historical messages that have been scheduled within the second monitoring period include the target message.
其中,第二监控期对应于从终端结束调度目标消息时检测到计数器发生更新到终端上一次检测到计数器发生更新之间的时间段。图13-图14为本公开实施例提供的另外两种计数器更新的示意图。在实际中,第二监控期主要对应两种情况: 情况一,参见图13,从一个历史消息调度的开始时刻到目标消息调度的结束时刻之间的时间段;情况二,参见图14,从一个历史消息调度的结束时刻到目标消息调度的结束时刻之间的时间段。无论是这两种情况的哪一种,“第二监控期内已经被调度的历史消息”均是指在第二监控期内完成调度的整个过程的历史消息。示例性地,在图13和图14中,消息2、消息3、消息4和消息5均为第二监控期内已经被调度的历史消息。由于在图13和图14中,目标消息为消息5,显然第二监控期内已经被调度的多个历史消息包括目标消息。根据本步骤,需要对消息2、消息3、消息4和消息5的调度信息进行记录。The second monitoring period corresponds to a time period from when the terminal finishes scheduling the target message and detects that the counter is updated to the last time that the terminal detects that the counter is updated. FIGS. 13-14 are schematic diagrams of other two types of counter updates provided by embodiments of the present disclosure. In practice, the second monitoring period mainly corresponds to two cases: Case 1, see Figure 13, the time period from the start time of a historical message scheduling to the end time of the target message scheduling; Case 2, see Figure 14, from The time period between the end time of a historical message schedule and the end time of the target message schedule. No matter which of the two cases, "historical messages that have been scheduled during the second monitoring period" refer to the historical messages that complete the entire process of scheduling within the second monitoring period. Exemplarily, in FIG. 13 and FIG. 14 , message 2, message 3, message 4 and message 5 are all historical messages that have been scheduled within the second monitoring period. Since in FIG. 13 and FIG. 14 , the target message is message 5, it is obvious that the multiple historical messages that have been scheduled in the second monitoring period include the target message. According to this step, the scheduling information of message 2, message 3, message 4 and message 5 needs to be recorded.
S340、根据目标消息的调度信息,生成消息调度时序图。S340. Generate a message scheduling sequence diagram according to the scheduling information of the target message.
这样设置的实质是,根据监控期的特征,对监控期进行分类(分为第一监控期和第二监控期)并针对不同监控期,采用不同的策略,进行多条历史消息的调度信息合并记录。其可以提高统计效率、存储效率、降低存储空间占用率、缩减从存储空间中再去读写的运算量,甚至降低因大量的内存申请和释放而造成内存抖动,引发性能问题的出现几率。The essence of this setting is to classify the monitoring period (divided into the first monitoring period and the second monitoring period) according to the characteristics of the monitoring period, and adopt different strategies for different monitoring periods to merge the scheduling information of multiple historical messages Record. It can improve statistical efficiency, storage efficiency, reduce storage space occupancy, reduce the amount of operations to read and write from storage space, and even reduce the chance of performance problems caused by memory jitter caused by a large number of memory applications and releases.
需要说明的是,在上述技术方案中,S320和S330之间是和/或的关系。It should be noted that, in the above technical solution, the relationship between S320 and S330 is and/or.
在上述技术方案中,S320的具体实现方法有多种,本公开对此不作限制。图15为本公开实施例提供的一种用于实现S320的方法的流程图。参见图15,用于实现S320的方法可以为:In the above technical solutions, there are various specific implementation methods of S320, which are not limited in the present disclosure. FIG. 15 is a flowchart of a method for implementing S320 according to an embodiment of the present disclosure. Referring to Fig. 15, the method for implementing S320 may be:
S321、在开始调度目标消息时,检测计数器是否发生更新;若否,执行S322;若是,执行S323。S321. When starting to schedule the target message, check whether the counter is updated; if not, execute S322; if yes, execute S323.
S322、对目标消息进行调度处理。S322. Perform scheduling processing on the target message.
S323、记录开始调度之前的第一监控期内已经被调度的多个历史消息的调度信息;其中,第一监控期对应于从开始调度目标消息时检测到计数器发生更新到上一次检测到计数器发生更新之间;多个历史消息的调度信息包括多个历史消息的总个数和多个历史消息总的调度耗时。S323. Record the scheduling information of multiple historical messages that have been scheduled within the first monitoring period before starting scheduling; wherein, the first monitoring period corresponds to the time from when the target message is scheduled to be updated when the counter is detected to be updated to the last time when the counter is detected. Between updates; the scheduling information of the multiple historical messages includes the total number of the multiple historical messages and the total scheduling time of the multiple historical messages.
本步骤的具体实现方法有多种,示例性地,当确定第一监控期内计数器的更新次数小于或等于2次时,记录第一监控期内已经被调度的多个历史消息的调度信息;当确定第一监控期内计数器的更新次数大于2次时,记录第一监控期内已经被调度的多个历史消息的调度信息、以及记录第一监控期内系统的休眠时间。There are various specific implementation methods for this step. Exemplarily, when it is determined that the number of updates of the counter in the first monitoring period is less than or equal to 2, the scheduling information of multiple historical messages that have been scheduled in the first monitoring period is recorded; When it is determined that the counter is updated more than twice during the first monitoring period, the scheduling information of multiple historical messages that have been scheduled within the first monitoring period is recorded, and the sleep time of the system during the first monitoring period is recorded.
典型地,参见图11或图12,假设目标消息为消息4,在终端在开始调度信息4时,检测相对于消息3调度结束时刻,计数器是否发生更新。由于相对于消息3 调度结束时刻,计数器未发生更新,主线程对消息4进行调度处理。Typically, referring to FIG. 11 or FIG. 12 , assuming that the target message is message 4, when the terminal starts scheduling information 4, it detects whether the counter is updated relative to the time at which the scheduling of message 3 ends. Since the counter has not been updated relative to the scheduling end time of message 3, the main thread schedules message 4.
继续参见图11或图12,假设目标消息为消息5,在终端在开始调度信息5,检测相对于消息4调度结束时刻,计数器是否发生更新。由于相对于消息4调度结束时刻,计数器发生更新,则确定本次第一监控期结束。终端记录本次第一监控期内已经被调度的所有历史消息(即消息2、消息3和消息4)的调度信息。Continue to refer to FIG. 11 or FIG. 12 , assuming that the target message is message 5, when the terminal starts scheduling information 5, it detects whether the counter is updated relative to the time at which the scheduling of message 4 ends. Since the counter is updated relative to the scheduling end time of message 4, it is determined that the first monitoring period ends this time. The terminal records the scheduling information of all historical messages (ie, message 2, message 3, and message 4) that have been scheduled within the first monitoring period of this time.
在执行“记录本次第一监控期内已经被调度的所有历史消息(即图11和图12中的消息2、消息3和消息4)的调度信息”时,可以进一步判断相对于第一监控期开始时刻(即图11中消息2调度开始时刻,或图12中消息1调度结束时刻),第一监控期结束时刻(即图11或图12消息5调度开始时刻)计数器的更新次数是否大于2次。具体判断的方法可以为,利用第一监控期结束时刻计数器的读数减去第一监控期开始时刻计数器的读数,判断其差值是否大于2,若大于2,说明计数器的更新次数大于2次,否则计数器的更新次数小于等于2次。When "recording the scheduling information of all historical messages that have been scheduled during the first monitoring period (ie, message 2, message 3, and message 4 in Fig. 11 and Fig. 12 )" is executed, it can be further judged that relative to the first monitoring period Whether the number of updates of the counter at the end of the first monitoring period (that is, the start time of message 5 scheduling in Figure 11 or Figure 12) is greater than 2 times. The specific judgment method can be as follows: using the reading of the counter at the end of the first monitoring period to subtract the reading of the counter at the beginning of the first monitoring period, to judge whether the difference is greater than 2, if it is greater than 2, it means that the number of updates of the counter is greater than 2, Otherwise, the counter is updated less than or equal to 2 times.
继续参见图11或图12,由于主线程在消息2的调度结束时刻、消息3的调度开始时刻、消息3的调度结束时刻,消息4的调度开始时刻、消息4的调度结束时刻均读取过计数器的读数,均未发现计数器更新。所以若在消息5的调度开始时刻发现计数器更新,说明计数器是在消息4的调度结束时刻至消息5的调度开始时刻之间的时间段内进行的更新。且消息2、消息3和消息4的调度耗时之和小于相邻两次更新的时间间隔T 0Continue to refer to Figure 11 or Figure 12, since the main thread has read the scheduling start time of message 2, the scheduling start time of message 3, the scheduling end time of message 3, the scheduling start time of message 4, and the scheduling end time of message 4 Counter readings, no counter updates were found. Therefore, if it is found that the counter is updated at the scheduling start time of message 5, it means that the counter is updated in the time period between the scheduling end time of message 4 and the scheduling start time of message 5. And the sum of the scheduling time of message 2, message 3 and message 4 is less than the time interval T 0 between two adjacent updates.
在此基础上,继续参见图11,若主线程在消息5的调度开始时刻读取过计数器的读数,且发现计数器的更新次数为1次,满足计数器的更新次数小于或等于2次的条件,此种情况下,认为从消息4的调度结束时刻起至消息5的调度开始时刻止的这段时间内系统不存在休眠的情况。此种情况下,可选地,仅将消息2、消息3和消息4的调度信息进行合并记录。On this basis, continue to refer to Figure 11, if the main thread has read the reading of the counter at the beginning of the scheduling of message 5, and finds that the number of updates of the counter is 1, and the condition that the number of updates of the counter is less than or equal to 2 is satisfied, In this case, it is considered that the system does not sleep during the period from the scheduling end time of message 4 to the scheduling start time of message 5 . In this case, optionally, only the scheduling information of message 2, message 3 and message 4 is combined and recorded.
继续参见图12,若主线程在消息5的调度开始时刻读取过计数器的读数,且发现计数器的更新次数为3次,满足计数器的更新次数大于2次的条件,则从消息4的调度结束时刻至消息5的调度开始时刻的时间长度大于2T 0。这说明,在该段时间内,存在系统休眠的情况。此种情况下,可选地,将消息2、消息3和消息4的调度信息进行合并记录,并且对第一监控期内系统的休眠时间进行记录。 Continue to refer to Figure 12, if the main thread has read the reading of the counter at the beginning of the scheduling of message 5, and finds that the number of updates of the counter is 3 times, and the condition that the number of updates of the counter is greater than 2 times is satisfied, then the scheduling of message 4 ends. The time length from the moment to the scheduling start moment of the message 5 is greater than 2T 0 . This shows that, during this period of time, there is a situation in which the system sleeps. In this case, optionally, the scheduling information of message 2, message 3 and message 4 is combined and recorded, and the sleep time of the system in the first monitoring period is recorded.
上述方案可以将系统的休眠时间抓取出来,可以避免因系统休眠导致各消息的调度信息记录不准确,进而导致后续性能问题定位不准确的情况出现。The above solution can capture the sleep time of the system, which can avoid inaccurate recording of scheduling information of each message due to system sleep, thereby leading to inaccurate positioning of subsequent performance problems.
类似地,在上述技术方案中,S330的具体实现方法有多种,本公开对此不作限制。图16为本公开实施例提供的一种用于实现S330的方法的流程图。参见图16,用于实现S330的方法可以为:Similarly, in the above technical solution, there are various specific implementation methods of S330, which are not limited in the present disclosure. FIG. 16 is a flowchart of a method for implementing S330 according to an embodiment of the present disclosure. Referring to FIG. 16, the method for implementing S330 may be:
S3311、在结束调度目标消息时,检测计数器是否发生更新;若否,执行S3312;若是,执行S3313。S3311. When the scheduling target message ends, check whether the counter is updated; if not, execute S3312; if yes, execute S3313.
S3312、从消息队列中获取目标消息的下一个消息。S3312. Obtain the next message of the target message from the message queue.
S3313、记录结束调度之前的第二监控期内已经被调度的多个历史消息的调度信息;其中,第二监控期对应于从结束调度目标消息时检测到计数器发生更新到上一次检测到计数器发生更新之间;多个历史消息的调度信息包括多个历史消息的总个数和多个历史消息总的调度耗时。S3313. Record the scheduling information of the multiple historical messages that have been scheduled within the second monitoring period before ending the scheduling; wherein, the second monitoring period corresponds to the time from the detection of the occurrence of the counter at the end of the scheduling target message to the detection of the occurrence of the counter last time Between updates; the scheduling information of the multiple historical messages includes the total number of the multiple historical messages and the total scheduling time of the multiple historical messages.
本步骤的具体实现方法有多种,示例性地,当确定第二监控期内计数器的更新次数小于或等于2次时,记录第二监控期内已经被调度的多个历史消息的调度信息;当确定第二监控期内计数器的更新次数大于2次时,记录目标消息的调度信息、以及记录第二监控期内除目标消息之外的已经被调度的历史消息的调度信息。There are various specific implementation methods for this step. Exemplarily, when it is determined that the number of updates of the counter in the second monitoring period is less than or equal to 2, the scheduling information of multiple historical messages that have been scheduled in the second monitoring period is recorded; When it is determined that the counter is updated more than 2 times in the second monitoring period, the scheduling information of the target message and the scheduling information of the historical messages other than the target message that have been scheduled in the second monitoring period are recorded.
典型地,参见图13或图14,假设目标消息为消息4,在结束调度信息4时,检测相对于消息4调度开始时刻,计数器是否发生更新。由于相对于消息4调度开始时刻,计数器未发生更新,主线程从消息队列中获取目标消息的下一个消息(即消息5)。Typically, referring to FIG. 13 or FIG. 14 , assuming that the target message is message 4, when scheduling information 4 is ended, it is detected whether the counter is updated relative to the scheduling start time of message 4. Since the counter is not updated relative to the scheduling start time of message 4, the main thread obtains the next message (ie, message 5) of the target message from the message queue.
继续参见图13或图14,假设目标消息为消息5,在结束调度信息5时,检测相对于消息5调度开始时刻,计数器是否发生更新。由于相对于消息5调度开始时刻,计数器发生更新,则确定本次第二监控期结束。终端记录本次第二监控期内已经被调度的所有历史消息(即消息2、消息3、消息4和消息5)的调度信息。Continuing to refer to FIG. 13 or FIG. 14 , assuming that the target message is message 5, when scheduling information 5 is ended, it is detected whether the counter is updated relative to the scheduling start time of message 5. Since the counter is updated relative to the scheduling start time of message 5, it is determined that the second monitoring period ends this time. The terminal records the scheduling information of all historical messages (ie, message 2, message 3, message 4, and message 5) that have been scheduled within the second monitoring period.
具体地,在执行“记录本次第二监控期内已经被调度的所有历史消息(即图13和图14中的消息2、消息3、消息4和消息5)的调度信息”时,可以进一步判断相对于第二监控期开始时刻(即图13中消息2调度开始时刻,或图14中消息1调度结束时刻),第二监控期结束时刻(即图13或图14消息5调度结束时刻)计数器的更新次数是否大于2次。具体判断的方法可以为,利用第二监控期结束时刻计数器的读数减去第二监控期开始时刻计数器的读数,判断其差值是否大于2,若大于2,说明计数器的更新次数大于2次,否则计数器的更新次数小于等于2次。Specifically, when "recording the scheduling information of all historical messages that have been scheduled in this second monitoring period (ie, message 2, message 3, message 4, and message 5 in Fig. 13 and Fig. 14 )", we can further Judgment is relative to the start time of the second monitoring period (that is, the start time of message 2 scheduling in Figure 13, or the end time of message 1 scheduling in Figure 14), the end time of the second monitoring period (that is, the end time of message 5 scheduling in Figure 13 or Figure 14) Whether the counter is updated more than 2 times. The specific judgment method may be as follows: using the reading of the counter at the end of the second monitoring period to subtract the reading of the counter at the beginning of the second monitoring period to determine whether the difference is greater than 2, if it is greater than 2, it means that the number of updates of the counter is greater than 2. Otherwise, the counter is updated less than or equal to 2 times.
继续参见图13或图14,由于主线程在消息2的调度结束时刻、消息3的调度开始时刻、消息3的调度结束时刻,消息4的调度开始时刻、消息4的调度结束时刻、消息5的调度开始时刻均读取过计数器的读数,均未发现计数器更新。所以若在消息5的调度结束时刻发现计数器更新,说明计数器是在消息5的调度开始时刻至消息5的调度结束时刻之间的时间段内进行的更新。且消息2、消息3和消息4的调度耗时之和均小于相邻两次更新的时间间隔T 0Continue to refer to FIG. 13 or FIG. 14, since the main thread is at the scheduling end time of message 2, the scheduling start time of message 3, and the scheduling end time of message 3, the scheduling start time of message 4, the scheduling end time of message 4, and the scheduling end time of message 5 The readings of the counters have been read at the beginning of the scheduling, and no counter updates have been found. Therefore, if the counter is found to be updated at the scheduling end time of message 5, it means that the counter is updated in the time period between the scheduling start time of message 5 and the scheduling end time of message 5. And the sum of the scheduling time of message 2, message 3 and message 4 is smaller than the time interval T 0 between two adjacent updates.
在此基础上,继续参见图13,若主线程在消息5的调度结束时刻读取过计数器的读数,且发现计数器的更新次数为1次,满足计数器的更新次数小于或等于2次的条件,此种情况下,认为从消息5的调度耗时不长。可选地,仅将消息2、消息3、消息4和消息5的调度信息进行合并记录。On this basis, continue to refer to Figure 13, if the main thread has read the reading of the counter at the end of the scheduling of message 5, and finds that the number of updates of the counter is 1, which satisfies the condition that the number of updates of the counter is less than or equal to 2, In this case, it is considered that the scheduling from message 5 does not take long. Optionally, only the scheduling information of message 2, message 3, message 4, and message 5 is combined and recorded.
继续参见图14,若主线程在消息5的调度结束时刻读取过计数器的读数,且发现计数器的更新次数为3次,满足计数器的更新次数大于2次的条件,则消息5的调度耗时大于2T 0。此种情况下,可选地,将消息2、消息3和消息4的调度信息进行合并记录,且将消息4的调度信息单独记录。 Continue to refer to Figure 14, if the main thread has read the reading of the counter at the end of the scheduling of message 5, and finds that the number of updates of the counter is 3 times, which satisfies the condition that the number of updates of the counter is greater than 2, then the scheduling of message 5 takes time. greater than 2T 0 . In this case, optionally, the scheduling information of message 2, message 3, and message 4 is combined and recorded, and the scheduling information of message 4 is recorded separately.
由于在实际中,性能问题往往是调度耗时长的消息出现问题引起的。上述方案可以将调度耗时长的消息抓取出来,对其的调度信息进行单独记录,可以确保后续对性能问题进行定位时,调度耗时长的消息的调度信息能够被凸显出来,缩短定位时间。In practice, performance problems are often caused by problems in scheduling messages that take a long time. The above solution can capture messages that take a long time to schedule, and record their scheduling information separately, which can ensure that when locating performance problems later, the scheduling information of messages that take a long time to schedule can be highlighted and the location time can be shortened.
图17为本公开实施例提供的另一种用于实现S330的方法的流程图。图17为图16中的一个具体示例。参见图17,用于实现S330的方法可以为:FIG. 17 is a flowchart of another method for implementing S330 according to an embodiment of the present disclosure. FIG. 17 is a specific example of FIG. 16 . Referring to Figure 17, the method for implementing S330 may be:
S3321、在结束调度目标消息时,检测目标消息的消息类型是否为预设类型;若是,执行S3322;若否,执行S3323。S3321. When the target message is scheduled to end, check whether the message type of the target message is a preset type; if so, execute S3322; if not, execute S3323.
S3322、记录目标消息的调度信息。S3322. Record the scheduling information of the target message.
此处,预设类型包括下述中的至少一种:Activity、Service、Receiver以及Provider。其中,Activity,用来展示UI和用户交互的界面,如打开应用程序显示的各个界面。Service,用来满足和支持后台工作的一种组件,如后台播放音乐。Receiver:用来监听系统行为变化的一种组件,如手机亮灭屏,网络切换等状态变化。Provider:用来向应用内部或其他应用提供数据管理的组件,如通讯录管理等。Here, the preset type includes at least one of the following: Activity, Service, Receiver, and Provider. Among them, Activity is used to display the UI and user interaction interface, such as opening the various interfaces displayed by the application. Service, a component used to satisfy and support background work, such as playing music in the background. Receiver: A component used to monitor system behavior changes, such as mobile phone on and off screen, network switching and other state changes. Provider: A component used to provide data management within an application or other applications, such as address book management.
本步骤的实质是对特殊类型的目标消息的调度信息进行单独记录。在实际中,不同类型的目标消息导致应用程序出现性能问题的几率不同。研究表明,存在某 些特殊类型的目标消息,其导致应用程序出现性能问题的几率极高。通过设置对特殊类型的目标消息的调度信息进行单独记录。可以确保后续对性能问题进行定位时,特殊类型的目标消息的调度信息能够被凸显出来,缩短定位时间。The essence of this step is to record the scheduling information of a special type of target message separately. In practice, different types of target messages have different chances of causing performance problems in an application. Research has shown that there are certain special types of targeted messages that have a high chance of causing performance problems in applications. The scheduling information for special types of target messages is recorded separately by setting. This can ensure that the scheduling information of special types of target messages can be highlighted when locating performance problems later, shortening the locating time.
S3323、检测计数器是否发生更新,若否,执行S3324;若是,执行S3325。S3323: Detect whether the counter is updated, if not, execute S3324; if yes, execute S3325.
S3324、从消息队列中获取目标消息的下一个消息。S3324. Obtain the next message of the target message from the message queue.
S3325、记录结束调度之前的第二监控期内已经被调度的多个历史消息的调度信息;其中,第二监控期对应于从结束调度目标消息时检测到计数器发生更新到上一次检测到计数器发生更新之间;多个历史消息的调度信息包括多个历史消息的总个数和多个历史消息总的调度耗时。S3325. Record the scheduling information of the multiple historical messages that have been scheduled in the second monitoring period before ending the scheduling; wherein, the second monitoring period corresponds to the time from the time when the scheduling target message is ended that the counter is updated to the last time that the counter is detected. Between updates; the scheduling information of the multiple historical messages includes the total number of the multiple historical messages and the total scheduling time of the multiple historical messages.
上述技术方案的实质是在终端在结束调度目标消息时,先检测目标消息是否为特殊类型的目标消息。若是,对特殊类型的目标消息的调度信息进行单独记录。在实际中,不同类型的目标消息导致应用程序出现性能问题的几率不同。研究表明,存在某些特殊类型的目标消息,其导致应用程序出现性能问题的几率极高。通过设置对特殊类型的目标消息的调度信息进行单独记录。可以确保后续对性能问题进行定位时,特殊类型的目标消息的调度信息能够被凸显出来,缩短定位时间。The essence of the above technical solution is that when the terminal finishes scheduling the target message, it firstly detects whether the target message is a special type of target message. If so, the scheduling information of the special type of target message is recorded separately. In practice, different types of target messages have different chances of causing performance problems in an application. Research has shown that there are certain types of targeted messages that have a very high chance of causing performance problems in applications. The scheduling information for special types of target messages is recorded separately by setting. This can ensure that the scheduling information of special types of target messages can be highlighted when locating performance problems later, shortening the locating time.
需要强调的是,在上述借助计数器完成调度信息与消息一对多存储的各方法在执行的过程中,可以完全不读取CPU时间和/或墙上时间(WALL),此时,其本质是将第一信息的调度耗时和相邻两次更新的时间间隔T 0进行比较,基于比较结果,确定各调度信息中的调度耗时。 It should be emphasized that, during the execution of the above-mentioned methods for completing the one-to-many storage of scheduling information and messages by means of a counter, the CPU time and/or the wall time (WALL) may not be read at all. At this time, the essence is The scheduling time of the first information is compared with the time interval T 0 between two adjacent updates, and based on the comparison result, the scheduling time in each scheduling information is determined.
可选地,还可以设置在上述借助计数器完成调度信息与消息一对多存储的各方法在执行的过程中,在每次检测到计数器更新后,读取CPU时间和/或墙上时间(WALL),并基于读取到的CPU时间和/或墙上时间(WALL)以及相邻两次更新的时间间隔T 0,共同确定各调度信息中的调度耗时。这样设置调度信息中的调度耗时确定较为准确,有助于后续能够准确地对性能问题进行定位。 Optionally, it can also be set in the process of executing the above-mentioned methods for completing the one-to-many storage of scheduling information and messages by means of a counter, after each detection of an update of the counter, reading the CPU time and/or the wall time (WALL time). ), and based on the read CPU time and/or wall time (WALL) and the time interval T 0 between two adjacent updates, jointly determine the scheduling time in each scheduling information. In this way, the scheduling time-consuming determination in the scheduling information is more accurate, which is helpful for accurately locating the performance problem in the future.
图18为本公开实施例中的另一种性能问题定位方法的流程图。图19和图20为采用图18提供的方法所形成的一种调度信息展示效果图。参见图18-图20,本实施例在上述实施例的基础上,方法还包括:FIG. 18 is a flowchart of another method for locating a performance problem in an embodiment of the present disclosure. FIG. 19 and FIG. 20 are effect diagrams for displaying scheduling information formed by using the method provided in FIG. 18 . Referring to FIG. 18 to FIG. 20 , on the basis of the above-mentioned embodiment, the method further includes:
S510、显示消息调度时序图,消息调度时序图包括多个第一标识和第二标识,第一标识用于标识性能问题出现时已被调度完成的多个历史消息的调度信息,第 二标识用于标识性能问题出现时正在调度的历史消息的调度信息。S510. Display a message scheduling sequence diagram, where the message scheduling sequence diagram includes multiple first identifiers and second identifiers, the first identifier is used to identify scheduling information of multiple historical messages that have been scheduled when the performance problem occurs, and the second identifier is used for Scheduling information to identify historical messages that were being scheduled when performance issues occurred.
S520、根据用户对第一标识的第一操作,显示第一标识对应的历史消息的调度信息。S520. Display scheduling information of historical messages corresponding to the first identifier according to the first operation of the user on the first identifier.
S530、根据用户对第二标识的第二操作,显示第二标识对应的历史消息的调度信息。S530. Display scheduling information of historical messages corresponding to the second identifier according to the second operation performed by the user on the second identifier.
在本实施例的基础上,方法还包括:On the basis of this embodiment, the method also includes:
显示性能问题出现时未被调度的历史消息对应的第三标识。Displays the third identifier corresponding to the historical message that was not scheduled when the performance problem occurred.
继续参见图19,在图19中,箭头表示时间轴,该时间轴包括多个顺序排列的矩形方框。根据填充图形可以将方框分为三个类型:第一类型为填充点的方框1-53,为第一标识,表示性能问题出现时已被调度完成的历史消息的调度信息;第二类型为无填充的方框,为第二标识,表示性能问题出现时正在调度的历史消息的调度信息;第三类型为填充斜线的方框1-3,为第三标识,表示性能问题出现时未被调度的历史消息的调度信息。当用户希望了解第一标识中的方框11对应的第一消息的调度信息,用户对方框11进行第一操作。第一操作具体可以为点击、滑动等。继续参见图20,显示界面中出现方框11对应的展示框。该展示框展示该调度信息的详细内容。由于第三标识表示性能问题出现时未被调度的历史消息的调度信息,当用户对第三标识进行操作时,显示界面中出现第三标识对应的展示框。展示框内容为空,或者,提示无调度信息。Continuing to refer to FIG. 19 , in FIG. 19 , the arrows indicate a time axis including a plurality of sequentially arranged rectangular boxes. The boxes can be divided into three types according to the filling graph: the first type is the filling point of the boxes 1-53, which are the first identification, indicating the scheduling information of the historical messages that have been scheduled when the performance problem occurs; the second type The unfilled box is the second mark, indicating the scheduling information of the historical message being scheduled when the performance problem occurs; the third type is the box 1-3 filled with slashes, which is the third mark, indicating when the performance problem occurs Scheduling information for unscheduled historical messages. When the user wants to know the scheduling information of the first message corresponding to the block 11 in the first identifier, the user performs the first operation on the block 11 . The first operation may specifically be clicking, sliding, or the like. Continuing to refer to FIG. 20 , a display box corresponding to block 11 appears in the display interface. The display box displays the details of the scheduling information. Since the third identifier represents scheduling information of historical messages that were not scheduled when the performance problem occurred, when the user operates the third identifier, a display frame corresponding to the third identifier appears in the display interface. The content of the display box is empty, or it indicates that there is no scheduling information.
这样设置尤其适用于用户显示界面尺寸有限,无法同时全面展示所有调度信息的情况。This setting is especially suitable for situations where the size of the user display interface is limited, and all scheduling information cannot be fully displayed at the same time.
需要说明的是,在图18-图20中,给出了调度信息的展示方法。调度信息之所以需要展示的一个原因是,虽然终端能够自行完成性能问题定位,但在某些情景下,用户或研发人员也希望了解出现性能问题前后历史消息的调度情况。It should be noted that, in FIG. 18-FIG. 20, the display method of the scheduling information is given. One reason why the scheduling information needs to be displayed is that although the terminal can complete the performance problem location by itself, in some scenarios, users or R&D personnel also want to know the scheduling situation of historical messages before and after the performance problem occurs.
另外,若出现性能问题的终端以及执行本公开提供的性能问题定位方法的终端为不同终端。假设第一终端为出现性能问题的终端,第二终端为执行本公开提供的性能问题定位方法的终端,该方法还包括:第一终端响应于应用程序出现的性能问题,将消息调度时序图发送至第二终端。第二终端基于根据消息调度时序图确定性能问题出现时已经被调度的多个历史消息的调度信息;根据性能问题出现时已经被调度的多个历史消息的调度信息,对性能问题进行定位。In addition, if a terminal with a performance problem and a terminal executing the method for locating a performance problem provided by the present disclosure are different terminals. Assuming that the first terminal is a terminal with a performance problem, and the second terminal is a terminal that executes the performance problem location method provided by the present disclosure, the method further includes: the first terminal sends a message scheduling sequence diagram in response to the performance problem occurring in the application program to the second terminal. The second terminal determines the scheduling information of the multiple historical messages that have been scheduled when the performance problem occurs according to the message scheduling sequence diagram; and locates the performance problem according to the scheduling information of the multiple historical messages that have been scheduled when the performance problem occurs.
这样设置的原因是,在实际中,可能出现第一终端出现性能问题。但是其他无法接触第一终端的人员希望了解第一终端出现性能问题的原因,此时,采用上 述方案,可以使得无法接触第一终端,但持有第二设备的人员能够获取第一终端出现性能问题前后的调度信息,并进行性能问题定位。The reason for this setting is that, in practice, there may be a performance problem in the first terminal. However, other personnel who cannot access the first terminal want to know the reasons for the performance problems of the first terminal. At this time, the above solution can be adopted to make the personnel unable to access the first terminal but holding the second device to obtain the performance of the first terminal. Scheduling information before and after the problem, and locating performance problems.
图20为本公开实施例中的一种性能问题定位装置的结构示意图。本公开实施例所提供的性能问题定位装置可以配置于终端中,或者可以配置于服务端中。参见图20,该性能问题定位装置具体包括:FIG. 20 is a schematic structural diagram of a device for locating performance problems in an embodiment of the present disclosure. The device for locating a performance problem provided by the embodiment of the present disclosure may be configured in a terminal, or may be configured in a server. Referring to Figure 20, the performance problem locating device specifically includes:
响应模块610,用于响应于应用程序出现的性能问题,根据消息调度时序图确定性能问题出现时已经被调度的多个历史消息的调度信息,消息调度时序图用于显示多个历史消息的调度信息;The response module 610 is configured to, in response to a performance problem occurring in the application, determine the scheduling information of multiple historical messages that have been scheduled when the performance problem occurs according to the message scheduling sequence diagram, and the message scheduling sequence diagram is used to display the scheduling of multiple historical messages information;
问题定位模块620,用于根据性能问题出现时已经被调度的多个历史消息的调度信息,对性能问题进行定位。The problem locating module 620 is configured to locate the performance problem according to the scheduling information of a plurality of historical messages that have been scheduled when the performance problem occurs.
进一步地,问题定位模块620,具体用于:Further, the problem location module 620 is specifically used for:
确定所述多个历史消息中调度耗时大于或等于预设时长的历史消息;Determine the historical messages whose scheduling time is greater than or equal to the preset duration among the plurality of historical messages;
根据所述多个历史消息中调度耗时大于或等于预设时长的历史消息,对所述性能问题进行定位。The performance problem is located according to the historical messages whose scheduling time is greater than or equal to a preset time length among the plurality of historical messages.
进一步地,该方法还包括消息调度时序图生成模块,消息调度时序图生成模块包括目标消息获取单元、调度信息记录单元以及消息调度时序图生成单元;Further, the method further includes a message scheduling sequence diagram generation module, the message scheduling sequence diagram generation module includes a target message acquisition unit, a scheduling information recording unit, and a message scheduling sequence diagram generation unit;
其中,目标消息获取单元,用于在所述应用程序出现性能问题之前,获取所述应用程序对应的消息队列中待调度的目标消息,所述目标消息为所述多个历史消息中的任一历史消息;Wherein, the target message acquisition unit is used to acquire the target message to be scheduled in the message queue corresponding to the application program before a performance problem occurs in the application program, and the target message is any one of the multiple historical messages historical news;
调度信息记录单元,用于在对所述目标消息进行调度的过程中,记录所述目标消息的调度信息;a scheduling information recording unit, configured to record the scheduling information of the target message in the process of scheduling the target message;
消息调度时序图生成单元,用于根据所述目标消息的调度信息,生成所述消息调度时序图。A message scheduling sequence diagram generating unit, configured to generate the message scheduling sequence diagram according to the scheduling information of the target message.
进一步地,调度信息记录单元,具体用于:Further, the scheduling information recording unit is specifically used for:
在开始调度所述目标消息时,记录所述目标消息的调度开始时间;When starting to schedule the target message, record the scheduling start time of the target message;
在结束调度所述目标消息时,记录所述目标消息的调度结束时间;When finishing scheduling the target message, record the scheduling end time of the target message;
根据所述目标消息的调度开始时间和所述目标消息的调度结束时间,确定所述目标消息的调度耗时;According to the scheduling start time of the target message and the scheduling end time of the target message, determine the scheduling time-consuming of the target message;
记录所述目标消息的调度信息,所述调度信息包括所述调度开始时间、所述调度结束时间和所述调度耗时中的至少一种。Scheduling information of the target message is recorded, where the scheduling information includes at least one of the scheduling start time, the scheduling end time, and the scheduling time-consuming.
进一步地,调度信息记录单元,包括第一监控期调度信息记录子单元和/或第 二监控期调度信息记录子单元;Further, the scheduling information recording unit includes a first monitoring period scheduling information recording subunit and/or a second monitoring period scheduling information recording subunit;
第一监控期调度信息记录子单元,用于在开始调度所述目标消息时,记录所述开始调度之前的第一监控期内已经被调度的多个历史消息的调度信息,所述第一监控期内已经被调度的多个历史消息是所述目标消息之前的消息;The first monitoring period scheduling information recording subunit is configured to, when starting to schedule the target message, record the scheduling information of a plurality of historical messages that have been scheduled within the first monitoring period before the start of scheduling, the first monitoring A plurality of historical messages that have been scheduled within the period are messages before the target message;
第二监控期调度信息记录子单元,用于在结束调度所述目标消息时,记录所述结束调度之前的第二监控期内已经被调度的多个历史消息的调度信息,所述第二监控期内已经被调度的多个历史消息包括所述目标消息。The second monitoring period scheduling information recording subunit is configured to record the scheduling information of multiple historical messages that have been scheduled in the second monitoring period before the end of the scheduling when the target message is scheduled, and the second monitoring A number of historical messages that have been scheduled within a period include the target message.
进一步地,第一监控期调度信息记录子单元,具体用于:Further, the first monitoring period scheduling information recording subunit is specifically used for:
在开始调度所述目标消息时,检测计数器是否发生更新;When starting to schedule the target message, detecting whether the counter is updated;
若在开始调度所述目标消息时,检测到所述计数器未发生更新,则对所述目标消息进行调度处理;If it is detected that the counter has not been updated when starting to schedule the target message, perform scheduling processing on the target message;
若在开始调度所述目标消息时,检测到所述计数器发生更新,则记录所述开始调度之前的第一监控期内已经被调度的多个历史消息的调度信息;If it is detected that the counter is updated when starting to schedule the target message, recording the scheduling information of multiple historical messages that have been scheduled within the first monitoring period before starting the scheduling;
其中,所述第一监控期对应于从开始调度所述目标消息时检测到所述计数器发生更新到上一次检测到所述计数器发生更新之间;所述多个历史消息的调度信息包括所述多个历史消息的总个数和所述多个历史消息总的调度耗时。Wherein, the first monitoring period corresponds to the period from when the target message is scheduled to be updated when the counter is detected to be updated to the last time the counter is detected to be updated; the scheduling information of the multiple historical messages includes the The total number of the multiple historical messages and the total scheduling time of the multiple historical messages.
进一步地,第一监控期调度信息记录子单元,在执行记录所述开始调度之前的第一监控期内已经被调度的多个历史消息的调度信息时,包括:Further, the first monitoring period scheduling information recording subunit, when performing recording the scheduling information of multiple historical messages that have been scheduled in the first monitoring period before the start of scheduling, includes:
当确定所述第一监控期内所述计数器的更新次数小于或等于2次时,记录所述第一监控期内已经被调度的多个历史消息的调度信息。When it is determined that the number of times of updating the counter within the first monitoring period is less than or equal to 2, the scheduling information of the multiple historical messages that have been scheduled within the first monitoring period is recorded.
进一步地,第一监控期调度信息记录子单元,在执行记录所述开始调度之前的第一监控期内已经被调度的多个历史消息的调度信息时,还包括:Further, the first monitoring period scheduling information recording subunit, when performing recording the scheduling information of multiple historical messages that have been scheduled in the first monitoring period before the start of scheduling, further includes:
当确定所述第一监控期内所述计数器的更新次数大于2次时,记录所述第一监控期内已经被调度的多个历史消息的调度信息、以及记录所述第一监控期内系统的休眠时间。When it is determined that the number of times the counter is updated during the first monitoring period is greater than 2, record scheduling information of multiple historical messages that have been scheduled within the first monitoring period, and record the system during the first monitoring period. sleep time.
进一步地,第二监控期调度信息记录子单元,具体用于:在结束调度所述目标消息时,检测计数器是否发生更新;Further, the second monitoring period scheduling information recording subunit is specifically configured to: when the target message is scheduled to end, detect whether the counter is updated;
若在结束调度所述目标消息时,检测到所述计数器未发生更新,则从所述消息队列中获取所述目标消息的下一个消息;If it is detected that the counter has not been updated when the target message is scheduled to end, the next message of the target message is obtained from the message queue;
若在结束调度所述目标消息时,检测到所述计数器发生更新,则记录所述结束调度之前的第二监控期内已经被调度的多个历史消息的调度信息;If it is detected that the counter is updated when scheduling the target message is completed, recording scheduling information of multiple historical messages that have been scheduled within the second monitoring period before the scheduling is completed;
其中,所述第二监控期对应于从结束调度所述目标消息时检测到所述计数器发生更新到上一次检测到所述计数器发生更新之间;所述多个历史消息的调度信息包括所述多个历史消息的总个数和所述多个历史消息总的调度耗时。Wherein, the second monitoring period corresponds to the period from when the target message is scheduled to be updated and the counter is detected to be updated last time; the scheduling information of the multiple historical messages includes the The total number of the multiple historical messages and the total scheduling time of the multiple historical messages.
进一步地,第二监控期调度信息记录子单元,在执行记录所述结束调度之前的第二监控期内已经被调度的多个历史消息的调度信息时,包括:Further, the second monitoring period scheduling information recording subunit, when performing recording the scheduling information of multiple historical messages that have been scheduled in the second monitoring period before the end scheduling, includes:
当确定所述第二监控期内所述计数器的更新次数小于或等于2次时,记录所述第二监控期内已经被调度的多个历史消息的调度信息。When it is determined that the number of updates of the counter in the second monitoring period is less than or equal to 2, the scheduling information of a plurality of historical messages that have been scheduled in the second monitoring period is recorded.
进一步地,第二监控期调度信息记录子单元,在执行记录所述结束调度之前的第二监控期内已经被调度的多个历史消息的调度信息时,还包括:Further, the second monitoring period scheduling information recording subunit, when performing recording the scheduling information of multiple historical messages that have been scheduled in the second monitoring period before the end scheduling, further includes:
当确定所述第二监控期内所述计数器的更新次数大于2次时,记录所述目标消息的调度信息、以及记录所述第二监控期内除所述目标消息之外的已经被调度的历史消息的调度信息。When it is determined that the number of updates of the counter in the second monitoring period is greater than 2, the scheduling information of the target message is recorded, and the scheduled information other than the target message in the second monitoring period is recorded. Scheduling information for historical messages.
进一步地,第二监控期调度信息记录子单元,还用于:Further, the second monitoring period scheduling information recording subunit is also used for:
在结束调度所述目标消息时,检测所述目标消息的消息类型是否为预设类型;When finishing scheduling the target message, detecting whether the message type of the target message is a preset type;
在所述目标消息的消息类型不是预设类型的情况下,检测所述计数器是否发生更新;In the case that the message type of the target message is not a preset type, detecting whether the counter is updated;
在所述目标消息的消息类型为预设类型的情况下,记录所述目标消息的调度信息。When the message type of the target message is a preset type, the scheduling information of the target message is recorded.
本公开实施例提供的性能问题定位装置,可执行本公开方法实施例所提供的性能问题定位方法中终端或服务端所执行的步骤,具备执行步骤和有益效果此处不再赘述。The device for locating performance problems provided by the embodiments of the present disclosure can execute the steps performed by the terminal or the server in the method for locating performance problems provided by the method embodiments of the present disclosure, and the execution steps and beneficial effects are not repeated here.
图22为本公开实施例中的一种电子设备的结构示意图。下面具体参考图22,其示出了适于用来实现本公开实施例中的电子设备1000的结构示意图。本公开实施例中的电子设备1000可以包括但不限于诸如移动电话、笔记本电脑、数字广播接收器、PDA(个人数字助理)、PAD(平板电脑)、PMP(便携式多媒体播放器)、车载终端(例如车载导航终端)、可穿戴电子设备等等的移动终端以及诸如数字TV、台式计算机、智能家居设备等等的固定终端。图22示出的电子设备仅仅是一个示例,不应对本公开实施例的功能和使用范围带来任何限制。FIG. 22 is a schematic structural diagram of an electronic device according to an embodiment of the disclosure. Referring specifically to FIG. 22 below, it shows a schematic structural diagram of the electronic device 1000 suitable for implementing the embodiment of the present disclosure. The electronic device 1000 in the embodiment of the present disclosure may include, but is not limited to, such as a mobile phone, a notebook computer, a digital broadcast receiver, a PDA (personal digital assistant), a PAD (tablet computer), a PMP (portable multimedia player), a vehicle-mounted terminal ( Mobile terminals such as in-vehicle navigation terminals), wearable electronic devices, etc., and stationary terminals such as digital TVs, desktop computers, smart home devices, and the like. The electronic device shown in FIG. 22 is only an example, and should not impose any limitation on the function and scope of use of the embodiments of the present disclosure.
如图22所示,电子设备1000可以包括处理装置(例如中央处理器、图形处理器等)1001,其可以根据存储在只读存储器(ROM)1002中的程序或者从存储装置1008加载到随机访问存储器(RAM)1003中的程序而执行各种适当的动作 和处理以实现如本公开所述的实施例的性能问题定位方法。在RAM 1003中,还存储有电子设备1000操作所需的各种程序和数据。处理装置1001、ROM 1002以及RAM 1003通过总线1004彼此相连。输入/输出(I/O)接口1005也连接至总线1004。As shown in FIG. 22, an electronic device 1000 may include a processing device (eg, a central processing unit, a graphics processor, etc.) 1001, which may be loaded into random access according to a program stored in a read only memory (ROM) 1002 or from a storage device 1008 A program in the memory (RAM) 1003 executes various appropriate actions and processes to implement the performance problem locating method of the embodiment as described in the present disclosure. In the RAM 1003, various programs and data required for the operation of the electronic device 1000 are also stored. The processing device 1001, the ROM 1002, and the RAM 1003 are connected to each other through a bus 1004. An input/output (I/O) interface 1005 is also connected to the bus 1004 .
通常,以下装置可以连接至I/O接口1005:包括例如触摸屏、触摸板、键盘、鼠标、摄像头、麦克风、加速度计、陀螺仪等的输入装置1006;包括例如液晶显示器(LCD)、扬声器、振动器等的输出装置1007;包括例如磁带、硬盘等的存储装置1008;以及通信装置1009。通信装置1009可以允许电子设备1000与其他设备进行无线或有线通信以交换数据。虽然图22示出了具有各种装置的电子设备1000,但是应理解的是,并不要求实施或具备所有示出的装置。可以替代地实施或具备更多或更少的装置。Typically, the following devices can be connected to the I/O interface 1005: input devices 1006 including, for example, a touch screen, touchpad, keyboard, mouse, camera, microphone, accelerometer, gyroscope, etc.; including, for example, a liquid crystal display (LCD), speakers, vibration An output device 1007 such as a computer; a storage device 1008 including, for example, a magnetic tape, a hard disk, etc.; and a communication device 1009 . The communication means 1009 may allow the electronic device 1000 to communicate wirelessly or by wire with other devices to exchange data. While FIG. 22 shows the electronic device 1000 having various means, it should be understood that not all of the illustrated means are required to be implemented or provided. More or fewer devices may alternatively be implemented or provided.
特别地,根据本公开的实施例,上文参考流程图描述的过程可以被实现为计算机软件程序。例如,本公开的实施例包括一种计算机程序产品,其包括承载在非暂态计算机可读介质上的计算机程序,该计算机程序包含用于执行流程图所示的方法的程序代码,从而实现如上所述的性能问题定位方法。在这样的实施例中,该计算机程序可以通过通信装置1009从网络上被下载和安装,或者从存储装置1008被安装,或者从ROM 1002被安装。在该计算机程序被处理装置1001执行时,执行本公开实施例的方法中限定的上述功能。In particular, according to embodiments of the present disclosure, the processes described above with reference to the flowcharts may be implemented as computer software programs. For example, embodiments of the present disclosure include a computer program product comprising a computer program carried on a non-transitory computer readable medium, the computer program comprising program code for performing the method shown in the flowchart, thereby achieving the above The described performance problem location method. In such an embodiment, the computer program may be downloaded and installed from the network via the communication device 1009, or from the storage device 1008, or from the ROM 1002. When the computer program is executed by the processing apparatus 1001, the above-mentioned functions defined in the methods of the embodiments of the present disclosure are executed.
需要说明的是,本公开上述的计算机可读介质可以是计算机可读信号介质或者计算机可读存储介质或者是上述两者的任意组合。计算机可读存储介质例如可以是——但不限于——电、磁、光、电磁、红外线、或半导体的系统、装置或器件,或者任意以上的组合。计算机可读存储介质的更具体的例子可以包括但不限于:具有一个或多个导线的电连接、便携式计算机磁盘、硬盘、随机访问存储器(RAM)、只读存储器(ROM)、可擦式可编程只读存储器(EPROM或闪存)、光纤、便携式紧凑磁盘只读存储器(CD-ROM)、光存储器件、磁存储器件、或者上述的任意合适的组合。在本公开中,计算机可读存储介质可以是任何包含或存储程序的有形介质,该程序可以被指令执行系统、装置或者器件使用或者与其结合使用。而在本公开中,计算机可读信号介质可以包括在基带中或者作为载波一部分传播的数据信号,其中承载了计算机可读的程序代码。这种传播的数据信号可以采用多种形式,包括但不限于电磁信号、光信号或上述的任意合适的组合。计算机可读信号介质还可以是计算机可读存储介质以外的任何计算机可读介质,该 计算机可读信号介质可以发送、传播或者传输用于由指令执行系统、装置或者器件使用或者与其结合使用的程序。计算机可读介质上包含的程序代码可以用任何适当的介质传输,包括但不限于:电线、光缆、RF(射频)等等,或者上述的任意合适的组合。It should be noted that the computer-readable medium mentioned above in the present disclosure may be a computer-readable signal medium or a computer-readable storage medium, or any combination of the above two. The computer-readable storage medium can be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus or device, or a combination of any of the above. More specific examples of computer readable storage media may include, but are not limited to, electrical connections with one or more wires, portable computer disks, hard disks, random access memory (RAM), read only memory (ROM), erasable Programmable read only memory (EPROM or flash memory), fiber optics, portable compact disk read only memory (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination of the foregoing. In this disclosure, a computer-readable storage medium may be any tangible medium that contains or stores a program that can be used by or in conjunction with an instruction execution system, apparatus, or device. In the present disclosure, however, a computer-readable signal medium may include a data signal propagated in baseband or as part of a carrier wave with computer-readable program code embodied thereon. Such propagated data signals may take a variety of forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination of the foregoing. A computer-readable signal medium can also be any computer-readable medium other than a computer-readable storage medium that can transmit, propagate, or transport the program for use by or in connection with the instruction execution system, apparatus, or device . Program code embodied on a computer readable medium may be transmitted using any suitable medium including, but not limited to, electrical wire, optical fiber cable, RF (radio frequency), etc., or any suitable combination of the foregoing.
在一些实施方式中,客户端、服务器可以利用诸如HTTP(HyperText Transfer Protocol,超文本传输协议)之类的任何当前已知或未来研发的网络协议进行通信,并且可以与任意形式或介质的数字数据通信(例如,通信网络)互连。通信网络的示例包括局域网(“LAN”),广域网(“WAN”),网际网(例如,互联网)以及端对端网络(例如,ad hoc端对端网络),以及任何当前已知或未来研发的网络。In some embodiments, the client and server can use any currently known or future developed network protocol such as HTTP (HyperText Transfer Protocol) to communicate, and can communicate with digital data in any form or medium Communication (eg, a communication network) interconnects. Examples of communication networks include local area networks ("LAN"), wide area networks ("WAN"), the Internet (eg, the Internet), and peer-to-peer networks (eg, ad hoc peer-to-peer networks), as well as any currently known or future development network of.
上述计算机可读介质可以是上述电子设备中所包含的;也可以是单独存在,而未装配入该电子设备中。The above-mentioned computer-readable medium may be included in the above-mentioned electronic device; or may exist alone without being assembled into the electronic device.
上述计算机可读介质承载有一个或者多个程序,当上述一个或者多个程序被该电子设备执行时,使得该电子设备:The above-mentioned computer-readable medium carries one or more programs, and when the above-mentioned one or more programs are executed by the electronic device, the electronic device:
响应于应用程序出现的性能问题,根据消息调度时序图确定所述性能问题出现时已经被调度的多个历史消息的调度信息,所述消息调度时序图用于显示所述多个历史消息的调度信息;In response to a performance problem occurring in the application, determine scheduling information of multiple historical messages that have been scheduled when the performance problem occurs according to a message scheduling sequence diagram, where the message scheduling sequence diagram is used to display the scheduling of the multiple historical messages information;
根据所述性能问题出现时已经被调度的多个历史消息的调度信息,对所述性能问题进行定位。The performance problem is located according to scheduling information of a plurality of historical messages that have been scheduled when the performance problem occurs.
可选的,当上述一个或者多个程序被该电子设备执行时,该电子设备还可以执行上述实施例所述的其他步骤。Optionally, when the above one or more programs are executed by the electronic device, the electronic device may also perform other steps described in the above embodiments.
可以以一种或多种程序设计语言或其组合来编写用于执行本公开的操作的计算机程序代码,上述程序设计语言包括但不限于面向对象的程序设计语言—诸如Java、Smalltalk、C++,还包括常规的过程式程序设计语言—诸如“C”语言或类似的程序设计语言。程序代码可以完全地在用户计算机上执行、部分地在用户计算机上执行、作为一个独立的软件包执行、部分在用户计算机上部分在远程计算机上执行、或者完全在远程计算机或服务器上执行。在涉及远程计算机的情形中,远程计算机可以通过任意种类的网络——包括局域网(LAN)或广域网(WAN)—连接到用户计算机,或者,可以连接到外部计算机(例如利用因特网服务提供商来通过因特网连接)。Computer program code for performing operations of the present disclosure may be written in one or more programming languages, including but not limited to object-oriented programming languages—such as Java, Smalltalk, C++, and This includes conventional procedural programming languages - such as the "C" language or similar programming languages. The program code may execute entirely on the user's computer, partly on the user's computer, as a stand-alone software package, partly on the user's computer and partly on a remote computer, or entirely on the remote computer or server. In the case of a remote computer, the remote computer may be connected to the user's computer through any kind of network, including a local area network (LAN) or a wide area network (WAN), or may be connected to an external computer (eg, using an Internet service provider through Internet connection).
附图中的流程图和框图,图示了按照本公开各种实施例的系统、方法和计算机程序产品的可能实现的体系架构、功能和操作。在这点上,流程图或框图中的 每个方框可以代表一个模块、程序段、或代码的一部分,该模块、程序段、或代码的一部分包含一个或多个用于实现规定的逻辑功能的可执行指令。也应当注意,在有些作为替换的实现中,方框中所标注的功能也可以以不同于附图中所标注的顺序发生。例如,两个接连地表示的方框实际上可以基本并行地执行,它们有时也可以按相反的顺序执行,这依所涉及的功能而定。也要注意的是,框图和/或流程图中的每个方框、以及框图和/或流程图中的方框的组合,可以用执行规定的功能或操作的专用的基于硬件的系统来实现,或者可以用专用硬件与计算机指令的组合来实现。The flowchart and block diagrams in the Figures illustrate the architecture, functionality, and operation of possible implementations of systems, methods and computer program products according to various embodiments of the present disclosure. In this regard, each block in the flowchart or block diagrams may represent a module, segment, or portion of code that contains one or more logical functions for implementing the specified functions executable instructions. It should also be noted that, in some alternative implementations, the functions noted in the blocks may occur out of the order noted in the figures. For example, two blocks shown in succession may, in fact, be executed substantially concurrently, or the blocks may sometimes be executed in the reverse order, depending upon the functionality involved. It is also noted that each block of the block diagrams and/or flowchart illustrations, and combinations of blocks in the block diagrams and/or flowchart illustrations, can be implemented in dedicated hardware-based systems that perform the specified functions or operations , or can be implemented in a combination of dedicated hardware and computer instructions.
描述于本公开实施例中所涉及到的单元可以通过软件的方式实现,也可以通过硬件的方式来实现。其中,单元的名称在某种情况下并不构成对该单元本身的限定。The units involved in the embodiments of the present disclosure may be implemented in a software manner, and may also be implemented in a hardware manner. Among them, the name of the unit does not constitute a limitation of the unit itself under certain circumstances.
本文中以上描述的功能可以至少部分地由一个或多个硬件逻辑部件来执行。例如,非限制性地,可以使用的示范类型的硬件逻辑部件包括:现场可编程门阵列(FPGA)、专用集成电路(ASIC)、专用标准产品(ASSP)、片上系统(SOC)、复杂可编程逻辑设备(CPLD)等等。The functions described herein above may be performed, at least in part, by one or more hardware logic components. For example, without limitation, exemplary types of hardware logic components that may be used include: Field Programmable Gate Arrays (FPGAs), Application Specific Integrated Circuits (ASICs), Application Specific Standard Products (ASSPs), Systems on Chips (SOCs), Complex Programmable Logical Devices (CPLDs) and more.
在本公开的上下文中,机器可读介质可以是有形的介质,其可以包含或存储以供指令执行系统、装置或设备使用或与指令执行系统、装置或设备结合地使用的程序。机器可读介质可以是机器可读信号介质或机器可读储存介质。机器可读介质可以包括但不限于电子的、磁性的、光学的、电磁的、红外的、或半导体系统、装置或设备,或者上述内容的任何合适组合。机器可读存储介质的更具体示例会包括基于一个或多个线的电气连接、便携式计算机盘、硬盘、随机存取存储器(RAM)、只读存储器(ROM)、可擦除可编程只读存储器(EPROM或快闪存储器)、光纤、便捷式紧凑盘只读存储器(CD-ROM)、光学储存设备、磁储存设备、或上述内容的任何合适组合。In the context of the present disclosure, a machine-readable medium may be a tangible medium that may contain or store a program for use by or in connection with the instruction execution system, apparatus or device. The machine-readable medium may be a machine-readable signal medium or a machine-readable storage medium. Machine-readable media may include, but are not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, devices, or devices, or any suitable combination of the foregoing. More specific examples of machine-readable storage media would include one or more wire-based electrical connections, portable computer disks, hard disks, random access memory (RAM), read only memory (ROM), erasable programmable read only memory (EPROM or flash memory), fiber optics, compact disk read only memory (CD-ROM), optical storage, magnetic storage, or any suitable combination of the foregoing.
本公开实施例还提供一种计算机可读存储介质,所述存储介质中存储有计算机程序,当所述计算机程序被处理器执行时可以实现上述图1-图20任一实施例的方法,其执行方式和有益效果类似,在这里不再赘述。Embodiments of the present disclosure further provide a computer-readable storage medium, where a computer program is stored in the storage medium. When the computer program is executed by a processor, the method of any of the foregoing embodiments in FIG. 1 to FIG. 20 can be implemented, and The implementation manner and beneficial effects are similar, and are not repeated here.
以上描述仅为本公开的较佳实施例以及对所运用技术原理的说明。本领域技术人员应当理解,本公开中所涉及的公开范围,并不限于上述技术特征的特定组合而成的技术方案,同时也应涵盖在不脱离上述公开构思的情况下,由上述技术特征或其等同特征进行任意组合而形成的其它技术方案。例如上述特征与本公开 中公开的(但不限于)具有类似功能的技术特征进行互相替换而形成的技术方案。The above description is merely a preferred embodiment of the present disclosure and an illustration of the technical principles employed. Those skilled in the art should understand that the scope of the disclosure involved in the present disclosure is not limited to the technical solutions formed by the specific combination of the above-mentioned technical features, and should also cover, without departing from the above-mentioned disclosed concept, the technical solutions formed by the above-mentioned technical features or Other technical solutions formed by any combination of its equivalent features. For example, a technical solution formed by replacing the above-mentioned features with the technical features disclosed in the present disclosure (but not limited to) with similar functions.
此外,虽然采用特定次序描绘了各操作,但是这不应当理解为要求这些操作以所示出的特定次序或以顺序次序执行来执行。在一定环境下,多任务和并行处理可能是有利的。同样地,虽然在上面论述中包含了若干具体实现细节,但是这些不应当被解释为对本公开的范围的限制。在单独的实施例的上下文中描述的某些特征还可以组合地实现在单个实施例中。相反地,在单个实施例的上下文中描述的各种特征也可以单独地或以任何合适的子组合的方式实现在多个实施例中。Additionally, although operations are depicted in a particular order, this should not be construed as requiring that the operations be performed in the particular order shown or in a sequential order. Under certain circumstances, multitasking and parallel processing may be advantageous. Likewise, although the above discussion contains several implementation-specific details, these should not be construed as limitations on the scope of the present disclosure. Certain features that are described in the context of separate embodiments can also be implemented in combination in a single embodiment. Conversely, various features that are described in the context of a single embodiment can also be implemented in multiple embodiments separately or in any suitable subcombination.
尽管已经采用特定于结构特征和/或方法逻辑动作的语言描述了本主题,但是应当理解所附权利要求书中所限定的主题未必局限于上面描述的特定特征或动作。相反,上面所描述的特定特征和动作仅仅是实现权利要求书的示例形式。Although the subject matter has been described in language specific to structural features and/or logical acts of method, it is to be understood that the subject matter defined in the appended claims is not necessarily limited to the specific features or acts described above. Rather, the specific features and acts described above are merely example forms of implementing the claims.

Claims (15)

  1. 一种性能问题定位方法,其特征在于,所述方法包括:A method for locating performance problems, characterized in that the method comprises:
    响应于应用程序出现的性能问题,根据消息调度时序图确定所述性能问题出现时已经被调度的多个历史消息的调度信息,所述消息调度时序图用于显示所述多个历史消息的调度信息;In response to a performance problem occurring in the application, determine scheduling information of multiple historical messages that have been scheduled when the performance problem occurs according to a message scheduling sequence diagram, where the message scheduling sequence diagram is used to display the scheduling of the multiple historical messages information;
    根据所述性能问题出现时已经被调度的多个历史消息的调度信息,对所述性能问题进行定位。The performance problem is located according to scheduling information of a plurality of historical messages that have been scheduled when the performance problem occurs.
  2. 根据权利要求1所述的方法,其特征在于,根据所述性能问题出现时已经被调度的多个历史消息的调度信息,对所述性能问题进行定位,包括:The method according to claim 1, wherein locating the performance problem according to scheduling information of multiple historical messages that have been scheduled when the performance problem occurs, comprises:
    确定所述多个历史消息中调度耗时大于或等于预设时长的历史消息;Determine the historical messages whose scheduling time is greater than or equal to the preset duration among the plurality of historical messages;
    根据所述多个历史消息中调度耗时大于或等于预设时长的历史消息,对所述性能问题进行定位。The performance problem is located according to the historical messages whose scheduling time is greater than or equal to a preset time length among the plurality of historical messages.
  3. 根据权利要求1或2所述的方法,其特征在于,在所述应用程序出现性能问题之前,所述方法还包括:The method according to claim 1 or 2, characterized in that, before the application has a performance problem, the method further comprises:
    获取所述应用程序对应的消息队列中待调度的目标消息,所述目标消息为所述多个历史消息中的任一历史消息;Obtain the target message to be scheduled in the message queue corresponding to the application, where the target message is any historical message in the plurality of historical messages;
    在对所述目标消息进行调度的过程中,记录所述目标消息的调度信息;In the process of scheduling the target message, recording the scheduling information of the target message;
    根据所述目标消息的调度信息,生成所述消息调度时序图。The message scheduling sequence diagram is generated according to the scheduling information of the target message.
  4. 根据权利要求3所述的方法,其特征在于,在对所述目标消息进行调度的过程中,记录所述目标消息的调度信息,包括:The method according to claim 3, wherein, in the process of scheduling the target message, recording the scheduling information of the target message, comprising:
    在开始调度所述目标消息时,记录所述目标消息的调度开始时间;When starting to schedule the target message, record the scheduling start time of the target message;
    在结束调度所述目标消息时,记录所述目标消息的调度结束时间;When finishing scheduling the target message, record the scheduling end time of the target message;
    根据所述目标消息的调度开始时间和所述目标消息的调度结束时间,确定所述目标消息的调度耗时;According to the scheduling start time of the target message and the scheduling end time of the target message, determine the scheduling time-consuming of the target message;
    记录所述目标消息的调度信息,所述调度信息包括所述调度开始时间、所述调度结束时间和所述调度耗时中的至少一种。Scheduling information of the target message is recorded, where the scheduling information includes at least one of the scheduling start time, the scheduling end time, and the scheduling time-consuming.
  5. 根据权利要求3所述的方法,其特征在于,在对所述目标消息进行调度的过程中,记录所述目标消息的调度信息,包括:The method according to claim 3, wherein, in the process of scheduling the target message, recording the scheduling information of the target message, comprising:
    在开始调度所述目标消息时,记录所述开始调度之前的第一监控期内已经被调度的多个历史消息的调度信息,所述第一监控期内已经被调度的多个历史消息是所述目标消息之前的消息;和/或When starting to schedule the target message, record the scheduling information of the multiple historical messages that have been scheduled in the first monitoring period before the scheduling starts, and the multiple historical messages that have been scheduled in the first monitoring period are all message preceding the target message; and/or
    在结束调度所述目标消息时,记录所述结束调度之前的第二监控期内已经被调度的多个历史消息的调度信息,所述第二监控期内已经被调度的多个历史消息包括所述目标消息。When scheduling the target message is ended, recording the scheduling information of the multiple historical messages that have been scheduled within the second monitoring period before the scheduling is ended, and the multiple historical messages that have been scheduled within the second monitoring period include the the target message.
  6. 根据权利要求5所述的方法,其特征在于,在开始调度所述目标消息时,记录所述开始调度之前的第一监控期内已经被调度的多个历史消息的调度信息,包括:The method according to claim 5, wherein, when starting to schedule the target message, recording scheduling information of multiple historical messages that have been scheduled within the first monitoring period before starting the scheduling, comprising:
    在开始调度所述目标消息时,检测计数器是否发生更新;When starting to schedule the target message, detecting whether the counter is updated;
    若在开始调度所述目标消息时,检测到所述计数器未发生更新,则对所述目标消息进行调度处理;If it is detected that the counter has not been updated when starting to schedule the target message, perform scheduling processing on the target message;
    若在开始调度所述目标消息时,检测到所述计数器发生更新,则记录所述开始调度之前的第一监控期内已经被调度的多个历史消息的调度信息;If it is detected that the counter is updated when starting to schedule the target message, recording the scheduling information of multiple historical messages that have been scheduled within the first monitoring period before starting the scheduling;
    其中,所述第一监控期对应于从开始调度所述目标消息时检测到所述计数器发生更新到上一次检测到所述计数器发生更新之间;所述多个历史消息的调度信息包括所述多个历史消息的总个数和所述多个历史消息总的调度耗时。Wherein, the first monitoring period corresponds to the period from when the target message is scheduled to be updated when the counter is detected to be updated to the last time the counter is detected to be updated; the scheduling information of the multiple historical messages includes the The total number of the multiple historical messages and the total scheduling time of the multiple historical messages.
  7. 根据权利要求6所述的方法,其特征在于,记录所述开始调度之前的第一监控期内已经被调度的多个历史消息的调度信息,包括:The method according to claim 6, wherein recording the scheduling information of multiple historical messages that have been scheduled in the first monitoring period before starting the scheduling, comprising:
    当确定所述第一监控期内所述计数器的更新次数小于或等于2次时,记录所述第一监控期内已经被调度的多个历史消息的调度信息。When it is determined that the number of times of updating the counter within the first monitoring period is less than or equal to 2, the scheduling information of the multiple historical messages that have been scheduled within the first monitoring period is recorded.
  8. 根据权利要求6所述的方法,其特征在于,记录所述开始调度之前的第一监控期内已经被调度的多个历史消息的调度信息,包括:The method according to claim 6, wherein recording the scheduling information of multiple historical messages that have been scheduled in the first monitoring period before starting the scheduling, comprising:
    当确定所述第一监控期内所述计数器的更新次数大于2次时,记录所述第一监控期内已经被调度的多个历史消息的调度信息、以及记录所述第一监控期内系统的休眠时间。When it is determined that the number of times the counter is updated during the first monitoring period is greater than 2, record scheduling information of multiple historical messages that have been scheduled within the first monitoring period, and record the system during the first monitoring period. sleep time.
  9. 根据权利要求5所述的方法,其特征在于,在结束调度所述目标消息时,记录所述结束调度之前的第二监控期内已经被调度的多个历史消息的调度信息,包括:The method according to claim 5, wherein when scheduling the target message is ended, recording scheduling information of multiple historical messages that have been scheduled within the second monitoring period before the scheduling is ended, comprising:
    在结束调度所述目标消息时,检测计数器是否发生更新;When finishing scheduling the target message, detecting whether the counter is updated;
    若在结束调度所述目标消息时,检测到所述计数器未发生更新,则从所述消息队列中获取所述目标消息的下一个消息;If it is detected that the counter has not been updated when the target message is scheduled to end, the next message of the target message is obtained from the message queue;
    若在结束调度所述目标消息时,检测到所述计数器发生更新,则记录所述结束调度之前的第二监控期内已经被调度的多个历史消息的调度信息;If it is detected that the counter is updated when scheduling the target message is completed, recording scheduling information of multiple historical messages that have been scheduled within the second monitoring period before the scheduling is completed;
    其中,所述第二监控期对应于从结束调度所述目标消息时检测到所述计数器发生更新到上一次检测到所述计数器发生更新之间;所述多个历史消息的调度信息包括所述多个历史消息的总个数和所述多个历史消息总的调度耗时。Wherein, the second monitoring period corresponds to the period from when the target message is scheduled to be updated and the counter is detected to be updated last time; the scheduling information of the multiple historical messages includes the The total number of the multiple historical messages and the total scheduling time of the multiple historical messages.
  10. 根据权利要求9所述的方法,其特征在于,记录所述结束调度之前的第二监控期内已经被调度的多个历史消息的调度信息,包括:The method according to claim 9, wherein recording scheduling information of multiple historical messages that have been scheduled within the second monitoring period before ending scheduling, comprising:
    当确定所述第二监控期内所述计数器的更新次数小于或等于2次时,记录所述第二监控期内已经被调度的多个历史消息的调度信息。When it is determined that the number of updates of the counter in the second monitoring period is less than or equal to 2, the scheduling information of a plurality of historical messages that have been scheduled in the second monitoring period is recorded.
  11. 根据权利要求9所述的方法,其特征在于,记录所述结束调度之前的第二监控期内已经被调度的多个历史消息的调度信息,包括:The method according to claim 9, wherein recording scheduling information of multiple historical messages that have been scheduled within the second monitoring period before ending scheduling, comprising:
    当确定所述第二监控期内所述计数器的更新次数大于2次时,记录所述目标消息的调度信息、以及记录所述第二监控期内除所述目标消息之外的已经被调度的历史消息的调度信息。When it is determined that the number of updates of the counter in the second monitoring period is greater than 2, the scheduling information of the target message is recorded, and the scheduled information other than the target message in the second monitoring period is recorded. Scheduling information for historical messages.
  12. 根据权利要求9所述的方法,其特征在于,在结束调度所述目标消息时,检测计数器是否发生更新,包括:The method according to claim 9, wherein, when the target message is scheduled to end, detecting whether the counter is updated, comprising:
    在结束调度所述目标消息时,检测所述目标消息的消息类型是否为预设类型;When finishing scheduling the target message, detecting whether the message type of the target message is a preset type;
    在所述目标消息的消息类型不是预设类型的情况下,检测所述计数器是否发生更新;In the case that the message type of the target message is not a preset type, detecting whether the counter is updated;
    在所述目标消息的消息类型为预设类型的情况下,记录所述目标消息的调度信息。When the message type of the target message is a preset type, the scheduling information of the target message is recorded.
  13. 一种性能问题定位装置,其特征在于,包括:A device for locating performance problems, comprising:
    响应模块,用于响应于应用程序出现的性能问题,根据消息调度时序图确定所述性能问题出现时已经被调度的多个历史消息的调度信息,所述消息调度时序图用于显示所述多个历史消息的调度信息;The response module is configured to, in response to a performance problem occurring in the application, determine scheduling information of multiple historical messages that have been scheduled when the performance problem occurs according to a message scheduling sequence diagram, and the message scheduling sequence diagram is used to display the multiple historical messages. scheduling information of a historical message;
    问题定位模块,用于根据所述性能问题出现时已经被调度的多个历史消息的调度信息,对所述性能问题进行定位。A problem locating module, configured to locate the performance problem according to scheduling information of a plurality of historical messages that have been scheduled when the performance problem occurs.
  14. 一种电子设备,其特征在于,所述电子设备包括:An electronic device, characterized in that the electronic device comprises:
    多个处理器;multiple processors;
    存储装置,用于存储多个程序;a storage device for storing a plurality of programs;
    当所述多个程序被所述多个处理器执行,使得所述多个处理器实现如权利要求1-12中任一项所述的方法。When the plurality of programs are executed by the plurality of processors, the plurality of processors are caused to implement the method of any one of claims 1-12.
  15. 一种计算机可读存储介质,其上存储有计算机程序,其特征在于,该程序被处理器执行时实现如权利要求1-12中任一项所述的方法。A computer-readable storage medium on which a computer program is stored, characterized in that, when the program is executed by a processor, the method according to any one of claims 1-12 is implemented.
PCT/CN2022/074602 2021-03-10 2022-01-28 Performance issue locating method and apparatus, and electronic device and storage medium WO2022188576A1 (en)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN202110261774.X 2021-03-10
CN202110261774.XA CN112882857A (en) 2021-03-10 2021-03-10 Performance problem positioning method and device, electronic equipment and storage medium

Publications (1)

Publication Number Publication Date
WO2022188576A1 true WO2022188576A1 (en) 2022-09-15

Family

ID=76054155

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2022/074602 WO2022188576A1 (en) 2021-03-10 2022-01-28 Performance issue locating method and apparatus, and electronic device and storage medium

Country Status (2)

Country Link
CN (1) CN112882857A (en)
WO (1) WO2022188576A1 (en)

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112882857A (en) * 2021-03-10 2021-06-01 北京字节跳动网络技术有限公司 Performance problem positioning method and device, electronic equipment and storage medium

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US8196151B1 (en) * 2008-06-03 2012-06-05 Sprint Communications Company L.P. Detecting queue problems using messages entering and leaving a queue during a time period
CN108572906A (en) * 2018-04-24 2018-09-25 广州优视网络科技有限公司 ANR method for real-time monitoring, device, terminal and storage medium
CN108776624A (en) * 2018-05-29 2018-11-09 北京小米移动软件有限公司 Determine the method, apparatus and storage medium of terminal interim card reason
CN109165114A (en) * 2018-09-14 2019-01-08 Oppo广东移动通信有限公司 Processing method, device, storage medium and intelligent terminal of the application program without response
CN111506376A (en) * 2020-04-15 2020-08-07 北京字节跳动网络技术有限公司 Feedback information display method and device, readable medium and electronic equipment
CN112882857A (en) * 2021-03-10 2021-06-01 北京字节跳动网络技术有限公司 Performance problem positioning method and device, electronic equipment and storage medium

Family Cites Families (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107038107B (en) * 2017-03-09 2020-03-17 武汉斗鱼网络科技有限公司 Method and device for acquiring application blocking information
CN109324946A (en) * 2018-09-10 2019-02-12 天津字节跳动科技有限公司 Operational monitoring method, apparatus, electronic equipment and computer readable storage medium

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US8196151B1 (en) * 2008-06-03 2012-06-05 Sprint Communications Company L.P. Detecting queue problems using messages entering and leaving a queue during a time period
CN108572906A (en) * 2018-04-24 2018-09-25 广州优视网络科技有限公司 ANR method for real-time monitoring, device, terminal and storage medium
CN108776624A (en) * 2018-05-29 2018-11-09 北京小米移动软件有限公司 Determine the method, apparatus and storage medium of terminal interim card reason
CN109165114A (en) * 2018-09-14 2019-01-08 Oppo广东移动通信有限公司 Processing method, device, storage medium and intelligent terminal of the application program without response
CN111506376A (en) * 2020-04-15 2020-08-07 北京字节跳动网络技术有限公司 Feedback information display method and device, readable medium and electronic equipment
CN112882857A (en) * 2021-03-10 2021-06-01 北京字节跳动网络技术有限公司 Performance problem positioning method and device, electronic equipment and storage medium

Also Published As

Publication number Publication date
CN112882857A (en) 2021-06-01

Similar Documents

Publication Publication Date Title
US11240126B2 (en) Distributed tracing for application performance monitoring
CN111475298B (en) Task processing method, device, equipment and storage medium
JP6191885B2 (en) Power efficient application notification system
US11526413B2 (en) Distributed tracing of huge spans for application and dependent application performance monitoring
WO2022227931A1 (en) Screen recording interaction method and apparatus, and electronic device and computer-readable storage medium
WO2022188576A1 (en) Performance issue locating method and apparatus, and electronic device and storage medium
CN111163336B (en) Video resource pushing method and device, electronic equipment and computer readable medium
CN114625597A (en) Monitoring operation and maintenance system, method and device, electronic equipment and storage medium
WO2022160913A1 (en) Method and apparatus for detecting application freezing problem, and device and storage medium
WO2022148485A1 (en) Information display method and apparatus, and electronic device
CN112954056B (en) Method and device for processing monitoring data, electronic equipment and storage medium
US11797218B2 (en) Method and device for detecting slow node and computer-readable storage medium
WO2023231851A1 (en) Information processing methods and apparatuses, and electronic device
CN112860513A (en) Application non-response monitoring method, device, equipment and storage medium
CN111552613A (en) Thread timeout processing method and device and electronic equipment
CN111367783B (en) Application program testing method and device and electronic equipment
US11960703B2 (en) Template selection method, electronic device and non-transitory computer-readable storage medium
CN109960659B (en) Method and device for detecting application program
WO2022057581A1 (en) Content display method and apparatus, electronic device, and computer readable storage medium
WO2020224295A1 (en) Information management method, device, and system
WO2021082893A1 (en) Desktop display control method and apparatus, terminal, and storage medium
CN115134254A (en) Network simulation method, device, equipment and storage medium
CN113568695A (en) Corner mark processing method and device for boarder application
CN117591488B (en) File detection method and device, storage medium and electronic equipment
WO2023138572A1 (en) User label detection method and apparatus, electronic device, and readable storage medium

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 22766103

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

32PN Ep: public notification in the ep bulletin as address of the adressee cannot be established

Free format text: NOTING OF LOSS OF RIGHTS PURSUANT TO RULE 112(1) EPC (EPO FORM 1205A DATED 23.01.2024)