WO2022262472A1 - Frame rate processing method and apparatus, storage medium, and terminal - Google Patents

Frame rate processing method and apparatus, storage medium, and terminal Download PDF

Info

Publication number
WO2022262472A1
WO2022262472A1 PCT/CN2022/091673 CN2022091673W WO2022262472A1 WO 2022262472 A1 WO2022262472 A1 WO 2022262472A1 CN 2022091673 W CN2022091673 W CN 2022091673W WO 2022262472 A1 WO2022262472 A1 WO 2022262472A1
Authority
WO
WIPO (PCT)
Prior art keywords
code
execution stack
target application
target
interface
Prior art date
Application number
PCT/CN2022/091673
Other languages
French (fr)
Chinese (zh)
Inventor
陈鑫
Original Assignee
Oppo广东移动通信有限公司
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 Oppo广东移动通信有限公司 filed Critical Oppo广东移动通信有限公司
Publication of WO2022262472A1 publication Critical patent/WO2022262472A1/en

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/30Monitoring
    • G06F11/3003Monitoring arrangements specially adapted to the computing system or computing system component being monitored
    • G06F11/302Monitoring arrangements specially adapted to the computing system or computing system component being monitored where the computing system component is a software system
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/07Responding to the occurrence of a fault, e.g. fault tolerance
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/07Responding to the occurrence of a fault, e.g. fault tolerance
    • G06F11/0703Error or fault processing not based on redundancy, i.e. by taking additional measures to deal with the error or fault not making use of redundancy in operation, in hardware, or in data representation
    • G06F11/079Root cause analysis, i.e. error or fault diagnosis
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/30Monitoring
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/30Monitoring
    • G06F11/3051Monitoring arrangements for monitoring the configuration of the computing system or of the computing system component, e.g. monitoring the presence of processing resources, peripherals, I/O links, software programs
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F3/00Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
    • G06F3/14Digital output to display device ; Cooperation and interconnection of the display device with other functional units
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/44Arrangements for executing specific programs
    • G06F9/451Execution arrangements for user interfaces
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04MTELEPHONIC COMMUNICATION
    • H04M1/00Substation equipment, e.g. for use by subscribers
    • H04M1/72Mobile telephones; Cordless telephones, i.e. devices for establishing wireless links to base stations without route selection
    • H04M1/724User interfaces specially adapted for cordless or mobile telephones
    • H04M1/72403User interfaces specially adapted for cordless or mobile telephones with means for local support of applications that increase the functionality

