Rendering time consumption determination method and device, electronic equipment and computer readable medium

By calling the target function to obtain execution time information, combined with hook functions and virtual function table operations, it solves the problem of difficulty in determining the rendering time of view objects and achieves accurate detection and optimization of rendering performance.

CN118799418APending Publication Date: 2024-10-18BEIJING ZITIAO NETWORK TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202310402636.8
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2023-04-14
Publication Date
2024-10-18

AI Technical Summary

Technical Problem

In the operating system, how to effectively determine the rendering time of a view object, especially when rendering performance directly affects application fluency and user experience, it is difficult to accurately obtain the rendering time with existing technology, making it difficult to optimize rendering performance.

Method used

By calling the target function and obtaining its execution time description information, determine the rendering time consumption of the view object at different granularities, including the overall rendering time consumption, the stage time consumption of each rendering stage and the component rendering time consumption of the view component, using the hook function Replacement and virtual function table operations implement time-consuming detection in the rendering process.

Benefits of technology

It achieves accurate and comprehensive detection of view object rendering time, improves the effect of rendering performance optimization, reduces the difficulty of obtaining rendering time, and enables more detailed analysis and optimization of time-consuming issues in the rendering process.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118799418A_ABST
    Figure CN118799418A_ABST
Patent Text Reader

Abstract

The invention discloses a rendering time consumption determination method and device, electronic equipment and a computer readable medium, and the method comprises the steps: after a rendering request triggered for a view object is received, calling at least one target function to achieve a rendering process for the view object, in addition, execution time description information of each objective function needs to be acquired, so that rendering time consumption of the view object under at least one granularity can be determined subsequently according to the execution time description information of the objective functions. The overall time consumption of the rendering process, the periodic time consumption of the view object presented in different rendering stages, the rendering time consumption of each view component in the view object presented in different rendering stages, and the like); in this way, the purpose of calculating the rendering time consumption of the view object under at least one granularity by means of the actual execution time of some functions in the rendering process can be achieved, and therefore the technical problem of how to determine the rendering time consumption of one view object can be solved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of computer technology, and in particular to a method, device, electronic device, and computer-readable medium for determining rendering time. Background Art

[0002] In some operating systems (eg, Android), in order to better implement view rendering, the system may create a rendering thread so that the rendering thread is used to execute view rendering logic for a certain application.

[0003] In fact, since rendering performance (eg, rendering time, etc.) directly affects the fluency of an application and user experience, obtaining the rendering performance (eg, rendering time) of the application becomes a relatively important research topic. Summary of the invention

[0004] The present application provides a method, device, electronic device, and computer-readable medium for determining rendering time.

[0005] In order to achieve the above objectives, the technical solutions provided by this application are as follows:

[0006] The present application provides a method for determining rendering time consumption, the method comprising:

[0007] In response to a rendering request triggered for a view object, calling at least one target function and obtaining execution time description information of the at least one target function; the at least one target function is used to implement a rendering process for the view object;

[0008] The rendering time consumption of the view object at at least one granularity is determined according to the execution time description information of the at least one objective function.

[0009] In a possible implementation manner, the rendering process includes at least one rendering stage;

[0010] The view object includes at least one view component;

[0011] The rendering time at the at least one granularity includes at least one of the overall rendering time of the rendering process, the staged rendering time of one or more of the rendering stages, and the component rendering time of each of the view components.

[0012] In one possible implementation, the at least one rendering stage includes an accurate rendering stage and a hardware rendering stage;

[0013] The component rendering time of the view component includes the processing time of the view component in the accurate rendering stage and the processing time of the view component in the hardware rendering stage.

[0014] In a possible implementation manner, before calling at least one target function and obtaining the execution time description information of the at least one target function, the method further includes:

[0015] Replacing at least one target function in the rendering process with a hook function corresponding to each target function;

[0016] The calling of at least one target function and obtaining the execution time description information of the at least one target function includes:

[0017] Calling a hook function corresponding to each of the target functions, wherein the hook function is used to implement the processing process described by the target function and obtain the execution time description information of the processing process;

[0018] The determining, according to the execution time description information of the at least one objective function, the rendering time consumption of the view object at at least one granularity includes:

[0019] The rendering time of the view object at at least one granularity is determined according to the execution time description information of the processing process.

[0020] In a possible implementation, the rendering process includes a first stage;

[0021] The step of replacing at least one target function in the rendering process with a hook function corresponding to each target function includes:

[0022] After obtaining the virtual function table of the rendering pipeline implementation class object, replacing the virtual function address corresponding to the first stage recorded in the virtual function table with the hook function address corresponding to the first stage;

[0023] The calling of the hook function corresponding to each of the target functions includes:

[0024] The hook function pointed to by the hook function address corresponding to the first stage is called to implement rendering processing for the view object in the first stage and obtain the rendering processing time of the view object in the first stage.

[0025] In a possible implementation manner, the process of obtaining the virtual function table includes:

[0026] Get the address of the rendering proxy class object from the constructor of the rendering proxy class;

[0027] Determine the memory of the context drawing object in the rendering proxy class object according to the address of the rendering proxy class object;

[0028] Searching the address of the rendering pipeline implementation class object from the memory;

[0029] According to the address of the rendering pipeline implementation class object, a virtual function table of the rendering pipeline implementation class object is obtained.

[0030] In a possible implementation manner, the first stage is a rendering start stage, a hardware rendering stage, or a rendering data submission stage.

[0031] In a possible implementation, the rendering process includes a rendering preparation stage;

[0032] The step of replacing at least one target function in the rendering process with a hook function corresponding to each target function includes:

[0033] Replacing the preparation function address corresponding to the root node in the view tree in the rendering preparation phase with the hook function address corresponding to the rendering preparation phase; the view tree is used to describe the view object;

[0034] The calling of the hook function corresponding to each of the target functions includes:

[0035] The hook function pointed to by the hook function address corresponding to the rendering preparation stage is called to implement rendering processing for the view object in the rendering preparation stage and obtain the rendering processing time of the view object in the rendering preparation stage.

[0036] In a possible implementation, the rendering process includes a second stage;

[0037] The step of replacing at least one target function in the rendering process with a hook function corresponding to each target function includes:

[0038] After decompressing the preset data segment in the target library, replacing the node processing function address corresponding to the second stage existing in the decompressed data with the hook function address corresponding to the node processing function address;

[0039] The calling of the hook function corresponding to each of the target functions includes:

[0040] For any node in the view tree, the hook function pointed to by the hook function address corresponding to the node processing function address is called to implement the rendering processing of the node in the second stage and obtain the rendering processing time of the node in the second stage; the view tree is used to describe the view object; different nodes in the view tree correspond to different view components in the view object.

[0041] In a possible implementation manner, the second stage is a rendering preparation stage or a hardware rendering stage.

[0042] In a possible implementation manner, the at least one objective function includes a rendering start characterization function and a rendering end characterization function;

[0043] The rendering time at the at least one granularity includes the overall rendering time of the rendering process;

[0044] The overall rendering time is determined according to the execution time description information of the rendering start characterization function and the execution time description information of the rendering end characterization function.

[0045] In a possible implementation, the rendering process includes a third stage;

[0046] The at least one objective function includes a stage-by-stage alignment function corresponding to the third stage;

[0047] The rendering time at the at least one granularity includes the stage-by-stage rendering time of the third stage;

[0048] The time consumption of the stage-by-stage rendering of the third stage is determined according to the execution time description information of the stage-by-stage alignment function corresponding to the third stage.

[0049] In a possible implementation manner, the rendering process further includes a rendering preparation stage;

[0050] The rendering time at the at least one granularity also includes the overall rendering time of the rendering process and the staged rendering time of the rendering preparation stage;

[0051] The stage-by-stage rendering time consumption of the rendering preparation stage is determined according to the overall rendering time consumption of the rendering process and the stage-by-stage rendering time consumption of the third stage.

[0052] In a possible implementation, the rendering process includes a rendering preparation stage;

[0053] The at least one target function includes a function corresponding to a root node in a view tree in the rendering preparation phase; the view tree is used to describe the view object;

[0054] The rendering time at the at least one granularity includes the staged rendering time of the rendering preparation stage;

[0055] The stage-by-stage rendering time consumption of the rendering preparation stage is determined according to the execution time description information of the function corresponding to the root node in the rendering preparation stage.

[0056] In a possible implementation, the rendering process includes a fourth stage;

[0057] The view object includes at least one view component;

[0058] The rendering time at the at least one granularity includes the processing time of each of the view components at the fourth stage;

[0059] The at least one objective function includes a function corresponding to a node corresponding to the view component in the fourth stage;

[0060] For any view component, the processing time of the view component in the fourth stage is determined according to the execution time description information of the function corresponding to the node corresponding to the view component in the fourth stage.

[0061] In a possible implementation manner, there is an association relationship between the nodes corresponding to each of the view components and the business scenario information of each of the view components;

[0062] After determining the rendering time of the view object at at least one granularity according to the execution time description information of the at least one objective function, the method further includes:

[0063] For any view component, if the processing time of the view component in the fourth stage meets the preset abnormal condition, the business scenario information associated with the node corresponding to the view component is displayed.

[0064] In a possible implementation manner, the process of establishing the association relationship includes:

[0065] Use the preset implementation class to replace the service acquisition interface through dynamic proxy;

[0066] For any view component, the preset implementation class is called so that the creation process of the view component is implemented using a custom layout service class; the custom layout service class includes an overridden layout creation method; the overridden layout creation method is at least used to associate the business scenario information of the created view component with the node corresponding to the created view component.

[0067] In a possible implementation manner, the business scenario information is determined according to a layout file.

[0068] The present application provides a rendering time determination device, comprising:

[0069] A first processing unit, configured to call at least one target function and obtain execution time description information of the at least one target function in response to a rendering request triggered for a view object; the at least one target function is used to implement a rendering process for the view object;

[0070] The second processing unit is used to determine the rendering time of the view object at at least one granularity according to the execution time description information of the at least one objective function.

[0071] The present application provides an electronic device, the device comprising: a processor and a memory;

