Method, device, equipment and storage medium for determining page loading time

By embedding the preset parent view in the calculation of the page loading time of the active window component in the Android system and monitoring the end time of its drawing distribution function, the problem of low accuracy in calculating the page loading time is solved and a more accurate page loading time is achieved. Measurement improves user experience.

CN112506592BActive Publication Date: 2024-09-20BEIJING JINGDONG SHANGKE INFORMATION TECH CO LTD +1
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN201910872751.5
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2019-09-16
Publication Date
2024-09-20
Estimated Expiration
2039-09-16

AI Technical Summary

Technical Problem

In the existing technology, the calculation accuracy of the page loading time is low because the calling start time of the interactive function onResume is later than the actual page loading completion time as the page loading end time.

Method used

By nesting a preset parent view in the outermost layer of the original page layout of the active window component, monitoring the end time of calling the drawing distribution function of the preset parent view to obtain the end time when the first drawing of the page is completed, thereby improving the page loading time. calculation accuracy.

Benefits of technology

By monitoring the end time of the drawing distribution function of the preset parent view, a more accurate end time of page loading is obtained, which improves the calculation accuracy of page loading time, helps developers optimize application software, reduces user waiting time, and improves user experience.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN112506592B
    Figure CN112506592B
Patent Text Reader

Abstract

This invention discloses a method, apparatus, device, and storage medium for determining page load duration. The method includes: obtaining a first call start time corresponding to the invocation of the creation function of an active window component; during the invocation of the creation function, performing view drawing according to a preset page layout, and obtaining a first call end time corresponding to the invocation of the drawing dispatch function of the outermost preset parent view, wherein the preset page layout is a preset parent view nested on the outermost layer of the original page layout; and determining the difference between the first call start time and the first call end time as the page load duration of the active window component. The technical solution of this invention can improve the accuracy of page load duration calculation.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] Embodiments of the present invention relate to software development technology, and in particular to a method, device, equipment and storage medium for determining page loading time. Background Art

[0002] With the rapid development of mobile Internet, more and more applications are being developed to meet people's growing needs. When developing applications, it is often necessary to consider the user experience to increase the popularity of the application. For example, the page loading time in the application should be as short as possible to avoid reducing the user experience due to long waiting time. Therefore, it is necessary to calculate the page loading time in real time so that developers can optimize the application based on the page loading time.

[0003] Currently, in the Android system, the page loading duration is usually determined based on the life cycle of the active window component Activity corresponding to the page. The specific determination process is: since each life cycle function corresponding to the active window component can represent the running status of the current page, the start time of the creation function onCreate called when the Activity is first created can be used as the start time of page loading, and the start time of the interaction function onResume can be used as the end time of page loading, so that the difference between the start time and the end time of page loading can be used as the page loading duration.

[0004] However, in the process of implementing the present invention, the inventors found that there are at least the following problems in the prior art:

[0005] Since the interaction function onResume is called before the Activity starts to interact with the user, that is, the page has been loaded before the interaction function onResume is called, the start time of the interaction function onResume being called as the end time of page loading will be later than the actual time when the page loading is completed, resulting in reduced accuracy in the calculation of page loading duration. Summary of the invention

[0006] Embodiments of the present invention provide a method, apparatus, device and storage medium for determining page loading duration, so as to improve the accuracy of calculating page loading duration.

[0007] In a first aspect, an embodiment of the present invention provides a method for determining a page loading time, comprising:

[0008] Get the first call start time corresponding to calling the creation function of the active window component;

[0009] During the calling process of the creation function, the view is drawn according to the preset page layout, and the first calling end time corresponding to the drawing distribution function of the outermost preset parent view is obtained, wherein the preset page layout is a layer of the preset parent view nested in the outermost layer of the original page layout;

[0010] The difference between the first call start time and the first call end time is determined as the page loading duration of the active window component.

[0011] In a second aspect, an embodiment of the present invention further provides a device for determining a page loading duration, comprising:

[0012] A first call start time acquisition module, used to acquire the first call start time corresponding to calling the creation function of the active window component;

[0013] A first call end time acquisition module is used to perform view drawing according to a preset page layout during the calling process of the creation function, and obtain a first call end time corresponding to calling a drawing distribution function of an outermost preset parent view, wherein the preset page layout is a preset parent view nested in the outermost layer of the original page layout;

[0014] The page loading duration determining module is used to determine the difference between the first call start time and the first call end time as the page loading duration of the active window component.