Definitions

  • the present application relates to the technical field of device display, and in particular to a frame rate processing method, device, storage medium and terminal.
  • the terminal can transmit information to the user by displaying relevant pictures. one of the focuses of the research.
  • the method of counting the frame rate of a certain application when it is running requires the terminal to be connected to special peripheral equipment, and to be connected to a computer and a server to assist in analyzing the frame loss rate. Due to the need to purchase additional peripheral equipment, such as a frame rate collector, the cost of frame rate processing is relatively high.
  • the present application provides a frame rate processing method, device, storage medium and terminal, which can solve the problem of high frame rate detection due to the need to purchase additional peripheral equipment in related technologies, and the inability to locate and analyze in real time the cause of frame loss
  • the cause is a technical problem.
  • the embodiment of the present application provides a frame rate processing method, the method including:
  • an embodiment of the present application provides a frame rate processing device, which includes:
  • a frame loss calculation module configured to count the number of times the target application program executes the interface drawing interface within a preset time interval, and calculate the number of times the target application program executes the interface drawing interface in the preset time interval according to the preset time interval and the number of times frame loss rate;
  • An execution stack determining module configured to obtain the execution time of each code execution stack corresponding to the target application within the preset time interval, and determine the execution time of the target application program according to the execution time of each code execution stack The object code execution stack of the frame;
  • the code printing module is used to print the target code functions included in the target code execution stack and the running time corresponding to each target code function.
  • an embodiment of the present application provides a computer storage medium, where a plurality of instructions are stored in the computer storage medium, and the instructions are suitable for being loaded by a processor and executing the steps of the above method.
  • an embodiment of the present application provides a terminal, including a memory, a processor, and a computer program stored in the memory and operable on the processor, the computer program being suitable for being loaded by the processor and executing the above method step.
  • the present application provides a frame rate processing method. First, count the number of times the target application program executes the interface drawing interface within a preset time interval, and calculate the frame loss rate of the target application program within the preset time interval according to the preset time interval and times; Then obtain the execution time of each code execution stack corresponding to the target application within the preset time interval, and determine the target code execution stack that causes the target application to lose frames according to the execution time of each code execution stack; finally print the target code execution stack including The target code functions and the running time corresponding to each target code function. Because the frame loss rate is determined by counting the number of times the target application executes the interface drawing interface within the preset time interval, that is, the frame loss rate is determined by pure software, which can reduce the cost of frame rate processing.
  • the code execution stack It can locate and analyze the target code execution stack that causes the frame loss of the target application program in real time, and print the target code functions included in the target code execution stack and the running time corresponding to each target code function, which can help developers quickly and accurately analyze to find out the cause of the dropped frame.
  • FIG. 1 is an exemplary system architecture diagram of a frame rate processing method provided in an embodiment of the present application
  • FIG. 2 is a system interaction diagram of a frame rate processing method provided by an embodiment of the present application
  • FIG. 3 is a schematic flowchart of a frame rate processing method provided in an embodiment of the present application.
  • FIG. 4 is a schematic diagram of an interface drawing principle provided in an embodiment of the present application.
  • FIG. 5 is a schematic diagram of calculating a frame loss rate provided by an embodiment of the present application.
  • FIG. 6 is a schematic diagram of an application program interface display provided by the embodiment of the present application.
  • FIG. 7 is a schematic structural diagram of a code execution stack provided by an embodiment of the present application.
  • FIG. 8 is a schematic flowchart of a frame rate processing method provided by another embodiment of the present application.
  • FIG. 9 is a schematic diagram of an aggregate structure provided by an embodiment of the present application.
  • FIG. 10 is a structural block diagram of a frame rate processing device provided by an embodiment of the present application.
  • FIG. 11 is a structural block diagram of a frame rate processing device provided by another embodiment of the present application.
  • FIG. 12 is a schematic structural diagram of a terminal provided by an embodiment of the present application.
  • FIG. 1 is an exemplary system architecture diagram of a frame rate processing method provided by an embodiment of the present application.
  • the system architecture may include a terminal 101 , a network 102 and a server 103 .
  • the network 102 is a medium for providing a communication link between the terminal 101 and the server 103 .
  • the network 102 may include various types of wired communication links or wireless communication links, for example: wired communication links include optical fiber, twisted pair or coaxial cables, wireless communication links include Bluetooth communication links, Wi-Fi ( Wireless-Fidelity, Wi-Fi) communication link or microwave communication link, etc.
  • the terminal 101 can interact with the server 103 through the network 102 to receive messages from the server 103 or send messages to the server 103 .
  • Terminal 101 may be hardware or software.
  • the terminal 101 can be various electronic devices, including but not limited to smart watches, smart phones, tablet computers, laptops, desktop computers, and the like.
  • the terminal 101 is software, it can be installed in the electronic devices listed above, which can be implemented as multiple software or software modules (for example: for providing distributed services), or can be implemented as a single software or software module, No specific limitation is made here.
  • the server 103 may be a service server that provides various services. It should be noted that the server 103 may be hardware or software. When the server 103 is hardware, it can be implemented as a distributed server cluster composed of multiple servers, or as a single server. When the server 103 is software, it can be implemented as multiple software or software modules (for example, for providing distributed services), or as a single software or software module, which is not specifically limited here.
  • terminals, networks, and servers in FIG. 1 are only illustrative, and may be any number of terminals, networks, and servers according to implementation requirements.
  • FIG. 2 is a system interaction diagram of a frame rate processing method provided by the embodiment of the present application.
  • the execution subject may be a terminal or a processor in the terminal, or may be
  • the processor in the terminal is used as the execution subject as an example, and a system interaction process in a frame rate processing method is introduced with reference to FIG. 1 and FIG. 2 .
  • a user runs a target application program.
  • Any application program in the terminal can be determined as the target application program as required.
  • the processor counts the number of times the target application program executes the interface drawing interface within the preset time interval, and calculates the frame loss rate of the target application program within the preset time interval according to the preset time interval and times.
  • the target application program before counting the number of times the target application program executes the interface drawing interface within the preset time interval, it also includes: determining the system interface drawing cycle corresponding to the target application program, and determining the preset number of system interface drawing cycles as the preset time interval.
  • calculating the frame loss rate of the target application in the preset time interval according to the preset time interval and the number of times includes: obtaining the ratio of the target difference to the preset number, and using the ratio as the target application in the preset time interval The frame loss rate within ; wherein, the target difference is the difference between the number of times the target application program executes the interface drawing interface and the preset number.
  • the processor acquires the execution time of each code execution stack corresponding to the target application program within a preset time interval, and determines the target code execution stack that causes the target application program to drop a frame according to the execution time of each code execution stack.
  • the target application program before counting the number of times the target application program executes the interface drawing interface within the preset time interval, it also includes: based on the first code inserted at the start position of each code function in the target application program, when each code function starts to run Record the identity, start time, and start flag of each code function respectively, and save them in the preset collection in chronological order; based on the second code inserted at the end position of each code function in the target application program, in each code function When the execution ends, the identity, end time, and end flag of each code function are recorded respectively, and are saved in the preset collection in chronological order.
  • obtaining the execution time of each code execution stack corresponding to the target application within the preset time interval includes: if the frame loss rate is greater than the preset frame loss rate threshold, determining that the target application corresponds to the The first identity of the initial code function of each code execution stack of each code execution stack, the first start flag matching the first identity of each initial code function is searched in the preset set, and the first start flag corresponding to the first start flag Time: determine the second identity mark of the end code function of each code execution stack corresponding to the target application program within the preset time interval, and search for the second end mark matching the second identity mark of each end code function in the preset set bit, and the second end time corresponding to the second end flag bit; the difference between the first start time of the initial code function of each code execution stack and the second end time of the end code function of each code execution stack is used as each code Execution time of the execution stack.
  • determining the target code execution stack that causes the frame loss of the target application program includes: determining the type of each code execution stack, and the type of code execution stack includes interface drawing execution stack and non-interface drawing execution Stack; the type of the code execution stack is the interface drawing execution stack, and the code execution stack whose execution time is longer than the system interface drawing cycle is determined as the target code execution stack; and/or the type of the code execution stack is non-interface drawing execution stack, and the code execution stack whose execution time of the code execution stack is greater than the execution time of the preset execution stack is determined as the target code execution stack.
  • the processor prints the target code functions included in the target code execution stack and the running time corresponding to each target code function.
  • printing the target code functions included in the target code execution stack and the running time corresponding to each target code function includes: determining the third identity between the initial code function and the end code function in the target code execution stack based on a preset set logo, the third start flag, the third end flag, the third start time and the third end time; obtain the corresponding target code functions according to each third identity, and obtain the corresponding target code functions according to the third start flag of each target code function
  • the third start time, the difference between the third end time corresponding to the third end flag bit of each object code function determines the running time corresponding to each object code function; print each object code function and the running time corresponding to each object code function .
  • the target application after calculating the frame loss rate of the target application in the preset time interval according to the preset time interval and times, it also includes: calculating the current interface frame rate of the target application, and displaying the current frame rate in the interface of the target application interface frame rate; and/or display the frame loss rate within a preset time interval in the interface of the target application.
  • the target application program before counting the number of times the target application program executes the interface drawing interface within the preset time interval, it also includes: assigning unique identities to each code function in the target application program, and linking each code function with the corresponding identities Establishing a mapping relationship; generating a mapping file based on all the mapping relationships, and packaging the mapping file into the target application, so that the target application loads the mapping file and resolves all the mapping relationships after installation.
  • the code execution stack It can locate and analyze the target code execution stack that causes the frame loss of the target application program in real time, and print the target code functions included in the target code execution stack and the running time corresponding to each target code function, which can help developers quickly and accurately analyze to find out the cause of the dropped frame.
  • FIG. 3 is a schematic flowchart of a frame rate processing method provided by an embodiment of the present application.
  • the frame rate processing method includes:
  • the frame rate processing method in the embodiment of the present application can be applied to the development and testing phase of the target application program by the developer, and can also be applied to the actual use process of the user.
  • the following is applied to the developer Taking the development and testing stages of the target application program as an example, the specific implementation process of the frame rate processing method is introduced.
  • the target application program can be any application program that requires frame rate testing or detection, for example, the target application program can be an audio-visual application program or a game application program that requires a high interface frame rate Program, where the frame rate (Frame rate) is the frequency (rate) at which the bitmap image in units of frames continuously appears on the display.
  • the target application program can be installed in the terminal first, and the terminal specifically uses the preset system to check the target application program.
  • the installation package is decompressed and installed, so that the target application can be run in the preset system after the installation of the target application is completed.
  • the preset system may be a terminal operating system such as an Android system and an Apple system.
  • this embodiment of the present application uses the Android system as an example for introduction.
  • the target application program can execute the preset program provided by the software development kit (Software Development Kit, SDK) in the preset system first.
  • the interface drawing signal can be considered as a vertical synchronization signal or a time pulse signal, and then the target application program can execute a complete interface drawing program based on the interface drawing signal to form a frame picture.
  • the target application continuously obtains the interface drawing signals sent by the preset system, it will execute multiple complete interface drawing programs based on each interface drawing signal to form a continuous multi-frame picture, then the user can observe Display a smooth interface composed of multiple frames in the interface of the target application program.
  • the interface drawing signal sent by the preset system has a certain cycle, which is also the system interface drawing cycle.
  • the system interface drawing cycle is related to the refresh rate of the system interface corresponding to the preset system. For example, when the preset system corresponds to The refresh rate of the interface is 60 Hz, that is, the system interface needs to be refreshed 60 times in one second, so the preset system will send 60 interface drawing signals within 1 second (1000 milliseconds), so that the target application can draw based on the interface If the signal executes 60 complete interface drawing programs within 1 second, then the system interface drawing cycle can be obtained to be about 16.6 milliseconds (1000 milliseconds/60 times).
  • the interface refresh rate corresponding to the preset system there is no limitation on the interface refresh rate corresponding to the preset system, and the interface refresh rate corresponding to the preset system may be 60 Hz, 90 Hz, or 144 Hz.
  • the principle of interface drawing is described in detail below in combination with FIG. 4 .
  • FIG. 4 is a schematic diagram of an interface drawing principle provided by an embodiment of the present application.
  • the preset system sends an interface drawing signal to the target application through the preset interface every 16.6 milliseconds, if there is a drawing event in the target application , then the target application program executes the preset interface to obtain the interface drawing signal, and executes the interface drawing program once to draw a frame of picture in the interface of the target application program.
  • the target application will complete the drawing of the interface before obtaining the next interface drawing signal, as shown in Figure 4 for the first drawing, and the interface drawing program is executed within 16.6 milliseconds of the interface drawing cycle. At this time The display interface of the target application does not experience dropped frames.
  • the second drawing took up about 3 interface drawing cycles. If there should have been planned drawing events in the last two interface drawing cycles of the 3 interface drawing cycles, but the second drawing has not ended It will cause the target application to fail to execute the preset interface to obtain the interface drawing signal and execute the interface drawing program, which means that the drawing events of the next two drawing cycles will not be executed. At this time, the display interface of the target application will drop frames. Case. A special case is that when there is no drawing event in the target application program, the target application program can execute the preset interface, that is, obtain the interface drawing signal, but the interface drawing signal will not call and execute the interface drawing program. At this time, the target application program is considered The display interface does not drop frames.
  • the target application program executes the preset interface once, it can obtain the interface drawing signal sent by the preset system through the preset interface and execute the interface drawing program once.
  • the number of times the program executes the interface drawing interface within a certain period of time can determine the frame rate and frame loss rate of the target application program.
  • the preset interface may only allow the source code of the target application to be executed, and the code in the processor or the code written by the developer cannot directly access the preset interface, so a feasible implementation
  • the method is that the developer can write the preset interface so that on the basis of the preset interface, the preset interface provides another interface, which can be named interface drawing interface, and the interface drawing interface can be used in the target application
  • the source code receives the interface drawing signal sent by the preset system, and the interface drawing program in the target application program can implement the interface drawing interface, and uses the interface drawing interface as the only entry to drive the operation of the interface drawing program in the target application program.
  • the code written by the developer can also implement the interface drawing interface, so that the interface drawing interface can also be accessed by the code written by the developer, and the interface drawing interface can also be used for the code written by the developer to receive the interface drawing sent by the preset system signal, and the code written by the developer to implement the interface drawing interface is consistent with the interface drawing program in the target application program, that is, the source code of the target application program can execute the preset interface in the system interface drawing cycle and the interface drawing interface in the system interface There is no difference in the execution of the interface drawing interface in the drawing cycle. It can be understood that if in some preset systems, the preset interface can be executed by the source code of the target application program, or by the code in the processor or the code written by the developer, then in the preset system, The default interface is also the interface drawing interface.
  • the interface drawing interface can also be accessed by the code written by the developer, and the source code of the target application program can execute the preset interface in the system interface drawing cycle and execute the interface drawing interface in the system interface drawing cycle, there is no difference, then the target application can be obtained As long as the program executes the interface drawing interface once, it can obtain an interface drawing signal sent by the preset system through the interface drawing interface, and execute the interface drawing program once.
  • the preset code written by the developer can be used to count the number of times the target application program executes the interface drawing interface within the preset time interval.
  • the interface drawing interface will be executed once, then the preset time interval can be set to include the preset number of system interface drawing cycles, then the preset number and the target within the preset time interval can be used.
  • the number of times the application program executes the interface drawing interface calculates the frame loss rate of the target application program within the preset time interval.
  • the number of times the target application program executes the interface drawing interface within the preset time interval can also be calculated.
  • the ratio of the target difference to the preset number can be obtained, and the ratio can be used as the frame loss rate of the target application within the preset time interval, wherein the target difference is the number of times the target application executes the interface drawing interface and the preset
  • the difference between the quantities That is, the difference between the preset number and the number of times may be determined first, and the ratio of the difference to the preset number may be calculated, and the ratio may be used as the frame loss rate of the target application within the preset time interval. It is also possible to calculate all preset time intervals included in the last unit time, and use the number of times the target application executes the interface drawing interface in all preset time intervals as the current interface frame rate of the target application.
  • Figure 5 is a schematic diagram of a frame loss rate calculation provided by the embodiment of the present application.
  • the interface refresh rate corresponding to the preset system as 60 Hz as an example
  • the default system every 16.6 milliseconds
  • Send an interface drawing signal to the target application program through the interface drawing interface if there is a drawing event in the target application program, then the target application program executes the interface drawing interface to obtain the interface drawing signal, and executes the interface drawing program once, so as to be in the target application program Draw a frame in the interface.
  • the target application program executes the interface drawing interface once, and the interface drawing program is executed within 16.6 milliseconds of the interface drawing cycle. At this time, the display interface of the target application program does not drop frames.
  • the target application executes the interface drawing interface once, but executes the interface drawing program within 3 interface drawing cycles, that is, the second drawing takes up 3 interface drawing cycles. If a drawing event should have been planned in the two interface drawing cycles of the three interface drawing cycles, but because the second drawing has not ended, the target application cannot execute the preset interface to obtain the interface drawing signal and execute the interface drawing program , that is, the drawing events of the next two drawing cycles will not be executed, and at this time, the display interface of the target application program drops frames. From the third drawing to the eighth drawing later on, the target application program will execute the interface drawing interface once respectively, and execute the interface drawing program in one drawing cycle respectively, that is, the third drawing to the eighth drawing are equal to each other. No frame drops occurred.
  • the preset time interval includes the system interface drawing cycle
  • the preset number of is 10, so the difference between the preset number and the number of times is 2, and the ratio of the difference to the preset number is 0.2, then the frame loss rate of the target application within the preset time interval is 20%. Furthermore, it is also possible to calculate all the preset time intervals included in the last unit time.
  • the unit time is 1 second
  • the preset number of drawing cycles of the system interface included in the preset time interval is 10
  • the number of times the target application program executes the interface drawing interface within the 6 preset time intervals is used as the current interface frame rate of the target application program.
  • the frame loss rate within a plurality of subsequent preset time intervals can also be calculated sequentially, and can also be displayed on the interface of the target application
  • the frame loss rate in each preset time interval is displayed in .
  • a window may be added at any position of the application interface of the target application, and the calculated frame loss rate of the target application within each preset time interval is displayed in real time through the window.
  • FIG. 6 is a schematic diagram of an application program interface display provided by an embodiment of the present application.
  • a target application program is running in the terminal 600 , and a window 620 may be set in the display interface 610 of the target application program, and the window 620 displays the calculated frame loss rate within each preset time interval.
  • the frame loss rate in different intervals can be represented by different graphics, colors or filling patterns. For example, when using a histogram to indicate the frame loss rate in each preset time interval, you can use a green column to indicate no frame loss (frame loss 0%), use a blue column to indicate frame loss below 30%, and use a red column to indicate frame loss More than 30%; the height of the column can also be used to correspond to the size of the frame loss rate. For example, in Figure 6, the higher the height of the column, the greater the frame loss rate in the corresponding time interval.
  • the current interface frame rate of the target application program can also be obtained, the current interface frame rate of the target application program can also be displayed in window 620 as required.
  • the frame loss rate can be compared to a frame loss rate threshold, which can be set as desired, for example, the frame loss rate threshold can be unaffected The minimum frame loss rate at which the user normally watches the display of the target application. Then when the frame loss rate is greater than the frame loss rate threshold, it will affect the user's normal viewing of the display screen of the target application.
  • the advantage of this implementation is that it can reduce the target application. Power consumption due to frame loss of the target application due to positioning.
  • the following takes locating the cause of the frame loss of the target application when the frame loss rate is greater than the frame loss rate threshold as an example, and specifically introduces the method of locating the cause of the frame loss of the target application.
  • a thread can include multiple code execution stacks arranged in the order of execution.
  • the code execution stack can be considered as a collection of code functions, and the execution process of the interface drawing program is also the execution process of the code functions in the code execution stack.
  • FIG. 7 is a schematic structural diagram of a code execution stack provided by an embodiment of the present application.
  • non-interface drawing code execution stack 1 in Figure 7.
  • the execution process of the non-interface drawing code execution stack 1 takes up more thread execution time, which in turn causes the interface drawing code execution stack 2 to fail to draw on the corresponding system interface.
  • the cycle is executed normally, resulting in frame loss on the display interface of the target application.
  • the length of the execution process of the code execution stack may cause the frame loss of the target application program, so a feasible implementation method for determining the cause of the frame loss of the target application program is, if If the frame loss rate within the preset time interval is greater than the frame loss rate threshold, first obtain the execution time of each code execution stack corresponding to the target application within the preset time interval, so as to determine whether the corresponding code execution stack is executed according to the execution time A problem arises, wherein the manner of determining the execution time of each code execution stack corresponding to the target application program within the preset time interval may not be limited.
  • the execution time corresponding to each code execution stack during normal execution can also be determined according to the type of each code execution stack, and each code The execution time of the execution stack is compared with its corresponding execution time during normal execution. If the execution time of the code execution stack is greater than its corresponding execution time during normal execution, the code execution stack can be determined as the one that causes the target application to drop frames. Object code execution stack.
  • the code execution stack can be considered as a collection of code functions, so the code execution stack can include at least one code function, then after determining the target code execution stack that causes the target application to drop frames, in order to facilitate the analysis of the developer
  • the code functions that cause the target application to drop frames can also be obtained from the target code functions included in the target code execution stack and the running time corresponding to each target code function, and the target code functions and the running time corresponding to each target code function are calculated.
  • Print where the specific way of printing can be to print logs or upload print logs.
  • the target code can be determined
  • the function is the cause of the problem in the execution of the target code execution stack. Developers can optimize the target code function so that the target code function and the corresponding target code execution stack can run normally, so that the target application can draw the interface normally. Addresses frame dropping issues with target applications.
  • the code execution stack It can locate and analyze the target code execution stack that causes the frame loss of the target application program in real time, and print the target code functions included in the target code execution stack and the running time corresponding to each target code function, which can help developers quickly and accurately analyze to find out the cause of the dropped frame.
  • FIG. 8 is a schematic flowchart of a frame rate processing method provided by another embodiment of the present application.
  • the method includes:
  • each code function in the target application can be assigned a unique identity, and establish a mapping relationship between each code function and the corresponding identity, so that each code function and its corresponding identity are mapped one by one. It is also possible to generate a mapping file based on all mapping relationships, for example, the mapping file is mapping.txt, and package the mapping file into the target application, so that after the target application is installed, the mapping file is loaded and all mapping relationships are resolved.
  • first code is used to record the identity and code of the corresponding code function based on the above-mentioned mapping relationship.
  • the start time when the function starts to run and the code function is the start identification bit to start running; and the second code is inserted at the end position of each code function, wherein the second code is used to record the identity and code of the corresponding code function based on the above-mentioned mapping relationship
  • the end time of the function ending operation and the code function is the end identification bit of the end operation.
  • the identity and start time of each code function can be recorded respectively when each code function starts running and the start flag, and are stored in the preset collection in chronological order.
  • the identity, start time, and start flag of each code function can be stored in a long-type storage method, wherein a long-type data includes 64-bit storage bytes, the first 18 bits of a long integer are used to save the identity of the corresponding code function, the middle 45 bits are used to save the start time of the corresponding code function, and the last bit is used to save the start flag of the corresponding code function.
  • the recording results can also be saved in a preset collection in chronological order.
  • the identity, start time, and start flag of each code function are stored in a long-type storage method
  • the order of the start time recorded in the long-type can be followed.
  • Each long type data is formed into a long type array, and the length of the long type array can be set according to the total number of code functions in the target application program, for example, the length of the long type array can be set to 8MB.
  • the identity of each code function can be recorded separately when each code function finishes running ID, end time and end flag, and save them in the preset collection in chronological order.
  • the identity, end time, and end flag of each code function can also be stored in a long-type storage method.
  • a long data type Including 64-bit storage bytes
  • the first 18 bits of a long integer are used to save the identity of the corresponding code function
  • the middle 45 bits are used to save the end time of the corresponding code function
  • the last bit is used to save the end sign of the corresponding code function bit.
  • the recording results can also be saved in the same preset set in the above steps in chronological order, that is, the identity, end time, and end flag of the code function It is stored in the same set as the code function's identity, end time, and end flag.
  • each code function when the identity, end time, and end flag of each code function are stored in a long-type storage method, after determining the long-type data of a code function, it can be recorded in the order of the end time in the long-type, Insert each long-type data into the above-mentioned long-type array, then the long-type array includes each long-type data arranged in chronological order.
  • FIG. 9 is a schematic diagram of an aggregate structure provided by an embodiment of the present application.
  • each code function when the identity, start time, end time, start flag, and end flag of each code function are stored in a long-type storage method, the left side of Figure 9 shows a long-type data storage method , that is, each long type data is formed into a set (long type array).
  • identity 1 represents the code function whose identity is 1
  • time 1 represents the start time of the code function whose identity is 1
  • flag 1 represents the start flag bit of the code function whose identity is 1
  • identity 1 represents the code function with identity 1
  • time 14 represents the end time of the code function with identity 1
  • mark 0 represents the code function with identity 1
  • the identity value represents the unique identity of the corresponding code function
  • the time value represents the start time or end time of the corresponding code function (judged according to the flag bit)
  • the flag value (0 Or 1) indicates whether the corresponding code function starts or ends, wherein the long data in the long array is sorted according to the start time or end time of the records.
  • different parts of the same code function can be executed separately, that is, other code functions can be nested in a code function, so the start time and end time of the same code function are different, and the same The start flag and end flag of the code function are also different.
  • step S803 reference may be made to the detailed description in step S301, which will not be repeated here.
  • the length of the execution process of the code execution stack may cause the frame loss of the target application program, so a feasible implementation method for determining the cause of the frame loss of the target application program is, if If the frame loss rate within the preset time interval is greater than the frame loss rate threshold, first obtain the execution time of each code execution stack corresponding to the target application within the preset time interval, so as to determine whether the corresponding code execution stack is executed according to the execution time problem appear.
  • the sequence of execution logic determines the execution order of the code functions. Therefore, according to the above mapping relationship, it is possible to first determine the code execution stacks corresponding to the target application program within the preset time interval, and then determine the first identity of the initial code function of each code execution stack, wherein the code execution
  • the initial code function of the stack refers to the code function that is executed first when the code execution stack starts to run, and finally finds the record result (for example, long data) corresponding to the first identity of each initial code function in the preset set, In the record result, if the first start flag matched with the first identity and the first start time corresponding to the first start flag are determined, then each first start time can be regarded as the time when each code execution stack starts to run.
  • S805. Determine the second identity of the end code function of each code execution stack corresponding to the target application within the preset time interval, and search for the second end mark matching the second identity of each end code function in the preset set bit, and the second end time corresponding to the second end flag bit.
  • the second identity of the end code function of each code execution stack corresponding to the target application within the preset time interval can also be determined according to the above mapping relationship, wherein the initial code function of the code execution stack refers to the start code function of the code execution stack The first code function to execute at runtime.
  • the start code function and the end code function of a code execution stack are different parts of the same code function, so the identity of the start code function and the end code function of a code execution stack
  • the identifiers can be the same (that is, the first identity identifier and the second identity identifier are the same); of course, the start code function and the end code function of a code execution stack may not be different parts of the same code function, so a code execution stack
  • the ID of the start code function and the ID of the end code function may also be different (that is, the first ID and the second ID are different).
  • each second end time can be considered as the time when each code execution stack finishes running.
  • each first start time can be considered as the time when each code execution stack starts running
  • each second end time can be considered as the time when each code execution stack ends running
  • the initial code function of each code execution stack can be The difference between the first start time of the code execution stack and the second end time of the end code function of each code execution stack is used as the execution time of each code execution stack.
  • the type of code execution stack includes an interface rendering execution stack and a non-interface rendering execution stack.
  • the types of code execution stacks include interface drawing execution stacks and non-interface drawing execution stacks, and the execution time of different types of code execution stacks is different, so when determining the target that causes the target application to drop frames When the code executes the stack, the type of each code execution stack can be determined first.
  • one interface drawing code execution stack corresponds to one system interface when the display interface of the target application program does not drop frames
  • the type of the code execution stack is the interface drawing execution stack
  • the execution of the interface drawing execution stack can be executed The time is compared with the system interface drawing cycle. If the execution time of the interface drawing execution stack is longer than the system interface drawing cycle, the code execution stack can be determined as the target code execution stack, that is, the target code execution stack that causes the target application to drop frames .
  • the non-interface drawing execution stack should occupy a small amount of time in the thread, so as to avoid occupying the subsequent system interface drawing cycle and avoid subsequent interface drawing
  • the code execution stack cannot be executed normally.
  • the non-interface drawing execution stack takes up less time in the thread. It can be set as the default execution stack execution time.
  • the specific value of the preset execution stack execution time can be set according to the needs.
  • the default execution stack The execution time can be considered as the minimum time for the normal execution of the non-interface drawing execution stack without affecting the normal execution of the subsequent interface drawing code execution stack.
  • the execution time of the non-interface drawing execution stack can be compared with the execution time of the preset execution stack.
  • the code execution stack can be determined as the target code execution stack, that is, the target code execution stack that causes the target application program to drop frames.
  • S810 Determine a third identity, a third start flag, a third end flag, a third start time, and a third end time between the initial code function and the end code function in the target code execution stack based on a preset set.
  • the code execution stack can be considered as a collection of code functions, so the code execution stack can include at least one code function, then after determining the target code execution stack that causes the target application to drop frames, in order to facilitate the analysis of the developer
  • the code function that causes the frame loss of the target application program can be obtained, and the target code functions included in the target code execution stack and the running time corresponding to each target code function can be obtained.
  • the identity of the initial code function and the identity of the end code function in the target code execution stack can be determined first according to the above mapping relationship. Since the record data in the preset collection is arranged in chronological order, the initial code function and the end code function The code functions between the end code functions are the target code functions in the target code execution stack, so all the identities between the identities of the initial code functions and the identities of the end code functions can be determined based on the preset set, and these The identities are determined as third identities, and these third identities are the identities of the object code functions. Further, a third start flag, a third end flag, a third start time, and a third end time of the target code function may also be determined according to the third identifier.
  • the corresponding target code functions can be determined based on the above-mentioned mapping relationship according to each third identity, and the target code function can be obtained from the code storage location of the target application program. specific code. Further, it is also possible to calculate the difference between the third start time corresponding to the third start flag of each object code function and the third end time corresponding to the third end flag of each object code function, and determine each difference as The running time corresponding to each object code function.
  • the target code can be determined
  • the function is the cause of the problem in the execution of the target code execution stack. Developers can optimize the target code function so that the target code function and the corresponding target code execution stack can run normally, so that the target application can draw the interface normally. Addresses frame dropping issues with target applications.
  • the execution time of each code execution stack corresponding to the target application program can be accurately calculated through the inserted code, so that the execution time of each code execution stack can be calculated according to each code execution stack.
  • Execution time determines the target code execution stack that causes the target application to drop frames, and the inserted code can also accurately locate the target code functions included in the target code execution stack and the corresponding running time of each target code function, which can help developers quickly , Accurately analyze the cause of frame loss.
  • FIG. 10 is a structural block diagram of a frame rate processing device provided by an embodiment of the present application.
  • the frame rate processing device 1000 includes:
  • the frame loss calculation module 1010 is configured to count the number of times the target application program executes the interface drawing interface within the preset time interval, and calculate the frame loss rate of the target application program within the preset time interval according to the preset time interval and times.
  • the frame loss calculation module 1010 is further configured to determine a system interface drawing period corresponding to the target application program, and determine a preset number of system interface drawing periods as a preset time interval.
  • calculating the frame loss rate of the target application in the preset time interval according to the preset time interval and the number of times includes: obtaining the ratio of the target difference to the preset number, and using the ratio as the target application in the preset time interval The frame loss rate within ; wherein, the target difference is the difference between the number of times the target application program executes the interface drawing interface and the preset number.
  • the frame loss calculation module 1010 is also used to calculate the current interface frame rate of the target application program, and display the current interface frame rate in the interface of the target application program; and/or display the preset time in the interface of the target application program The frame loss rate in the interval.
  • the execution stack determination module 1020 is configured to obtain the execution time of each code execution stack corresponding to the target application program within a preset time interval, and determine the target code execution stack that causes the target application program to drop frames according to the execution time of each code execution stack.
  • the code printing module 1030 is configured to print the target code functions included in the target code execution stack and the running time corresponding to each target code function.
  • FIG. 11 is a structural block diagram of a frame rate processing device provided by another embodiment of the present application.
  • the frame rate processing device 1000 includes:
  • the first code insertion module 1110 is used to record the identity, start time and start flag of each code function when each code function starts running based on the first code inserted at the start position of each code function in the target application program, And save them in the preset collection in chronological order.
  • the second code insertion module 1120 is used to record the identity, end time and end flag of each code function when each code function ends running based on the second code inserted at the end position of each code function in the target application program, And save them in the preset collection in chronological order.
  • the frame loss calculation module 1130 is configured to count the number of times the target application program executes the interface drawing interface within the preset time interval, and calculate the frame loss rate of the target application program within the preset time interval according to the preset time interval and times.
  • the first information determination module 1140 is configured to determine the first identity of the initial code function of each code execution stack corresponding to the target application program within the preset time interval if the frame loss rate is greater than the frame loss rate threshold, in the preset set Search for the first start flag matching the first identity of each initial code function, and the first start time corresponding to the first start flag.
  • the second information determination module 1150 is configured to determine the second identity of the end code function of each code execution stack corresponding to the target application within the preset time interval, and search for the second identity of each end code function in the preset set Identify the matched second end flag bit, and the second end time corresponding to the second end flag bit.
  • Execution stack time determination module 1160 is used to use the difference between the first start time of the initial code function of each code execution stack and the second end time of the end code function of each code execution stack as the execution time of each code execution stack.
  • the execution stack type determination module 1170 is configured to determine the type of each code execution stack, and the type of the code execution stack includes an interface drawing execution stack and a non-interface drawing execution stack.
  • the first judging module 1180 is configured to determine the type of the code execution stack as the interface drawing execution stack, and the code execution stack whose execution time is longer than the system interface drawing cycle as the target code execution stack.
  • the second judging module 1190 is configured to determine the code execution stack whose type is non-interface drawing execution stack and whose execution time is longer than the preset execution stack execution time as the target code execution stack.
  • the third information determination module 11100 is configured to determine the third identity, the third start flag, the third end flag, and the third start time between the initial code function and the end code function in the target code execution stack based on a preset set and the third end time.
  • the code time-consuming determination module 11110 is used to obtain the corresponding target code functions according to the third identities, according to the third start time corresponding to the third start flag of each target code function, and the third end flag of each target code function The difference of the corresponding third end time determines the running time corresponding to each target code function.
  • the printing module 11120 is used to print each object code function and the running time corresponding to each object code function.
  • a frame rate processing device includes: a frame loss calculation module, configured to count the number of times a target application program executes an interface drawing interface within a preset time interval, and calculate the number of times the target application program executes an interface drawing interface according to the preset time interval and times The frame loss rate within the preset time interval; the execution stack determination module is used to obtain the execution time of each code execution stack corresponding to the target application program within the preset time interval, and determine the resulting target according to the execution time of each code execution stack The target code execution stack where the application program drops frames; the code printing module is used to print the target code functions included in the target code execution stack and the running time corresponding to each target code function.
  • the frame loss rate is determined by counting the number of times the target application executes the interface drawing interface within the preset time interval, that is, the frame loss rate is determined by pure software, which can reduce the cost of frame rate processing.
  • the code execution stack It can locate and analyze the target code execution stack that causes the frame loss of the target application program in real time, and print the target code functions included in the target code execution stack and the running time corresponding to each target code function, which can help developers quickly and accurately analyze to find out the cause of the dropped frame.
  • An embodiment of the present application further provides a computer storage medium, where a plurality of instructions are stored in the computer storage medium, and the instructions are suitable for being loaded by a processor and executing the steps of any one of the methods in the foregoing embodiments.
  • FIG. 12 provides a schematic structural diagram of a terminal according to an embodiment of the present application.
  • a terminal 1200 may include: at least one central processing unit 1201 , at least one network interface 1204 , a user interface 1203 , a memory 1205 , and at least one communication bus 1202 .
  • the communication bus 1202 is used to realize connection and communication between these components.
  • the user interface 1203 may include a display screen (Display) and a camera (Camera), and the optional user interface 1203 may also include a standard wired interface and a wireless interface.
  • Display display screen
  • Camera Camera
  • the optional user interface 1203 may also include a standard wired interface and a wireless interface.
  • the network interface 1204 may optionally include a standard wired interface and a wireless interface (such as a WI-FI interface).
  • the central processing unit 1201 may include one or more processing cores.
  • the central processing unit 1201 uses various interfaces and lines to connect various parts of the entire terminal 1200, by running or executing instructions, programs, code sets or instruction sets stored in the memory 1205, and calling data stored in the memory 1205 to execute Various functions and processing data of the terminal 1200.
  • the central processing unit 1201 can adopt at least one of a digital signal processing (Digital Signal Processing, DSP), a field-programmable gate array (Field-Programmable Gate Array, FPGA), and a programmable logic array (Programmable Logic Array, PLA). A form of hardware to achieve.
  • DSP Digital Signal Processing
  • FPGA Field-Programmable Gate Array
  • PLA programmable logic array
  • the central processing unit 1201 may integrate one or a combination of a central processing unit (Central Processing Unit, CPU), an image central processing unit (Graphics Processing Unit, GPU) and a modem.
  • a central processing unit Central Processing Unit, CPU
  • an image central processing unit Graphics Processing Unit, GPU
  • a modem used to handle wireless communication.
  • the above-mentioned modem may not be integrated into the central processing unit 1201, but may be realized by a single chip.
  • the memory 1205 may include a random access memory (Random Access Memory, RAM), and may also include a read-only memory (Read-Only Memory).
  • the memory 1205 includes a non-transitory computer-readable storage medium (non-transitory computer-readable storage medium). The memory 1205 may be used to store instructions, programs, codes, sets of codes, or sets of instructions.
  • the memory 1205 may include a program storage area and a data storage area, wherein the program storage area may store instructions for implementing an operating system, instructions for at least one function (such as a touch function, a sound playback function, an image playback function, etc.), Instructions and the like for implementing the above method embodiments; the storage data area can store the data and the like involved in the above method embodiments.
  • the memory 1205 may also be at least one storage device located away from the aforementioned central processing unit 1201 .
  • the memory 1205 as a computer storage medium may include an operating system, a network communication module, a user interface module, and a frame rate processing program.
  • the user interface 1203 is mainly used to provide the user with an input interface to obtain the data input by the user; and the central processing unit 1201 can be used to call the frame rate processing program stored in the memory 1205, and specifically Do the following:
  • the target application program before counting the number of times the target application program executes the interface drawing interface within the preset time interval, it also includes: determining the system interface drawing cycle corresponding to the target application program, and determining the preset number of system interface drawing cycles as the preset time interval.
  • calculating the frame loss rate of the target application in the preset time interval according to the preset time interval and the number of times includes: obtaining the ratio of the target difference to the preset number, and using the ratio as the target application in the preset time interval The frame loss rate within ; wherein, the target difference is the difference between the number of times the target application program executes the interface drawing interface and the preset number.
  • the target application program before counting the number of times the target application program executes the interface drawing interface within the preset time interval, it also includes: based on the first code inserted at the start position of each code function in the target application program, when each code function starts to run Record the identity, start time, and start flag of each code function respectively, and save them in the preset collection in chronological order; based on the second code inserted at the end position of each code function in the target application program, in each code function When the execution ends, the identity, end time, and end flag of each code function are recorded respectively, and are saved in the preset collection in chronological order.
  • obtaining the execution time of each code execution stack corresponding to the target application within the preset time interval includes: if the frame loss rate is greater than the preset frame loss rate threshold, determining that the target application corresponds to the The first identity of the initial code function of each code execution stack of each code execution stack, the first start flag matching the first identity of each initial code function is searched in the preset set, and the first start flag corresponding to the first start flag Time: determine the second identity mark of the end code function of each code execution stack corresponding to the target application program within the preset time interval, and search for the second end mark matching the second identity mark of each end code function in the preset set bit, and the second end time corresponding to the second end flag bit; the difference between the first start time of the initial code function of each code execution stack and the second end time of the end code function of each code execution stack is used as each code Execution time of the execution stack.
  • determining the target code execution stack that causes the frame loss of the target application program includes: determining the type of each code execution stack, and the type of code execution stack includes interface drawing execution stack and non-interface drawing execution Stack; the type of the code execution stack is the interface drawing execution stack, and the code execution stack whose execution time is longer than the system interface drawing cycle is determined as the target code execution stack; and/or the type of the code execution stack is non-interface drawing execution stack, and the code execution stack whose execution time of the code execution stack is greater than the execution time of the preset execution stack is determined as the target code execution stack.
  • printing the target code functions included in the target code execution stack and the running time corresponding to each target code function includes: determining the third identity between the initial code function and the end code function in the target code execution stack based on a preset set logo, the third start flag, the third end flag, the third start time and the third end time; obtain the corresponding target code functions according to each third identity, and obtain the corresponding target code functions according to the third start flag of each target code function
  • the third start time, the difference between the third end time corresponding to the third end flag bit of each object code function determines the running time corresponding to each object code function; print each object code function and the running time corresponding to each object code function .
  • the target application after calculating the frame loss rate of the target application in the preset time interval according to the preset time interval and times, it also includes: calculating the current interface frame rate of the target application, and displaying the current frame rate in the interface of the target application interface frame rate; and/or display the frame loss rate within a preset time interval in the interface of the target application.
  • the target application program before counting the number of times the target application program executes the interface drawing interface within the preset time interval, it also includes: assigning unique identities to each code function in the target application program, and linking each code function with the corresponding identities Establishing a mapping relationship; generating a mapping file based on all the mapping relationships, and packaging the mapping file into the target application, so that the target application loads the mapping file and resolves all the mapping relationships after installation.
  • the disclosed devices and methods may be implemented in other ways.
  • the device embodiments described above are only illustrative.
  • the division of modules is only a logical function division. In actual implementation, there may be other division methods.
  • multiple modules or components can be combined or integrated. to another system, or some features may be ignored, or not implemented.
  • the mutual coupling or direct coupling or communication connection shown or discussed may be through some interfaces, and the indirect coupling or communication connection of devices or modules may be in electrical, mechanical or other forms.
  • a module described as a separate component may or may not be physically separated, and a component shown as a module may or may not be a physical module, that is, it may be located in one place, or may also be distributed to multiple network modules. Part or all of the modules can be selected according to actual needs to achieve the purpose of the solution of this embodiment.
  • each functional module in each embodiment of the present application may be integrated into one processing module, each module may exist separately physically, or two or more modules may be integrated into one module.
  • the above-mentioned integrated modules can be implemented in the form of hardware or in the form of software function modules.
  • the integrated modules are realized in the form of software function modules and sold or used as independent products, they can be stored in a computer-readable storage medium.
  • the technical solution of the present application is essentially or part of the contribution to the prior art or all or part of the technical solution can be embodied in the form of a software product, and the computer software product is stored in a storage medium , including several instructions to make a computer device (which may be a personal computer, a server, or a network device, etc.) execute all or part of the steps of the methods in various embodiments of the present application.
  • the aforementioned storage media include: U disk, mobile hard disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), magnetic disk or optical disc, etc., which can store program codes. .

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Human Computer Interaction (AREA)
  • Software Systems (AREA)
  • Quality & Reliability (AREA)
  • Computing Systems (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Health & Medical Sciences (AREA)
  • Biomedical Technology (AREA)
  • Mathematical Physics (AREA)
  • Debugging And Monitoring (AREA)

Abstract

The present application discloses a frame rate processing method and apparatus, a storage medium, and a terminal, which relate to the technical field of device display. The method comprises: first, counting the number of times that a target application executes an interface-drawing interface, and according to a preset time interval and the number of times, calculating the frame loss rate of the target application in the preset time interval; then, acquiring the execution time of each code execution stack corresponding to the target application in the preset time interval, and according to the execution time of each code execution stack, determining a target code execution stack causing the target application to lose frames; finally, printing a target code function comprised in the target code execution stack and runtime corresponding to each target code function. As frame loss rate is determined by purely software means, the cost of frame rate processing may be reduced. In addition, a target code execution stack causing frame loss of a target application may be positioned and analyzed in real time, which may help developers to quickly and accurately analyze the cause of the frame loss.

Description

帧率处理方法、装置、存储介质以及终端Frame rate processing method, device, storage medium and terminal
本申请要求了2021年6月18日提交的、申请号为202110683368.2、发明名称为“帧率处理方法、装置、存储介质以及终端”的中国专利申请的优先权,其全部内容通过引用结合在本申请中。This application claims the priority of the Chinese patent application with the application number 202110683368.2 and the title of the invention "frame rate processing method, device, storage medium and terminal" filed on June 18, 2021, the entire contents of which are incorporated herein by reference. Applying.
技术领域technical field
本申请涉及设备显示技术领域,尤其涉及一种帧率处理方法、装置、存储介质以及终端。The present application relates to the technical field of device display, and in particular to a frame rate processing method, device, storage medium and terminal.
背景技术Background technique
随着科学技术的发展,越来越多的终端出现在人们的生活中,终端可以通过显示相关画面来与用户进行信息传递,因此关于终端中显示画面的帧率处理方法也成为本领域技术人员研究的重点之一。With the development of science and technology, more and more terminals appear in people's lives. The terminal can transmit information to the user by displaying relevant pictures. one of the focuses of the research.
在相关技术中,统计某一应用程序运行时的帧率的方法是需要终端连接专门的外设装备,以及连接计算机、服务器以辅助分析丢帧率。由于需要购买额外的外设装备,例如画面帧率采集器,导致帧率处理的成本较高。In related technologies, the method of counting the frame rate of a certain application when it is running requires the terminal to be connected to special peripheral equipment, and to be connected to a computer and a server to assist in analyzing the frame loss rate. Due to the need to purchase additional peripheral equipment, such as a frame rate collector, the cost of frame rate processing is relatively high.
发明内容Contents of the invention
本申请提供一种帧率处理方法、装置、存储介质以及终端,可以解决相关技术中由于需要购买额外的外设装备,导致帧率检测的成本较高,且无法实时定位分析出导致丢帧的原因的技术问题。The present application provides a frame rate processing method, device, storage medium and terminal, which can solve the problem of high frame rate detection due to the need to purchase additional peripheral equipment in related technologies, and the inability to locate and analyze in real time the cause of frame loss The cause is a technical problem.
第一方面,本申请实施例提供一种帧率处理方法,该方法包括:In the first aspect, the embodiment of the present application provides a frame rate processing method, the method including:
统计在预设时间区间内目标应用程序执行界面绘制接口的次数,根据所述预设时间区间以及所述次数计算所述目标应用程序在所述预设时间区间内的丢帧率;Counting the number of times the target application program executes the interface drawing interface within the preset time interval, and calculating the frame loss rate of the target application program within the preset time interval according to the preset time interval and the number of times;
获取在所述预设时间区间内所述目标应用程对应的各代码执行栈的执行时间,以及根据所述各代码执行栈的执行时间确定导致所述目标应用程序丢帧的目标代码执行栈;Obtain the execution time of each code execution stack corresponding to the target application program within the preset time interval, and determine the target code execution stack that causes the target application program to drop frames according to the execution time of each code execution stack;
打印所述目标代码执行栈包括的目标代码函数以及各目标代码函数对应的运行耗时。Print the target code functions included in the target code execution stack and the running time corresponding to each target code function.
第二方面,本申请实施例提供一种帧率处理装置,该装置包括:In a second aspect, an embodiment of the present application provides a frame rate processing device, which includes:
丢帧计算模块,用于统计在预设时间区间内目标应用程序执行界面绘制接口的次数,根据所述预设时间区间以及所述次数计算所述目标应用程序在所述预设时间区间内的丢帧率;A frame loss calculation module, configured to count the number of times the target application program executes the interface drawing interface within a preset time interval, and calculate the number of times the target application program executes the interface drawing interface in the preset time interval according to the preset time interval and the number of times frame loss rate;
执行栈确定模块,用于获取在所述预设时间区间内所述目标应用程对应的各代码执行栈的执行时间,以及根据所述各代码执行栈的执行时间确定导致所述目标应用程序丢帧的目标代码执行栈;An execution stack determining module, configured to obtain the execution time of each code execution stack corresponding to the target application within the preset time interval, and determine the execution time of the target application program according to the execution time of each code execution stack The object code execution stack of the frame;
代码打印模块,用于打印所述目标代码执行栈包括的目标代码函数以及各目标代码函数对应的运行耗时。The code printing module is used to print the target code functions included in the target code execution stack and the running time corresponding to each target code function.
第三方面,本申请实施例提供一种计算机存储介质,所述计算机存储介质存储有多条指令,所述指令适于由处理器加载并执行上述的方法的步骤。In a third aspect, an embodiment of the present application provides a computer storage medium, where a plurality of instructions are stored in the computer storage medium, and the instructions are suitable for being loaded by a processor and executing the steps of the above method.
第四方面,本申请实施例提供一种终端,包括存储器、处理器及存储在存储器上并可在处理器上运行的计算机程序,所述计算机程序适于由处理器加载并执行上述的方法的步骤。In a fourth aspect, an embodiment of the present application provides a terminal, including a memory, a processor, and a computer program stored in the memory and operable on the processor, the computer program being suitable for being loaded by the processor and executing the above method step.
本申请一些实施例提供的技术方案带来的有益效果至少包括:The beneficial effects brought by the technical solutions provided by some embodiments of the present application at least include:
本申请提供一种帧率处理方法,首先统计在预设时间区间内目标应用程序执行界面绘制接口的次数,根据预设时间区间以及次数计算目标应用程序在预设时间区间内的丢帧率;然后获取在预设时间区间内目标应用程对应的各代码执行栈的执行时间,以及根据各代码执行栈的执行时间确定导致目标应用程序丢帧的目标代码执行栈;最后打印目标代码执行栈包括的目标代码函数以及各目标代码函数对应的运行耗时。由于是通过统计在预设时间区间内目标应用程序执行界面绘制接口的次数来确定丢帧率,也即通过纯软件的方式确定丢帧率,可以减少帧率处理的成本,另外通过代码执行栈的执行时间,可以实时定位分析出导致目标应用程序丢帧的目标代码执行栈,打印目标代码执行栈包括的目标代码函数以及各目标代码函数对应的运行耗时,可以帮助开发人员快速、准确分析出导致丢帧的原因。The present application provides a frame rate processing method. First, count the number of times the target application program executes the interface drawing interface within a preset time interval, and calculate the frame loss rate of the target application program within the preset time interval according to the preset time interval and times; Then obtain the execution time of each code execution stack corresponding to the target application within the preset time interval, and determine the target code execution stack that causes the target application to lose frames according to the execution time of each code execution stack; finally print the target code execution stack including The target code functions and the running time corresponding to each target code function. Because the frame loss rate is determined by counting the number of times the target application executes the interface drawing interface within the preset time interval, that is, the frame loss rate is determined by pure software, which can reduce the cost of frame rate processing. In addition, through the code execution stack It can locate and analyze the target code execution stack that causes the frame loss of the target application program in real time, and print the target code functions included in the target code execution stack and the running time corresponding to each target code function, which can help developers quickly and accurately analyze to find out the cause of the dropped frame.
附图说明Description of drawings
为了更清楚地说明本申请实施例或现有技术中的技术方案,下面将对实施例或现有技术描述中所需 要使用的附图作简单地介绍,显而易见地,下面描述中的附图仅仅是本申请的一些实施例,对于本领域技术人员来讲,在不付出创造性劳动的前提下,还可以根据这些附图获得其他的附图。In order to more clearly illustrate the technical solutions in the embodiments of the present application or the prior art, the following will briefly introduce the drawings that need to be used in the description of the embodiments or the prior art. Obviously, the accompanying drawings in the following description are only These are some embodiments of the present application. For those skilled in the art, other drawings can also be obtained based on these drawings without creative work.
图1为本申请实施例提供的一种帧率处理方法的示例性系统架构图;FIG. 1 is an exemplary system architecture diagram of a frame rate processing method provided in an embodiment of the present application;
图2为本申请实施例提供的一种帧率处理方法的系统交互图;FIG. 2 is a system interaction diagram of a frame rate processing method provided by an embodiment of the present application;
图3为本申请实施例提供的一种帧率处理方法的流程示意图;FIG. 3 is a schematic flowchart of a frame rate processing method provided in an embodiment of the present application;
图4为本申请实施例提供的一种界面绘制原理的示意图;FIG. 4 is a schematic diagram of an interface drawing principle provided in an embodiment of the present application;
图5为本申请实施例提供的一种丢帧率计算示意图;FIG. 5 is a schematic diagram of calculating a frame loss rate provided by an embodiment of the present application;
图6为本申请实施例提供的一种应用程序界面显示示意图;FIG. 6 is a schematic diagram of an application program interface display provided by the embodiment of the present application;
图7为本申请实施例提供的一种代码执行栈的结构示意图;FIG. 7 is a schematic structural diagram of a code execution stack provided by an embodiment of the present application;
图8为本申请另一实施例提供的一种帧率处理方法的流程示意图;FIG. 8 is a schematic flowchart of a frame rate processing method provided by another embodiment of the present application;
图9为本申请一实施例提供的一种集合结构示意图;FIG. 9 is a schematic diagram of an aggregate structure provided by an embodiment of the present application;
图10为本申请一实施例提供的一种帧率处理装置的结构框图;FIG. 10 is a structural block diagram of a frame rate processing device provided by an embodiment of the present application;
图11为本申请另一实施例提供的一种帧率处理装置的结构框图;FIG. 11 is a structural block diagram of a frame rate processing device provided by another embodiment of the present application;
图12为本申请实施例提供的一种终端的结构示意图。FIG. 12 is a schematic structural diagram of a terminal provided by an embodiment of the present application.
具体实施方式detailed description
为使得本申请的特征和优点能够更加的明显和易懂,下面将结合本申请实施例中的附图,对本申请实施例中的技术方案进行清楚、完整地描述,显然,所描述的实施例仅仅是本申请一部分实施例,而非全部实施例。基于本申请中的实施例,本领域技术人员在没有做出创造性劳动前提下所获得的所有其他实施例,都属于本申请保护的范围。In order to make the features and advantages of the present application more obvious and understandable, the technical solutions in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments It is only a part of the embodiments of the present application, but not all the embodiments. Based on the embodiments in this application, all other embodiments obtained by those skilled in the art without making creative efforts belong to the scope of protection of this application.
下面的描述涉及附图时,除非另有表示,不同附图中的相同数字表示相同或相似的要素。以下示例性实施例中所描述的实施方式并不代表与本申请相一致的所有实施方式。相反,它们仅是如所附权利要求书中所详述的、本申请的一些方面相一致的装置和方法的例子。When the following description refers to the accompanying drawings, the same numerals in different drawings refer to the same or similar elements unless otherwise indicated. The implementations described in the following exemplary embodiments do not represent all implementations consistent with this application. Rather, they are merely examples of apparatuses and methods consistent with aspects of the present application as recited in the appended claims.
图1为本申请实施例提供的一种帧率处理方法的示例性系统架构图。FIG. 1 is an exemplary system architecture diagram of a frame rate processing method provided by an embodiment of the present application.
如图1所示,系统架构可以包括终端101、网络102和服务器103。网络102用于在终端101和服务器103之间提供通信链路的介质。网络102可以包括各种类型的有线通信链路或无线通信链路,例如:有线通信链路包括光纤、双绞线或同轴电缆的,无线通信链路包括蓝牙通信链路、无线保真(Wireless-Fidelity,Wi-Fi)通信链路或微波通信链路等。As shown in FIG. 1 , the system architecture may include a terminal 101 , a network 102 and a server 103 . The network 102 is a medium for providing a communication link between the terminal 101 and the server 103 . The network 102 may include various types of wired communication links or wireless communication links, for example: wired communication links include optical fiber, twisted pair or coaxial cables, wireless communication links include Bluetooth communication links, Wi-Fi ( Wireless-Fidelity, Wi-Fi) communication link or microwave communication link, etc.
终端101可以通过网络102与服务器103交互,以接收来自服务器103的消息或向服务器103发送消息。终端101可以是硬件,也可以是软件。当终端101为硬件时,可以是各种电子设备,包括但不限于智能手表、智能手机、平板电脑、膝上型便携式计算机和台式计算机等。当终端101为软件时,可以是安装在上述所列举的电子设备中,其可以实现呈多个软件或软件模块(例如:用来提供分布式服务),也可以实现成单个软件或软件模块,在此不作具体限定。The terminal 101 can interact with the server 103 through the network 102 to receive messages from the server 103 or send messages to the server 103 . Terminal 101 may be hardware or software. When the terminal 101 is hardware, it can be various electronic devices, including but not limited to smart watches, smart phones, tablet computers, laptops, desktop computers, and the like. When the terminal 101 is software, it can be installed in the electronic devices listed above, which can be implemented as multiple software or software modules (for example: for providing distributed services), or can be implemented as a single software or software module, No specific limitation is made here.
服务器103可以是提供各种服务的业务服务器。需要说明的是,服务器103可以是硬件,也可以是软件。当服务器103为硬件时,可以实现成多个服务器组成的分布式服务器集群,也可以实现成单个服务器。当服务器103为软件时,可以实现成多个软件或软件模块(例如用来提供分布式服务),也可以实现成单个软件或软件模块,在此不做具体限定。The server 103 may be a service server that provides various services. It should be noted that the server 103 may be hardware or software. When the server 103 is hardware, it can be implemented as a distributed server cluster composed of multiple servers, or as a single server. When the server 103 is software, it can be implemented as multiple software or software modules (for example, for providing distributed services), or as a single software or software module, which is not specifically limited here.
应理解,图1中的终端、网络以及服务器的数目仅是示意性的,根据实现需要,可以是任意数量的终端、网络以及服务器。It should be understood that the numbers of terminals, networks, and servers in FIG. 1 are only illustrative, and may be any number of terminals, networks, and servers according to implementation requirements.
请参阅图2,图2为本申请实施例提供的一种帧率处理方法的系统交互图,可以理解的,在本申请实施例中,执行主体可以终端或者终端中的处理器,还可以是终端中执行帧率处理方法的相关服务,为方便描述下面以执行主体为终端中的处理器为例,结合图1和图2介绍一种帧率处理方法中系统交互过程。Please refer to FIG. 2. FIG. 2 is a system interaction diagram of a frame rate processing method provided by the embodiment of the present application. It can be understood that in the embodiment of the present application, the execution subject may be a terminal or a processor in the terminal, or may be For the convenience of describing the services related to the execution of the frame rate processing method in the terminal, the processor in the terminal is used as the execution subject as an example, and a system interaction process in a frame rate processing method is introduced with reference to FIG. 1 and FIG. 2 .
S201、用户运行目标应用程序。S201. A user runs a target application program.
根据需要可以将终端中任一一个应用程序确定为目标应用程序。Any application program in the terminal can be determined as the target application program as required.
S202、处理器统计在预设时间区间内目标应用程序执行界面绘制接口的次数,根据预设时间区间以及次数计算目标应用程序在预设时间区间内的丢帧率。S202. The processor counts the number of times the target application program executes the interface drawing interface within the preset time interval, and calculates the frame loss rate of the target application program within the preset time interval according to the preset time interval and times.
可选地,统计在预设时间区间内目标应用程序执行界面绘制接口的次数之前,还包括:确定目标应用程序对应的系统界面绘制周期,以及将预设数量的系统界面绘制周期确定为预设时间区间。Optionally, before counting the number of times the target application program executes the interface drawing interface within the preset time interval, it also includes: determining the system interface drawing cycle corresponding to the target application program, and determining the preset number of system interface drawing cycles as the preset time interval.
可选地,根据预设时间区间以及次数计算目标应用程序在预设时间区间内的丢帧率,包括:获取目标差值与预设数量的比值,将比值作为目标应用程序在预设时间区间内的丢帧率;其中,目标差值为目标应用程序执行界面绘制接口的次数与预设数量之间的差值。Optionally, calculating the frame loss rate of the target application in the preset time interval according to the preset time interval and the number of times includes: obtaining the ratio of the target difference to the preset number, and using the ratio as the target application in the preset time interval The frame loss rate within ; wherein, the target difference is the difference between the number of times the target application program executes the interface drawing interface and the preset number.
S203、处理器获取在预设时间区间内目标应用程对应的各代码执行栈的执行时间,以及根据各代码执行栈的执行时间确定导致目标应用程序丢帧的目标代码执行栈。S203. The processor acquires the execution time of each code execution stack corresponding to the target application program within a preset time interval, and determines the target code execution stack that causes the target application program to drop a frame according to the execution time of each code execution stack.
可选地,统计在预设时间区间内目标应用程序执行界面绘制接口的次数之前,还包括:基于在目标应用程序中各代码函数的开始位置插入的第一代码,在各代码函数开始运行时分别记录各代码函数的身份标识、开始时间以及开始标志位,并按照时间先后顺序保存至预设集合中;基于在目标应用程序中各代码函数的结束位置插入的第二代码,在各代码函数结束运行时分别记录各代码函数的身份标识、结束时间以及结束标志位,并按照时间先后顺序保存至预设集合中。Optionally, before counting the number of times the target application program executes the interface drawing interface within the preset time interval, it also includes: based on the first code inserted at the start position of each code function in the target application program, when each code function starts to run Record the identity, start time, and start flag of each code function respectively, and save them in the preset collection in chronological order; based on the second code inserted at the end position of each code function in the target application program, in each code function When the execution ends, the identity, end time, and end flag of each code function are recorded respectively, and are saved in the preset collection in chronological order.
可选地,获取在预设时间区间内目标应用程对应的各代码执行栈的执行时间,包括:若丢帧率大于预设丢帧率阈值,则确定在预设时间区间内目标应用程对应的各代码执行栈的初始代码函数的第一身份标识,在预设集合中查找与各初始代码函数的第一身份标识匹配的第一开始标志位,以及第一开始标志位对应的第一开始时间;确定在预设时间区间内目标应用程对应的各代码执行栈的结束代码函数的第二身份标识,在预设集合中查找与各结束代码函数的第二身份标识匹配的第二结束标志位,以及第二结束标志位对应的第二结束时间;将各代码执行栈的初始代码函数的第一开始时间与各代码执行栈的结束代码函数的第二结束时间的差值,作为各代码执行栈的执行时间。Optionally, obtaining the execution time of each code execution stack corresponding to the target application within the preset time interval includes: if the frame loss rate is greater than the preset frame loss rate threshold, determining that the target application corresponds to the The first identity of the initial code function of each code execution stack of each code execution stack, the first start flag matching the first identity of each initial code function is searched in the preset set, and the first start flag corresponding to the first start flag Time: determine the second identity mark of the end code function of each code execution stack corresponding to the target application program within the preset time interval, and search for the second end mark matching the second identity mark of each end code function in the preset set bit, and the second end time corresponding to the second end flag bit; the difference between the first start time of the initial code function of each code execution stack and the second end time of the end code function of each code execution stack is used as each code Execution time of the execution stack.
可选地,根据各代码执行栈的执行时间确定导致目标应用程序丢帧的目标代码执行栈,包括:确定各代码执行栈的类型,代码执行栈的类型包括界面绘制执行栈以及非界面绘制执行栈;将代码执行栈的类型为界面绘制执行栈,且代码执行栈的执行时间大于系统界面绘制周期的代码执行栈确定为目标代码执行栈;和/或将代码执行栈的类型为非界面绘制执行栈,且代码执行栈的执行时间大于预设执行栈执行时间的代码执行栈确定为目标代码执行栈。Optionally, according to the execution time of each code execution stack, determining the target code execution stack that causes the frame loss of the target application program includes: determining the type of each code execution stack, and the type of code execution stack includes interface drawing execution stack and non-interface drawing execution Stack; the type of the code execution stack is the interface drawing execution stack, and the code execution stack whose execution time is longer than the system interface drawing cycle is determined as the target code execution stack; and/or the type of the code execution stack is non-interface drawing execution stack, and the code execution stack whose execution time of the code execution stack is greater than the execution time of the preset execution stack is determined as the target code execution stack.
S204、处理器打印目标代码执行栈包括的目标代码函数以及各目标代码函数对应的运行耗时。S204. The processor prints the target code functions included in the target code execution stack and the running time corresponding to each target code function.
可选地,打印目标代码执行栈包括的目标代码函数以及各目标代码函数对应的运行耗时,包括:基于预设集合确定目标代码执行栈中初始代码函数与结束代码函数之间的第三身份标识、第三开始标志位、第三结束标志位、第三开始时间以及第三结束时间;根据各第三身份标识获取对应的各目标代码函数,根据各目标代码函数第三开始标志位对应的第三开始时间,与各目标代码函数第三结束标志位对应的第三结束时间的差值确定各目标代码函数对应的运行耗时;打印各目标代码函数以及各目标代码函数对应的运行耗时。Optionally, printing the target code functions included in the target code execution stack and the running time corresponding to each target code function includes: determining the third identity between the initial code function and the end code function in the target code execution stack based on a preset set logo, the third start flag, the third end flag, the third start time and the third end time; obtain the corresponding target code functions according to each third identity, and obtain the corresponding target code functions according to the third start flag of each target code function The third start time, the difference between the third end time corresponding to the third end flag bit of each object code function determines the running time corresponding to each object code function; print each object code function and the running time corresponding to each object code function .
可选地,根据预设时间区间以及次数计算目标应用程序在预设时间区间内的丢帧率之后,还包括:计算目标应用程序的当前界面帧率,以及在目标应用程序的界面中显示当前界面帧率;和/或在目标应用程序的界面中显示预设时间区间内的丢帧率。Optionally, after calculating the frame loss rate of the target application in the preset time interval according to the preset time interval and times, it also includes: calculating the current interface frame rate of the target application, and displaying the current frame rate in the interface of the target application interface frame rate; and/or display the frame loss rate within a preset time interval in the interface of the target application.
可选地,统计在预设时间区间内目标应用程序执行界面绘制接口的次数之前,还包括:为目标应用程序中各代码函数分别分配唯一的身份标识,并将各代码函数与对应的身份标识建立映射关系;基于所有映射关系生成映射文件,以及将映射文件打包至目标应用程序中,以使得目标应用程序安装之后加载映射文件并解析出所有映射关系。Optionally, before counting the number of times the target application program executes the interface drawing interface within the preset time interval, it also includes: assigning unique identities to each code function in the target application program, and linking each code function with the corresponding identities Establishing a mapping relationship; generating a mapping file based on all the mapping relationships, and packaging the mapping file into the target application, so that the target application loads the mapping file and resolves all the mapping relationships after installation.
在本申请实施例中,首先统计在预设时间区间内目标应用程序执行界面绘制接口的次数,根据预设时间区间以及次数计算目标应用程序在预设时间区间内的丢帧率;然后获取在预设时间区间内目标应用程对应的各代码执行栈的执行时间,以及根据各代码执行栈的执行时间确定导致目标应用程序丢帧的目 标代码执行栈;最后打印目标代码执行栈包括的目标代码函数以及各目标代码函数对应的运行耗时。由于是通过统计在预设时间区间内目标应用程序执行界面绘制接口的次数来确定丢帧率,也即通过纯软件的方式确定丢帧率,可以减少帧率处理的成本,另外通过代码执行栈的执行时间,可以实时定位分析出导致目标应用程序丢帧的目标代码执行栈,打印目标代码执行栈包括的目标代码函数以及各目标代码函数对应的运行耗时,可以帮助开发人员快速、准确分析出导致丢帧的原因。In the embodiment of the present application, first count the number of times the target application program executes the interface drawing interface within the preset time interval, and calculate the frame loss rate of the target application program within the preset time interval according to the preset time interval and times; then obtain the The execution time of each code execution stack corresponding to the target application within the preset time interval, and determine the target code execution stack that causes the target application to lose frames according to the execution time of each code execution stack; finally print the target code included in the target code execution stack Functions and the running time corresponding to each object code function. Because the frame loss rate is determined by counting the number of times the target application executes the interface drawing interface within the preset time interval, that is, the frame loss rate is determined by pure software, which can reduce the cost of frame rate processing. In addition, through the code execution stack It can locate and analyze the target code execution stack that causes the frame loss of the target application program in real time, and print the target code functions included in the target code execution stack and the running time corresponding to each target code function, which can help developers quickly and accurately analyze to find out the cause of the dropped frame.
请参阅图3,图3为本申请实施例提供的一种帧率处理方法的流程示意图。Please refer to FIG. 3 . FIG. 3 is a schematic flowchart of a frame rate processing method provided by an embodiment of the present application.
如图3所示,帧率处理方法包括:As shown in Figure 3, the frame rate processing method includes:
S301、统计在预设时间区间内目标应用程序执行界面绘制接口的次数,根据预设时间区间以及次数计算目标应用程序在预设时间区间内的丢帧率。S301. Count the number of times the target application program executes the interface drawing interface within the preset time interval, and calculate the frame loss rate of the target application program within the preset time interval according to the preset time interval and times.
可以理解的,本申请实施例中的帧率处理方法可以应用于开发人员对目标应用程序的开发、测试阶段,也可以应用于用户的实际使用过程中,为方便描述,下面以应用于开发人员对目标应用程序的开发、测试阶段为例,介绍帧率处理方法的具体实施过程。It can be understood that the frame rate processing method in the embodiment of the present application can be applied to the development and testing phase of the target application program by the developer, and can also be applied to the actual use process of the user. For the convenience of description, the following is applied to the developer Taking the development and testing stages of the target application program as an example, the specific implementation process of the frame rate processing method is introduced.
在本申请实施例中,目标应用程序可以是任一一款需要进行帧率测试或者检测的应用程序,例如,目标应用程序可以是对界面帧率要求较高的影音类应用程序或者游戏类应用程序,其中帧率(Frame rate)是以帧称为单位的位图图像连续出现在显示器上的频率(速率)。在开发人员对目标应用程序开发完成之后,需要对目标应用程序进行帧率检测、分析等处理,那么可以首先将目标应用程序安装至终端中,其中终端具体通过预设系统对目标应用程序对应的安装包进行解压、安装,以便于目标应用程序安装完成之后可以在预设系统中运行目标应用程序。可选地,预设系统可以是安卓系统、苹果系统等终端操作系统,为方便描述本申请实施例以安卓系统为例进行介绍。In this embodiment of the application, the target application program can be any application program that requires frame rate testing or detection, for example, the target application program can be an audio-visual application program or a game application program that requires a high interface frame rate Program, where the frame rate (Frame rate) is the frequency (rate) at which the bitmap image in units of frames continuously appears on the display. After the developer completes the development of the target application program, it needs to perform frame rate detection and analysis on the target application program, then the target application program can be installed in the terminal first, and the terminal specifically uses the preset system to check the target application program. The installation package is decompressed and installed, so that the target application can be run in the preset system after the installation of the target application is completed. Optionally, the preset system may be a terminal operating system such as an Android system and an Apple system. For the convenience of description, this embodiment of the present application uses the Android system as an example for introduction.
开发人员在预设系统中启动并运行目标应用程序之后,目标应用目标为了在其界面中显示画面,目标应用程序可以先通过执行预设系统中软件开发工具包(Software DevelopmentKit,SDK)提供的预设接口,获取预设系统发出的界面绘制信号,界面绘制信号可以认为是一种垂直同步信号或者时间脉冲信号,然后目标应用程序可以基于该界面绘制信号执行一次完整的界面绘制程序,以形成一帧画面。在理想情况下,当目标应用程序连续获取预设系统发出的界面绘制信号之后,会基于各界面绘制信号连续执行多次完整的界面绘制程序,以形成连续的多帧画面,那么用户就可以观察到目标应用程序的界面中显示由多帧画面组成的流畅界面。After the developer starts and runs the target application program in the preset system, in order to display the screen on the interface of the target application target, the target application program can execute the preset program provided by the software development kit (Software Development Kit, SDK) in the preset system first. Set the interface to obtain the interface drawing signal sent by the preset system. The interface drawing signal can be considered as a vertical synchronization signal or a time pulse signal, and then the target application program can execute a complete interface drawing program based on the interface drawing signal to form a frame picture. Ideally, after the target application continuously obtains the interface drawing signals sent by the preset system, it will execute multiple complete interface drawing programs based on each interface drawing signal to form a continuous multi-frame picture, then the user can observe Display a smooth interface composed of multiple frames in the interface of the target application program.
进一步地,预设系统发出的界面绘制信号是有一定的周期的,这个周期也即系统界面绘制周期,系统界面绘制周期根据预设系统对应的系统界面刷新率有关,例如,当预设系统对应的界面刷新率为60赫兹,也即系统界面需要在一秒内刷新60次,因此预设系统会在1秒(1000毫秒)内发出60次界面绘制信号,以使得目标应用程序可以基于界面绘制信号在1秒内执行60次完整的界面绘制程序,那么可以得到系统界面绘制周期大概为16.6毫秒(1000毫秒/60次)。可选地,本申请实施例中,对预设系统对应的界面刷新率不做限定,预设系统对应的界面刷新率可以是60赫兹、90赫兹或者144赫兹等。下面结合图4对界面绘制原理进行具体介绍。Furthermore, the interface drawing signal sent by the preset system has a certain cycle, which is also the system interface drawing cycle. The system interface drawing cycle is related to the refresh rate of the system interface corresponding to the preset system. For example, when the preset system corresponds to The refresh rate of the interface is 60 Hz, that is, the system interface needs to be refreshed 60 times in one second, so the preset system will send 60 interface drawing signals within 1 second (1000 milliseconds), so that the target application can draw based on the interface If the signal executes 60 complete interface drawing programs within 1 second, then the system interface drawing cycle can be obtained to be about 16.6 milliseconds (1000 milliseconds/60 times). Optionally, in this embodiment of the present application, there is no limitation on the interface refresh rate corresponding to the preset system, and the interface refresh rate corresponding to the preset system may be 60 Hz, 90 Hz, or 144 Hz. The principle of interface drawing is described in detail below in combination with FIG. 4 .
请参阅图4,图4为本申请实施例提供的一种界面绘制原理的示意图。如图4所示,以预设系统对应的界面刷新率为60赫兹为例,预设系统每隔16.6毫秒通过预设接口向目标应用程序发送一次界面绘制信号,如果目标应用程序中存在绘制事件,那么目标应用程序执行预设接口以获取界面绘制信号,并执行一次界面绘制程序,以在目标应用程序的界面中绘制一帧画面。在理想情况下,目标应用程序会在获取到下一次界面绘制信号前完成绘制本次界面绘制,如图4中的第一次绘制,在界面绘制周期16.6毫秒内执行完界面绘制程序,此时目标应用程序的显示界面没有发生丢帧的情况。Please refer to FIG. 4 . FIG. 4 is a schematic diagram of an interface drawing principle provided by an embodiment of the present application. As shown in Figure 4, taking the interface refresh rate corresponding to the preset system as 60 Hz as an example, the preset system sends an interface drawing signal to the target application through the preset interface every 16.6 milliseconds, if there is a drawing event in the target application , then the target application program executes the preset interface to obtain the interface drawing signal, and executes the interface drawing program once to draw a frame of picture in the interface of the target application program. In an ideal situation, the target application will complete the drawing of the interface before obtaining the next interface drawing signal, as shown in Figure 4 for the first drawing, and the interface drawing program is executed within 16.6 milliseconds of the interface drawing cycle. At this time The display interface of the target application does not experience dropped frames.
但是在图4中第二次绘制时占用了大约3个界面绘制周期,如果在3个界面绘制周期的后两个界面绘制周期中本来应该计划有绘制事件,但由于第二次绘制一直没有结束就会导致目标应用程序不能执行预设接口获取界面绘制信号并执行界面绘制程序,也即导致之后的两个绘制周期的绘制事件不会被执行,此时目标应用程序的显示界面发生了丢帧的情况。一种特殊情况是,当目标应用程序中没有绘制事件, 目标应用程序可以执行预设接口,也即获取界面绘制信号,但是界面绘制信号不会调用、执行界面绘制程序,此时认为目标应用程序的显示界面没有发生丢帧的情况。However, in Figure 4, the second drawing took up about 3 interface drawing cycles. If there should have been planned drawing events in the last two interface drawing cycles of the 3 interface drawing cycles, but the second drawing has not ended It will cause the target application to fail to execute the preset interface to obtain the interface drawing signal and execute the interface drawing program, which means that the drawing events of the next two drawing cycles will not be executed. At this time, the display interface of the target application will drop frames. Case. A special case is that when there is no drawing event in the target application program, the target application program can execute the preset interface, that is, obtain the interface drawing signal, but the interface drawing signal will not call and execute the interface drawing program. At this time, the target application program is considered The display interface does not drop frames.
由上述界面绘制原理可知,一般情况下,目标应用程序只要执行一次预设接口,就可以通过预设接口获取一次预设系统发送的界面绘制信号,并执行一次界面绘制程序,因此通过统计目标应用程序在一定时间内执行界面绘制接口的次数,可以确定目标应用程序的帧率以及丢帧率。但是在相关技术中,例如在安卓系统中,预设接口可能只允许目标应用程序的源码执行,处理器中的代码或者开发者编写的代码不能直接访问该预设接口,因此一种可行的实施方式是,开发者可以对预设接口进行编写,以使得在预设接口的基础上,预设接口提供另外一个接口,可以将该接口命名为界面绘制接口,界面绘制接口可以用于目标应用程序的源码接收预设系统发送的界面绘制信号,且目标应用程序中的界面绘制程序可以实现界面绘制接口,并将界面绘制接口作为驱动目标应用程序中的界面绘制程序运行的唯一入口。According to the above interface drawing principle, in general, as long as the target application program executes the preset interface once, it can obtain the interface drawing signal sent by the preset system through the preset interface and execute the interface drawing program once. The number of times the program executes the interface drawing interface within a certain period of time can determine the frame rate and frame loss rate of the target application program. However, in related technologies, such as in the Android system, the preset interface may only allow the source code of the target application to be executed, and the code in the processor or the code written by the developer cannot directly access the preset interface, so a feasible implementation The method is that the developer can write the preset interface so that on the basis of the preset interface, the preset interface provides another interface, which can be named interface drawing interface, and the interface drawing interface can be used in the target application The source code receives the interface drawing signal sent by the preset system, and the interface drawing program in the target application program can implement the interface drawing interface, and uses the interface drawing interface as the only entry to drive the operation of the interface drawing program in the target application program.
进一步地,开发者编写的代码也可以实现界面绘制接口,以使得界面绘制接口也可以被开发者编写的代码访问,界面绘制接口也可以用于开发者编写的代码接收预设系统发送的界面绘制信号,并且开发者编写的代码实现界面绘制接口和目标应用程序中的界面绘制程序实现界面绘制接口保持一致,也即目标应用程序的源码可以在系统界面绘制周期内执行预设接口与在系统界面绘制周期内执行界面绘制接口无差别。可以理解的,如果在某些预设系统中,预设接口既可以被目标应用程序的源码执行,也可以被处理器中的代码或者开发者编写的代码执行,那么在该预设系统中,预设接口也就是界面绘制接口。Furthermore, the code written by the developer can also implement the interface drawing interface, so that the interface drawing interface can also be accessed by the code written by the developer, and the interface drawing interface can also be used for the code written by the developer to receive the interface drawing sent by the preset system signal, and the code written by the developer to implement the interface drawing interface is consistent with the interface drawing program in the target application program, that is, the source code of the target application program can execute the preset interface in the system interface drawing cycle and the interface drawing interface in the system interface There is no difference in the execution of the interface drawing interface in the drawing cycle. It can be understood that if in some preset systems, the preset interface can be executed by the source code of the target application program, or by the code in the processor or the code written by the developer, then in the preset system, The default interface is also the interface drawing interface.
由于界面绘制接口也可以被开发者编写的代码访问,且目标应用程序的源码可以在系统界面绘制周期内执行预设接口与在系统界面绘制周期内执行界面绘制接口无差别,那么可以得到目标应用程序只要执行一次界面绘制接口,就可以通过界面绘制接口获取一次预设系统发送的界面绘制信号,并执行一次界面绘制程序。Since the interface drawing interface can also be accessed by the code written by the developer, and the source code of the target application program can execute the preset interface in the system interface drawing cycle and execute the interface drawing interface in the system interface drawing cycle, there is no difference, then the target application can be obtained As long as the program executes the interface drawing interface once, it can obtain an interface drawing signal sent by the preset system through the interface drawing interface, and execute the interface drawing program once.
因此为了计算出目标应用程序的显示界面发生丢帧情况时的丢帧率,可以通过开发者编写的预设代码,统计在预设时间区间内目标应用程序执行界面绘制接口的次数,由于在理想情况下,在一次系统界面绘制周期内,会执行一次界面绘制接口,那么可以将预设时间区间设置为包括预设数量的系统界面绘制周期,那么可以通过预设数量与预设时间区间内目标应用程序执行界面绘制接口的次数,计算出目标应用程序在预设时间区间内的丢帧率,另外也可以通过预设数量与预设时间区间内目标应用程序执行界面绘制接口的次数,计算出目标应用程序的当前界面帧率。Therefore, in order to calculate the frame loss rate when the display interface of the target application program loses frames, the preset code written by the developer can be used to count the number of times the target application program executes the interface drawing interface within the preset time interval. In this case, in a system interface drawing cycle, the interface drawing interface will be executed once, then the preset time interval can be set to include the preset number of system interface drawing cycles, then the preset number and the target within the preset time interval can be used The number of times the application program executes the interface drawing interface calculates the frame loss rate of the target application program within the preset time interval. In addition, the number of times the target application program executes the interface drawing interface within the preset time interval can also be calculated. The current interface frame rate of the target application.
具体的,可以获取目标差值与预设数量的比值,将比值作为目标应用程序在预设时间区间内的丢帧率,其中,目标差值为目标应用程序执行界面绘制接口的次数与预设数量之间的差值。也即可以先确定预设数量与次数的差值,以及计算差值与预设数量的比值,将比值作为目标应用程序在预设时间区间内的丢帧率。还可以计算出在上一单位时间内包括的所有预设时间区间,将所有预设时间区间内目标应用程序执行界面绘制接口的次数,作为目标应用程序的当前界面帧率。Specifically, the ratio of the target difference to the preset number can be obtained, and the ratio can be used as the frame loss rate of the target application within the preset time interval, wherein the target difference is the number of times the target application executes the interface drawing interface and the preset The difference between the quantities. That is, the difference between the preset number and the number of times may be determined first, and the ratio of the difference to the preset number may be calculated, and the ratio may be used as the frame loss rate of the target application within the preset time interval. It is also possible to calculate all preset time intervals included in the last unit time, and use the number of times the target application executes the interface drawing interface in all preset time intervals as the current interface frame rate of the target application.
下面结合图5,介绍计算目标应用程序在预设时间区间内的丢帧率的具体过程。The specific process of calculating the frame loss rate of the target application program within the preset time interval will be introduced below with reference to FIG. 5 .
请参阅图5,图5为本申请实施例提供的一种丢帧率计算示意图,如图5所示,以预设系统对应的界面刷新率为60赫兹为例,预设系统每隔16.6毫秒通过界面绘制接口向目标应用程序发送一次界面绘制信号,如果目标应用程序中存在绘制事件,那么目标应用程序执行界面绘制接口以获取界面绘制信号,并执行一次界面绘制程序,以在目标应用程序的界面中绘制一帧画面。Please refer to Figure 5. Figure 5 is a schematic diagram of a frame loss rate calculation provided by the embodiment of the present application. As shown in Figure 5, taking the interface refresh rate corresponding to the preset system as 60 Hz as an example, the default system every 16.6 milliseconds Send an interface drawing signal to the target application program through the interface drawing interface, if there is a drawing event in the target application program, then the target application program executes the interface drawing interface to obtain the interface drawing signal, and executes the interface drawing program once, so as to be in the target application program Draw a frame in the interface.
如图5中的第一次绘制,目标应用程序执行一次界面绘制接口,在界面绘制周期16.6毫秒内执行完界面绘制程序,此时目标应用程序的显示界面没有发生丢帧的情况。As shown in Figure 5 for the first drawing, the target application program executes the interface drawing interface once, and the interface drawing program is executed within 16.6 milliseconds of the interface drawing cycle. At this time, the display interface of the target application program does not drop frames.
但是在图5中第二次绘制时,目标应用程序执行一次界面绘制接口,但是却在3个界面绘制周期内执行完界面绘制程序,也即第二次绘制时占用了3个界面绘制周期,如果在3个界面绘制周期的两个界面绘制周期中本来应该计划有绘制事件,但由于第二次绘制一直没有结束就会导致目标应用程序不能执行预设接口获取界面绘制信号并执行界面绘制程序,也即导致之后的两个绘制周期的绘制事件不会被执行,此时目标应用程序的显示界面发生了丢帧的情况。而后面的第三次绘制至第八次绘制时,目标应用程序会分别执行一次界面绘制接口,并分别在一个绘制周期内执行完界面绘制程序,也即第三次绘制至 第八次绘制均未发生丢帧情况。However, when drawing for the second time in Figure 5, the target application executes the interface drawing interface once, but executes the interface drawing program within 3 interface drawing cycles, that is, the second drawing takes up 3 interface drawing cycles. If a drawing event should have been planned in the two interface drawing cycles of the three interface drawing cycles, but because the second drawing has not ended, the target application cannot execute the preset interface to obtain the interface drawing signal and execute the interface drawing program , that is, the drawing events of the next two drawing cycles will not be executed, and at this time, the display interface of the target application program drops frames. From the third drawing to the eighth drawing later on, the target application program will execute the interface drawing interface once respectively, and execute the interface drawing program in one drawing cycle respectively, that is, the third drawing to the eighth drawing are equal to each other. No frame drops occurred.
如果将图5中的10个界面绘制周期作为预设时间区间,那么在该预设时间区间内可以统计出目标应用程序执行界面绘制接口的次数为8次,预设时间区间包含系统界面绘制周期的预设数量为10,因此预设数量与次数的差值为2,该差值与预设数量的比值为0.2,那么目标应用程序在该预设时间区间内的丢帧率20%。进一步地,还可以计算出在上一单位时间内包括的所有预设时间区间,例如,当单位时间为1秒,预设时间区间包含系统界面绘制周期的预设数量为10,那么1秒内包括6个预设时间区间,将6个预设时间区间内目标应用程序执行界面绘制接口的次数,作为目标应用程序的当前界面帧率。If the 10 interface drawing cycles in Figure 5 are used as the preset time interval, then within the preset time interval, it can be counted that the number of times the target application executes the interface drawing interface is 8 times, and the preset time interval includes the system interface drawing cycle The preset number of is 10, so the difference between the preset number and the number of times is 2, and the ratio of the difference to the preset number is 0.2, then the frame loss rate of the target application within the preset time interval is 20%. Furthermore, it is also possible to calculate all the preset time intervals included in the last unit time. For example, when the unit time is 1 second, and the preset number of drawing cycles of the system interface included in the preset time interval is 10, then within 1 second 6 preset time intervals are included, and the number of times the target application program executes the interface drawing interface within the 6 preset time intervals is used as the current interface frame rate of the target application program.
可选地,在计算到目标应用程序在一个预设时间区间内的丢帧率之后,还可以依次计算出后续多个预设时间区间内的丢帧率,并且还可以在目标应用程序的界面中显示各预设时间区间内的丢帧率。具体的,可以在目标应用程序的应用界面的任意位置中添加一个窗口,通过该窗口去实时显示计算到的目标应用程序在各预设时间区间内的丢帧率。Optionally, after the frame loss rate of the target application is calculated within a preset time interval, the frame loss rate within a plurality of subsequent preset time intervals can also be calculated sequentially, and can also be displayed on the interface of the target application The frame loss rate in each preset time interval is displayed in . Specifically, a window may be added at any position of the application interface of the target application, and the calculated frame loss rate of the target application within each preset time interval is displayed in real time through the window.
请参阅图6,图6为本申请实施例提供的一种应用程序界面显示示意图。Please refer to FIG. 6 . FIG. 6 is a schematic diagram of an application program interface display provided by an embodiment of the present application.
如图6所示,终端600中运行有目标应用程序,在目标应用程序的显示界面610中可以设置有一个窗口620,窗口620中显示了计算到的各预设时间区间内的丢帧率。为了便于方便开发人员判断各预设时间区间内的丢帧率的大小,可以将处于不同区间的丢帧率,用不同的图形、颜色或者填充花纹来表示。例如,当使用柱状图表示各预设时间区间内的丢帧率时,可以使用绿柱表示无丢帧(丢帧0%),使用蓝柱表示丢帧30%以下,使用红柱表示丢帧30%以上;还可以通过柱子的高度对应表示丢帧率的大小,例如在图6中,柱子的高度越高则对应的时间区间内的丢帧率越大。As shown in FIG. 6 , a target application program is running in the terminal 600 , and a window 620 may be set in the display interface 610 of the target application program, and the window 620 displays the calculated frame loss rate within each preset time interval. In order to make it easier for developers to judge the frame loss rate in each preset time interval, the frame loss rate in different intervals can be represented by different graphics, colors or filling patterns. For example, when using a histogram to indicate the frame loss rate in each preset time interval, you can use a green column to indicate no frame loss (frame loss 0%), use a blue column to indicate frame loss below 30%, and use a red column to indicate frame loss More than 30%; the height of the column can also be used to correspond to the size of the frame loss rate. For example, in Figure 6, the higher the height of the column, the greater the frame loss rate in the corresponding time interval.
可选地,由于还可以获取目标应用程序的当前界面帧率,那么也可以根据需要在窗口620显示目标应用程序的当前界面帧率。Optionally, since the current interface frame rate of the target application program can also be obtained, the current interface frame rate of the target application program can also be displayed in window 620 as required.
由于上述计算目标应用程序在预设时间区间内的丢帧率以及目标应用程序的当前界面帧率的方法,是通过软件的方式实现的,因此相较于相关技术中,需要购买额外的外设装备来分析丢帧率的方法,可以有效减少帧率处理的成本。Since the above-mentioned method of calculating the frame loss rate of the target application program within the preset time interval and the current interface frame rate of the target application program is implemented by means of software, it is necessary to purchase additional peripherals compared to the related technology Equipped to analyze the method of frame loss rate, which can effectively reduce the cost of frame rate processing.
S302、获取在预设时间区间内目标应用程对应的各代码执行栈的执行时间,以及根据各代码执行栈的执行时间确定导致目标应用程序丢帧的目标代码执行栈。S302. Obtain the execution time of each code execution stack corresponding to the target application program within a preset time interval, and determine the target code execution stack that causes the target application program to drop a frame according to the execution time of each code execution stack.
当获取到目标应用程序在预设时间区间内的丢帧率之后,可以根据需要确定是否定位导致目标应用程序丢帧的原因,一种可行的方式是,不论丢帧率的具体数值是多少,都可以在确定目标应用程序在预设时间区间内的丢帧率之后,定位导致目标应用程序丢帧的原因,这种实施方式的优点是,可以及早发现导致目标应用程序丢帧的原因,避免目标应用程序出现更严重的错误;另一种可行的方式是,可以将丢帧率与丢帧率阈值进行比较,丢帧率阈值可以根据需要进行设置,例如,丢帧率阈值可以是不影响用户正常观看目标应用程序的显示画面的最低丢帧率。那么当丢帧率大于丢帧率阈值时,会影响用户正常观看目标应用程序的显示画面,此时需要确定导致目标应用程序丢帧的原因,这种实施方式的优点是,可以减少目标应用程序中因为定位导致目标应用程序丢帧而产生的功耗。为方面描述,下面以当丢帧率大于丢帧率阈值时,定位导致目标应用程序丢帧的原因为例,具体介绍定位导致目标应用程序丢帧的原因的方法。After obtaining the frame loss rate of the target application within the preset time interval, you can determine whether to locate the cause of the frame loss of the target application according to your needs. One feasible way is, regardless of the specific value of the frame loss rate, After determining the frame loss rate of the target application program within the preset time interval, the cause of the frame loss of the target application program can be located. More severe errors in the target application; as an alternative, the frame loss rate can be compared to a frame loss rate threshold, which can be set as desired, for example, the frame loss rate threshold can be unaffected The minimum frame loss rate at which the user normally watches the display of the target application. Then when the frame loss rate is greater than the frame loss rate threshold, it will affect the user's normal viewing of the display screen of the target application. At this time, it is necessary to determine the cause of the frame loss of the target application. The advantage of this implementation is that it can reduce the target application. Power consumption due to frame loss of the target application due to positioning. For the sake of description, the following takes locating the cause of the frame loss of the target application when the frame loss rate is greater than the frame loss rate threshold as an example, and specifically introduces the method of locating the cause of the frame loss of the target application.
可以理解的,在目标应用程序的运行过程中,各运行事件的执行过程分别在对应的特定线程中执行,那么目标应用程序在执行界面绘制程序时,也会在一个特定的主线程中执行,线程中可以包括多个按照执行先后顺序排列的代码执行栈,代码执行栈可以认为是一种代码函数的集合,界面绘制程序的执行过程也就是代码执行栈中代码函数的执行过程。It can be understood that during the running of the target application, the execution process of each running event is executed in the corresponding specific thread, so when the target application executes the interface drawing program, it will also be executed in a specific main thread. A thread can include multiple code execution stacks arranged in the order of execution. The code execution stack can be considered as a collection of code functions, and the execution process of the interface drawing program is also the execution process of the code functions in the code execution stack.
请参阅图7,图7为本申请实施例提供的一种代码执行栈的结构示意图。Please refer to FIG. 7 . FIG. 7 is a schematic structural diagram of a code execution stack provided by an embodiment of the present application.
如图7所示,在理想的情况下,在界面绘制的过程对应的主线程代码执行时序中仅仅包括界面绘制代码执行栈,一个界面绘制代码执行栈对应一个系统界面绘制周期,那么如果目标应用程序在预设时间区间内出现丢帧的情况,可能是某一个或者多个界面绘制代码执行栈出现问题,导致在某一个或者多个系统界面绘制周期内,界面绘制代码执行栈执行超时。例如,图7中的界面绘制代码执行栈1出现问题, 导致在对应的一个系统界面绘制周期内,界面绘制代码执行栈1执行超时,界面绘制代码执行栈1可能会占用后续的系统界面绘制周期,后续的系统界面绘制周期内界面绘制代码执行栈不能执行,进而导致目标应用程序的显示界面发生了丢帧的情况。As shown in Figure 7, in an ideal situation, only the interface drawing code execution stack is included in the main thread code execution sequence corresponding to the interface drawing process, and one interface drawing code execution stack corresponds to one system interface drawing cycle, then if the target application If the program loses frames within the preset time interval, it may be that there is a problem with one or more interface drawing code execution stacks, causing the interface drawing code execution stack to time out during one or more system interface drawing cycles. For example, there is a problem with the interface drawing code execution stack 1 in Figure 7, which causes the execution of the interface drawing code execution stack 1 to time out in a corresponding system interface drawing cycle, and the interface drawing code execution stack 1 may occupy the subsequent system interface drawing cycle , the interface drawing code execution stack cannot be executed in the subsequent system interface drawing cycle, which leads to frame loss on the display interface of the target application program.
还有一种情况是,由于目标应用程序的运行过程中,除了执行界面绘制事件之外,还可能执行其他业务事件(例如,采集语音信息等),那么这些业务事件也会在线程中对应代码执行栈,由于这些代码执行栈不涉及界面绘制,这里将这些代码执行栈命名为非界面绘制代码执行栈。那么如果目标应用程序在预设时间区间内出现丢帧的情况,还可能是某一个或者多个非界面绘制代码执行栈出现问题,非界面绘制代码执行栈执行过程中占用了较多的线程执行时间,很可能占用了后续的系统界面绘制周期,进而导致界面绘制代码执行栈不能正常执行。例如,图7中的非界面绘制代码执行栈1出现问题,非界面绘制代码执行栈1执行过程中占用了较多的线程执行时间,进而导致界面绘制代码执行栈2不能在对应的系统界面绘制周期正常执行,进而导致目标应用程序的显示界面发生了丢帧的情况。Another situation is that during the running of the target application, in addition to executing interface drawing events, other business events (for example, collecting voice information, etc.) may also be executed, then these business events will also be executed in the corresponding code in the thread Stack, since these code execution stacks do not involve interface drawing, these code execution stacks are named non-interface drawing code execution stacks here. Then, if the target application loses frames within the preset time interval, there may be a problem with one or more non-interface drawing code execution stacks, and the execution process of non-interface drawing code execution stacks takes up more thread execution The time is likely to occupy the subsequent system interface drawing cycle, which will cause the interface drawing code execution stack to fail to execute normally. For example, there is a problem with the non-interface drawing code execution stack 1 in Figure 7. The execution process of the non-interface drawing code execution stack 1 takes up more thread execution time, which in turn causes the interface drawing code execution stack 2 to fail to draw on the corresponding system interface. The cycle is executed normally, resulting in frame loss on the display interface of the target application.
由上述代码执行栈的执行过程可知,代码执行栈的执行过程的占用时间的长短可能会导致目标应用程序丢帧,因此一种可行的确定导致目标应用程序丢帧原因的实施方式是,若确定预设时间区间内的丢帧率大于丢帧率阈值,先获取在该预设时间区间内目标应用程对应的各代码执行栈的执行时间,以便于根据执行时间确定对应的代码执行栈是否执行出现问题,其中确定预设时间区间内目标应用程对应的各代码执行栈的执行时间的方式可以不做限定。From the execution process of the above code execution stack, it can be seen that the length of the execution process of the code execution stack may cause the frame loss of the target application program, so a feasible implementation method for determining the cause of the frame loss of the target application program is, if If the frame loss rate within the preset time interval is greater than the frame loss rate threshold, first obtain the execution time of each code execution stack corresponding to the target application within the preset time interval, so as to determine whether the corresponding code execution stack is executed according to the execution time A problem arises, wherein the manner of determining the execution time of each code execution stack corresponding to the target application program within the preset time interval may not be limited.
进一步地,在获取预设时间区间内目标应用程对应的各代码执行栈的执行时间之后,还可以根据各代码执行栈的类型确定各代码执行栈在正常执行时对应的执行时间,将各代码执行栈的执行时间与其在正常执行时对应的执行时间进行比较,若代码执行栈的执行时间大于其在正常执行时对应的执行时间,可以将该代码执行栈确定为导致目标应用程序丢帧的目标代码执行栈。Further, after obtaining the execution time of each code execution stack corresponding to the target application in the preset time interval, the execution time corresponding to each code execution stack during normal execution can also be determined according to the type of each code execution stack, and each code The execution time of the execution stack is compared with its corresponding execution time during normal execution. If the execution time of the code execution stack is greater than its corresponding execution time during normal execution, the code execution stack can be determined as the one that causes the target application to drop frames. Object code execution stack.
当丢帧率小于或者等于丢帧率阈值时,那么不会影响用户正常观看目标应用程序的显示画面,此时也就不需要确定导致目标应用程序丢帧的原因,可以返回步骤S301。When the frame loss rate is less than or equal to the frame loss rate threshold, it will not affect the user's normal viewing of the display screen of the target application program. At this time, there is no need to determine the cause of the frame loss of the target application program, and the process can return to step S301.
S303、打印目标代码执行栈包括的目标代码函数以及各目标代码函数对应的运行耗时。S303. Print the target code functions included in the target code execution stack and the running time corresponding to each target code function.
可以理解的,代码执行栈可以认为是一种代码函数的集合,因此代码执行栈中可以包括至少一个代码函数,那么在确定导致目标应用程序丢帧的目标代码执行栈之后,为了便于开发人员分析出导致目标应用程序丢帧的代码函数,还可以获取目标代码执行栈包括的目标代码函数以及各目标代码函数对应的运行耗时,并将目标代码函数以及各目标代码函数对应的运行耗时进行打印,其中打印的具体方式可以是打印日志或者上传打印日志。It can be understood that the code execution stack can be considered as a collection of code functions, so the code execution stack can include at least one code function, then after determining the target code execution stack that causes the target application to drop frames, in order to facilitate the analysis of the developer The code functions that cause the target application to drop frames can also be obtained from the target code functions included in the target code execution stack and the running time corresponding to each target code function, and the target code functions and the running time corresponding to each target code function are calculated. Print, where the specific way of printing can be to print logs or upload print logs.
由于代码执行栈中各代码函数的运行耗时也是在一定的预设时间范围之内,那么如果某一或者某些目标代码函数对应的运行耗时超过预设时间范围,那么可以确定该目标代码函数是导致目标代码执行栈执行出现问题的原因,开发人员可以对该目标代码函数进行优化,以使得该目标代码函数以及对应的目标代码执行栈正常运行,进而使得目标应用程序正常进行界面绘制,解决目标应用程序丢帧得问题。Since the running time of each code function in the code execution stack is also within a certain preset time range, if the running time corresponding to one or some target code functions exceeds the preset time range, then the target code can be determined The function is the cause of the problem in the execution of the target code execution stack. Developers can optimize the target code function so that the target code function and the corresponding target code execution stack can run normally, so that the target application can draw the interface normally. Addresses frame dropping issues with target applications.
在本申请实施例中,首先统计在预设时间区间内目标应用程序执行界面绘制接口的次数,根据预设时间区间以及次数计算目标应用程序在预设时间区间内的丢帧率;然后获取在预设时间区间内目标应用程对应的各代码执行栈的执行时间,以及根据各代码执行栈的执行时间确定导致目标应用程序丢帧的目标代码执行栈;最后打印目标代码执行栈包括的目标代码函数以及各目标代码函数对应的运行耗时。由于是通过统计在预设时间区间内目标应用程序执行界面绘制接口的次数来确定丢帧率,也即通过纯软件的方式确定丢帧率,可以减少帧率处理的成本,另外通过代码执行栈的执行时间,可以实时定位分析出导致目标应用程序丢帧的目标代码执行栈,打印目标代码执行栈包括的目标代码函数以及各目标代码函数对应的运行耗时,可以帮助开发人员快速、准确分析出导致丢帧的原因。In the embodiment of the present application, first count the number of times the target application program executes the interface drawing interface within the preset time interval, and calculate the frame loss rate of the target application program within the preset time interval according to the preset time interval and times; then obtain the The execution time of each code execution stack corresponding to the target application within the preset time interval, and determine the target code execution stack that causes the target application to lose frames according to the execution time of each code execution stack; finally print the target code included in the target code execution stack Functions and the running time corresponding to each object code function. Because the frame loss rate is determined by counting the number of times the target application executes the interface drawing interface within the preset time interval, that is, the frame loss rate is determined by pure software, which can reduce the cost of frame rate processing. In addition, through the code execution stack It can locate and analyze the target code execution stack that causes the frame loss of the target application program in real time, and print the target code functions included in the target code execution stack and the running time corresponding to each target code function, which can help developers quickly and accurately analyze to find out the cause of the dropped frame.
请参阅图8,图8为本申请另一实施例提供的一种帧率处理方法的流程示意图。Please refer to FIG. 8 . FIG. 8 is a schematic flowchart of a frame rate processing method provided by another embodiment of the present application.
如图8所示,该方法包括:As shown in Figure 8, the method includes:
S801、基于在目标应用程序中各代码函数的开始位置插入的第一代码,在各代码函数开始运行时分 别记录各代码函数的身份标识、开始时间以及开始标志位,并按照时间先后顺序保存至预设集合中。S801. Based on the first code inserted at the start position of each code function in the target application program, record the identity, start time, and start flag of each code function when each code function starts running, and save them in chronological order to in the preset collection.
在本申请实施例中,为了便于后续确定预设时间区间内目标应用程对应的各代码执行栈的执行时间,可以在目标应用程序的开发阶段,为目标应用程序中各代码函数分别分配唯一的身份标识,并将各代码函数与对应的身份标识建立映射关系,以使得各代码函数与其对应的身份标识一一映射。还可以基于所有映射关系生成映射文件,例如,映射文件为mapping.txt,以及将映射文件打包至目标应用程序中,以使得目标应用程序安装之后加载映射文件并解析出所有映射关系。In the embodiment of the present application, in order to facilitate the subsequent determination of the execution time of each code execution stack corresponding to the target application within the preset time interval, each code function in the target application can be assigned a unique identity, and establish a mapping relationship between each code function and the corresponding identity, so that each code function and its corresponding identity are mapped one by one. It is also possible to generate a mapping file based on all mapping relationships, for example, the mapping file is mapping.txt, and package the mapping file into the target application, so that after the target application is installed, the mapping file is loaded and all mapping relationships are resolved.
进一步地,还可以在目标应用程序中各代码函数的编写过程中,在各代码函数的开始位置插入第一代码,其中第一代码用于基于上述映射关系记录对应的代码函数的身份标识、代码函数开始运行的开始时间以及代码函数是开始运行的开始标识位;以及在各代码函数的结束位置插入第二代码,其中第二代码用于基于上述映射关系记录对应的代码函数的身份标识、代码函数结束运行的结束时间以及代码函数是结束运行的结束标识位。Further, it is also possible to insert the first code at the beginning of each code function during the writing process of each code function in the target application, wherein the first code is used to record the identity and code of the corresponding code function based on the above-mentioned mapping relationship. The start time when the function starts to run and the code function is the start identification bit to start running; and the second code is inserted at the end position of each code function, wherein the second code is used to record the identity and code of the corresponding code function based on the above-mentioned mapping relationship The end time of the function ending operation and the code function is the end identification bit of the end operation.
那么在目标应用程序在预设系统中运行之后,可以基于在目标应用程序中各代码函数的开始位置插入的第一代码,在各代码函数开始运行时分别记录各代码函数的身份标识、开始时间以及开始标志位,并按照时间先后顺序保存至预设集合中。其中为了方便对应存储每个代码函数的身份标识、开始时间以及开始标志位,可以通过long型存储方式来存储每个代码函数的身份标识、开始时间以及开始标志位,其中,一个long型数据包括64位存储字节,一个long型整数的前18位用于保存对应代码函数的身份标识,中间45用于保存对应代码函数的开始时间,最后一位用于保存对应代码函数的开始标志位。Then, after the target application program runs in the preset system, based on the first code inserted at the start position of each code function in the target application program, the identity and start time of each code function can be recorded respectively when each code function starts running and the start flag, and are stored in the preset collection in chronological order. In order to facilitate corresponding storage of the identity, start time and start flag of each code function, the identity, start time, and start flag of each code function can be stored in a long-type storage method, wherein a long-type data includes 64-bit storage bytes, the first 18 bits of a long integer are used to save the identity of the corresponding code function, the middle 45 bits are used to save the start time of the corresponding code function, and the last bit is used to save the start flag of the corresponding code function.
在记录各代码函数的身份标识、开始时间以及开始标志位的过程中,还可以按照时间先后顺序将记录结果保存至预设集合中。例如,当通过long型存储方式来存储每个代码函数的身份标识、开始时间以及开始标志位时,那么在确定一个代码函数的long型数据之后,可以按照long型中纪录的开始时间的顺序,将各long型数据组成一个long型数组,该long型数组的长度可以根据目标应用程序中代码函数的总数量进行设置,例如,可以将long型数组的长度设置为8MB。In the process of recording the identity, start time, and start flag of each code function, the recording results can also be saved in a preset collection in chronological order. For example, when the identity, start time, and start flag of each code function are stored in a long-type storage method, after determining the long-type data of a code function, the order of the start time recorded in the long-type can be followed. Each long type data is formed into a long type array, and the length of the long type array can be set according to the total number of code functions in the target application program, for example, the length of the long type array can be set to 8MB.
S802、基于在目标应用程序中各代码函数的结束位置插入的第二代码,在各代码函数结束运行时分别记录各代码函数的身份标识、结束时间以及结束标志位,并按照时间先后顺序保存至预设集合中。S802. Based on the second code inserted at the end position of each code function in the target application program, record the identity, end time, and end flag of each code function when each code function finishes running, and save them in chronological order to in the preset collection.
与上述步骤类似,在目标应用程序在预设系统中运行之后,可以基于在目标应用程序中各代码函数的结束位置插入的第二代码,在各代码函数结束运行时分别记录各代码函数的身份标识、结束时间以及结束标志位,并按照时间先后顺序保存至预设集合中。其中为了方便对应存储每个代码函数的身份标识、结束时间以及结束标志位,也可以通过long型存储方式来存储每个代码函数的身份标识、结束时间以及结束标志位,其中,一个long数据型包括64位存储字节,一个long型整数的前18位用于保存对应代码函数的身份标识,中间45为用于保存对应代码函数的结束时间,最后一位用于保存对应代码函数的结束标志位。Similar to the above steps, after the target application program runs in the preset system, based on the second code inserted at the end position of each code function in the target application program, the identity of each code function can be recorded separately when each code function finishes running ID, end time and end flag, and save them in the preset collection in chronological order. Among them, in order to store the identity, end time and end flag of each code function conveniently, the identity, end time, and end flag of each code function can also be stored in a long-type storage method. Among them, a long data type Including 64-bit storage bytes, the first 18 bits of a long integer are used to save the identity of the corresponding code function, the middle 45 bits are used to save the end time of the corresponding code function, and the last bit is used to save the end sign of the corresponding code function bit.
在上一步骤的基础上,由于在记录代码函数的身份标识、开始时间以及开始标志位的过程中,还可能随时需要记录代码函数的身份标识、结束时间以及结束标志位,因此在记录各代码函数的身份标识、结束时间以及结束标志位的过程中,也可以按照时间先后顺序将记录结果保存至上述步骤中的同一预设集合中,也即代码函数的身份标识、结束时间以及结束标志位与代码函数的身份标识、结束时间以及结束标志位是存储在同一集合中。例如,当通过long型存储方式来存储每个代码函数的身份标识、结束时间以及结束标志位时,那么在确定一个代码函数的long型数据之后,可以按照long型中纪录的结束时间的顺序,将各long型数据插入到上述long型数组中,那么long型数组中包括了按照时间先后顺序排列的各long型数据。On the basis of the previous step, since it may be necessary to record the identity, end time, and end flag of the code function at any time during the process of recording the identity, start time, and start flag of the code function, so when recording each code In the process of identifying the identity, end time, and end flag of the function, the recording results can also be saved in the same preset set in the above steps in chronological order, that is, the identity, end time, and end flag of the code function It is stored in the same set as the code function's identity, end time, and end flag. For example, when the identity, end time, and end flag of each code function are stored in a long-type storage method, after determining the long-type data of a code function, it can be recorded in the order of the end time in the long-type, Insert each long-type data into the above-mentioned long-type array, then the long-type array includes each long-type data arranged in chronological order.
请参阅图9,图9为本申请一实施例提供的一种集合结构示意图。Please refer to FIG. 9 . FIG. 9 is a schematic diagram of an aggregate structure provided by an embodiment of the present application.
如图9所示,当通过long型存储方式来存储每个代码函数的身份标识、开始时间、结束时间、开始标志位以及结束标志位时,那么图9左边表示了一个long型数据的存储方式,也即将各long型数据组成一个集合(long型数组)。例如,图9中一个long型数据中,身份1代表身份标识为1的代码函数,时间1代表身份标识为1的代码函数的开始时间,标志1代表身份标识为1的代码函数的开始标志位; 再例如,图9中另一个long型数据中,身份1代表身份标识为1的代码函数,时间14代表身份标识为1的代码函数的结束时间,标志0代表身份标识为1的代码函数的结束标志位,其余long型数据与上述类似,也即身份数值表示对应的代码函数的唯一身份标识,时间数值表示对应的代码函数的开始时间或者结束时间(根据标志位判断),标志数值(0或者1)表示对应的代码函数是开始还是结束,其中long型数组中的各long型数据按照记录的开始时间或者结束时间进行排序。进一步地,按照代码函数的编写逻辑,同一个代码函数的不同部分可以分开执行,也即一个代码函数中可以嵌套其他代码函数,因此同一个代码函数的开始时间和结束时不同,且同一个代码函数的开始标志位与结束标志位也是不同的。As shown in Figure 9, when the identity, start time, end time, start flag, and end flag of each code function are stored in a long-type storage method, the left side of Figure 9 shows a long-type data storage method , that is, each long type data is formed into a set (long type array). For example, in the long data in Figure 9, identity 1 represents the code function whose identity is 1, time 1 represents the start time of the code function whose identity is 1, and flag 1 represents the start flag bit of the code function whose identity is 1 ; Another example, in another long data in Figure 9, identity 1 represents the code function with identity 1, time 14 represents the end time of the code function with identity 1, and mark 0 represents the code function with identity 1 The end flag, and the rest of the long data are similar to the above, that is, the identity value represents the unique identity of the corresponding code function, the time value represents the start time or end time of the corresponding code function (judged according to the flag bit), and the flag value (0 Or 1) indicates whether the corresponding code function starts or ends, wherein the long data in the long array is sorted according to the start time or end time of the records. Furthermore, according to the writing logic of the code function, different parts of the same code function can be executed separately, that is, other code functions can be nested in a code function, so the start time and end time of the same code function are different, and the same The start flag and end flag of the code function are also different.
那么通过这种集合可以很容易确定某一个代码函数的所在运行位置以及其对应的运行耗时,例如,对于任一身份标识的代码函数,通过上述集合可以确定两个long型数据,然后通过两个long型数据的标志位分别确定代码函数开始运行对应的long型数据,以及代码函数结束运行对应的long型数据,最后分别确定long型数据对应的开始时间以及结束时间,计算开始时间与结束时间的差值就可以确定该代码函数的运行耗时。类似的,可以计算出目标应用程序中任一一个代码函数的运行耗时。Then through this set, it is easy to determine the running position of a certain code function and its corresponding running time. For example, for any code function with an identity, two long data can be determined through the above set, and then through The flag bits of each long-type data respectively determine the long-type data corresponding to the start of the code function and the long-type data corresponding to the end of the code function, and finally determine the start time and end time corresponding to the long-type data respectively, and calculate the start time and end time The difference can determine the running time of the code function. Similarly, the running time of any code function in the target application can be calculated.
S803、统计在预设时间区间内目标应用程序执行界面绘制接口的次数,根据预设时间区间以及次数计算目标应用程序在预设时间区间内的丢帧率。S803. Count the number of times the target application program executes the interface drawing interface within the preset time interval, and calculate the frame loss rate of the target application program within the preset time interval according to the preset time interval and times.
关于步骤S803,可以参阅步骤S301中的详细记载,此处不在赘述。For step S803, reference may be made to the detailed description in step S301, which will not be repeated here.
S804、若丢帧率大于丢帧率阈值,则确定在预设时间区间内目标应用程对应的各代码执行栈的初始代码函数的第一身份标识,在预设集合中查找与各初始代码函数的第一身份标识匹配的第一开始标志位,以及第一开始标志位对应的第一开始时间。S804. If the frame loss rate is greater than the frame loss rate threshold, determine the first identity of the initial code function of each code execution stack corresponding to the target application within the preset time interval, and search the preset set for each initial code function The first start flag matched by the first ID of the ID and the first start time corresponding to the first start flag.
由上述代码执行栈的执行过程可知,代码执行栈的执行过程的占用时间的长短可能会导致目标应用程序丢帧,因此一种可行的确定导致目标应用程序丢帧原因的实施方式是,若确定预设时间区间内的丢帧率大于丢帧率阈值,先获取在该预设时间区间内目标应用程对应的各代码执行栈的执行时间,以便于根据执行时间确定对应的代码执行栈是否执行出现问题。From the execution process of the above code execution stack, it can be seen that the length of the execution process of the code execution stack may cause the frame loss of the target application program, so a feasible implementation method for determining the cause of the frame loss of the target application program is, if If the frame loss rate within the preset time interval is greater than the frame loss rate threshold, first obtain the execution time of each code execution stack corresponding to the target application within the preset time interval, so as to determine whether the corresponding code execution stack is executed according to the execution time problem appear.
由于代码执行栈可以认为是包括多个代码函数,且代码函数在执行时具有一定的执行逻辑,执行逻辑的先后决定了代码函数的执行顺序,在上述集合中各代码函数的记录结果是按照时间先后顺序进行排列的,因此可以根据上述映射关系先确定在预设时间区间内目标应用程对应的各代码执行栈,然后确定各代码执行栈的初始代码函数的第一身份标识,其中,代码执行栈的初始代码函数是指代码执行栈开始运行时第一个执行的代码函数,最后在预设集合中查找与各初始代码函数的第一身份标识对应的记录结果(例如,long型数据),在记录结果中确定与第一身份标识匹配的第一开始标志位,以及第一开始标志位对应的第一开始时间,那么各第一开始时间可以认为是各代码执行栈开始运行的时间。Since the code execution stack can be considered as including multiple code functions, and the code functions have a certain execution logic during execution, the sequence of execution logic determines the execution order of the code functions. Therefore, according to the above mapping relationship, it is possible to first determine the code execution stacks corresponding to the target application program within the preset time interval, and then determine the first identity of the initial code function of each code execution stack, wherein the code execution The initial code function of the stack refers to the code function that is executed first when the code execution stack starts to run, and finally finds the record result (for example, long data) corresponding to the first identity of each initial code function in the preset set, In the record result, if the first start flag matched with the first identity and the first start time corresponding to the first start flag are determined, then each first start time can be regarded as the time when each code execution stack starts to run.
S805、确定在预设时间区间内目标应用程对应的各代码执行栈的结束代码函数的第二身份标识,在预设集合中查找与各结束代码函数的第二身份标识匹配的第二结束标志位,以及第二结束标志位对应的第二结束时间。S805. Determine the second identity of the end code function of each code execution stack corresponding to the target application within the preset time interval, and search for the second end mark matching the second identity of each end code function in the preset set bit, and the second end time corresponding to the second end flag bit.
同样的,还可以根据上述映射关系确定在预设时间区间内目标应用程对应的各代码执行栈的结束代码函数的第二身份标识,其中,代码执行栈的初始代码函数是指代码执行栈开始运行时第一个执行的代码函数。可以理解的,由于代码函数的编写逻辑,一个代码执行栈的开始代码函数与结束代码函数为同一个代码函数的不同部分,因此一个代码执行栈的开始代码函数的身份标识与结束代码函数的身份标识可以是相同的(也即第一身份标识与第二身份标识是相同的);当然一个代码执行栈的开始代码函数与结束代码函数可以不是同一个代码函数的不同部分,因此一个代码执行栈的开始代码函数的身份标识与结束代码函数的身份标识也可以是不同的(也即第一身份标识与第二身份标识是不同的)。还可以在预设集合中查找与各结束代码函数的第二身份标识对应的记录结果(例如,long型数据),并在记录结果中确定与第二身份标识匹配的第二结束标志位,以及第二结束标志位对应的第二结束时间,那么各第二结束时间可以认为是各代码执行栈结束运行的时间。Similarly, the second identity of the end code function of each code execution stack corresponding to the target application within the preset time interval can also be determined according to the above mapping relationship, wherein the initial code function of the code execution stack refers to the start code function of the code execution stack The first code function to execute at runtime. Understandably, due to the writing logic of the code function, the start code function and the end code function of a code execution stack are different parts of the same code function, so the identity of the start code function and the end code function of a code execution stack The identifiers can be the same (that is, the first identity identifier and the second identity identifier are the same); of course, the start code function and the end code function of a code execution stack may not be different parts of the same code function, so a code execution stack The ID of the start code function and the ID of the end code function may also be different (that is, the first ID and the second ID are different). It is also possible to search for the record results (for example, long data) corresponding to the second identity of each end code function in the preset set, and determine the second end flag bit matching the second identity in the record results, and For the second end time corresponding to the second end flag bit, each second end time can be considered as the time when each code execution stack finishes running.
S806、将各代码执行栈的初始代码函数的第一开始时间与各代码执行栈的结束代码函数的第二结束时间的差值,作为各代码执行栈的执行时间。S806. Use the difference between the first start time of the initial code function of each code execution stack and the second end time of the end code function of each code execution stack as the execution time of each code execution stack.
上述记载了,各第一开始时间可以认为是各代码执行栈开始运行的时间,且各第二结束时间可以认为是各代码执行栈结束运行的时间,那么可以将各代码执行栈的初始代码函数的第一开始时间与各代码执行栈的结束代码函数的第二结束时间的差值,作为各代码执行栈的执行时间。As mentioned above, each first start time can be considered as the time when each code execution stack starts running, and each second end time can be considered as the time when each code execution stack ends running, so the initial code function of each code execution stack can be The difference between the first start time of the code execution stack and the second end time of the end code function of each code execution stack is used as the execution time of each code execution stack.
S807、确定各代码执行栈的类型,代码执行栈的类型包括界面绘制执行栈以及非界面绘制执行栈。S807. Determine the type of each code execution stack. The type of code execution stack includes an interface rendering execution stack and a non-interface rendering execution stack.
在上述实施例中介绍了,代码执行栈的类型包括界面绘制执行栈以及非界面绘制执行栈,且不同类型的代码执行栈的执行时间是不一样,因此在确定导致目标应用程序丢帧的目标代码执行栈时,可以先确定各代码执行栈的类型。In the above-mentioned embodiment, the types of code execution stacks include interface drawing execution stacks and non-interface drawing execution stacks, and the execution time of different types of code execution stacks is different, so when determining the target that causes the target application to drop frames When the code executes the stack, the type of each code execution stack can be determined first.
S808、将代码执行栈的类型为界面绘制执行栈,且代码执行栈的执行时间大于系统界面绘制周期的代码执行栈确定为目标代码执行栈。S808. Determine the type of the code execution stack as the interface drawing execution stack, and the code execution stack whose execution time is longer than the system interface drawing cycle is determined as the target code execution stack.
由于在目标应用程序的显示界面不发生丢帧的情况下,一个界面绘制代码执行栈对应一个系统界面,因此当代码执行栈的类型为界面绘制执行栈时,可以将该界面绘制执行栈的执行时间与系统界面绘制周期进行比较,若界面绘制执行栈的执行时间大于系统界面绘制周期,则可以将该代码执行栈确定为目标代码执行栈,也即导致目标应用程序丢帧的目标代码执行栈。Since one interface drawing code execution stack corresponds to one system interface when the display interface of the target application program does not drop frames, when the type of the code execution stack is the interface drawing execution stack, the execution of the interface drawing execution stack can be executed The time is compared with the system interface drawing cycle. If the execution time of the interface drawing execution stack is longer than the system interface drawing cycle, the code execution stack can be determined as the target code execution stack, that is, the target code execution stack that causes the target application to drop frames .
S809、将代码执行栈的类型为非界面绘制执行栈,且代码执行栈的执行时间大于预设执行栈执行时间的代码执行栈确定为目标代码执行栈。S809. Determine the code execution stack whose type is the non-interface drawing execution stack and whose execution time is longer than the preset execution stack execution time as the target code execution stack.
进一步地,由于在目标应用程序的显示界面不发生丢帧的情况下,非界面绘制执行栈应该在线程中占用较小的时间,以避免占用了后续的系统界面绘制周期,避免后续的界面绘制代码执行栈不能正常执行,非界面绘制执行栈在线程中占用较小的时间可以设置为预设执行栈执行时间,预设执行栈执行时间的具体数值可以根据需要进行设定,预设执行栈执行时间可以认为是非界面绘制执行栈执行时不影响后续的界面绘制代码执行栈能正常执行最小时间。Further, since the display interface of the target application program does not drop frames, the non-interface drawing execution stack should occupy a small amount of time in the thread, so as to avoid occupying the subsequent system interface drawing cycle and avoid subsequent interface drawing The code execution stack cannot be executed normally. The non-interface drawing execution stack takes up less time in the thread. It can be set as the default execution stack execution time. The specific value of the preset execution stack execution time can be set according to the needs. The default execution stack The execution time can be considered as the minimum time for the normal execution of the non-interface drawing execution stack without affecting the normal execution of the subsequent interface drawing code execution stack.
因此当代码执行栈的类型为非界面绘制执行栈时,可以将非界面绘制执行栈的执行时间与预设执行栈执行时间进行比较,当非界面绘制执行栈的执行时间大于预设执行栈执行时间时,则可以将该代码执行栈确定为目标代码执行栈,也即导致目标应用程序丢帧的目标代码执行栈。Therefore, when the type of the code execution stack is the non-interface drawing execution stack, the execution time of the non-interface drawing execution stack can be compared with the execution time of the preset execution stack. When the execution time of the non-interface drawing execution stack is greater than the execution time of the preset execution stack time, the code execution stack can be determined as the target code execution stack, that is, the target code execution stack that causes the target application program to drop frames.
S810、基于预设集合确定目标代码执行栈中初始代码函数与结束代码函数之间的第三身份标识、第三开始标志位、第三结束标志位、第三开始时间以及第三结束时间。S810. Determine a third identity, a third start flag, a third end flag, a third start time, and a third end time between the initial code function and the end code function in the target code execution stack based on a preset set.
可以理解的,代码执行栈可以认为是一种代码函数的集合,因此代码执行栈中可以包括至少一个代码函数,那么在确定导致目标应用程序丢帧的目标代码执行栈之后,为了便于开发人员分析出导致目标应用程序丢帧的代码函数,还可以获取目标代码执行栈包括的目标代码函数以及各目标代码函数对应的运行耗时。It can be understood that the code execution stack can be considered as a collection of code functions, so the code execution stack can include at least one code function, then after determining the target code execution stack that causes the target application to drop frames, in order to facilitate the analysis of the developer The code function that causes the frame loss of the target application program can be obtained, and the target code functions included in the target code execution stack and the running time corresponding to each target code function can be obtained.
具体的,可以先根据上述映射关系确定目标代码执行栈中初始代码函数的身份标识与结束代码函数的身份标识,由于预设集合中各记录数据是按照时间先后顺序排列的,因此初始代码函数与结束代码函数之间的代码函数即为目标代码执行栈中的目标代码函数,那么可以基于预设集合确定初始代码函数的身份标识与结束代码函数的身份标识之间的所有的身份标识,将这些身份标识确定为第三身份标识,这些第三身份标识即为目标代码函数的身份标识。进一步地,还可以根据第三身份标识确定目标代码函数的第三开始标志位、第三结束标志位、第三开始时间以及第三结束时间。Specifically, the identity of the initial code function and the identity of the end code function in the target code execution stack can be determined first according to the above mapping relationship. Since the record data in the preset collection is arranged in chronological order, the initial code function and the end code function The code functions between the end code functions are the target code functions in the target code execution stack, so all the identities between the identities of the initial code functions and the identities of the end code functions can be determined based on the preset set, and these The identities are determined as third identities, and these third identities are the identities of the object code functions. Further, a third start flag, a third end flag, a third start time, and a third end time of the target code function may also be determined according to the third identifier.
S811、根据各第三身份标识获取对应的各目标代码函数,根据各目标代码函数第三开始标志位对应的第三开始时间,与各目标代码函数第三结束标志位对应的第三结束时间的差值确定各目标代码函数对应的运行耗时。S811. Obtain the corresponding target code functions according to each third identity, and according to the third start time corresponding to the third start flag bit of each target code function, the third end time corresponding to the third end flag bit of each target code function The difference determines the execution time corresponding to each object code function.
由于第三身份标识即为目标代码函数的身份标识,因此可以基于上述映射关系根据各第三身份标识确定对应的各目标代码函数,并从目标应用程序的代码存储位置获取到各目标代码函数的具体代码。进一步地,还可以计算根据各目标代码函数第三开始标志位对应的第三开始时间,与各目标代码函数第三结束标志位对应的第三结束时间的差值,并将各差值确定为各目标代码函数对应的运行耗时。Since the third identity is the identity of the target code function, the corresponding target code functions can be determined based on the above-mentioned mapping relationship according to each third identity, and the target code function can be obtained from the code storage location of the target application program. specific code. Further, it is also possible to calculate the difference between the third start time corresponding to the third start flag of each object code function and the third end time corresponding to the third end flag of each object code function, and determine each difference as The running time corresponding to each object code function.
S812、打印各目标代码函数以及各目标代码函数对应的运行耗时。S812. Print each object code function and the running time corresponding to each object code function.
为了便于开发人员分析出导致目标应用程序丢帧的代码函数,还可以获取目标代码执行栈包括的目 标代码函数以及各目标代码函数对应的运行耗时,并将目标代码函数以及各目标代码函数对应的运行耗时进行打印,其中打印的具体方式可以是打印日志或者上传打印日志。In order to facilitate developers to analyze the code functions that cause the target application to drop frames, it is also possible to obtain the target code functions included in the target code execution stack and the running time corresponding to each target code function, and compare the target code functions and each target code function It takes time to print the operation, and the specific way of printing can be to print the log or upload the print log.
由于代码执行栈中各代码函数的运行耗时也是在一定的预设时间范围之内,那么如果某一或者某些目标代码函数对应的运行耗时超过预设时间范围,那么可以确定该目标代码函数是导致目标代码执行栈执行出现问题的原因,开发人员可以对该目标代码函数进行优化,以使得该目标代码函数以及对应的目标代码执行栈正常运行,进而使得目标应用程序正常进行界面绘制,解决目标应用程序丢帧得问题。Since the running time of each code function in the code execution stack is also within a certain preset time range, if the running time corresponding to one or some target code functions exceeds the preset time range, then the target code can be determined The function is the cause of the problem in the execution of the target code execution stack. Developers can optimize the target code function so that the target code function and the corresponding target code execution stack can run normally, so that the target application can draw the interface normally. Addresses frame dropping issues with target applications.
在本申请实施例中,通过预先在目标应用程序的代码函数中插入代码,通过插入的代码可以准确计算出目标应用程对应的各代码执行栈的执行时间,以使得可以根据各代码执行栈的执行时间确定导致目标应用程序丢帧的目标代码执行栈,并且通过插入的代码也可以准确定位出目标代码执行栈包括的目标代码函数以及各目标代码函数对应的运行耗时,可以帮助开发人员快速、准确分析出导致丢帧的原因。In this embodiment of the application, by inserting code in the code function of the target application program in advance, the execution time of each code execution stack corresponding to the target application program can be accurately calculated through the inserted code, so that the execution time of each code execution stack can be calculated according to each code execution stack. Execution time determines the target code execution stack that causes the target application to drop frames, and the inserted code can also accurately locate the target code functions included in the target code execution stack and the corresponding running time of each target code function, which can help developers quickly , Accurately analyze the cause of frame loss.
请参阅图10,图10为本申请一实施例提供的一种帧率处理装置的结构框图。Please refer to FIG. 10 . FIG. 10 is a structural block diagram of a frame rate processing device provided by an embodiment of the present application.
如图10所示,帧率处理装置1000包括:As shown in Figure 10, the frame rate processing device 1000 includes:
丢帧计算模块1010,用于统计在预设时间区间内目标应用程序执行界面绘制接口的次数,根据预设时间区间以及次数计算目标应用程序在预设时间区间内的丢帧率。The frame loss calculation module 1010 is configured to count the number of times the target application program executes the interface drawing interface within the preset time interval, and calculate the frame loss rate of the target application program within the preset time interval according to the preset time interval and times.
可选地,丢帧计算模块1010还用于确定目标应用程序对应的系统界面绘制周期,以及将预设数量的系统界面绘制周期确定为预设时间区间。Optionally, the frame loss calculation module 1010 is further configured to determine a system interface drawing period corresponding to the target application program, and determine a preset number of system interface drawing periods as a preset time interval.
可选地,根据预设时间区间以及次数计算目标应用程序在预设时间区间内的丢帧率,包括:获取目标差值与预设数量的比值,将比值作为目标应用程序在预设时间区间内的丢帧率;其中,目标差值为目标应用程序执行界面绘制接口的次数与预设数量之间的差值。Optionally, calculating the frame loss rate of the target application in the preset time interval according to the preset time interval and the number of times includes: obtaining the ratio of the target difference to the preset number, and using the ratio as the target application in the preset time interval The frame loss rate within ; wherein, the target difference is the difference between the number of times the target application program executes the interface drawing interface and the preset number.
可选地,丢帧计算模块1010还用于计算目标应用程序的当前界面帧率,以及在目标应用程序的界面中显示当前界面帧率;和/或在目标应用程序的界面中显示预设时间区间内的丢帧率。Optionally, the frame loss calculation module 1010 is also used to calculate the current interface frame rate of the target application program, and display the current interface frame rate in the interface of the target application program; and/or display the preset time in the interface of the target application program The frame loss rate in the interval.
执行栈确定模块1020,用于获取在预设时间区间内目标应用程对应的各代码执行栈的执行时间,以及根据各代码执行栈的执行时间确定导致目标应用程序丢帧的目标代码执行栈。The execution stack determination module 1020 is configured to obtain the execution time of each code execution stack corresponding to the target application program within a preset time interval, and determine the target code execution stack that causes the target application program to drop frames according to the execution time of each code execution stack.
代码打印模块1030,用于打印目标代码执行栈包括的目标代码函数以及各目标代码函数对应的运行耗时。The code printing module 1030 is configured to print the target code functions included in the target code execution stack and the running time corresponding to each target code function.
请参阅图11,图11为本申请另一实施例提供的一种帧率处理装置的结构框图。Please refer to FIG. 11 . FIG. 11 is a structural block diagram of a frame rate processing device provided by another embodiment of the present application.
如图11所示,帧率处理装置1000包括:As shown in Figure 11, the frame rate processing device 1000 includes:
第一代码插入模块1110,用于基于在目标应用程序中各代码函数的开始位置插入的第一代码,在各代码函数开始运行时分别记录各代码函数的身份标识、开始时间以及开始标志位,并按照时间先后顺序保存至预设集合中。The first code insertion module 1110 is used to record the identity, start time and start flag of each code function when each code function starts running based on the first code inserted at the start position of each code function in the target application program, And save them in the preset collection in chronological order.
第二代码插入模块1120,用于基于在目标应用程序中各代码函数的结束位置插入的第二代码,在各代码函数结束运行时分别记录各代码函数的身份标识、结束时间以及结束标志位,并按照时间先后顺序保存至预设集合中。The second code insertion module 1120 is used to record the identity, end time and end flag of each code function when each code function ends running based on the second code inserted at the end position of each code function in the target application program, And save them in the preset collection in chronological order.
丢帧计算模块1130,用于统计在预设时间区间内目标应用程序执行界面绘制接口的次数,根据预设时间区间以及次数计算目标应用程序在预设时间区间内的丢帧率。The frame loss calculation module 1130 is configured to count the number of times the target application program executes the interface drawing interface within the preset time interval, and calculate the frame loss rate of the target application program within the preset time interval according to the preset time interval and times.
第一信息确定模块1140,用于若丢帧率大于丢帧率阈值,则确定在预设时间区间内目标应用程对应的各代码执行栈的初始代码函数的第一身份标识,在预设集合中查找与各初始代码函数的第一身份标识匹配的第一开始标志位,以及第一开始标志位对应的第一开始时间。The first information determination module 1140 is configured to determine the first identity of the initial code function of each code execution stack corresponding to the target application program within the preset time interval if the frame loss rate is greater than the frame loss rate threshold, in the preset set Search for the first start flag matching the first identity of each initial code function, and the first start time corresponding to the first start flag.
第二信息确定模块1150,用于确定在预设时间区间内目标应用程对应的各代码执行栈的结束代码函数的第二身份标识,在预设集合中查找与各结束代码函数的第二身份标识匹配的第二结束标志位,以及第二结束标志位对应的第二结束时间。The second information determination module 1150 is configured to determine the second identity of the end code function of each code execution stack corresponding to the target application within the preset time interval, and search for the second identity of each end code function in the preset set Identify the matched second end flag bit, and the second end time corresponding to the second end flag bit.
执行栈时间确定模块1160,用于将各代码执行栈的初始代码函数的第一开始时间与各代码执行栈的 结束代码函数的第二结束时间的差值,作为各代码执行栈的执行时间。Execution stack time determination module 1160 is used to use the difference between the first start time of the initial code function of each code execution stack and the second end time of the end code function of each code execution stack as the execution time of each code execution stack.
执行栈类型确定模块1170,用于确定各代码执行栈的类型,代码执行栈的类型包括界面绘制执行栈以及非界面绘制执行栈。The execution stack type determination module 1170 is configured to determine the type of each code execution stack, and the type of the code execution stack includes an interface drawing execution stack and a non-interface drawing execution stack.
第一判断模块1180,用于将代码执行栈的类型为界面绘制执行栈,且代码执行栈的执行时间大于系统界面绘制周期的代码执行栈确定为目标代码执行栈。The first judging module 1180 is configured to determine the type of the code execution stack as the interface drawing execution stack, and the code execution stack whose execution time is longer than the system interface drawing cycle as the target code execution stack.
第二判断模块1190,用于将代码执行栈的类型为非界面绘制执行栈,且代码执行栈的执行时间大于预设执行栈执行时间的代码执行栈确定为目标代码执行栈。The second judging module 1190 is configured to determine the code execution stack whose type is non-interface drawing execution stack and whose execution time is longer than the preset execution stack execution time as the target code execution stack.
第三信息确定模块11100,用于基于预设集合确定目标代码执行栈中初始代码函数与结束代码函数之间的第三身份标识、第三开始标志位、第三结束标志位、第三开始时间以及第三结束时间。The third information determination module 11100 is configured to determine the third identity, the third start flag, the third end flag, and the third start time between the initial code function and the end code function in the target code execution stack based on a preset set and the third end time.
代码耗时确定模块11110,用于根据各第三身份标识获取对应的各目标代码函数,根据各目标代码函数第三开始标志位对应的第三开始时间,与各目标代码函数第三结束标志位对应的第三结束时间的差值确定各目标代码函数对应的运行耗时。The code time-consuming determination module 11110 is used to obtain the corresponding target code functions according to the third identities, according to the third start time corresponding to the third start flag of each target code function, and the third end flag of each target code function The difference of the corresponding third end time determines the running time corresponding to each target code function.
打印模块11120,用于打印各目标代码函数以及各目标代码函数对应的运行耗时。The printing module 11120 is used to print each object code function and the running time corresponding to each object code function.
在本申请实施例中,一种帧率处理装置包括:丢帧计算模块,用于统计在预设时间区间内目标应用程序执行界面绘制接口的次数,根据预设时间区间以及次数计算目标应用程序在预设时间区间内的丢帧率;执行栈确定模块,用于获取在预设时间区间内目标应用程对应的各代码执行栈的执行时间,以及根据各代码执行栈的执行时间确定导致目标应用程序丢帧的目标代码执行栈;代码打印模块,用于打印目标代码执行栈包括的目标代码函数以及各目标代码函数对应的运行耗时。由于是通过统计在预设时间区间内目标应用程序执行界面绘制接口的次数来确定丢帧率,也即通过纯软件的方式确定丢帧率,可以减少帧率处理的成本,另外通过代码执行栈的执行时间,可以实时定位分析出导致目标应用程序丢帧的目标代码执行栈,打印目标代码执行栈包括的目标代码函数以及各目标代码函数对应的运行耗时,可以帮助开发人员快速、准确分析出导致丢帧的原因。In an embodiment of the present application, a frame rate processing device includes: a frame loss calculation module, configured to count the number of times a target application program executes an interface drawing interface within a preset time interval, and calculate the number of times the target application program executes an interface drawing interface according to the preset time interval and times The frame loss rate within the preset time interval; the execution stack determination module is used to obtain the execution time of each code execution stack corresponding to the target application program within the preset time interval, and determine the resulting target according to the execution time of each code execution stack The target code execution stack where the application program drops frames; the code printing module is used to print the target code functions included in the target code execution stack and the running time corresponding to each target code function. Because the frame loss rate is determined by counting the number of times the target application executes the interface drawing interface within the preset time interval, that is, the frame loss rate is determined by pure software, which can reduce the cost of frame rate processing. In addition, through the code execution stack It can locate and analyze the target code execution stack that causes the frame loss of the target application program in real time, and print the target code functions included in the target code execution stack and the running time corresponding to each target code function, which can help developers quickly and accurately analyze to find out the cause of the dropped frame.
本申请实施例还提供了一种计算机存储介质,计算机存储介质存储有多条指令,指令适于由处理器加载并执行如上述实施例中的任一项的方法的步骤。An embodiment of the present application further provides a computer storage medium, where a plurality of instructions are stored in the computer storage medium, and the instructions are suitable for being loaded by a processor and executing the steps of any one of the methods in the foregoing embodiments.
进一步地,请参见图12,图12为本申请实施例提供了一种终端的结构示意图。如图12所示,终端1200可以包括:至少一个中央处理器1201,至少一个网络接口1204,用户接口1203,存储器1205,至少一个通信总线1202。Further, please refer to FIG. 12 . FIG. 12 provides a schematic structural diagram of a terminal according to an embodiment of the present application. As shown in FIG. 12 , a terminal 1200 may include: at least one central processing unit 1201 , at least one network interface 1204 , a user interface 1203 , a memory 1205 , and at least one communication bus 1202 .
其中,通信总线1202用于实现这些组件之间的连接通信。Wherein, the communication bus 1202 is used to realize connection and communication between these components.
其中,用户接口1203可以包括显示屏(Display)、摄像头(Camera),可选用户接口1203还可以包括标准的有线接口、无线接口。Wherein, the user interface 1203 may include a display screen (Display) and a camera (Camera), and the optional user interface 1203 may also include a standard wired interface and a wireless interface.
其中,网络接口1204可选的可以包括标准的有线接口、无线接口(如WI-FI接口)。Wherein, the network interface 1204 may optionally include a standard wired interface and a wireless interface (such as a WI-FI interface).
其中,中央处理器1201可以包括一个或者多个处理核心。中央处理器1201利用各种接口和线路连接整个终端1200内的各个部分,通过运行或执行存储在存储器1205内的指令、程序、代码集或指令集,以及调用存储在存储器1205内的数据,执行终端1200的各种功能和处理数据。可选的,中央处理器1201可以采用数字信号处理(Digital Signal Processing,DSP)、现场可编程门阵列(Field-Programmable Gate Array,FPGA)、可编程逻辑阵列(Programmable Logic Array,PLA)中的至少一种硬件形式来实现。中央处理器1201可集成中央中央处理器(Central Processing Unit,CPU)、图像中央处理器(Graphics Processing Unit,GPU)和调制解调器等中的一种或几种的组合。其中,CPU主要处理操作系统、用户界面和应用程序等;GPU用于负责显示屏所需要显示的内容的渲染和绘制;调制解调器用于处理无线通信。可以理解的是,上述调制解调器也可以不集成到中央处理器1201中,单独通过一块芯片进行实现。Wherein, the central processing unit 1201 may include one or more processing cores. The central processing unit 1201 uses various interfaces and lines to connect various parts of the entire terminal 1200, by running or executing instructions, programs, code sets or instruction sets stored in the memory 1205, and calling data stored in the memory 1205 to execute Various functions and processing data of the terminal 1200. Optionally, the central processing unit 1201 can adopt at least one of a digital signal processing (Digital Signal Processing, DSP), a field-programmable gate array (Field-Programmable Gate Array, FPGA), and a programmable logic array (Programmable Logic Array, PLA). A form of hardware to achieve. The central processing unit 1201 may integrate one or a combination of a central processing unit (Central Processing Unit, CPU), an image central processing unit (Graphics Processing Unit, GPU) and a modem. Among them, the CPU mainly handles the operating system, user interface and application programs, etc.; the GPU is used to render and draw the content that needs to be displayed on the display screen; the modem is used to handle wireless communication. It can be understood that, the above-mentioned modem may not be integrated into the central processing unit 1201, but may be realized by a single chip.
其中,存储器1205可以包括随机存储器(Random Access Memory,RAM),也可以包括只读存储 器(Read-Only Memory)。可选的,该存储器1205包括非瞬时性计算机可读介质(non-transitory computer-readable storage medium)。存储器1205可用于存储指令、程序、代码、代码集或指令集。存储器1205可包括存储程序区和存储数据区,其中,存储程序区可存储用于实现操作系统的指令、用于至少一个功能的指令(比如触控功能、声音播放功能、图像播放功能等)、用于实现上述各个方法实施例的指令等;存储数据区可存储上面各个方法实施例中涉及到的数据等。存储器1205可选的还可以是至少一个位于远离前述中央处理器1201的存储装置。如图12所示,作为一种计算机存储介质的存储器1205中可以包括操作系统、网络通信模块、用户接口模块以及帧率处理程序。Wherein, the memory 1205 may include a random access memory (Random Access Memory, RAM), and may also include a read-only memory (Read-Only Memory). Optionally, the memory 1205 includes a non-transitory computer-readable storage medium (non-transitory computer-readable storage medium). The memory 1205 may be used to store instructions, programs, codes, sets of codes, or sets of instructions. The memory 1205 may include a program storage area and a data storage area, wherein the program storage area may store instructions for implementing an operating system, instructions for at least one function (such as a touch function, a sound playback function, an image playback function, etc.), Instructions and the like for implementing the above method embodiments; the storage data area can store the data and the like involved in the above method embodiments. Optionally, the memory 1205 may also be at least one storage device located away from the aforementioned central processing unit 1201 . As shown in FIG. 12 , the memory 1205 as a computer storage medium may include an operating system, a network communication module, a user interface module, and a frame rate processing program.
在图12所示的终端1200中,用户接口1203主要用于为用户提供输入的接口,获取用户输入的数据;而中央处理器1201可以用于调用存储器1205中存储的帧率处理程序,并具体执行以下操作:In the terminal 1200 shown in FIG. 12 , the user interface 1203 is mainly used to provide the user with an input interface to obtain the data input by the user; and the central processing unit 1201 can be used to call the frame rate processing program stored in the memory 1205, and specifically Do the following:
统计在预设时间区间内目标应用程序执行界面绘制接口的次数,根据预设时间区间以及次数计算目标应用程序在预设时间区间内的丢帧率;若获取在预设时间区间内目标应用程对应的各代码执行栈的执行时间,以及根据各代码执行栈的执行时间确定导致目标应用程序丢帧的目标代码执行栈;打印目标代码执行栈包括的目标代码函数以及各目标代码函数对应的运行耗时。Count the number of times the target application program executes the interface drawing interface in the preset time interval, and calculate the frame loss rate of the target application program in the preset time interval according to the preset time interval and times; The corresponding execution time of each code execution stack, and the execution time of each code execution stack to determine the target code execution stack that causes the target application to lose frames; print the target code functions included in the target code execution stack and the corresponding operation of each target code function time consuming.
可选地,统计在预设时间区间内目标应用程序执行界面绘制接口的次数之前,还包括:确定目标应用程序对应的系统界面绘制周期,以及将预设数量的系统界面绘制周期确定为预设时间区间。Optionally, before counting the number of times the target application program executes the interface drawing interface within the preset time interval, it also includes: determining the system interface drawing cycle corresponding to the target application program, and determining the preset number of system interface drawing cycles as the preset time interval.
可选地,根据预设时间区间以及次数计算目标应用程序在预设时间区间内的丢帧率,包括:获取目标差值与预设数量的比值,将比值作为目标应用程序在预设时间区间内的丢帧率;其中,目标差值为目标应用程序执行界面绘制接口的次数与预设数量之间的差值。Optionally, calculating the frame loss rate of the target application in the preset time interval according to the preset time interval and the number of times includes: obtaining the ratio of the target difference to the preset number, and using the ratio as the target application in the preset time interval The frame loss rate within ; wherein, the target difference is the difference between the number of times the target application program executes the interface drawing interface and the preset number.
可选地,统计在预设时间区间内目标应用程序执行界面绘制接口的次数之前,还包括:基于在目标应用程序中各代码函数的开始位置插入的第一代码,在各代码函数开始运行时分别记录各代码函数的身份标识、开始时间以及开始标志位,并按照时间先后顺序保存至预设集合中;基于在目标应用程序中各代码函数的结束位置插入的第二代码,在各代码函数结束运行时分别记录各代码函数的身份标识、结束时间以及结束标志位,并按照时间先后顺序保存至预设集合中。Optionally, before counting the number of times the target application program executes the interface drawing interface within the preset time interval, it also includes: based on the first code inserted at the start position of each code function in the target application program, when each code function starts to run Record the identity, start time, and start flag of each code function respectively, and save them in the preset collection in chronological order; based on the second code inserted at the end position of each code function in the target application program, in each code function When the execution ends, the identity, end time, and end flag of each code function are recorded respectively, and are saved in the preset collection in chronological order.
可选地,获取在预设时间区间内目标应用程对应的各代码执行栈的执行时间,包括:若丢帧率大于预设丢帧率阈值,则确定在预设时间区间内目标应用程对应的各代码执行栈的初始代码函数的第一身份标识,在预设集合中查找与各初始代码函数的第一身份标识匹配的第一开始标志位,以及第一开始标志位对应的第一开始时间;确定在预设时间区间内目标应用程对应的各代码执行栈的结束代码函数的第二身份标识,在预设集合中查找与各结束代码函数的第二身份标识匹配的第二结束标志位,以及第二结束标志位对应的第二结束时间;将各代码执行栈的初始代码函数的第一开始时间与各代码执行栈的结束代码函数的第二结束时间的差值,作为各代码执行栈的执行时间。Optionally, obtaining the execution time of each code execution stack corresponding to the target application within the preset time interval includes: if the frame loss rate is greater than the preset frame loss rate threshold, determining that the target application corresponds to the The first identity of the initial code function of each code execution stack of each code execution stack, the first start flag matching the first identity of each initial code function is searched in the preset set, and the first start flag corresponding to the first start flag Time: determine the second identity mark of the end code function of each code execution stack corresponding to the target application program within the preset time interval, and search for the second end mark matching the second identity mark of each end code function in the preset set bit, and the second end time corresponding to the second end flag bit; the difference between the first start time of the initial code function of each code execution stack and the second end time of the end code function of each code execution stack is used as each code Execution time of the execution stack.
可选地,根据各代码执行栈的执行时间确定导致目标应用程序丢帧的目标代码执行栈,包括:确定各代码执行栈的类型,代码执行栈的类型包括界面绘制执行栈以及非界面绘制执行栈;将代码执行栈的类型为界面绘制执行栈,且代码执行栈的执行时间大于系统界面绘制周期的代码执行栈确定为目标代码执行栈;和/或将代码执行栈的类型为非界面绘制执行栈,且代码执行栈的执行时间大于预设执行栈执行时间的代码执行栈确定为目标代码执行栈。Optionally, according to the execution time of each code execution stack, determining the target code execution stack that causes the frame loss of the target application program includes: determining the type of each code execution stack, and the type of code execution stack includes interface drawing execution stack and non-interface drawing execution Stack; the type of the code execution stack is the interface drawing execution stack, and the code execution stack whose execution time is longer than the system interface drawing cycle is determined as the target code execution stack; and/or the type of the code execution stack is non-interface drawing execution stack, and the code execution stack whose execution time of the code execution stack is greater than the execution time of the preset execution stack is determined as the target code execution stack.
可选地,打印目标代码执行栈包括的目标代码函数以及各目标代码函数对应的运行耗时,包括:基于预设集合确定目标代码执行栈中初始代码函数与结束代码函数之间的第三身份标识、第三开始标志位、第三结束标志位、第三开始时间以及第三结束时间;根据各第三身份标识获取对应的各目标代码函数,根据各目标代码函数第三开始标志位对应的第三开始时间,与各目标代码函数第三结束标志位对应的第三结束时间的差值确定各目标代码函数对应的运行耗时;打印各目标代码函数以及各目标代码函数对应的运行耗时。Optionally, printing the target code functions included in the target code execution stack and the running time corresponding to each target code function includes: determining the third identity between the initial code function and the end code function in the target code execution stack based on a preset set logo, the third start flag, the third end flag, the third start time and the third end time; obtain the corresponding target code functions according to each third identity, and obtain the corresponding target code functions according to the third start flag of each target code function The third start time, the difference between the third end time corresponding to the third end flag bit of each object code function determines the running time corresponding to each object code function; print each object code function and the running time corresponding to each object code function .
可选地,根据预设时间区间以及次数计算目标应用程序在预设时间区间内的丢帧率之后,还包括:计算目标应用程序的当前界面帧率,以及在目标应用程序的界面中显示当前界面帧率;和/或在目标应用程序的界面中显示预设时间区间内的丢帧率。Optionally, after calculating the frame loss rate of the target application in the preset time interval according to the preset time interval and times, it also includes: calculating the current interface frame rate of the target application, and displaying the current frame rate in the interface of the target application interface frame rate; and/or display the frame loss rate within a preset time interval in the interface of the target application.
可选地,统计在预设时间区间内目标应用程序执行界面绘制接口的次数之前,还包括:为目标应用程序中各代码函数分别分配唯一的身份标识,并将各代码函数与对应的身份标识建立映射关系;基于所有映射关系生成映射文件,以及将映射文件打包至目标应用程序中,以使得目标应用程序安装之后加载映射文件并解析出所有映射关系。Optionally, before counting the number of times the target application program executes the interface drawing interface within the preset time interval, it also includes: assigning unique identities to each code function in the target application program, and linking each code function with the corresponding identities Establishing a mapping relationship; generating a mapping file based on all the mapping relationships, and packaging the mapping file into the target application, so that the target application loads the mapping file and resolves all the mapping relationships after installation.
在本申请所提供的几个实施例中,应该理解到,所揭露的装置和方法,可以通过其它的方式实现。例如,以上所描述的装置实施例仅仅是示意性的,例如,模块的划分,仅仅为一种逻辑功能划分,实际实现时可以有另外的划分方式,例如多个模块或组件可以结合或者可以集成到另一个系统,或一些特征可以忽略,或不执行。另一点,所显示或讨论的相互之间的耦合或直接耦合或通信连接可以是通过一些接口,装置或模块的间接耦合或通信连接,可以是电性,机械或其它的形式。In the several embodiments provided in this application, it should be understood that the disclosed devices and methods may be implemented in other ways. For example, the device embodiments described above are only illustrative. For example, the division of modules is only a logical function division. In actual implementation, there may be other division methods. For example, multiple modules or components can be combined or integrated. to another system, or some features may be ignored, or not implemented. In another point, the mutual coupling or direct coupling or communication connection shown or discussed may be through some interfaces, and the indirect coupling or communication connection of devices or modules may be in electrical, mechanical or other forms.
作为分离部件说明的模块可以是或者也可以不是物理上分开的,作为模块显示的部件可以是或者也可以不是物理模块,即可以位于一个地方,或者也可以分布到多个网络模块上。可以根据实际的需要选择其中的部分或者全部模块来实现本实施例方案的目的。A module described as a separate component may or may not be physically separated, and a component shown as a module may or may not be a physical module, that is, it may be located in one place, or may also be distributed to multiple network modules. Part or all of the modules can be selected according to actual needs to achieve the purpose of the solution of this embodiment.
另外,在本申请各个实施例中的各功能模块可以集成在一个处理模块中,也可以是各个模块单独物理存在,也可以两个或两个以上模块集成在一个模块中。上述集成的模块既可以采用硬件的形式实现,也可以采用软件功能模块的形式实现。In addition, each functional module in each embodiment of the present application may be integrated into one processing module, each module may exist separately physically, or two or more modules may be integrated into one module. The above-mentioned integrated modules can be implemented in the form of hardware or in the form of software function modules.
集成的模块如果以软件功能模块的形式实现并作为独立的产品销售或使用时,可以存储在一个计算机可读取存储介质中。基于这样的理解,本申请的技术方案本质上或者说对现有技术做出贡献的部分或者该技术方案的全部或部分可以以软件产品的形式体现出来,该计算机软件产品存储在一个存储介质中,包括若干指令用以使得一台计算机设备(可以是个人计算机,服务器,或者网络设备等)执行本申请各个实施例方法的全部或部分步骤。而前述的存储介质包括:U盘、移动硬盘、只读存储器(ROM,Read-Only Memory)、随机存取存储器(RAM,Random Access Memory)、磁碟或者光盘等各种可以存储程序代码的介质。If the integrated modules are realized in the form of software function modules and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present application is essentially or part of the contribution to the prior art or all or part of the technical solution can be embodied in the form of a software product, and the computer software product is stored in a storage medium , including several instructions to make a computer device (which may be a personal computer, a server, or a network device, etc.) execute all or part of the steps of the methods in various embodiments of the present application. The aforementioned storage media include: U disk, mobile hard disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), magnetic disk or optical disc, etc., which can store program codes. .
需要说明的是,对于前述的各方法实施例,为了简便描述,故将其都表述为一系列的动作组合,但是本领域技术人员应该知悉,本申请并不受所描述的动作顺序的限制,因为依据本申请,某些步骤可以采用其它顺序或者同时进行。其次,本领域技术人员也应该知悉,说明书中所描述的实施例均属于优选实施例,所涉及的动作和模块并不一定都是本申请所必须的。It should be noted that, for the sake of simplicity of description, the aforementioned method embodiments are expressed as a series of action combinations, but those skilled in the art should know that the present application is not limited by the described action sequence. Depending on the application, certain steps may be performed in other orders or simultaneously. Secondly, those skilled in the art should also know that the embodiments described in the specification are all preferred embodiments, and the actions and modules involved are not necessarily required by this application.
在上述实施例中,对各个实施例的描述都各有侧重,某个实施例中没有详述的部分,可以参见其它实施例的相关描述。In the foregoing embodiments, the descriptions of each embodiment have their own emphases, and for parts not described in detail in a certain embodiment, reference may be made to relevant descriptions of other embodiments.
以上为对本申请所提供的一种帧率处理方法、装置、存储介质以及终端的描述,对于本领域的技术人员,依据本申请实施例的思想,在具体实施方式及应用范围上均会有改变之处,综上,本说明书内容不应理解为对本申请的限制。The above is a description of a frame rate processing method, device, storage medium and terminal provided by this application. For those skilled in the art, according to the idea of the embodiment of this application, there will be changes in the specific implementation and application scope In summary, the contents of this specification should not be construed as limiting the application.