[0072] The memory is used to store instructions or computer programs;

[0073] The processor is used to execute the instructions or computer programs in the memory so that the electronic device executes the rendering time determination method provided in the present application.

[0074] The present application provides a computer-readable medium, in which instructions or computer programs are stored. When the instructions or computer programs are executed on a device, the device executes the rendering time determination method provided in the present application.

[0075] The present application provides a computer program product, which includes a computer program carried on a non-transitory computer-readable medium, and the computer program contains program code for executing the rendering time determination method provided by the present application.

[0076] Compared with the prior art, this application has at least the following advantages:

[0077] In the technical solution provided in the present application, for an electronic device, after the electronic device receives a rendering request triggered for a view object, it is not only necessary to implement the rendering process for the view object by calling at least one target function, but also to obtain the execution time description information of each target function, so that it can subsequently determine the rendering time of the view object at at least one granularity based on the execution time description information of these target functions (for example, the overall time of the rendering process, the staged time presented by the view object at different rendering stages, the rendering time presented by each view component in the view object at different rendering stages, etc.). In this way, the purpose of calculating the rendering time of the view object at at least one granularity with the help of the actual execution time of certain functions in the rendering process can be achieved, thereby solving the technical problem of how to determine the rendering time of a view object.

[0078] In addition, since the rendering time of the view object at at least one granularity above can describe the rendering time of the view object at different granularities, the "rendering time of the view object at at least one granularity" can more comprehensively and accurately describe the time consumption status of the view object in the rendering process, which is conducive to improving the determination effect of the rendering time. BRIEF DESCRIPTION OF THE DRAWINGS

[0079] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments recorded in the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.

[0080] Figure 1 A flowchart of a method for determining rendering time provided by this application;

[0081] Figure 2 A schematic diagram of a rendering process for a view object provided by this application;

[0082] Figure 3 A schematic diagram of a virtual function table provided for this application;

[0083] Figure 4 A schematic diagram of the structure of a device for determining rendering time provided in an embodiment of the present application;

[0084] Figure 5 A schematic diagram of the structure of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION

[0085] According to research, in some operating systems (such as Android), the rendering thread can combine the attribute information of a view object (such as size, position, etc.) to convert the drawing instructions for the view object into calls to the underlying image library (such as OpenGL or Vulkan) interface to complete the actual rendering work. However, how to obtain the rendering time for the view object is a technical problem that needs to be solved urgently.

[0086] Based on the above research findings, the present application provides a method for determining rendering time, which includes: after receiving a rendering request triggered for a view object, it is not only necessary to call at least one target function to implement the rendering process for the view object, but also to obtain the execution time description information of each target function, so that the rendering time of the view object at at least one granularity can be determined based on the execution time description information of these target functions (for example, the overall time of the rendering process, the staged time presented by the view object in different rendering stages, the rendering time presented by each view component in the view object at different rendering stages, etc.). In this way, the purpose of calculating the rendering time of the view object at at least one granularity with the help of the actual execution time of certain functions in the rendering process can be achieved, thereby solving the technical problem of how to determine the rendering time of a view object.

[0087] In addition, since the rendering time of the view object at at least one granularity above can describe the rendering time of the view object at different granularities, the "rendering time of the view object at at least one granularity" can more comprehensively and accurately describe the time consumption status of the view object in the rendering process, which is conducive to improving the determination effect of the rendering time.

[0088] In addition, the present application converts the problem of rendering time for a view object into a problem of detecting the execution time description information of each target function involved in the rendering process of the view object. In this way, it can effectively overcome the defect that the rendering time is difficult to obtain due to the small number of detectable interfaces exposed to the outside by the rendering logic implementation module, thereby effectively reducing the difficulty of obtaining the rendering time.

[0089] In addition, the present application does not limit the execution subject of the rendering time determination method. For example, the rendering time determination method provided in the embodiment of the present application can be applied to a device with data processing function such as a terminal device or a server. For another example, the rendering time determination method provided in the embodiment of the present application can also be implemented with the help of a data communication process between different devices (for example, a terminal device and a server, two terminal devices, or two servers). Among them, the terminal device can be a smart phone, a computer, a personal digital assistant (PDA) or a tablet computer, etc. The server can be a stand-alone server, a cluster server or a cloud server.

[0090] In order to enable those skilled in the art to better understand the solution of the present application, the technical solution 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 are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.

[0091] In order to better understand the technical solution provided by the present application, the rendering time determination method provided by the present application is described below with reference to some drawings. Figure 1 As shown, the rendering time determination method provided in the embodiment of the present application includes the following S1-S2. Figure 1 A flowchart of a method for determining rendering time provided in this application.

[0092] S1: In response to a rendering request triggered for a view object, call at least one target function and obtain execution time description information of the at least one target function; the at least one target function is used to implement a rendering process for the view object.

[0093] Among them, the view object refers to the object that needs to be rendered; and the present application does not limit the view object, for example, it can be a window.

[0094] In addition, in some application scenarios, for a view object, the view object may include at least one view component, wherein the view component is used to form a view object; and the present application does not limit the implementation method of the view component.

[0095] In addition, in some application scenarios, in order to better express a view object, the view object can be converted into a view tree, so that the view tree can represent the view object with the help of a tree structure, and different nodes in the view tree correspond to different view components in the view object, so that the view tree can represent the view components involved in the view object and the association relationship between different view components. It should be noted that the present application does not limit the implementation method of the view tree. For example, for the view tree, the root node in the view tree can be used to represent the view object, and the other nodes in the view tree except the root node represent the view components, so that the view tree can represent the overall structure of the view object.

[0096] The rendering request is used to request rendering of the view object; and the present application does not limit the implementation method of the rendering request, nor does it limit the triggering method of the rendering request (for example, it can be triggered automatically or manually by the user).