[0015] In a third aspect, an embodiment of the present invention further provides a device, the device comprising:

[0016] one or more processors;

[0017] A memory for storing one or more programs;

[0018] When the one or more programs are executed by the one or more processors, the one or more processors implement the method for determining the page loading duration provided by any embodiment of the present invention.

[0019] In a fourth aspect, an embodiment of the present invention further provides a computer-readable storage medium having a computer program stored thereon, wherein the program, when executed by a processor, implements a method for determining a page loading time as provided in any embodiment of the present invention.

[0020] The embodiments of the above invention have the following advantages or beneficial effects:

[0021] By pre-nesting a layer of preset parent view in the outermost layer of the original page layout of the active window component, the preset page layout is obtained. Therefore, when drawing the view of the page according to the preset page layout, the end time of the first drawing of the page can be obtained by monitoring the end time of the first call of the drawing distribution function of the preset parent view, that is, the actual end time of page loading. Therefore, based on the view drawing mechanism, a more accurate end time of page loading can be obtained, thereby improving the accuracy of page loading duration calculation. BRIEF DESCRIPTION OF THE DRAWINGS

[0022] Figure 1 This is a flow chart of a method for determining page loading time provided by Embodiment 1 of the present invention;

[0023] Figure 2 This is an example of a method for determining page loading time involved in the first embodiment of the present invention;

[0024] Figure 3 This is a view drawing example of a preset parent view involved in the first embodiment of the present invention;

[0025] Figure 4 This is a flow chart of a method for determining page loading time provided by Embodiment 2 of the present invention;

[0026] Figure 5 It is a structural schematic diagram of a device for determining page loading time provided by Embodiment 3 of the present invention;

[0027] Figure 6 It is a structural schematic diagram of a device provided in Embodiment 4 of the present invention. DETAILED DESCRIPTION

[0028] The present invention will be further described in detail below in conjunction with the accompanying drawings and embodiments. It is to be understood that the specific embodiments described herein are only used to explain the present invention, rather than to limit the present invention. It should also be noted that, for ease of description, only parts related to the present invention, rather than all structures, are shown in the accompanying drawings.

[0029] Embodiment 1

[0030] Figure 1 This is a flow chart of a method for determining page loading time provided in the first embodiment of the present invention. This embodiment can be applied to the case of determining the page loading time of an active window component Activity in an Android application software. The method can be executed by a device for determining page loading time, which can be implemented by software and / or hardware and integrated into a device installed with Android application software, such as a typical user terminal device, such as a mobile phone, tablet computer or smart TV. See Figure 1 , the method specifically comprises the following steps:

[0031] S110: Obtain a first call start time corresponding to calling a creation function of an active window component.

[0032] Among them, the activity window component Activity is a component responsible for interacting with the user, which provides a screen (which can be understood as a screen interface, not a physical display screen) for users to interact and complete a task. In an Android application software, an Activity is usually a separate screen, on which some view controls can be displayed and it can also listen to and process user events to respond. The entire life cycle of Activity is a process from creation, running, stopping to destruction. It can convert the running state of Activity by calling the creation function onCreate(), the start function onStart(), the interaction function onResume(), the pause function onPause(), the stop function onStop() and the destruction function onDestory(). The creation function onCreate() is a function called when an Activity is first created. It is the first function called in the life cycle of the Activity, so the first call start time of calling the creation function of the activity window component can be used as the start time of the page loading of the activity window component.

[0033] Specifically, when the corresponding active window component is created by calling the creation function, the present embodiment can use the current time when the creation function is started to be called as the first start calling time of calling the creation function, and record the first start calling time, so as to obtain the start time of the page loading of the active window component. Exemplarily, Figure 2 An example of a method for determining the page loading time is given. Figure 2 As shown, a recording point can be set at the starting position of the creation function onCreate() call to record the start time of the first call.

[0034] S120. During the calling process of the creation function, the view is drawn according to the preset page layout, and the first call end time corresponding to the drawing distribution function of the outermost preset parent view is obtained, wherein the preset page layout is a preset parent view nested in the outermost layer of the original page layout.

[0035] Among them, the original page layout may refer to the original view layout file of the active window component, so that the view can be drawn based on the view layout file to obtain the page displayed on the screen. The preset parent view may refer to a pre-set parent view nested in the outermost layer of the original page layout. At this time, all views in the original page layout are subviews of the preset parent view. The layout area of ​​the preset parent view is the area of ​​the entire screen, so that all views are drawn within the area of ​​the preset parent view, so that the end time of page drawing can be accurately monitored based on the preset parent view. The drawing distribution function dispatcherDraw may refer to a function used to distribute to child view controls for drawing.