Claims (20)

  1. 一种帧率处理方法,其特征在于,所述方法包括:A frame rate processing method, characterized in that the method comprises:
    统计在预设时间区间内目标应用程序执行界面绘制接口的次数,根据所述预设时间区间以及所述次数计算所述目标应用程序在所述预设时间区间内的丢帧率;Counting the number of times the target application program executes the interface drawing interface within the preset time interval, and calculating the frame loss rate of the target application program within the preset time interval according to the preset time interval and the number of times;
    获取在所述预设时间区间内所述目标应用程对应的各代码执行栈的执行时间,以及根据所述各代码执行栈的执行时间确定导致所述目标应用程序丢帧的目标代码执行栈;Obtain the execution time of each code execution stack corresponding to the target application program within the preset time interval, and determine the target code execution stack that causes the target application program to drop frames according to the execution time of each code execution stack;
    打印所述目标代码执行栈包括的目标代码函数以及各目标代码函数对应的运行耗时。Print the target code functions included in the target code execution stack and the running time corresponding to each target code function.
  2. 根据权利要求1所述的方法,其特征在于,所述统计在预设时间区间内目标应用程序执行界面绘制接口的次数之前,还包括:The method according to claim 1, wherein the counting the number of times the target application program executes the interface drawing interface before the preset time interval further includes:
    确定目标应用程序对应的系统界面绘制周期,以及将预设数量的系统界面绘制周期确定为预设时间区间。A system interface drawing period corresponding to the target application program is determined, and a preset number of system interface drawing periods is determined as a preset time interval.
  3. 根据权利要求2所述的方法,其特征在于,所述根据所述预设时间区间以及所述次数计算所述目标应用程序在所述预设时间区间内的丢帧率,包括:The method according to claim 2, wherein the calculating the frame loss rate of the target application in the preset time interval according to the preset time interval and the number of times comprises:
    获取目标差值与所述预设数量的比值,将所述比值作为所述目标应用程序在所述预设时间区间内的丢帧率;Obtain the ratio of the target difference to the preset number, and use the ratio as the frame loss rate of the target application within the preset time interval;
    其中,所述目标差值为所述目标应用程序执行界面绘制接口的次数与预设数量之间的差值。Wherein, the target difference is a difference between the number of times the target application executes the interface drawing interface and a preset number.
  4. 根据权利要求1所述的方法,其特征在于,所述统计在预设时间区间内目标应用程序执行界面绘制接口的次数之前,还包括:The method according to claim 1, wherein the counting the number of times the target application program executes the interface drawing interface before the preset time interval further includes:
    基于在所述目标应用程序中各代码函数的开始位置插入的第一代码,在各代码函数开始运行时分别记录各代码函数的身份标识、开始时间以及开始标志位,并按照时间先后顺序保存至预设集合中;Based on the first code inserted at the start position of each code function in the target application program, record the identity, start time and start flag of each code function when each code function starts to run, and save them in chronological order to in the default collection;
    基于在所述目标应用程序中各代码函数的结束位置插入的第二代码,在各代码函数结束运行时分别记录各代码函数的身份标识、结束时间以及结束标志位,并按照时间先后顺序保存至所述预设集合中。Based on the second code inserted at the end position of each code function in the target application program, record the identity, end time and end flag of each code function when each code function ends, and save them in chronological order to in the preset set.
  5. 根据权利要求4所述的方法,其特征在于,所述获取在所述预设时间区间内所述目标应用程对应的各代码执行栈的执行时间,包括:The method according to claim 4, wherein the obtaining the execution time of each code execution stack corresponding to the target application within the preset time interval comprises:
    若所述丢帧率大于预设丢帧率阈值,则确定在所述预设时间区间内所述目标应用程对应的各代码执行栈的初始代码函数的第一身份标识,在所述预设集合中查找与各初始代码函数的第一身份标识匹配的第一开始标志位,以及所述第一开始标志位对应的第一开始时间;If the frame loss rate is greater than the preset frame loss rate threshold, determine the first identity of the initial code function of each code execution stack corresponding to the target application program within the preset time interval, and in the preset time interval Finding the first start flag matching the first identity of each initial code function in the set, and the first start time corresponding to the first start flag;
    确定在所述预设时间区间内所述目标应用程对应的各代码执行栈的结束代码函数的第二身份标识,在所述预设集合中查找与各结束代码函数的第二身份标识匹配的第二结束标志位,以及所述第二结束标志位对应的第二结束时间;Determine the second identity of the end code function of each code execution stack corresponding to the target application program within the preset time interval, and search for the second identity that matches the second identity of each end code function in the preset set a second end flag, and a second end time corresponding to the second end flag;
    将各代码执行栈的初始代码函数的第一开始时间与各代码执行栈的结束代码函数的第二结束时间的差值,作为各代码执行栈的执行时间。The difference between the first start time of the initial code function of each code execution stack and the second end time of the end code function of each code execution stack is used as the execution time of each code execution stack.
  6. 根据权利要求5所述的方法,其特征在于,所述根据所述各代码执行栈的执行时间确定导致所述目标应用程序丢帧的目标代码执行栈,包括:The method according to claim 5, wherein the determining the target code execution stack that causes the frame loss of the target application program according to the execution time of each code execution stack includes:
    确定各代码执行栈的类型,所述代码执行栈的类型包括界面绘制执行栈以及非界面绘制执行栈;Determine the type of each code execution stack, the type of the code execution stack includes an interface drawing execution stack and a non-interface drawing execution stack;
    将所述代码执行栈的类型为界面绘制执行栈,且所述代码执行栈的执行时间大于系统界面绘制周期的所述代码执行栈确定为目标代码执行栈;和/或The type of the code execution stack is an interface drawing execution stack, and the code execution stack whose execution time is longer than the system interface drawing cycle is determined as the target code execution stack; and/or
    将所述代码执行栈的类型为非界面绘制执行栈,且所述代码执行栈的执行时间大于预设执行栈执行 时间的所述代码执行栈确定为目标代码执行栈。The type of the code execution stack is a non-interface drawing execution stack, and the execution time of the code execution stack is greater than the execution time of the preset execution stack. The code execution stack is determined as the target code execution stack.
  7. 根据权利要求5或者6所述的方法,其特征在于,所述打印所述目标代码执行栈包括的目标代码函数以及各目标代码函数对应的运行耗时,包括:The method according to claim 5 or 6, wherein the printing of the target code functions included in the target code execution stack and the running time corresponding to each target code function includes:
    基于所述预设集合确定所述目标代码执行栈中初始代码函数与结束代码函数之间的第三身份标识、第三开始标志位、第三结束标志位、第三开始时间以及第三结束时间;Determine a third identity, a third start flag, a third end flag, a third start time, and a third end time between the initial code function and the end code function in the target code execution stack based on the preset set ;
    根据各第三身份标识获取对应的各目标代码函数,根据各目标代码函数第三开始标志位对应的第三开始时间,与各目标代码函数第三结束标志位对应的第三结束时间的差值确定各目标代码函数对应的运行耗时;Obtain the corresponding target code functions according to each third identity, and according to the third start time corresponding to the third start flag of each target code function, the difference between the third end time corresponding to the third end flag of each target code function Determine the running time corresponding to each object code function;
    打印各目标代码函数以及各目标代码函数对应的运行耗时。Print each object code function and the running time corresponding to each object code function.
  8. 根据权利要求1所述的方法,其特征在于,所述根据所述预设时间区间以及所述次数计算所述目标应用程序在所述预设时间区间内的丢帧率之后,还包括:The method according to claim 1, wherein after calculating the frame loss rate of the target application program in the preset time interval according to the preset time interval and the number of times, further comprising:
    计算所述目标应用程序的当前界面帧率,以及在所述目标应用程序的界面中显示所述当前界面帧率;和/或calculating the current interface frame rate of the target application, and displaying the current interface frame rate in the interface of the target application; and/or
    在所述目标应用程序的界面中显示所述预设时间区间内的丢帧率。Displaying the frame loss rate within the preset time interval on the interface of the target application program.
  9. 根据权利要求4所述的方法,其特征在于,所述统计在预设时间区间内目标应用程序执行界面绘制接口的次数之前,还包括:The method according to claim 4, wherein the counting the number of times the target application executes the interface drawing interface before the preset time interval further includes:
    为所述目标应用程序中各代码函数分别分配唯一的身份标识,并将各代码函数与对应的身份标识建立映射关系;Assigning unique identities to each code function in the target application program, and establishing a mapping relationship between each code function and the corresponding identities;
    基于所有所述映射关系生成映射文件,以及将所述映射文件打包至所述目标应用程序中,以使得所述目标应用程序安装之后加载所述映射文件并解析出所有所述映射关系。A mapping file is generated based on all the mapping relationships, and the mapping file is packaged into the target application program, so that the target application program loads the mapping file and resolves all the mapping relationships after installation.
  10. 一种帧率处理装置,其特征在于,所述装置包括:A frame rate processing device, characterized in that the device comprises:
    丢帧计算模块,用于统计在预设时间区间内目标应用程序执行界面绘制接口的次数,根据所述预设时间区间以及所述次数计算所述目标应用程序在所述预设时间区间内的丢帧率;A frame loss calculation module, configured to count the number of times the target application program executes the interface drawing interface within a preset time interval, and calculate the number of times the target application program executes the interface drawing interface in the preset time interval according to the preset time interval and the number of times frame loss rate;
    执行栈确定模块,用于获取在所述预设时间区间内所述目标应用程对应的各代码执行栈的执行时间,以及根据所述各代码执行栈的执行时间确定导致所述目标应用程序丢帧的目标代码执行栈;An execution stack determining module, configured to obtain the execution time of each code execution stack corresponding to the target application within the preset time interval, and determine the execution time of the target application program according to the execution time of each code execution stack The object code execution stack of the frame;
    代码打印模块,用于打印所述目标代码执行栈包括的目标代码函数以及各目标代码函数对应的运行耗时。The code printing module is used to print the target code functions included in the target code execution stack and the running time corresponding to each target code function.
  11. 根据权利要求10所述的装置,其特征在于,所述丢帧计算模块,还用于确定目标应用程序对应的系统界面绘制周期,以及将预设数量的系统界面绘制周期确定为预设时间区间。The device according to claim 10, wherein the frame loss calculation module is further configured to determine the system interface drawing cycle corresponding to the target application program, and determine a preset number of system interface drawing cycles as a preset time interval .
  12. 根据权利要求11所述的装置,其特征在于,所述丢帧计算模块,还用于获取目标差值与所述预设数量的比值,将所述比值作为所述目标应用程序在所述预设时间区间内的丢帧率;The device according to claim 11, wherein the frame loss calculation module is further configured to obtain a ratio of the target difference to the preset number, and use the ratio as the target application program in the preset Set the frame loss rate in the time interval;
    其中,所述目标差值为所述目标应用程序执行界面绘制接口的次数与预设数量之间的差值。Wherein, the target difference is a difference between the number of times the target application executes the interface drawing interface and a preset number.
  13. 根据权利要求10所述的装置,其特征在于,所述装置还包括:The device according to claim 10, further comprising:
    第一代码插入模块,用于基于在所述目标应用程序中各代码函数的开始位置插入的第一代码,在各代码函数开始运行时分别记录各代码函数的身份标识、开始时间以及开始标志位,并按照时间先后顺序保存至预设集合中;The first code insertion module is used to record the identity, start time and start flag of each code function when each code function starts running based on the first code inserted at the start position of each code function in the target application program , and save them in the preset collection in chronological order;
    第二代码插入模块,用于基于在所述目标应用程序中各代码函数的结束位置插入的第二代码,在各 代码函数结束运行时分别记录各代码函数的身份标识、结束时间以及结束标志位,并按照时间先后顺序保存至所述预设集合中。The second code insertion module is used to record the identity, end time and end flag of each code function when each code function ends running based on the second code inserted at the end position of each code function in the target application program , and save them in the preset collection in chronological order.
  14. 根据权利要求13所述的装置,其特征在于,所述装置还包括:The device according to claim 13, further comprising:
    第一信息确定模块,用于若所述丢帧率大于预设丢帧率阈值,则确定在所述预设时间区间内所述目标应用程对应的各代码执行栈的初始代码函数的第一身份标识,在所述预设集合中查找与各初始代码函数的第一身份标识匹配的第一开始标志位,以及所述第一开始标志位对应的第一开始时间;The first information determination module is configured to determine the first information of the initial code function of each code execution stack corresponding to the target application within the preset time interval if the frame loss rate is greater than the preset frame loss rate threshold An identity, searching in the preset set for a first start flag that matches the first identity of each initial code function, and a first start time corresponding to the first start flag;
    第二信息确定模块,用于确定在所述预设时间区间内所述目标应用程对应的各代码执行栈的结束代码函数的第二身份标识,在所述预设集合中查找与各结束代码函数的第二身份标识匹配的第二结束标志位,以及所述第二结束标志位对应的第二结束时间;The second information determination module is configured to determine the second identity of the end code function of each code execution stack corresponding to the target application program within the preset time interval, and search for each end code in the preset set the second end flag matched by the second identifier of the function, and the second end time corresponding to the second end flag;
    执行栈时间确定模块,用于将各代码执行栈的初始代码函数的第一开始时间与各代码执行栈的结束代码函数的第二结束时间的差值,作为各代码执行栈的执行时间。The execution stack time determination module is used to use the difference between the first start time of the initial code function of each code execution stack and the second end time of the end code function of each code execution stack as the execution time of each code execution stack.
  15. 根据权利要求14所述的装置,其特征在于,所述装置还包括:The device according to claim 14, further comprising:
    执行栈类型确定模块,用于确定各代码执行栈的类型,所述代码执行栈的类型包括界面绘制执行栈以及非界面绘制执行栈;The execution stack type determination module is used to determine the type of each code execution stack, and the type of the code execution stack includes an interface drawing execution stack and a non-interface drawing execution stack;
    第一判断模块,用于将所述代码执行栈的类型为界面绘制执行栈,且所述代码执行栈的执行时间大于系统界面绘制周期的所述代码执行栈确定为目标代码执行栈;和/或The first judging module is used to determine the type of the code execution stack as an interface drawing execution stack, and the code execution stack whose execution time is longer than the system interface drawing cycle is determined as the target code execution stack; and/ or
    第二判断模块,用于将所述代码执行栈的类型为非界面绘制执行栈,且所述代码执行栈的执行时间大于预设执行栈执行时间的所述代码执行栈确定为目标代码执行栈。The second judging module is used to determine the type of the code execution stack as a non-interface drawing execution stack, and the code execution stack whose execution time is greater than the preset execution stack execution time is determined as the target code execution stack .
  16. 根据权利要求14或者15所述的装置,其特征在于,所述装置还包括:The device according to claim 14 or 15, wherein the device further comprises:
    第三信息确定模块,用于基于所述预设集合确定所述目标代码执行栈中初始代码函数与结束代码函数之间的第三身份标识、第三开始标志位、第三结束标志位、第三开始时间以及第三结束时间;The third information determination module is configured to determine the third identity, the third start flag, the third end flag, the third code function between the initial code function and the end code function in the target code execution stack based on the preset set. Three start time and a third end time;
    代码耗时确定模块,用于根据各第三身份标识获取对应的各目标代码函数,根据各目标代码函数第三开始标志位对应的第三开始时间,与各目标代码函数第三结束标志位对应的第三结束时间的差值确定各目标代码函数对应的运行耗时;The code time-consuming determination module is used to obtain corresponding target code functions according to each third identity, and corresponds to the third end flag of each target code function according to the third start time corresponding to the third start flag of each target code function The difference of the third end time of the determination of the running time corresponding to each object code function;
    打印模块,用于打印各目标代码函数以及各目标代码函数对应的运行耗时。The printing module is used to print each object code function and the running time corresponding to each object code function.
  17. 根据权利要求10所述的装置,其特征在于,所述丢帧计算模块,还用于:The device according to claim 10, wherein the frame loss calculation module is also used for:
    计算所述目标应用程序的当前界面帧率,以及在所述目标应用程序的界面中显示所述当前界面帧率;和/或calculating the current interface frame rate of the target application, and displaying the current interface frame rate in the interface of the target application; and/or
    在所述目标应用程序的界面中显示所述预设时间区间内的丢帧率。Displaying the frame loss rate within the preset time interval on the interface of the target application program.
  18. 根据权利要求13所述的装置,其特征在于,所述丢帧计算模块,还用于:The device according to claim 13, wherein the frame loss calculation module is also used for:
    为所述目标应用程序中各代码函数分别分配唯一的身份标识,并将各代码函数与对应的身份标识建立映射关系;Assigning unique identities to each code function in the target application program, and establishing a mapping relationship between each code function and the corresponding identities;
    基于所有所述映射关系生成映射文件,以及将所述映射文件打包至所述目标应用程序中,以使得所述目标应用程序安装之后加载所述映射文件并解析出所有所述映射关系。A mapping file is generated based on all the mapping relationships, and the mapping file is packaged into the target application program, so that the target application program loads the mapping file and resolves all the mapping relationships after installation.
  19. 一种计算机存储介质,其特征在于,所述计算机存储介质存储有多条指令,所述指令适于由处理器加载并执行如权利要求1~9任意一项的所述方法的步骤。A computer storage medium, characterized in that the computer storage medium stores a plurality of instructions, and the instructions are suitable for being loaded by a processor and executing the steps of the method according to any one of claims 1-9.
  20. 一种终端,其特征在于,包括存储器、处理器及存储在存储器上并可在处理器上运行的计算机 程序,所述处理器执行所述程序时实现如权利要求1~9任一项所述方法的步骤。A terminal, characterized by comprising a memory, a processor, and a computer program stored in the memory and operable on the processor, when the processor executes the program, it realizes any one of claims 1-9 method steps.