[0097] The target function is a function that is used in the rendering process for the view object and needs to be processed for execution time detection (for example, Figure 2 The makeCurrent() function, draw() function, or swapBuffers() function shown in the figure) enables these target functions to participate in the rendering process for the view object. The "rendering process of the view object" refers to the process required for rendering the view object (for example, Figure 2 The present application does not limit the “rendering process of the view object”. For example, it may be: firstly, some rendering-related steps (for example, Figure 2 The steps involved in the rendering preparation stage shown in FIG. 1 ); then the graphics processing unit (GPU) continues to execute other rendering-related steps (for example, Figure 2 The steps involved in the hardware rendering stage shown, etc.); ... (other subsequent steps are omitted here).

[0098] In addition, the present application does not limit the implementation method of the above target function. For example, it may refer to a function that has been configured in an operating system (for example, Android) (for example, makeCurrent(), draw(), swapBuffers(), etc.), and these functions can be used to implement the rendering process for the view object.

[0099] In addition, the present application does not limit the implementation method of the at least one objective function mentioned above. For example, in some application scenarios, when the scenario can use a function to implement the rendering process for a view object, the "at least one objective function" may only include this one function, so that the time information of the rendering process (for example, the overall rendering time of the rendering process, etc.) can be determined based on the execution time of the function later. For another example, when the rendering process for a view object includes a rendering start phase, a rendering preparation phase, a hardware rendering phase, and a rendering data submission phase, and the view object includes at least one view component, the at least one objective function may include: a virtual function corresponding to the rendering start phase (for example, Figure 2 The virtual function makeCurren() shown in the figure), the virtual function corresponding to the hardware rendering stage (for example, Figure 2 The virtual function draw() shown in the figure), the virtual function corresponding to the rendering data submission phase (for example, Figure 2The virtual function swapBuffers() shown in the figure), the first processing function corresponding to the root node in the view tree in the rendering preparation stage (for example, prepareTree() function), the second processing function corresponding to each node in the view tree in the rendering preparation stage (for example, prepareTreeImpl() function), and the third processing function corresponding to each node in the view tree in the hardware rendering stage (for example, forceDraw() function). Among them, the rendering start stage refers to the first execution stage involved in the rendering process of the view object; and the present application does not limit the rendering start stage, for example, it can be implemented at a time point. The rendering preparation stage refers to the stage of preparing rendering data involved in the rendering process of the view object; and the present application does not limit the rendering preparation stage, for example, it can be implemented in a time period. The hardware rendering stage refers to the stage of the rendering process of the view object that is implemented with the help of a GPU; and the present application does not limit the hardware rendering stage, for example, it can be implemented in a time period. The rendering data submission stage refers to the last execution stage involved in the rendering process of the view object; and the present application does not limit the rendering data submission stage, for example, it can be implemented in a time period.

[0100] The execution time description information of the target function is used to describe the time information involved in the execution process of the target function. It can be seen that for any target function, the execution time description information of the target function can be used to describe the time consumed when executing the processing process described by the target function.

[0101] In addition, the present application does not limit the above “execution time description information of the target function”, for example, it may include the start execution time of the target function and the execution completion time of the target function.

[0102] S2: Determine the rendering time of the view object at at least one granularity according to the execution time description information of at least one target function.

[0103] The above “rendering time of the view object at at least one granularity” is used to describe the rendering time of the view object at different granularities, so that the “rendering time of the view object at at least one granularity” can more comprehensively describe the time consumption status presented when rendering the view object.

[0104] In addition, the present application does not limit the implementation method of the above "rendering time of a view object at at least one granularity". For example, when the rendering process of the above view object includes at least one rendering stage, and the view object includes at least one view component, the "rendering time of the view object at at least one granularity" may include the overall rendering time of the rendering process, the staged rendering time of one or more rendering stages, and at least one of the component rendering time of each view component.

[0105] The above "overall rendering time of the rendering process" refers to executing a rendering process for a view object (for example, Figure 2 The time required for a rendering process shown in Figure 1.

[0106] In addition, the present application does not limit the determination process of the above “overall rendering time of the rendering process”. For example, when the above at least one objective function includes a rendering start characterization function (for example, Figure 2 The makeCurren() virtual function shown in the figure) and the rendering end representation function (for example, Figure 2 When the swapBuffers() virtual function shown in the figure is used, the determination process of the "overall rendering time of the rendering process" can be specifically as follows: the overall rendering time of the rendering process is determined according to the execution time description information of the rendering start characterization function and the execution time description information of the rendering end characterization function.

[0107] The rendering start characterization function is used to describe the start execution action involved in the rendering process for the view object; and the present application does not limit the rendering start characterization function. For example, when the rendering process includes at least a rendering start stage, the rendering start characterization function may refer to a function having a corresponding relationship with the rendering start stage (for example, Figure 2 It should be noted that the present application does not limit the "function corresponding to the rendering start stage", for example, it may adopt a rendering pipeline interface (for example, Figure 2 A virtual function in the IRenderPipeline interface shown in the figure (for example, Figure 2 It is implemented by the makeCurren() virtual function shown in the figure.

[0108] The execution time description information of the rendering start representation function is used to describe the time information (such as the start execution time, etc.) involved in the execution process of the rendering start representation function.

[0109] The rendering end characterization function is used to describe the end execution action involved in the rendering process for the view object; and the present application does not limit the rendering end characterization function. For example, when the rendering process includes at least a rendering data submission phase, the rendering end characterization function may refer to a function having a corresponding relationship with the rendering data submission phase (for example, Figure 2 It should be noted that the present application does not limit the "function corresponding to the rendering data submission stage". For example, it may adopt another virtual function in the rendering pipeline interface (for example, Figure 2 It is implemented using the virtual function swapBuffers() shown in the figure.

[0110] The execution time description information of the rendering end representation function is used to describe the time information involved in the execution process of the rendering end representation function (for example, the execution start time and the execution completion time, etc.).

[0111] In addition, the present application does not limit the above step of "determining the overall rendering time of the rendering process based on the execution time description information of the rendering start characterization function and the execution time description information of the rendering end characterization function". For example, it can be specifically: subtracting the start execution time of the rendering start characterization function from the execution completion time of the rendering end characterization function to obtain the overall rendering time of the rendering process.

[0112] In fact, when the rendering process of the view object above includes at least one rendering phase, some of these rendering phases (for example, Figure 2 The rendering preparation phase, hardware rendering phase, and rendering data submission phase shown in the figure are relatively important, so it is necessary to determine the time consumption of these rendering phases themselves. Based on this, it can be seen that in a possible implementation, the above "rendering time of the view object at at least one granularity" may include at least the staged rendering time consumption of one or more rendering phases. Among them, the staged rendering time consumption of the rendering phase is used to indicate the time consumed to implement the rendering phase. For ease of understanding, the following two situations are explained.

[0113] Case 1: For some rendering stages (such as the hardware rendering stage and the rendering data submission stage) in at least one of the above rendering stages, since the rendering stage is implemented with the help of a function, the time consumption of the rendering stage can be determined with the help of the execution time description information of the function.

[0114] Based on the above situation 1, it can be known that in a possible implementation mode, when at least one rendering stage above includes one or more third stages, the above "rendering time of the view object at at least one granularity" may include the stage-by-stage rendering time of each third stage. Among them, the third stage refers to the rendering stage that needs to be analyzed for stage-by-stage time consumption, and the stage-by-stage time consumption analysis for the third stage can be implemented with the help of a function. In addition, the present application does not limit the third stage above, for example, it can be a hardware rendering stage or a rendering data submission stage.

[0115] The stage-by-stage rendering time of the third stage refers to the time required to implement the third stage; and the present application does not limit the determination process of the stage-by-stage rendering time of the third stage. For example, when at least one of the above objective functions includes the stage-by-stage alignment function corresponding to the third stage, the determination process of the stage-by-stage rendering time of the third stage may specifically be: determining the stage-by-stage rendering time of the third stage according to the execution time description information of the stage-by-stage alignment function corresponding to the third stage. Among them, the stage-by-stage alignment function refers to a function that has a corresponding relationship with the third stage, so that the stage-by-stage alignment function can be used to implement the third stage; and the present application does not limit the stage-by-stage alignment function. For example, when the third stage is the hardware rendering stage, the stage-by-stage alignment function corresponding to the third stage may refer to a virtual function that has a corresponding relationship with the hardware rendering stage (for example, Figure 2 For example, when the third stage is the rendering data submission stage, the phase alignment function corresponding to the third stage may refer to a virtual function that has a corresponding relationship with the rendering data submission stage (for example, Figure 2 The virtual function swapBuffers() corresponding to the "rendering data submission phase" is shown in the figure).

[0116] In addition, the present application does not limit the implementation method of the step in the previous paragraph "determining the stage-by-stage rendering time of the third stage according to the execution time description information of the stage-by-stage alignment function corresponding to the third stage". For example, it can be specifically: subtracting the start execution time of the stage-by-stage alignment function from the execution completion time of the stage-by-stage alignment function to obtain the stage-by-stage rendering time of the third stage.

[0117] Based on the relevant content of the above situation 1, it can be known that for the rendering process of a view object, if the rendering process includes a hardware rendering stage and a rendering data submission stage, then the "rendering time of the view object at at least one granularity" may at least include the staged rendering time of the hardware rendering stage and the staged rendering time of the rendering data submission stage. The staged rendering time of the hardware rendering stage can be obtained by detecting a virtual function that has a corresponding relationship with the hardware rendering stage (for example, Figure 2 The time information involved in the execution process of the virtual function draw() shown in the drawing data submission stage can be determined; the staged rendering time of the rendering data submission stage can be determined by detecting the virtual function corresponding to the rendering data submission stage (for example, Figure 2 The time information involved in the execution process of the virtual function swapBuffers() shown in the figure is determined.

[0118] Case 2: For other rendering stages (such as rendering preparation stage) in at least one of the above rendering stages, since the rendering stage is not implemented by means of a virtual function, it is necessary to determine the stage-by-stage rendering time of the rendering stage by means of other methods.

[0119] Based on the relevant content of the above situation 2, it can be known that in a possible implementation mode, when at least one rendering stage above includes a rendering preparation stage, the above "rendering time of the view object at at least one granularity" may at least include the stage-by-stage rendering time of the rendering preparation stage, wherein the stage-by-stage rendering time of the rendering preparation stage refers to the time required to implement the rendering preparation stage.

[0120] In addition, the present application does not limit the determination process of the above "stage-by-stage rendering time of the rendering preparation stage". For example, if at least one rendering stage above includes at least one third stage and a rendering preparation stage, and the above "rendering time of the view object at at least one granularity" includes the overall rendering time of the rendering process, the stage-by-stage rendering time of each third stage, and the stage-by-stage rendering time of the rendering preparation stage, then the determination process of the "stage-by-stage rendering time of the rendering preparation stage" can be specifically: determine the stage-by-stage rendering time of the rendering preparation stage according to the overall rendering time of the rendering process and the stage-by-stage rendering time of each third stage.

[0121] It should be noted that the present application does not limit the implementation method of the step "determining the staged rendering time of the rendering preparation stage according to the overall rendering time of the rendering process and the staged rendering time of each third stage" in the above paragraph. For example, when the rendering process of the view object above is Figure 2 The rendering process shown, and Figure 2When the "start" stage is just a time point, the overall rendering time of the rendering process can be subtracted from the staged rendering time of all the third stages to obtain the staged rendering time of the rendering preparation stage, that is, the staged rendering time of the rendering preparation stage = the overall rendering time of the rendering process - the staged rendering time of the hardware rendering stage - the staged rendering time of the rendering data submission stage.

[0122] In fact, since the main logic of the rendering preparation phase is to recursively execute the prepareTree logic of each node in the view tree (also known as RenderNode), the time consumption of the rendering preparation phase can be detected by detecting the prepareTree() function of the root node (RootRenderNode). Among them, since the prepareTree() function of RenderNode is an externally exposed function and only the root node will call this function, the time consumption of the rendering preparation phase can be detected by detecting the execution time of the prepareTree() function.

[0123] Based on the content of the above paragraph, it can be known that in a possible implementation, when at least one rendering stage above includes a rendering preparation stage, and at least one objective function above includes a function corresponding to the root node in the view tree in the rendering preparation stage (for example, prepareTree() function), the above "rendering time of the view object at at least one granularity" may at least include the stage-by-stage rendering time of the rendering preparation stage, and the determination process of the stage-by-stage rendering time of the rendering preparation stage may specifically be: determining the stage-by-stage rendering time of the rendering preparation stage according to the execution time description information of the function corresponding to the root node in the rendering preparation stage.

[0124] The above “function corresponding to the root node in the view tree in the rendering preparation stage” refers to the function involved in the root node in the rendering preparation stage and can assist in implementing time-consuming detection for the rendering preparation stage; and this application does not limit the “function corresponding to the root node in the view tree in the rendering preparation stage”, for example, it may refer to the above “first processing function corresponding to the root node in the view tree in the rendering preparation stage”.

[0125] The above “execution time description information of the function corresponding to the root node in the rendering preparation stage” is used to describe the time information involved in the execution process of the function (for example, the start time of execution and the execution completion time, etc.).

[0126] In addition, the present application does not limit the implementation method of the above step of "determining the stage-by-stage rendering time of the rendering preparation stage according to the execution time description information of the function corresponding to the root node in the rendering preparation stage". For example, it can be specifically: using the execution completion time of the function (for example, prepareTree() function) minus the start execution time of the function, the stage-by-stage rendering time of the rendering preparation stage is obtained.

[0127] Based on the above content about the timing of stage-by-stage rendering, it can be known that in some application scenarios, for the rendering process of a view object, not only the overall rendering timing of the rendering process can be detected, but also the timing of different stages in the rendering process can be detected, so that these timing information can more accurately represent the specific timing of the rendering process, so that more accurate exception location processing can be performed based on these timing information in the future (for example, which stage's timing exceeds a preset threshold, etc.).

[0128] In fact, for a view object, the view object can usually be composed of multiple view components. Therefore, in order to better improve the detection effect of rendering time, some time-consuming information involved in the rendering process of each view component can be detected. Based on this, it can be seen that in a possible implementation, when the view object includes at least one view component, the above "rendering time of the view object at at least one granularity" can at least include the component rendering time of each view component. Among them, the component rendering time of the view component is used to describe the processing time consumed for the view component in the rendering process of the view object.

[0129] In addition, the present application does not limit the implementation method of the above "component rendering time of view component".

[0130] In fact, since both the rendering preparation stage and the hardware rendering stage involve processing operations for the nodes corresponding to each view component, in order to better improve the refinement of the rendering time, the processing time of each node in these two stages can be detected. Based on this, it can be seen that in a possible implementation, the above "component rendering time of the view component" may at least include the processing time of the view component in the accurate rendering stage and the processing time of the view component in the hardware rendering stage. Among them, the "processing time of the view component in the accurate rendering stage" refers to the time required to process the nodes corresponding to the view component in the accurate rendering stage. The "processing time of the view component in the hardware rendering stage" refers to the time required to process the nodes corresponding to the view component in the hardware rendering stage.

[0131] Based on the above content, it can be known that in a possible implementation, when the rendering process of the view object includes a fourth stage (for example, a rendering preparation stage or a hardware rendering stage), and the view object includes at least one view component, the above "rendering time of the view object at at least one granularity" may at least include the processing time of each view component at the fourth stage. The fourth stage refers to the rendering stage in which the time consumption needs to be detected for each view component separately; and the present application does not limit the fourth stage, for example, it can be a rendering preparation stage or a hardware rendering stage.

[0132] The above “processing time of the view component in the fourth stage” refers to the time consumed for processing the node corresponding to the view component in the fourth stage; and the present application does not limit the implementation method of the “processing time of the view component in the fourth stage”, for example, if the fourth stage is the rendering preparation stage, then the “processing time of the view component in the fourth stage” may be the above “processing time of the view component in the rendering accuracy stage”; if the fourth stage is the hardware rendering stage, then the “processing time of the view component in the fourth stage” may be the above “processing time of the view component in the hardware rendering stage”.

[0133] In addition, the present application does not limit the determination process of the above "processing time of the view component in the fourth stage". For example, when at least one of the above objective functions includes the function corresponding to the node corresponding to the view component in the fourth stage (for example, prepareTreeImpl() function or forceDraw() function), the processing time of the view component in the fourth stage can be determined based on the execution time description information of the function corresponding to the node corresponding to the view component in the fourth stage.

[0134] The above “function corresponding to the node corresponding to the view component in the fourth stage” refers to the function required to process the view component in the fourth stage; and this application does not limit the “function corresponding to the node corresponding to the view component in the fourth stage”. For ease of understanding, the following two situations are explained.

[0135] Case 1: In the rendering preparation phase, the prepareTreeImpl() function of RenderNode needs to be executed for each node to implement the processing of the view component corresponding to the node in the rendering preparation phase.

[0136] Based on the above situation 1, it can be known that for any view component, when the fourth stage above is the rendering preparation stage, the function corresponding to the node corresponding to the view component in the fourth stage can refer to the second processing function corresponding to the node corresponding to the view component in the rendering preparation stage (for example, prepareTreeImpl() function).

[0137] Case 2: In the hardware rendering stage, the forceDraw() function of RenderNodeDrawable needs to be executed for each node to implement the processing of the view component corresponding to the node in the hardware rendering stage.

[0138] Based on the above situation 2, it can be known that for any view component, when the fourth stage above is the hardware rendering stage, the function corresponding to the node corresponding to the view component in the fourth stage may refer to the third processing function corresponding to the node corresponding to the view component in the hardware rendering stage (for example, forceDraw() function).

[0139] The above “execution time description information of the function corresponding to the node corresponding to the view component in the fourth stage” is used to describe the time information involved in the execution process of the function (for example, the start execution time and the execution completion time, etc.).

[0140] In addition, the present application does not limit the implementation method of the above step "determining the processing time of the view component in the fourth stage based on the execution time description information of the function corresponding to the node corresponding to the view component in the fourth stage". For example, it can be specifically: use the execution completion time of the function (for example, prepareTreeImpl() function or forceDraw() function) minus the start execution time of the function to obtain the processing time of the view component in the fourth stage.

[0141] Based on the relevant content about component rendering time in the above text, it can be known that in some application scenarios, for a view object, when the view object includes multiple view components, and there are nodes corresponding to each view component in the view tree obtained by abstracting the view object, it is possible to detect not only the time consumed by the view object as a whole in the rendering process, but also the time consumed by each view component in the rendering preparation stage and the time consumed by each view component in the hardware rendering stage, so that these time-consuming information can more accurately represent the specific time consumption of the view object as a whole and each view component, so that more accurate exception location processing can be performed based on these time-consuming information in the future (for example, which view at which stage has a time consumption that exceeds a preset threshold, etc.).

[0142] Based on the relevant contents of S1 to S2 above, it can be known that for the rendering time determination method provided in the embodiment of the present application, after receiving the rendering request triggered for the view object, it is not only necessary to call at least one target function to implement the rendering process for the view object, but also necessary to obtain the execution time description information of each target function, so that the rendering time of the view object at at least one granularity can be determined based on the execution time description information of these target functions. (For example, the overall time of the rendering process, the staged time presented by the view object at different rendering stages, the rendering time presented by each view component in the view object at different rendering stages, etc.) In this way, the purpose of calculating the rendering time of the view object at at least one granularity with the help of the actual execution time of certain functions in the rendering process can be achieved, thereby solving the technical problem of how to determine the rendering time of a view object.

[0143] In addition, since the rendering time of the view object at at least one granularity above can describe the rendering time of the view object at different granularities, the "rendering time of the view object at at least one granularity" can more comprehensively and accurately describe the time consumption status of the view object in the rendering process, which is conducive to improving the determination effect of the rendering time.

[0144] In fact, in order to better improve the effect of determining the rendering time, the execution time of certain functions (for example, at least one target function mentioned above) in the rendering process can be detected by means of hooks. Based on this, the present application also provides a possible implementation method of the rendering time determination method, which can specifically include the following steps 11 to 13.

[0145] Step 11: Replace at least one target function in the rendering process with the hook functions corresponding to each target function.

[0146] The hook function corresponding to the target function refers to the hook function configured for the target function, so that the "hook function corresponding to the target function" is not only used to execute the process described by the target function, but also used to obtain the execution time description information of the process (equivalent to the "execution time description information of the target function" above). It can be seen that the "hook function corresponding to the target function" can detect the time consumption of the process on the premise of realizing the process represented by the target function.

[0147] In addition, the present application does not limit the implementation method of step 11. For example, it can be implemented by any existing or future method that can perform hook processing on the corresponding function.

[0148] In fact, in some application scenarios, hooks can be implemented by replacing function addresses. For ease of understanding, the following describes several scenarios.

[0149] Case 1: In some application scenarios, different rendering stages in a rendering process correspond to the rendering pipeline interface (for example, Figure 2 The different virtual functions in the IRenderPipeline interface shown in the figure can be used to detect the time consumption of the entire rendering process, the time consumption of the hardware rendering stage, and the time consumption of the rendering data submission stage. In addition, the virtual functions in the detection rendering pipeline interface are stored in the virtual function table during runtime, and the virtual function table can be obtained from the implementation class object of the detection rendering pipeline interface (for example, Figure 2 The IRenderPipeline implementation class object shown in the figure is obtained directly from the memory.

[0150] Based on the above situation 1, it can be known that under a possible implementation mode, when a rendering process includes the first stage (such as the rendering start stage, the hardware rendering stage or the rendering data submission stage), the above step 11 may specifically include: after obtaining the virtual function table of the rendering pipeline implementation class object, the virtual function address corresponding to the first stage recorded in the virtual function table is replaced with the hook function address corresponding to the first stage, so as to achieve the purpose of replacing the virtual function corresponding to the first stage with the corresponding hook function. Among them, the first stage refers to the rendering stage that can be hooked with the help of the virtual function in the rendering pipeline interface; and the first stage corresponds to a virtual function in the rendering pipeline interface. In addition, the present application does not limit the first stage, for example, it can be the rendering start stage, the hardware rendering stage or the rendering data submission stage.

[0151] A rendering pipeline implementation class object refers to an object obtained by instantiating a rendering pipeline class (e.g., IRenderPipeline class). For example, the rendering pipeline implementation class object may refer to Figure 2 The IRenderPipeline implementation class object shown.

[0152] The virtual function table refers to the function address of some virtual functions that exists in the memory of the rendering pipeline implementation class object above (for example, Figure 3 The function addresses shown in the table.

[0153] In addition, the present application does not limit the process of obtaining the virtual function table, for example, it may include the following steps 21 to 24.

[0154] Step 21: Get the address of the rendering proxy class object from the constructor of the rendering proxy class.

[0155] It should be noted that the present application does not limit the implementation method of step 21. For example, it can specifically be: obtaining the address of the RenderProxy class object from the constructor of the RenderProxy class by means of a hook method (for example, obtaining the address of the RenderProxy class object by inline hooking the constructor of the RenderProxy class).

[0156] Step 22: According to the address of the rendering proxy class object, determine the memory of the context drawing (CanvasContext) object in the rendering proxy class object.

[0157] In the present application, after obtaining the address of the RenderProxy class object, the memory allocated for the rendering proxy class object can be determined according to the address, and the memory of the CanvasContext object in the RenderProxy class object can be determined from the memory, so that the address of the IRenderPipeline implementation class object can be searched from the memory of the CanvasContext object later.

[0158] Step 23: Find the address of the rendering pipeline implementation class object from the above memory.

[0159] Step 24: According to the address of the rendering pipeline implementation class object, obtain the virtual function table of the rendering pipeline implementation class object.

[0160] In this application, after obtaining the address of the IRenderPipeline implementation class object, the memory allocated for the IRenderPipeline implementation class object is determined according to the address (for example, Figure 3 The "IRenderPipeline implementation class object memory" shown in the figure); then search and find the virtual function table address from the memory, and determine the virtual function table according to the virtual function table address, so that some virtual function addresses recorded in the virtual function table can be replaced with corresponding hook function addresses later, so as to achieve the purpose of replacing the virtual functions corresponding to some rendering stages with corresponding hook functions.

[0161] Based on the relevant contents of steps 21 to 24 above, it can be known that in some application scenarios, if the hook condition is met, the address of the RenderProxy class object can be obtained from the constructor of the RenderProxy class by means of a hook; then, based on the address of the RenderProxy class object, the memory of the CanvasContext object in the RenderProxy class object is determined; then, the address of the IRenderPipeline implementation class object is searched from the memory, and according to the address of the IRenderPipeline implementation class object, the virtual function table of the IRenderPipeline implementation class object is obtained, so that some function addresses recorded in the virtual function table (for example, the makeCurren() function address, the draw() function address, and the swapBuffers() function address) can be replaced with the addresses of the corresponding hook functions later, so as to achieve the purpose of replacing the virtual functions corresponding to some rendering stages with the corresponding hook functions.

[0162] It should be noted that the present application does not limit the above hook sub-conditions. For example, if the above view object belongs to a page, and the above view object is an object deployed on the page, the hook sub-condition can be: receiving a page building request for the page, and the page building request is used to request the construction of the page. That is, in some application scenarios, after obtaining a page building request for a certain page, the above step 11 can be directly executed, so that after obtaining a rendering request for a certain view object in the page, the hook function corresponding to the above target function can be called to realize the detection of some processing time information while executing the rendering process for the view object, so that the time consumption of the view object can be analyzed based on these time information later.

[0163] The "hook function address corresponding to the first stage" is used to point to a hook function, and the hook function is not only used to implement the processing described by the virtual function pointed to by the virtual function address corresponding to the first stage (that is, the virtual function corresponding to the first stage), but also used to detect the time information involved in executing the processing. For ease of understanding, the following is an explanation in combination with three examples.

[0164] Example 1: When the first stage above is the rendering start stage, the virtual function address corresponding to the first stage can be Figure 3The makeCurren() function address shown in the figure, the virtual function pointed to by the virtual function address refers to the virtual function corresponding to the start stage of the rendering, that is, the makeCurren() function, and the virtual function address recorded in the above virtual function table needs to be replaced with the hook function address corresponding to the start stage of the rendering, so that the hook function pointed to by the hook function address can not only implement the processing procedure described by the makeCurren() function, but also be used to detect the time information involved in the execution of the processing procedure (equivalent to the execution time description information of the makeCurren() function).

[0165] Example 2: When the first stage above is the hardware rendering stage, the virtual function address corresponding to the first stage can be Figure 3 The draw() function address shown in the figure, the virtual function pointed to by the virtual function address refers to the virtual function corresponding to the hardware rendering stage, that is, the draw() function, and the virtual function address recorded in the above virtual function table needs to be replaced with the hook function address corresponding to the hardware rendering stage, so that the hook function pointed to by the hook function address can not only implement the processing procedure described by the draw() function, but also be used to detect the time information involved in executing the processing procedure (equivalent to the execution time description information of the draw() function).

[0166] Example 3: When the first stage above is the rendering data submission stage, the virtual function address corresponding to the first stage can be Figure 3 The swapBuffers() function address shown in the figure, the virtual function pointed to by the virtual function address refers to the virtual function corresponding to the rendering data submission stage, that is, the swapBuffers() function, and the virtual function address recorded in the above virtual function table needs to be replaced with the hook function address corresponding to the rendering data submission stage, so that the hook function pointed to by the hook function address can not only implement the processing procedure described by the swapBuffers() function, but also be used to detect the time information involved in executing the processing procedure (equivalent to the execution time description information of the swapBuffers() function).

[0167] Based on the relevant content of the above situation 1, it can be known that in some application scenarios, the virtual functions corresponding to some rendering stages in the rendering process can be replaced with corresponding hook functions in advance with the help of certain methods (for example, address replacement method, etc.), so as to achieve the purpose of hooking these virtual functions, so that these hook functions can be used to implement time-consuming detection and processing for these rendering stages (for example, rendering start stage, hardware rendering stage or rendering data submission stage) in the future.

[0168] Case 2: In some application scenarios, since the main logic of the rendering preparation phase is to recursively execute the prepareTree logic of each node, the time consumption detection of the entire rendering preparation phase can be achieved by detecting the prepareTree() function of the root node. In addition, since the prepareTree() function of RenderNode is an externally exposed function and only the root node will call this function, the time consumption detection processing for the rendering preparation phase can be achieved by hooking the prepareTree() function.

[0169] Based on the above situation 2, it can be known that in a possible implementation, when a rendering process includes a rendering preparation stage, the above step 11 may specifically include: replacing the preparation function address corresponding to the root node in the view tree in the rendering preparation stage with the hook function address corresponding to the rendering preparation stage, so as to achieve the purpose of replacing the first processing function corresponding to the root node in the rendering preparation stage (for example, prepareTree() function) with the corresponding hook function. Among them, the preparation function address is used to point to the first processing function corresponding to the root node in the rendering preparation stage; and the present application does not limit the preparation function address, for example, it can refer to the function address of the prepareTree() function.

[0170] The above "hook function address corresponding to the rendering preparation stage" is used to point to a hook function, and the hook function is not only used to implement the processing process described by the function pointed to by the above preparation function address (that is, the first processing function corresponding to the root node in the view tree above in the rendering preparation stage), but also used to detect the time information involved in executing the processing process.

[0171] Based on the relevant content of the above situation 2, it can be known that in some application scenarios, some functions involved in the rendering preparation stage (for example, prepareTree() function) can be replaced with corresponding hook functions in advance with the help of certain methods (for example, address replacement method, etc.) to achieve the purpose of hooking these functions, so that the time-consuming information of the rendering preparation stage can be detected with the help of these hook functions later.

[0172] Case 3, in some application scenarios, since the processing operations of the nodes corresponding to each view component are involved in the rendering preparation stage and the hardware rendering stage, in order to better improve the refinement of the rendering time, the processing time of each node in these two stages can be further detected to realize the time-consuming detection and processing of the view component corresponding to each node. Among them, since the prepareTreeImpl() function of RenderNode needs to be executed for each node in the rendering preparation stage, although the function is not exposed to the outside, it can be obtained by decompressing the .gnu_debugdata segment of the hwui library. Therefore, the prepareTreeImpl() function can be found by first decompressing the .gnu_debugdata segment of the hwui library, and then the function can be hooked to realize the time-consuming detection and processing of the view component corresponding to each node in the rendering preparation stage. In addition, since the forceDraw() function of RenderNodeDrawable needs to be executed for each node in the hardware rendering stage, and the function can also be obtained by decompressing the .gnu_debugdata segment of the hwui library, the same method can also be used for hooking.

[0173] Based on the above situation 3, it can be known that in a possible implementation, when a rendering process includes a second stage (such as a rendering preparation stage or a hardware rendering stage), the above step 11 may specifically include: after decompressing the preset data segment in the target library, the node processing function address corresponding to the second stage in the decompressed data is replaced with the hook function address corresponding to the node processing function address. Among them, the second stage refers to the rendering stage that requires time-consuming analysis of the nodes corresponding to each view component, and the present application does not limit the second stage, for example, it can be a rendering preparation stage or a hardware rendering stage. The target library refers to the database used when searching for the function used to process the node in the second stage (for example, prepareTreeImpl() function or forceDraw() function); and the present application does not limit the target library, for example, it can be the hwui library. The preset data segment refers to the data segment used when searching for the function used to process the node in the second stage; and the present application does not limit the preset data segment, for example, it can be the .gnu_debugdata segment. The node processing function address is used to point to the function used to process the node in the second stage. For example, if the second stage is the rendering preparation stage, the node processing function address corresponding to the second stage is used to point to the above "the second processing function corresponding to the node in the rendering preparation stage"; if the second stage is the hardware rendering stage, the node processing function address corresponding to the second stage is used to point to the above "the third processing function corresponding to the node in the hardware rendering stage".

[0174] The above "hook function address corresponding to the node processing function address" is used to point to a hook function, and the hook function is not only used to implement the processing process described by the function pointed to by the node processing function address (for example, prepareTreeImpl() function or forceDraw() function) itself, but also used to detect the time information involved in executing the processing process.

[0175] Based on the relevant content of the above situation 3, it can be known that in some application scenarios, some functions involved in the rendering preparation stage or the hardware rendering stage for processing the nodes corresponding to the view components (for example, prepareTreeImpl() function or forceDraw() function) can be replaced with corresponding hook functions in advance with the help of certain methods (for example, address change method, etc.), so as to achieve the purpose of hooking these functions, so that these hook functions can be used to detect the time consumption of each view component in the rendering preparation stage or the hardware rendering stage.

[0176] Based on the relevant content of step 11 above, it can be known that in some application scenarios, some functions involved in the rendering process (for example, at least one target function above) can be hooked in advance, so that in the subsequent rendering process of each view object, some time-consuming information involved in the rendering process of the view object can be detected by hook means.

[0177] Step 12: In response to the rendering request triggered for the view object, call the hook function corresponding to each target function, which is used to implement the processing described by the target function and obtain the execution time description information of the processing (equivalent to the above "execution time description information of the target function").

[0178] In this application, after receiving a rendering request triggered for a certain view object, it can be determined that the view object needs to be rendered, so the hook functions corresponding to all target functions can be called to further detect the execution time description information of the processing process described by each target function while executing the rendering process for the view object (equivalent to the above "execution time description information of the target function"), so that the purpose of detecting the time-consuming information involved in the rendering process of the view object by means of a hook method can be achieved. For better understanding, the following is explained with examples.

[0179] As an example, the above step 12 may include at least one of the following steps 121 to 123 .

[0180] Step 121: calling the hook function pointed to by the hook function address corresponding to the first stage above to implement rendering processing for the view object in the first stage and obtain the rendering processing time of the view object in the first stage. The first stage is the rendering start stage, the hardware rendering stage or the rendering data submission stage.

[0181] In the present application, if the virtual function address corresponding to the first stage (for example, the rendering start stage, the hardware rendering stage or the rendering data submission stage) is replaced in advance with the hook function address corresponding to the first stage, then in the rendering process of a view object, the hook function pointed to by the hook function address corresponding to the first stage can be called to implement the rendering processing of the view object in the first stage (that is, the processing process described by the virtual function corresponding to the first stage) and obtain the rendering processing time of the view object in the first stage, thereby achieving the purpose of detecting the time consumption of the rendering start stage, the hardware rendering stage and the rendering data submission stage with the help of the hook method.

[0182] Step 122: calling the hook function pointed to by the hook function address corresponding to the rendering preparation stage to implement the rendering processing of the view object in the rendering preparation stage and obtain the rendering processing time of the view object in the rendering preparation stage.

[0183] In the present application, if the preparation function address corresponding to the root node in the view tree in the rendering preparation stage is replaced in advance with the hook function address corresponding to the rendering preparation stage, then in the rendering process of a view object, the hook function pointed to by the hook function address corresponding to the rendering preparation stage can be called to implement the rendering processing of the view object in the rendering preparation stage (that is, the processing process described by the first processing function corresponding to the root node in the view tree in the rendering preparation stage) and obtain the rendering processing time of the view object in the rendering preparation stage, so as to achieve the purpose of detecting the time consumption of the rendering preparation stage with the help of a hook method.

[0184] Step 123: For any node in the view tree, call the hook function pointed to by the hook function address corresponding to the node processing function address above to implement the rendering processing of the node in the second stage and obtain the rendering processing time of the node in the second stage; the view tree is used to describe the view object; different nodes in the view tree correspond to different view components in the view object.

[0185] In the present application, if the node processing function address corresponding to the second stage existing in the preset data segment in the target library is replaced in advance with the hook function address corresponding to the node processing function address, then in the rendering process of a view object, the hook function pointed to by the hook function address corresponding to the node processing function address can be called to realize the rendering processing of the nodes corresponding to each view component in the view object in the second stage (that is, the processing process described by the function corresponding to the node in the second stage) and obtain the rendering processing time for each node in the second stage, so as to achieve the purpose of detecting the time consumption of each view component in the view object in different rendering stages by means of a hook method.

[0186] Based on the relevant content of step 12 above, it can be known that when rendering processing is required for a view object, the above hook function can be directly called. This not only realizes the rendering process for the view object, but also detects some time-consuming information involved in the rendering process, thereby achieving the purpose of detecting the time-consuming information involved in the rendering process with the help of hook means.

[0187] Step 13: Determine the rendering time of the view object at at least one granularity according to the execution time description information of the above processing process.

[0188] It should be noted that the implementation of step 13 is similar to the implementation of S2 above.

[0189] Based on the relevant content of steps 11 to 13 above, it can be known that in some application scenarios, the time-consuming information involved in the rendering process of any view object (for example, the overall time consumption of the rendering process, the time consumption of the view object at different rendering stages, and the time consumption of each view component in the view object at different rendering stages, etc.) can be detected with the help of hook means. This is conducive to improving the determination effect of rendering time.

[0190] In fact, after obtaining the time-consuming information of a view object, it is possible to analyze whether there is an exception in the rendering process of the view object based on the time-consuming information. Therefore, in order to better improve the abnormality analysis effect, the present application also provides a possible implementation method of the above rendering time determination method. In this implementation method, the rendering time determination method may at least include the following step 31. The execution time of step 31 is later than the execution time of S2 above or the execution time of step 13 above.

[0191] Step 31: When there is an association between the nodes corresponding to each view component and the business scenario information of each view component, for any view component, if the processing time of the view component in the fourth stage meets the preset abnormal conditions, the business scenario information associated with the node corresponding to the view component is displayed.

[0192] Among them, the business scenario information of the view component is used to describe the relevant information of the application scenario of the view component; and this application does not limit the "business scenario information of the view component", for example, it may refer to the layout information of the view component, and in particular, it may be the layout file of the view component.

[0193] In addition, the present application does not limit the construction process of the above “there is an association relationship between the nodes corresponding to each view component and the business scenario information of each view component”.

[0194] In fact, since there is a one-to-one relationship between each view component in the view object and each node in the view tree, and most view components are created from the layout file through the layout service (LayoutInflater) class, the LayoutInflater class can be proxied so that when the layout creation method of the proxied LayoutInflater class (that is, the inflate() method) is executed, not only the view components can be created, but also the business scenario information carried by the layout file corresponding to the created view component can be associated with the node corresponding to the view component, thereby achieving the purpose of associating each node with the business scenario.

[0195] Based on the above content, the present application also provides an implementation method of the construction process of the above "there is an association relationship between the nodes corresponding to each view component and the business scenario information of each view component", which may specifically include the following steps 41-42.

[0196] Step 41: Use the preset implementation class to replace the service acquisition (ServiceFetcher) interface through dynamic proxy.

[0197] The preset implementation class refers to an implementation class of the ServiceFetcher interface, and the implementation class is implemented in the form of a proxy, so that the preset implementation class can be used to proxy the ServiceFetcher interface.

[0198] In addition, the preset implementation class is a class that is set in advance based on demand, and this application does not make any specific limitations on this.

[0199] Step 42: For any view component, call the preset implementation class so that the creation process for the view component is implemented using a custom layout service class; the custom layout service class includes an overridden layout creation method; the overridden layout creation method is at least used to associate the business scenario information of the created view component with the node corresponding to the created view component.

[0200] Among them, the customized layout service class refers to the LayoutInflater class set according to the requirements, and the customized layout service class includes an overridden layout creation method (that is, the inflate() method), which is not only used for the created view component, but also for associating the business scenario information of the created view component with the node corresponding to the created view component.

[0201] In addition, the present application does not limit the determination process of the above-mentioned "business scenario information of the created view component". For example, it may specifically be: according to the layout file corresponding to the created view component, the business scenario information of the created view component is determined (for example, the layout file corresponding to the created view component is determined as the business scenario information of the created view component. For another example, the file identifier of the layout file corresponding to the created view component is determined as the business scenario information of the created view component).

[0202] Based on the relevant content of steps 41 to 42 above, it can be known that in some application scenarios, the ServiceFetcher interface of LAYOUT_INFLATER_SERVICE in SystemServiceRegistry can be replaced by dynamic proxy first; then the instance object of the custom LayoutInfalter class is returned in the proxy process; finally, with the help of the inflate() method overridden in the custom LayoutInflater class, the business scenario information corresponding to the view component (for example, the layout file or the file identifier of the layout file, etc.) is automatically associated with the node corresponding to the view component after the view component is created. In this way, the purpose of associating the business scenario information of each view component with the node corresponding to each view component can be achieved.

[0203] The preset exception condition is used to describe the conditions satisfied by the view component that has an exception in the fourth stage; and the present application does not limit the preset exception condition. For example, it can be specifically: the processing time of the view component in the fourth stage reaches the preset time threshold.

[0204] Based on the relevant content of step 31 above, it can be known that in some application scenarios, during the rendering process of each view component, an association relationship can be constructed between the nodes corresponding to each view component and the business scenario information of each view component (for example, the file identifier of the layout file of each view component, etc.), so as to determine that the processing time of a certain view component in a certain rendering stage (for example, the rendering preparation stage or the hardware rendering stage) exceeds the corresponding preset time threshold, then it can be determined that an exception has occurred in the view component in the rendering stage. Therefore, not only can the abnormal situation be fed back to the user, but also the business scenario information associated with the node corresponding to the view component (for example, the layout file of the view component) can be fed back to the user, so that the user can better analyze the cause of the abnormality of the view component based on the business scenario information, which is conducive to improving the effect of abnormality analysis.

[0205] Based on the rendering time determination method provided in the embodiment of the present application, the embodiment of the present application also provides a rendering time determination device. Figure 4 Explain and illustrate. Figure 4 This is a schematic diagram of the structure of a rendering time determination device provided in an embodiment of the present application. It should be noted that for the technical details of the rendering time determination device provided in an embodiment of the present application, please refer to the relevant content of the rendering time determination method above.

[0206] like Figure 4 As shown, the rendering time determination device 400 provided in the embodiment of the present application includes:

[0207] The first processing unit 401 is configured to, in response to a rendering request triggered for a view object, call at least one target function and obtain execution time description information of the at least one target function; the at least one target function is used to implement a rendering process for the view object;

[0208] The second processing unit 402 is used to determine the rendering time of the view object at at least one granularity according to the execution time description information of the at least one objective function.

[0209] In one possible implementation, the rendering process includes at least one rendering stage; the view object includes at least one view component; the rendering time at the at least one granularity includes the overall rendering time of the rendering process, the staged rendering time of one or more of the rendering stages, and at least one of the component rendering time of each of the view components.

[0210] In one possible implementation, the at least one rendering stage includes a rendering accuracy stage and a hardware rendering stage; the component rendering time of the view component includes the processing time of the view component in the rendering accuracy stage and the processing time of the view component in the hardware rendering stage.

[0211] In a possible implementation manner, the rendering time determination device 400 further includes:

[0212] A content replacement unit, used to replace at least one target function in the rendering process with a hook function corresponding to each target function;

[0213] The first processing unit 401 is specifically used to: call the hook function corresponding to each of the target functions, the hook function is used to implement the processing process described by the target function, and obtain the execution time description information of the processing process;

[0214] The second processing unit 402 is specifically configured to determine the rendering time of the view object at at least one granularity according to the execution time description information of the processing process.

[0215] In a possible implementation, the rendering process includes a first stage;

[0216] The content replacement unit includes:

[0217] A first replacement subunit is used to replace the virtual function address corresponding to the first stage recorded in the virtual function table with the hook function address corresponding to the first stage after acquiring the virtual function table of the rendering pipeline implementation class object;

[0218] The first processing unit 401 includes:

[0219] The first calling sub-unit is used to call the hook function pointed to by the hook function address corresponding to the first stage to implement rendering processing for the view object in the first stage and obtain the rendering processing time of the view object in the first stage.

[0220] In a possible implementation manner, the rendering time determination device 400 further includes:

[0221] A virtual table acquisition unit is used to acquire the address of a rendering proxy class object from a constructor of the rendering proxy class; determine the memory of a context drawing object in the rendering proxy class object according to the address of the rendering proxy class object; search the address of the rendering pipeline implementation class object from the memory; and acquire the virtual function table of the rendering pipeline implementation class object according to the address of the rendering pipeline implementation class object.

[0222] In a possible implementation manner, the first stage is a rendering start stage, a hardware rendering stage, or a rendering data submission stage.

[0223] In a possible implementation, the rendering process includes a rendering preparation stage;

[0224] The content replacement unit includes:

[0225] A second replacement subunit is used to replace the preparation function address corresponding to the root node in the view tree in the rendering preparation phase with the hook function address corresponding to the rendering preparation phase; the view tree is used to describe the view object;

[0226] The first processing unit 401 includes:

[0227] The second calling sub-unit is used to call the hook function pointed to by the hook function address corresponding to the rendering preparation stage to implement the rendering processing of the view object in the rendering preparation stage and obtain the rendering processing time of the view object in the rendering preparation stage.

[0228] In a possible implementation, the rendering process includes a second stage;

[0229] The content replacement unit includes:

[0230] A third replacement subunit is used to replace the node processing function address corresponding to the second stage existing in the decompressed data with the hook function address corresponding to the node processing function address after decompressing the preset data segment in the target library;

[0231] The first processing unit 401 includes:

[0232] The third calling sub-unit is used to call the hook function pointed to by the hook function address corresponding to the node processing function address for any node in the view tree, so as to realize the rendering processing of the node in the second stage and obtain the rendering processing time of the node in the second stage; the view tree is used to describe the view object; different nodes in the view tree correspond to different view components in the view object.

[0233] In a possible implementation manner, the second stage is a rendering preparation stage or a hardware rendering stage.

[0234] In one possible implementation, the at least one objective function includes a rendering start characterization function and a rendering end characterization function; the rendering time at the at least one granularity includes the overall rendering time of the rendering process; the overall rendering time is determined based on the execution time description information of the rendering start characterization function and the execution time description information of the rendering end characterization function.

[0235] In one possible implementation, the rendering process includes a third stage; the at least one objective function includes a stage-by-stage alignment function corresponding to the third stage; the rendering time at at least one granularity includes the stage-by-stage rendering time of the third stage; the stage-by-stage rendering time of the third stage is determined based on the execution time description information of the stage-by-stage alignment function corresponding to the third stage.

[0236] In one possible implementation, the rendering process also includes a rendering preparation stage; the rendering time at at least one granularity also includes the overall rendering time of the rendering process and the staged rendering time of the rendering preparation stage; the staged rendering time of the rendering preparation stage is determined based on the overall rendering time of the rendering process and the staged rendering time of the third stage.

[0237] In one possible implementation, the rendering process includes a rendering preparation stage; the at least one objective function includes a function corresponding to a root node in a view tree in the rendering preparation stage; the view tree is used to describe the view object; the rendering time at at least one granularity includes a phased rendering time of the rendering preparation stage; the phased rendering time of the rendering preparation stage is determined based on the execution time description information of the function corresponding to the root node in the rendering preparation stage.

[0238] In one possible implementation, the rendering process includes a fourth stage; the view object includes at least one view component; the rendering time at the at least one granularity includes the processing time of each view component at the fourth stage; the at least one objective function includes the function corresponding to the node corresponding to the view component at the fourth stage; for any view component, the processing time of the view component at the fourth stage is determined based on the execution time description information of the function corresponding to the node corresponding to the view component at the fourth stage.

[0239] In a possible implementation manner, there is an association relationship between the nodes corresponding to each of the view components and the business scenario information of each of the view components;

[0240] The rendering time determination device 400 further includes:

[0241] An information display unit is used to determine the rendering time of the view object at at least one granularity based on the execution time description information of the at least one objective function, and for any view component, if the processing time of the view component in the fourth stage meets the preset exception condition, then display the business scenario information associated with the node corresponding to the view component.

[0242] In a possible implementation manner, the rendering time determination device 400 further includes:

[0243] A relationship building unit, used to replace the service acquisition interface by dynamic proxy using a preset implementation class; for any view component, the preset implementation class is called so that the creation process for the view component is implemented using a custom layout service class; the custom layout service class includes an overridden layout creation method; the overridden layout creation method is at least used to associate the business scenario information of the created view component with the node corresponding to the created view component.

[0244] In a possible implementation manner, the business scenario information is determined according to a layout file.

[0245] Based on the relevant content of the above-mentioned rendering time determination device 400, it can be known that for the rendering time determination device 400 provided in the embodiment of the present application, after the rendering time determination device 400 receives a rendering request triggered for a view object, it is not only necessary to call at least one objective function to implement the rendering process for the view object, but also to obtain the execution time description information of each objective function, so that the rendering time of the view object at at least one granularity can be determined based on the execution time description information of these objective functions. (For example, the overall time of the rendering process, the staged time presented by the view object at different rendering stages, the rendering time presented by each view component in the view object at different rendering stages, etc.) In this way, the purpose of calculating the rendering time of the view object at at least one granularity with the help of the actual execution time of certain functions in the rendering process can be achieved, thereby solving the technical problem of how to determine the rendering time of a view object.

[0246] In addition, an embodiment of the present application also provides an electronic device, which includes a processor and a memory: the memory is used to store instructions or computer programs; the processor is used to execute the instructions or computer programs in the memory, so that the electronic device executes any implementation of the rendering time determination method provided in the embodiment of the present application.

[0247] See also Figure 5 , which shows a schematic diagram of the structure of an electronic device 500 suitable for implementing the embodiment of the present disclosure. The terminal device in the embodiment of the present disclosure may include but is not limited to mobile terminals such as mobile phones, laptop computers, digital broadcast receivers, PDAs (personal digital assistants), PADs (tablet computers), PMPs (portable multimedia players), vehicle-mounted terminals (such as vehicle-mounted navigation terminals), etc., and fixed terminals such as digital TVs, desktop computers, etc. Figure 5 The electronic device shown is only an example and should not bring any limitation to the functions and scope of use of the embodiments of the present disclosure.

[0248] like Figure 5 As shown, the electronic device 500 may include a processing device (e.g., a central processing unit, a graphics processing unit, etc.) 501, which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM) 502 or a program loaded from a storage device 508 into a random access memory (RAM) 503. In the RAM 503, various programs and data required for the operation of the electronic device 500 are also stored. The processing device 501, the ROM 502, and the RAM 503 are connected to each other via a bus 504. An input / output (I / O) interface 505 is also connected to the bus 504.

[0249] Typically, the following devices may be connected to the I / O interface 505: an input device 506 including, for example, a touch screen, a touch pad, a keyboard, a mouse, a camera, a microphone, an accelerometer, a gyroscope, etc.; an output device 507 including, for example, a liquid crystal display (LCD), a speaker, a vibrator, etc.; a storage device 508 including, for example, a magnetic tape, a hard disk, etc.; and a communication device 509. The communication device 509 may allow the electronic device 500 to communicate with other devices wirelessly or by wire to exchange data. Although Figure 5 The electronic device 500 is shown with various devices, but it should be understood that it is not required to implement or possess all the devices shown. More or fewer devices may be implemented or possessed instead.

[0250] In particular, according to an embodiment of the present disclosure, the process described above with reference to the flowchart can be implemented as a computer software program. For example, an embodiment of the present disclosure includes a computer program product, which includes a computer program carried on a non-transitory computer-readable medium, and the computer program contains program code for executing the method shown in the flowchart. In such an embodiment, the computer program can be downloaded and installed from the network through the communication device 509, or installed from the storage device 508, or installed from the ROM502. When the computer program is executed by the processing device 501, the above-mentioned functions defined in the method of the embodiment of the present disclosure are executed.

[0251] The electronic device provided by the embodiment of the present disclosure and the method provided by the above embodiment belong to the same inventive concept, and the technical details not fully described in this embodiment can be referred to the above embodiment, and this embodiment has the same beneficial effects as the above embodiment.

[0252] An embodiment of the present application further provides a computer-readable medium, in which instructions or computer programs are stored. When the instructions or computer programs are executed on a device, the device executes any implementation of the method for determining the rendering time provided in the embodiment of the present application.

[0253] It should be noted that the computer-readable medium disclosed above may be a computer-readable signal medium or a computer-readable storage medium or any combination of the above two. The computer-readable storage medium may be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or device, or any combination of the above. More specific examples of computer-readable storage media may include, but are not limited to: an electrical connection with one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above. In the present disclosure, a computer-readable storage medium may be any tangible medium containing or storing a program that may be used by or in combination with an instruction execution system, device or device. In the present disclosure, a computer-readable signal medium may include a data signal propagated in a baseband or as part of a carrier wave, in which a computer-readable program code is carried. This propagated data signal may take a variety of forms, including but not limited to an electromagnetic signal, an optical signal, or any suitable combination of the above. The computer readable signal medium may also be any computer readable medium other than a computer readable storage medium, which may send, propagate or transmit a program for use by or in conjunction with an instruction execution system, apparatus or device. The program code contained on the computer readable medium may be transmitted using any suitable medium, including but not limited to: wires, optical cables, RF (radio frequency), etc., or any suitable combination of the above.

[0254] In some embodiments, the client and the server may communicate using any currently known or future developed network protocol such as HTTP (Hyper Text Transfer Protocol), and may be interconnected with any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include a local area network ("LAN"), a wide area network ("WAN"), an internet (e.g., the Internet), and a peer-to-peer network (e.g., an ad hoc peer-to-peer network), as well as any currently known or future developed network.

[0255] The computer-readable medium may be included in the electronic device, or may exist independently without being installed in the electronic device.

[0256] The computer-readable medium carries one or more programs, and when the one or more programs are executed by the electronic device, the electronic device can execute the method.

[0257] Computer program code for performing the operations of the present disclosure may be written in one or more programming languages ​​or a combination thereof, including, but not limited to, object-oriented programming languages, such as Java, Smalltalk, C++, and conventional procedural programming languages, such as "C" or similar programming languages. The program code may be executed entirely on the user's computer, partially on the user's computer, as a separate software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In cases involving a remote computer, the remote computer may be connected to the user's computer through any type of network, including a local area network (LAN) or a wide area network (WAN), or may be connected to an external computer (e.g., through the Internet using an Internet service provider).

[0258] The flow chart and block diagram in the accompanying drawings illustrate the possible architecture, function and operation of the system, method and computer program product according to various embodiments of the present disclosure. In this regard, each square box in the flow chart or block diagram can represent a module, a program segment or a part of a code, and the module, the program segment or a part of the code contains one or more executable instructions for realizing the specified logical function. It should also be noted that in some implementations as replacements, the functions marked in the square box can also occur in a sequence different from that marked in the accompanying drawings. For example, two square boxes represented in succession can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each square box in the block diagram and / or flow chart, and the combination of the square boxes in the block diagram and / or flow chart can be implemented with a dedicated hardware-based system that performs a specified function or operation, or can be implemented with a combination of dedicated hardware and computer instructions.

[0259] The units involved in the embodiments described in the present disclosure may be implemented by software or hardware, wherein the name of a unit / module does not, in some cases, constitute a limitation on the unit itself.

[0260] The functions described above herein may be performed at least in part by one or more hardware logic components. For example, without limitation, exemplary types of hardware logic components that may be used include: field programmable gate arrays (FPGAs), application specific integrated circuits (ASICs), application specific standard products (ASSPs), systems on chips (SOCs), complex programmable logic devices (CPLDs), and the like.

[0261] In the context of the present disclosure, a machine-readable medium may be a tangible medium that may contain or store a program for use by or in conjunction with an instruction execution system, device, or equipment. A machine-readable medium may be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium may include, but is not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, device, or equipment, or any suitable combination of the foregoing. A more specific example of a machine-readable storage medium may include an electrical connection based on one or more lines, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.

[0262] It should be noted that the various embodiments in this specification are described in a progressive manner, and each embodiment focuses on the differences from other embodiments, and the same or similar parts between the various embodiments can be referred to each other. For the system or device disclosed in the embodiment, since it corresponds to the method disclosed in the embodiment, the description is relatively simple, and the relevant parts can be referred to the method part description.

[0263] It should be understood that in the present application, "at least one (item)" means one or more, and "plurality" means two or more. "And / or" is used to describe the association relationship of associated objects, indicating that three relationships may exist. For example, "A and / or B" can mean: only A exists, only B exists, and A and B exist at the same time, where A and B can be singular or plural. The character " / " generally indicates that the objects associated before and after are in an "or" relationship. "At least one of the following" or similar expressions refers to any combination of these items, including any combination of single or plural items. For example, at least one of a, b or c can mean: a, b, c, "a and b", "a and c", "b and c", or "a and b and c", where a, b, c can be single or multiple.

[0264] It should also be noted that, in this article, relational terms such as first and second, etc. are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, the elements defined by the sentence "comprise a ..." do not exclude the presence of other identical elements in the process, method, article or device including the elements.

[0265] The steps of the method or algorithm described in conjunction with the embodiments disclosed herein may be implemented directly using hardware, a software module executed by a processor, or a combination of the two. The software module may be placed in a random access memory (RAM), a memory, a read-only memory (ROM), an electrically programmable ROM, an electrically erasable programmable ROM, a register, a hard disk, a removable disk, a CD-ROM, or any other form of storage medium known in the art.

[0266] The above description of the disclosed embodiments enables those skilled in the art to implement or use the present application. Various modifications to these embodiments will be apparent to those skilled in the art, and the general principles defined herein may be implemented in other embodiments without departing from the spirit or scope of the present application. Therefore, the present application will not be limited to the embodiments shown herein, but will conform to the widest scope consistent with the principles and novel features disclosed herein.

Claims

1. A method for determining rendering time, characterized in that: The method comprises: In response to a rendering request triggered for a view object, calling at least one target function and obtaining execution time description information of the at least one target function; the at least one target function is used to implement a rendering process for the view object; The rendering time consumption of the view object at at least one granularity is determined according to the execution time description information of the at least one objective function.

2. The method according to claim 1, characterized in that The rendering process includes at least one rendering stage; The view object includes at least one view component; The rendering time at the at least one granularity includes at least one of the overall rendering time of the rendering process, the staged rendering time of one or more of the rendering stages, and the component rendering time of each of the view components.

3. The method according to claim 2, characterized in that The at least one rendering stage includes a rendering accuracy stage and a hardware rendering stage; The component rendering time of the view component includes the processing time of the view component in the accurate rendering stage and the processing time of the view component in the hardware rendering stage.

4. The method according to claim 1, characterized in that: Before calling at least one target function and obtaining the execution time description information of the at least one target function, the method further includes: Replacing at least one target function in the rendering process with a hook function corresponding to each target function; The calling of at least one target function and obtaining the execution time description information of the at least one target function includes: Calling a hook function corresponding to each of the target functions, wherein the hook function is used to implement the processing process described by the target function and obtain the execution time description information of the processing process; The determining, according to the execution time description information of the at least one objective function, the rendering time consumption of the view object at at least one granularity includes: The rendering time of the view object at at least one granularity is determined according to the execution time description information of the processing process.

5. The method according to claim 4, characterized in that The rendering process includes a first stage; The method further comprises: Get the address of the rendering proxy class object from the constructor of the rendering proxy class; Determine the memory of the context drawing object in the rendering proxy class object according to the address of the rendering proxy class object; Find the address of the rendering pipeline implementation class object from the memory; According to the address of the rendering pipeline implementation class object, obtaining the virtual function table of the rendering pipeline implementation class object; The step of replacing at least one target function in the rendering process with a hook function corresponding to each target function includes: Replace the virtual function address corresponding to the first stage recorded in the virtual function table with the hook function address corresponding to the first stage; The calling of the hook function corresponding to each of the target functions includes: The hook function pointed to by the hook function address corresponding to the first stage is called to implement rendering processing for the view object in the first stage and obtain the rendering processing time of the view object in the first stage.

6. The method according to claim 4, characterized in that The rendering process includes a rendering preparation stage; The step of replacing at least one target function in the rendering process with a hook function corresponding to each target function includes: Replacing the preparation function address corresponding to the root node in the view tree in the rendering preparation phase with the hook function address corresponding to the rendering preparation phase; the view tree is used to describe the view object; The calling of the hook function corresponding to each of the target functions includes: The hook function pointed to by the hook function address corresponding to the rendering preparation stage is called to implement rendering processing for the view object in the rendering preparation stage and obtain the rendering processing time of the view object in the rendering preparation stage.

7. The method according to claim 4, characterized in that The rendering process includes a second stage; The step of replacing at least one target function in the rendering process with a hook function corresponding to each target function includes: After decompressing the preset data segment in the target library, replacing the node processing function address corresponding to the second stage existing in the decompressed data with the hook function address corresponding to the node processing function address; The calling of the hook function corresponding to each of the target functions includes: For any node in the view tree, the hook function pointed to by the hook function address corresponding to the node processing function address is called to implement the rendering processing of the node in the second stage and obtain the rendering processing time of the node in the second stage; the view tree is used to describe the view object; different nodes in the view tree correspond to different view components in the view object.

8. The method according to claim 1, characterized in that The at least one objective function includes a rendering start characterization function and a rendering end characterization function; The rendering time at the at least one granularity includes the overall rendering time of the rendering process; The overall rendering time is determined according to the execution time description information of the rendering start characterization function and the execution time description information of the rendering end characterization function; and / or, The rendering process includes a third stage; The at least one objective function includes a stage-by-stage alignment function corresponding to the third stage; The rendering time at the at least one granularity includes the stage-by-stage rendering time of the third stage; The time consumption of the stage-by-stage rendering of the third stage is determined according to the execution time description information of the stage-by-stage alignment function corresponding to the third stage.

9. The method according to claim 1, characterized in that: The rendering process includes a rendering preparation stage; The at least one target function includes a function corresponding to a root node in a view tree in the rendering preparation phase; the view tree is used to describe the view object; The rendering time at the at least one granularity includes the staged rendering time of the rendering preparation stage; The staged rendering time consumption of the rendering preparation stage is determined according to the execution time description information of the function corresponding to the root node in the rendering preparation stage; and / or, The rendering process includes a fourth stage; The view object includes at least one view component; The rendering time at the at least one granularity includes the processing time of each of the view components at the fourth stage; The at least one objective function includes a function corresponding to a node corresponding to the view component in the fourth stage; For any view component, the processing time of the view component in the fourth stage is determined according to the execution time description information of the function corresponding to the node corresponding to the view component in the fourth stage.

10. The method according to claim 9, characterized in that There is an association relationship between the nodes corresponding to each of the view components and the business scenario information of each of the view components; After determining the rendering time of the view object at at least one granularity according to the execution time description information of the at least one objective function, the method further includes: For any view component, if the processing time of the view component in the fourth stage meets the preset abnormal condition, the business scenario information associated with the node corresponding to the view component is displayed.

11. The method according to claim 10, characterized in that The process of building the association relationship includes: Use the preset implementation class to replace the service acquisition interface through dynamic proxy; For any view component, the preset implementation class is called so that the creation process of the view component is implemented using a custom layout service class; the custom layout service class includes an overridden layout creation method; the overridden layout creation method is at least used to associate the business scenario information of the created view component with the node corresponding to the created view component.

12. A rendering time determination device, characterized in that: include: A first processing unit, configured to, in response to a rendering request triggered for a view object, call at least one target function and obtain execution time description information of the at least one target function; The at least one objective function is used to implement a rendering process for the view object; The second processing unit is used to determine the rendering time of the view object at at least one granularity according to the execution time description information of the at least one objective function.

13. An electronic device, characterized in that: The device comprises: a processor and a memory; The memory is used to store instructions or computer programs; The processor is used to execute the instructions or computer programs in the memory so that the electronic device executes the method according to any one of claims 1 to 11.

14. A computer readable medium, characterized in that The computer-readable medium stores instructions or computer programs, and when the instructions or computer programs are executed on a device, the device executes the method according to any one of claims 1 to 11.