[0036] Specifically, after calling the creation function, initialization operations can be performed in the creation function. For example, the preset page layout can be set to the active window component by calling the layout setting function setContentView, so that the view can be drawn according to the preset page layout to obtain the page displayed on the screen, that is, the page loading process is completed. In the view drawing process, the outermost preset parent view is drawn first, and then the drawing distribution function in the preset parent view is called to distribute the drawing subviews, thereby realizing layer-by-layer drawing. When the drawing distribution function call of the preset parent view ends, it indicates that the page drawing is completed, so that the first call end time corresponding to the call of the preset parent view's drawing distribution function can be used as the end time of the page drawing, that is, the end time of the page loading. Figure 2 As shown, a recording point can be set at the end position of the call of the drawing dispatching function dispatcherDraw of the preset parent view to record the end time of the first call corresponding to the end of the first drawing of the page.

[0037] Exemplarily, "drawing views according to a preset page layout" in S120 may include: drawing the outermost preset parent view in the preset page layout by calling a drawing function, wherein the preset parent view is an empty view; after the drawing of the preset parent view is completed, drawing each child view layer by layer by calling a drawing distribution function of the preset parent view; when the drawing of the innermost child view in the preset page layout is completed, returning to the outermost preset parent view layer by layer, and taking the current time as the first call end time corresponding to the drawing distribution function of the preset parent view.

[0038] The drawing function may refer to but is not limited to the draw function and the onDraw function. Specifically, Figure 3 An example of drawing a view with a preset parent view is given. Figure 3As shown, the outermost preset parent view is drawn first, that is, the draw function is called first, then the onDraw function is called, and finally the drawing distribution function dispatcherDraw is called, and the drawing process of each subview is executed layer by layer in dispatcherDraw. The layer-by-layer transmission process is passed to the subview through the view's own dispatcherDraw function. If the current view has subviews, the drawing function of the subview can be called by calling the dispatcherDraw function; if the current view does not have subviews, it means that the innermost subview has been drawn. At this time, it can return to the outermost preset parent layout layer by layer, so that the current time when returning to the outermost preset parent layout can be used as the end time of the first call of the preset parent view's drawing distribution function. Therefore, the time when all views are drawn can be accurately obtained, that is, the end time of page loading.

[0039] It should be noted that the preset parent view in this embodiment can be an empty view, so that the drawing time of the preset parent view can be ignored, thereby reducing the impact of drawing the preset parent view on the loading time.

[0040] S130: Determine the difference between the first call start time and the first call end time as the page loading duration of the active window component.

[0041] Specifically, the difference obtained by subtracting the first call start time from the first call end time can be used as the page loading time of the active window component, that is, the interface startup time. The more accurate page loading time obtained is provided to developers to further optimize the application software to further reduce the page loading time, thereby reducing the user's waiting time and improving the user experience.

[0042] The technical solution of this embodiment obtains a preset page layout by pre-nesting a layer of preset parent view in the outermost layer of the original page layout of the active window component. Therefore, when drawing the view of the page according to the preset page layout, the end time of the first drawing of the page can be obtained by monitoring the end time of the first call of the drawing distribution function of the preset parent view, that is, the actual end time of page loading. Therefore, based on the view drawing mechanism, a more accurate end time of page loading can be obtained, thereby improving the accuracy of page loading duration calculation.

[0043] Based on the above technical solution, the method may also include: when drawing a view according to a preset page layout, obtaining the second call start time corresponding to calling the drawing distribution function of the outermost preset parent view; determining the difference between the second call start time and the first call end time as the page drawing duration for the first drawing.

[0044] Specifically, when drawing the page for the first time for the active window component that is created for the first time, a recording point can be set at the starting position of the drawing distribution function call of the preset parent view to record the start time of the second call corresponding to the drawing distribution function of the outermost preset parent view. Since the preset parent view is an additional layer of view nested on the basis of the original page layout, the start time of drawing the actual page refers to the start time of calling the drawing distribution function of the preset parent view, that is, the start time of drawing the original page layout. By recording the start time of the second call and the end time of the first call corresponding to the call of the drawing distribution function of the outermost preset parent view, the page drawing duration used for the first drawing of the page can be determined, that is, the difference obtained by subtracting the start time of the second call from the end time of the first call is used as the page drawing duration for the first drawing. Determining the page drawing duration for the first drawing can help developers further analyze the running performance of the application for optimization.