PCT/CN2022/091673 2021-06-18 2022-05-09 Frame rate processing method and apparatus, storage medium, and terminal WO2022262472A1 (en)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN202110683368.2A CN115495303A (en) 2021-06-18 2021-06-18 Frame rate processing method, device, storage medium and terminal
CN202110683368.2 2021-06-18

Publications (1)

Publication Number Publication Date
WO2022262472A1 true WO2022262472A1 (en) 2022-12-22

Family

ID=84464422

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2022/091673 WO2022262472A1 (en) 2021-06-18 2022-05-09 Frame rate processing method and apparatus, storage medium, and terminal

Country Status (2)

Country Link
CN (1) CN115495303A (en)
WO (1) WO2022262472A1 (en)

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN117312117B (en) * 2023-11-30 2024-03-01 沐曦集成电路(杭州)有限公司 Dotting data processing method, dotting data processing device, dotting data processing equipment and medium

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN108763012A (en) * 2018-03-13 2018-11-06 广东欧珀移动通信有限公司 Interim card information acquisition method, device and terminal
CN109376053A (en) * 2018-09-20 2019-02-22 Oppo广东移动通信有限公司 Data processing method, device and mobile terminal
US20190354468A1 (en) * 2018-05-17 2019-11-21 Red Hat Israel, Ltd. Code coverage module with testing function identifier
CN110737463A (en) * 2019-10-24 2020-01-31 北京智游网安科技有限公司 analysis method of key function source information, intelligent terminal and storage medium
CN112099798A (en) * 2020-09-16 2020-12-18 广州虎牙科技有限公司 Statistical method and device for public function execution time consumption, storage medium and terminal

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN108763012A (en) * 2018-03-13 2018-11-06 广东欧珀移动通信有限公司 Interim card information acquisition method, device and terminal
US20190354468A1 (en) * 2018-05-17 2019-11-21 Red Hat Israel, Ltd. Code coverage module with testing function identifier
CN109376053A (en) * 2018-09-20 2019-02-22 Oppo广东移动通信有限公司 Data processing method, device and mobile terminal
CN110737463A (en) * 2019-10-24 2020-01-31 北京智游网安科技有限公司 analysis method of key function source information, intelligent terminal and storage medium
CN112099798A (en) * 2020-09-16 2020-12-18 广州虎牙科技有限公司 Statistical method and device for public function execution time consumption, storage medium and terminal