[0045] Based on the above technical solution, the method may also include: when a page redrawing trigger instruction is detected, redrawing the view according to the preset page layout, and obtaining the third call start time and the second call end time corresponding to the drawing distribution function of calling the outermost preset parent view in the redrawing of the view; the difference between the third call start time and the second call end time is determined as the redrawing page drawing duration.

[0046] The page redrawing trigger instruction may refer to a trigger instruction for redrawing a page generated when a page changes. The page change may be caused by a user operation or a dynamic change of the page itself.

[0047] Specifically, when a page changes, a page redrawing trigger instruction is generated, and when the system detects the page redrawing trigger instruction, the drawing function is called to redraw the view of the preset page layout that needs to be drawn at this time, so as to refresh the page. By recording the start time of the third call and the end time of the second call corresponding to the drawing distribution function of the outermost preset parent view called in the redrawing, the page drawing time used for each page drawing can be accurately determined, thereby obtaining the single-frame page drawing time, which is more helpful for developers to analyze the performance of application software during operation and improve the optimization effect.

[0048] Embodiment 2

[0049] Figure 4A flowchart of a method for determining page loading duration provided in the second embodiment of the present invention. Based on the above embodiment, this embodiment uses a first time variable and a second time variable to respectively store the call start time and the call end time corresponding to the call of the drawing distribution function of the outermost preset parent view each time drawing, and determines the page loading time of the active window component and the page loading duration of each drawing based on the first time variable and the second time variable. The explanations of the terms that are the same or corresponding to the above embodiment are not repeated here.

[0050] See also Figure 4 The method for determining the page loading time provided in this embodiment specifically includes the following steps:

[0051] S210: Obtain a first call start time corresponding to calling a creation function of an active window component.

[0052] S220. During the process of calling the creation function, the view is drawn according to the preset page layout, and the first time variable and the second time variable are used to respectively store the call start time and the call end time corresponding to the call of the drawing distribution function of the outermost preset parent view each time the drawing is performed.

[0053] The first time variable may refer to a pre-set variable for storing the call start time corresponding to calling the drawing distribution function of the outermost preset parent view. The second time variable may refer to a pre-set variable for storing the call end time corresponding to calling the drawing distribution function of the outermost preset parent view.

[0054] Specifically, a first time variable is set at the start position of the call of the drawing distribution function of the outermost preset parent view to store the obtained call start time, and a second time variable is set at the end position of the call of the drawing distribution function of the outermost preset parent view to store the obtained call end time, so that only the start time and end time of the page drawing during a single drawing need to be recorded, and there is no need to record the start time and end time of all drawings, thereby saving storage space and improving operating efficiency.

[0055] S230, determining whether it is the first drawing according to the current drawing identifier, if so, proceeding to step S240, otherwise proceeding to step S250.

[0056] The current drawing identifier may refer to an identifier used to represent the current drawing times. The drawing identifier may refer to, but is not limited to, numbers, letters, and symbols. Exemplarily, the first preset identifier may be used to represent the identifier of the first drawing. Exemplarily, the drawing identifier may be set to a Boolean variable, and the first preset identifier may be set to "False".

[0057] Specifically, by detecting whether the current drawing mark is the first preset mark, the current drawing times can be determined so that the page loading time can be accurately calculated. For example, detecting whether the current drawing mark is the first preset mark, if so, it is determined to be the first drawing, if not, it is determined to be a non-first drawing.

[0058] S240. Determine the difference between the currently stored second time variable and the first call start time as the page loading duration of the active window component, and proceed to step S250.

[0059] Specifically, at the time of the first drawing, it indicates that the time stored in the current second time variable is the end time of the page loading when the first drawing ends. At this time, the difference obtained by subtracting the first call start time from the second time variable can be determined as the page loading duration. After determining the page loading duration, the operation of step S250 is performed so that the page drawing duration at the time of the first drawing can be determined.

[0060] Exemplarily, after determining the difference between the currently stored second time variable and the first call start time as the page loading duration of the active window component, the method further includes: switching the current drawing identifier from the first preset identifier to the second preset identifier.

[0061] The second preset flag may be a flag used to indicate that the drawing is not the first drawing. For example, when the first preset flag is "False", the second preset flag is set to "True".

[0062] Specifically, since the page can be redrawn in the created active window component, the active window component will not be recreated, so there is no need to calculate the page loading time corresponding to the page redrawing. After determining the page loading time, the current drawing identifier is updated to the second preset identifier, which can avoid recalculating the page loading time.

[0063] S250: Determine the difference between the first time variable and the second time variable stored during each drawing as the page drawing duration of each drawing.

[0064] Specifically, after each drawing is completed, the second time variable stored in the drawing can be subtracted from the first time variable, so that the page drawing duration of each drawing can be obtained conveniently.

[0065] The technical solution of this embodiment uses the first time variable and the second time variable to respectively store the call start time and the call end time corresponding to the drawing distribution function of the outermost preset parent view when drawing each time. Therefore, it is only necessary to record the start time and the end time of the page drawing during a single drawing, without having to record the start time and the end time of all the drawings, thereby saving storage space, and more conveniently calculating the page loading time and the page drawing time for each drawing, thereby improving operating efficiency.

[0066] On the basis of the above technical solution, before S210, it can also include: obtaining the compiled active window component file; parsing the active window component file to obtain each function information and the original page layout in the active window component file; traversing each function information, and when the creation function of the active window component is detected, inserting a first preset code at the call start position of the creation function to obtain the first call start time corresponding to the call of the creation function of the active window component through the first preset code; nesting a layer of preset parent view for the outermost layer of the original page layout, and inserting a second preset code at the call end position of the drawing distribution function of the preset parent view to obtain the first call end time corresponding to the call of the drawing distribution function of the preset parent view through the second preset code.

[0067] Each active window component in the application software corresponds to an active window component file. The active window component file may refer to a compiled class file. The first preset code may refer to a code for obtaining the first call start time corresponding to the creation function of the active window component. The second preset code may refer to a code for obtaining the first call end time corresponding to the drawing distribution function of the preset parent view.

[0068] Specifically, this embodiment can use ASM technology in the compilation stage of the code through the project automation construction tool Gradle to dynamically modify the bytecode of the active window component file. Among them, ASM is a Java bytecode-level processing framework, which can directly add, delete, and modify class files. ASM can directly generate binary class files, and can also dynamically change class behavior before the class is loaded into the Java virtual machine. After reading information from the class file, ASM can change class behavior, analyze class information, and even generate new classes according to user requirements. This embodiment can automatically and uniformly modify all active window component files in the application software by utilizing ASM technology, avoiding manual addition and modification and improving processing efficiency.

[0069] The following is an embodiment of a device for determining a page loading time provided in an embodiment of the present invention. The device and the method for determining a page loading time in the above-mentioned embodiments belong to the same inventive concept. For details not described in detail in the embodiment of the device for determining a page loading time, reference can be made to the embodiment of the method for determining a page loading time in the above-mentioned embodiments.

[0070] Embodiment 3

[0071] Figure 5 This is a structural diagram of a device for determining page loading duration provided in Example 3 of the present invention. This embodiment can be applied to determining the page loading duration of an active window component Activity in Android application software. The device specifically includes: a first call start time acquisition module 310, a first call end time acquisition module 320 and a page loading duration determination module 330.

[0072] Among them, the first call start time acquisition module 310 is used to obtain the first call start time corresponding to the call of the creation function of the active window component; the first call end time acquisition module 320 is used to draw the view according to the preset page layout during the call of the creation function, and obtain the first call end time corresponding to the drawing distribution function of the outermost preset parent view, wherein the preset page layout is a preset parent view nested in the outermost layer of the original page layout; the page loading duration determination module 330 is used to determine the difference between the first call start time and the first call end time as the page loading duration of the active window component.

[0073] Optionally, the device further comprises:

[0074] The first page drawing duration determination module is used to obtain the second call start time corresponding to the drawing distribution function of the outermost preset parent view when drawing the view according to the preset page layout; and determine the difference between the second call start time and the first call end time as the page drawing duration for the first drawing.

[0075] Optionally, the device further comprises:

[0076] The second page drawing duration determination module is used to redraw the view according to the preset page layout when a page redrawing trigger instruction is detected, and obtain the third call start time and the second call end time corresponding to the drawing distribution function of the outermost preset parent view called in the redrawing of the view; the difference between the third call start time and the second call end time is determined as the redrawing page drawing duration.

[0077] Optionally, the first call end time acquisition module 320 is specifically used to: use the first time variable and the second time variable to respectively store the call start time and the call end time corresponding to calling the drawing distribution function of the outermost preset parent view during each drawing;