Also Published As

Publication number Publication date
CN115495303A (en) 2022-12-20

Similar Documents

Publication Publication Date Title
WO2018103245A1 (en) Method, device, and readable storage medium for monitoring interface lag
WO2017206949A1 (en) Bullet screen content processing method, and application server and user terminal
WO2016127811A1 (en) Information processing method and terminal, and computer storage medium
CN110585702B (en) Sound and picture synchronous data processing method, device, equipment and medium
CN110554831B (en) Operation synchronization method, device, equipment and storage medium
WO2020151599A1 (en) Method and apparatus for publishing video synchronously, electronic device, and readable storage medium
WO2020177734A1 (en) App triggering method, computer device, and storage medium
CN109144858B (en) Fluency detection method and device, computing equipment and storage medium
US20150026293A1 (en) Method, apparatus, terminal, and server for synchronizing terminal mirror
CN110018845B (en) Metadata version comparison method and device
JP2018517195A (en) Multimedia information processing method, apparatus and system, and computer storage medium
CN113868126A (en) Application debugging method, device and storage medium of equipment
WO2022262472A1 (en) Frame rate processing method and apparatus, storage medium, and terminal
CN111084991A (en) Game-based chatting method, device, terminal and storage medium
US10574765B2 (en) Method, device, and non-transitory computer-readable recording medium
JP2019509547A (en) GPU resource reconstruction method, user device, system, and storage medium
WO2017206893A1 (en) Interface refresh synchronization method and apparatus, terminal, and storage medium
CN107589979A (en) A kind of terminal screenshot method and device based on virtual desktop
CN109032911B (en) Frame rate detection method and device for mobile device and electronic device
CN110445667A (en) A kind of link delay detection method, device, storage medium and terminal
CN114448823A (en) NFS service testing method and system and electronic equipment
US8681954B1 (en) Multi-device video communication session
WO2022242419A1 (en) Partition creation method and apparatus, and storage medium and computer device
CN111797345A (en) Application page display method and device, computer equipment and storage medium
CN112379967B (en) Simulator detection method, device, equipment and 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: 22823955

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 22823955

Country of ref document: EP

Kind code of ref document: A1