[0078] Correspondingly, the page loading duration determination module 330 is specifically used to: when it is determined as the first drawing according to the current drawing identifier, determine the difference between the currently stored second time variable and the start time of the first call as the page loading duration of the active window component; determine the difference between the first time variable stored in each drawing and the second time variable as the page drawing duration of each drawing.

[0079] Optionally, the device further comprises:

[0080] A drawing identifier switching module is used to switch the current drawing identifier from a first preset identifier to a second preset identifier after determining the difference between the currently stored second time variable and the first call start time as the page loading duration of the active window component, wherein the first preset identifier is an identifier used to represent the first drawing.

[0081] Optionally, the first call end time acquisition module 320 is further specifically configured to:

[0082] By calling the drawing function, the outermost preset parent view in the preset page layout is drawn, where the preset parent view is an empty view; after the drawing of the preset parent view is completed, each child view is drawn layer by layer by calling the drawing distribution function of the preset parent view; when the drawing of the innermost child view in the preset page layout is completed, return to the outermost preset parent view layer by layer, and use the current time as the first call end time corresponding to the drawing distribution function of the preset parent view.

[0083] Optionally, the device further comprises:

[0084] An activity window component file acquisition module, used for acquiring a compiled activity window component file before acquiring a first call start time corresponding to a creation function of calling the activity window component;

[0085] An activity window component file parsing module is used to parse the activity window component file to obtain each function information and original page layout in the activity window component file;

[0086] A first preset code insertion module is used to traverse each function information, and when a creation function of an active window component is detected, insert a first preset code at the call start position of the creation function, so as to obtain a first call start time corresponding to calling the creation function of the active window component through the first preset code;

[0087] The second preset code insertion module is used to nest a layer of preset parent view in the outermost layer of the original page layout, and insert the second preset code at the end position of the call of the drawing distribution function of the preset parent view, so as to obtain the first call end time corresponding to the call of the drawing distribution function of the preset parent view through the second preset code.

[0088] The device for determining the page loading time provided in the embodiment of the present invention can execute the method for determining the page loading time provided in any embodiment of the present invention, and has the corresponding functional modules and beneficial effects for executing the method for determining the page loading time.

[0089] Embodiment 4

[0090] Figure 6 A schematic diagram of the structure of a device provided in Embodiment 4 of the present invention. Figure 6 A block diagram of an exemplary device 12 suitable for use in implementing embodiments of the present invention is shown. Figure 6 The device 12 shown is only an example and should not bring any limitation to the functions and scope of use of the embodiments of the present invention.

[0091] like Figure 6 As shown, device 12 is in the form of a general purpose computing device. Components of device 12 may include, but are not limited to, one or more processors or processing units 16, system memory 28, and bus 18 that connects various system components (including system memory 28 and processing unit 16).

[0092] Bus 18 represents one or more of several types of bus structures, including a memory bus or memory controller, a peripheral bus, an accelerated graphics port, a processor or a local bus using any of a variety of bus architectures. By way of example, these architectures include, but are not limited to, an Industry Standard Architecture (ISA) bus, a Micro Channel Architecture (MAC) bus, an Enhanced ISA bus, a Video Electronics Standards Association (VESA) local bus, and a Peripheral Component Interconnect (PCI) bus.

[0093] Device 12 typically includes a variety of computer system readable media. These media can be any available media that can be accessed by device 12, including volatile and non-volatile media, removable and non-removable media.

[0094] System memory 28 may include computer system readable media in the form of volatile memory, such as random access memory (RAM) 30 and / or cache memory 32. Device 12 may further include other removable / non-removable, volatile / non-volatile computer system storage media. By way of example only, storage system 34 may be used to read and write non-removable, non-volatile magnetic media ( Figure 6not shown, usually called a "hard drive"). Although Figure 6 Not shown in the figure, a disk drive for reading and writing to a removable non-volatile disk (e.g., a "floppy disk"), and an optical disk drive for reading and writing to a removable non-volatile optical disk (e.g., a CD-ROM, a DVD-ROM, or other optical media) may be provided. In these cases, each drive may be connected to the bus 18 via one or more data medium interfaces. The system memory 28 may include at least one program product having a set (e.g., at least one) of program modules that are configured to perform the functions of the various embodiments of the present invention.

[0095] A program / utility 40 having a set (at least one) of program modules 42 may be stored, for example, in system memory 28, such program modules 42 including, but not limited to, an operating system, one or more application programs, other program modules, and program data, each of which or some combination may include an implementation of a network environment. Program modules 42 generally perform the functions and / or methods of the embodiments described herein.

[0096] The device 12 may also communicate with one or more external devices 14 (e.g., keyboards, pointing devices, displays 24, etc.), may communicate with one or more devices that enable a user to interact with the device 12, and / or may communicate with any device that enables the device 12 to communicate with one or more other computing devices (e.g., network cards, modems, etc.). Such communication may be performed via an input / output (I / O) interface 22. Furthermore, the device 12 may also communicate with one or more networks (e.g., local area networks (LANs), wide area networks (WANs), and / or public networks, such as the Internet) via a network adapter 20. As shown, the network adapter 20 communicates with other modules of the device 12 via a bus 18. It should be understood that, although not shown in the figure, other hardware and / or software modules may be used in conjunction with the device 12, including, but not limited to, microcode, device drivers, redundant processing units, external disk drive arrays, RAID systems, tape drives, and data backup storage systems.

[0097] The processing unit 16 executes various functional applications and data processing by running the program stored in the system memory 28, for example, implementing a method for determining a page loading time provided in an embodiment of the present invention, the method comprising:

[0098] Get the first call start time corresponding to calling the creation function of the active window component;

[0099] During the calling process of the creation function, the view is drawn according to the preset page layout, and the first call end time corresponding to the drawing distribution function of the outermost preset parent view is obtained, wherein the preset page layout is a preset parent view nested in the outermost layer of the original page layout;

[0100] The difference between the first call start time and the first call end time is determined as the page loading duration of the active window component.

[0101] Of course, those skilled in the art can understand that the processor can also implement the technical solution of the method for determining the page loading time provided by any embodiment of the present invention.

[0102] Embodiment 5

[0103] The fifth embodiment provides a computer-readable storage medium on which a computer program is stored. When the program is executed by a processor, the method steps for determining the page loading time length provided in any embodiment of the present invention are implemented. The method includes:

[0104] Get the first call start time corresponding to calling the creation function of the active window component;

[0105] During the calling process of the creation function, the view is drawn according to the preset page layout, and the first call end time corresponding to the drawing distribution function of the outermost preset parent view is obtained, wherein the preset page layout is a preset parent view nested in the outermost layer of the original page layout;

[0106] The difference between the first call start time and the first call end time is determined as the page loading duration of the active window component.

[0107] The computer storage medium of the embodiment of the present invention can adopt any combination of one or more computer-readable media. The computer-readable medium can be a computer-readable signal medium or a computer-readable storage medium. The computer-readable storage medium can 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 (non-exhaustive list) of computer-readable storage media include: 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 this document, a computer-readable storage medium can be any tangible medium containing or storing a program, which can be used by an instruction execution system, device or device or used in combination with it.

[0108] Computer-readable signal media may include data signals propagated in baseband or as part of a carrier wave, which carry computer-readable program code. Such propagated data signals may take a variety of forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination of the above. Computer-readable signal media 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.

[0109] The program code embodied on the computer readable medium may be transmitted using any appropriate medium, including but not limited to wireless, wireline, optical fiber cable, RF, etc., or any suitable combination of the foregoing.

[0110] Computer program code for performing the operations of the present invention may be written in one or more programming languages ​​or a combination thereof, including 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 the case of 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., via the Internet using an Internet service provider).

[0111] It should be understood by those skilled in the art that the modules or steps of the present invention described above can be implemented by a general-purpose computing device, they can be concentrated on a single computing device, or distributed on a network composed of multiple computing devices, optionally, they can be implemented by a program code executable by a computer device, so that they can be stored in a storage device and executed by the computing device, or they can be made into individual integrated circuit modules, or multiple modules or steps therein can be made into a single integrated circuit module for implementation. Thus, the present invention is not limited to any specific combination of hardware and software.

[0112] Note that the above are only preferred embodiments of the present invention and the technical principles used. Those skilled in the art will understand that the present invention is not limited to the specific embodiments described herein, and that various obvious changes, readjustments and substitutions can be made by those skilled in the art without departing from the scope of protection of the present invention. Therefore, although the present invention has been described in more detail through the above embodiments, the present invention is not limited to the above embodiments, and may include more other equivalent embodiments without departing from the concept of the present invention, and the scope of the present invention is determined by the scope of the appended claims.

Claims

1. A method for determining page loading time, characterized in that: include: Get the first call start time corresponding to calling the creation function of the active window component; During the calling process of the creation function, the view is drawn according to the preset page layout, and the first calling end time corresponding to the drawing distribution function of the outermost preset parent view is obtained, wherein the preset page layout is a layer of the preset parent view nested in the outermost layer of the original page layout; Determine the difference between the first call start time and the first call end time as the page loading duration of the active window component; Before obtaining the first call start time corresponding to calling the creation function of the active window component, the method further includes: Get the compiled active window component file; Parsing the active window component file to obtain each function information and original page layout in the active window component file; Traversing each function information, when detecting a creation function of an active window component, inserting a first preset code at a call start position of the creation function, so as to obtain a first call start time corresponding to calling the creation function of the active window component through the first preset code; A preset parent view is nested in the outermost layer of the original page layout, and a second preset code is inserted at the end position of the call of the drawing distribution function of the preset parent view, so as to obtain the first call end time corresponding to calling the drawing distribution function of the preset parent view through the second preset code.

2. The method according to claim 1, characterized in that Also includes: When drawing the view according to the preset page layout, obtaining a second call start time corresponding to calling the drawing distribution function of the outermost preset parent view; The difference between the start time of the second call and the end time of the first call is determined as the page drawing duration of the first drawing.

3. The method according to claim 1, characterized in that Also includes: When a page redrawing trigger instruction is detected, the view is redrawn according to the preset page layout, and the third call start time and the second call end time corresponding to the drawing distribution function of the outermost preset parent view are obtained in the redrawing of the view; The difference between the start time of the third call and the end time of the second call is determined as the redrawing page drawing duration.

4. The method according to claim 1, characterized in that: Obtain the first call end time corresponding to calling the drawing distribution function of the outermost preset parent view, including: Using the first time variable and the second time variable to respectively store the call start time and the call end time corresponding to calling the drawing distribution function of the outermost preset parent view during each drawing; Accordingly, determining the difference between the first call start time and the call end time as the page loading duration of the active window component includes: When it is determined that the drawing is the first time according to the current drawing identifier, the difference between the currently stored second time variable and the first call start time is determined as the page loading duration of the active window component; The difference between the first time variable and the second time variable stored during each drawing is determined as the page drawing duration of each drawing.

5. The method according to claim 4, characterized in that After determining the difference between the currently stored second time variable and the first call start time as the page loading duration of the active window component, the method further includes: The current drawing mark is switched from a first preset mark to a second preset mark, wherein the first preset mark is a mark used to represent the first drawing.

6. The method according to claim 1, characterized in that Draw views based on preset page layouts, including: By calling a drawing function, drawing the outermost preset parent view in the preset page layout, wherein the preset parent view is an empty view; After the preset parent view is drawn, each subview is drawn layer by layer by calling the drawing distribution function of the preset parent view; When the innermost subview in the preset page layout is drawn, the outermost preset parent view is returned layer by layer, and the current time is used as the first call end time corresponding to the drawing distribution function of the preset parent view.

7. A device for determining page loading time, characterized in that: include: A first call start time acquisition module, used to acquire the first call start time corresponding to calling the creation function of the active window component; A first call end time acquisition module is used to perform view drawing according to a preset page layout during the calling process of the creation function, and obtain a first call end time corresponding to calling a drawing distribution function of an outermost preset parent view, wherein the preset page layout is a preset parent view nested in the outermost layer of the original page layout; a page loading duration determining module, configured to determine a difference between the first call start time and the first call end time as the page loading duration of the active window component; The device also includes: An activity window component file acquisition module, used for acquiring a compiled activity window component file before acquiring a first call start time corresponding to a creation function of calling the activity window component; An active window component file parsing module, used for parsing the active window component file to obtain each function information and original page layout in the active window component file; a first preset code insertion module, configured to traverse the various function information, and when detecting a creation function of an active window component, insert a first preset code at a call start position of the creation function, so as to obtain a first call start time corresponding to calling the creation function of the active window component through the first preset code; The second preset code insertion module is used to nest a layer of preset parent view in the outermost layer of the original page layout, and insert the second preset code at the call end position of the drawing distribution function of the preset parent view, so as to obtain the first call end time corresponding to calling the drawing distribution function of the preset parent view through the second preset code.

8. A device, characterized in that The device comprises: one or more processors; A memory for storing one or more programs; When the one or more programs are executed by the one or more processors, the one or more processors implement the method for determining the page loading duration as described in any one of claims 1-6.

9. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the program is executed by a processor, the method for determining the page loading time as described in any one of claims 1 to 6 is implemented.