CN112506592A - Method, device, equipment and storage medium for determining page loading duration - Google Patents

Method, device, equipment and storage medium for determining page loading duration Download PDF

Info

Publication number
CN112506592A
CN112506592A CN201910872751.5A CN201910872751A CN112506592A CN 112506592 A CN112506592 A CN 112506592A CN 201910872751 A CN201910872751 A CN 201910872751A CN 112506592 A CN112506592 A CN 112506592A
Authority
CN
China
Prior art keywords
calling
preset
time
page
view
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN201910872751.5A
Other languages
Chinese (zh)
Inventor
韩雨
李海峰
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Beijing Jingdong Century Trading Co Ltd
Beijing Jingdong Shangke Information Technology Co Ltd
Original Assignee
Beijing Jingdong Century Trading Co Ltd
Beijing Jingdong Shangke Information Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Beijing Jingdong Century Trading Co Ltd, Beijing Jingdong Shangke Information Technology Co Ltd filed Critical Beijing Jingdong Century Trading Co Ltd
Priority to CN201910872751.5A priority Critical patent/CN112506592A/en
Publication of CN112506592A publication Critical patent/CN112506592A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/44Arrangements for executing specific programs
    • G06F9/451Execution arrangements for user interfaces

Abstract

The embodiment of the invention discloses a method, a device, equipment and a storage medium for determining page loading duration, wherein the method comprises the following steps: acquiring a first calling starting moment corresponding to a creating function for calling the movable window component; in the calling process of the creating function, drawing views according to a preset page layout, and obtaining a first calling end time corresponding to a drawing distribution function calling an outermost preset parent view, wherein the preset page layout is formed by nesting a layer of preset parent views in the outermost layer of an original page layout; and determining the difference between the first calling starting time and the first calling ending time as the page loading time of the active window component. By the technical scheme of the embodiment of the invention, the accuracy of calculating the page loading duration can be improved.

Description

Method, device, equipment and storage medium for determining page loading duration
Technical Field
The embodiment of the invention relates to a software development technology, in particular to a method, a device, equipment and a storage medium for determining page loading duration.
Background
With the rapid development of the mobile internet, more and more application software is developed to meet the increasing demand of people. The user experience is often required to be considered when developing the application software so as to improve the popularity of the application software. For example, the page loading duration in the application software needs to be as short as possible, so that the user experience is prevented from being reduced due to the overlong waiting time, and therefore the page loading duration needs to be calculated in real time, so that a developer can optimize the application software based on the page loading duration.
At present, in an Android system, a page loading duration is generally determined based on a lifecycle of an Activity window component corresponding to a page, and the specific determination process is as follows: each life cycle function corresponding to the active window component can represent the running state of the current page, so that the calling starting time of the creating function onCreate called when the Activity is created for the first time can be taken as the starting time of page loading, and the calling starting time of the calling interaction function onResume can be taken as the ending time of page loading, and therefore the difference value between the starting time and the ending time of page loading can be taken as the page loading time length.
However, in the process of implementing the present invention, the inventor finds that at least the following problems exist in the prior art:
since the interaction function onResume is called before the Activity is about to start interacting with the user, that is, the page has been loaded and ended before the interaction function onResume is called, the calling start time of the interaction function onResume is taken as the page loading end time, which is later than the actual page loading end time, and the accuracy of calculating the page loading time length is reduced.
Disclosure of Invention
The embodiment of the invention provides a method, a device, equipment and a storage medium for determining page loading duration, which are used for improving the accuracy of page loading duration calculation.
In a first aspect, an embodiment of the present invention provides a method for determining a page loading duration, including:
acquiring a first calling starting moment corresponding to a creating function for calling the movable window component;
in the calling process of the creating function, drawing a view according to a preset page layout, and obtaining a first calling end time corresponding to a drawing distribution function calling an outermost preset parent view, wherein the preset page layout is formed by nesting a layer of the preset parent view in the outermost layer of an original page layout;
and determining the difference between the first calling starting time and the first calling ending time as the page loading duration of the active window component.
In a second aspect, an embodiment of the present invention further provides a device for determining a page loading duration, where the device includes:
the first calling starting time acquisition module is used for acquiring a first calling starting time corresponding to a creating function for calling the movable window component;
a first call end time obtaining module, configured to perform view drawing according to a preset page layout in a call process of the creation function, and obtain a first call end time corresponding to a drawing distribution function that calls an outermost preset parent view, where the preset page layout is obtained by nesting a layer of the preset parent view in an outermost layer of an original page layout;
and the page loading duration determining module is used for determining the difference value between the first calling starting time and the first calling ending time as the page loading duration of the active window component.
In a third aspect, an embodiment of the present invention further provides an apparatus, where the apparatus includes:
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 page loading duration according to any embodiment of the present invention.
In a fourth aspect, an embodiment of the present invention further provides a computer-readable storage medium, on which a computer program is stored, where the computer program is executed by a processor to implement the method for determining a page loading duration according to any embodiment of the present invention.
The embodiment of the invention has the following advantages or beneficial effects:
the preset page layout is obtained by nesting a layer of preset parent view in the outermost layer of the original page layout of the active window assembly in advance, so that when the view drawing of the page is carried out according to the preset page layout, the finishing time of the first drawing completion of the page, namely the actual page loading finishing time, can be obtained by monitoring the first calling finishing time of the drawing distribution function of the preset parent view, and therefore more accurate page loading finishing time can be obtained based on a view drawing mechanism, and the accuracy of page loading time calculation is improved.
Drawings
Fig. 1 is a flowchart of a method for determining a page loading duration according to an embodiment of the present invention;
fig. 2 is an example of a method for determining a page loading duration according to an embodiment of the present invention;
FIG. 3 is a pictorial illustration of a default parent view according to an embodiment of the present invention;
fig. 4 is a flowchart of a method for determining a page loading duration according to a second embodiment of the present invention;
fig. 5 is a schematic structural diagram of a device for determining page loading duration according to a third embodiment of the present invention;
fig. 6 is a schematic structural diagram of an apparatus according to a fourth embodiment of the present invention.
Detailed Description
The present invention will be described in further detail with reference to the accompanying drawings and examples. It is to be understood that the specific embodiments described herein are merely illustrative of the invention and are not limiting of the invention. It should be further noted that, for the convenience of description, only some of the structures related to the present invention are shown in the drawings, not all of the structures.
Example one
Fig. 1 is a flowchart of a method for determining page loading duration according to an embodiment of the present invention, which is applicable to a case of determining page loading duration of Activity of an active window component in Android application software. The method can be executed by a page loading duration determining device, which can be implemented in a software and/or hardware manner and integrated in a device installed with Android application software, for example, a typical user terminal device is a mobile phone, a tablet computer, or a smart television. Referring to fig. 1, the method specifically includes the following steps:
s110, obtaining a first calling starting time corresponding to a creating function for calling the active window component.
The active window component Activity is a component responsible for interaction with a user, and provides a screen (which can be understood as a screen interface, rather than a display screen of an entity) for the user to interact with and complete a task. In an Android application, an Activity is usually a separate screen on which some view controls can be displayed and events of a user can be monitored and processed to respond. The entire lifecycle of Activity is the process from creation, running, stop to destruction, which may transform the running state of Activity by calling the create function onCreate (), the start function onStart (), the interact function onResume (), the pause function onPause (), the stop function onStop () and the destroy function onhistory (). The create function onCreate () is a function called when a certain Activity is first created, which is a function called first in the life cycle of the Activity, so that the first call start time of calling the create function of an active window component can be taken as the start time of the page load of the active window component.
Specifically, in the embodiment, when the corresponding active window component is created by calling the creating function, the current time at which the creating function is started to be called is taken as the first call starting time at which the creating function is called, and the first call starting time is recorded, so that the start time of page loading of the active window component can be obtained. Exemplarily, fig. 2 shows an example of a method for determining a page load duration. As shown in fig. 2, a recording point may be set at the start position of the create function onCreate () call to record the first call start time.
And S120, in the calling process of the creating function, drawing the view according to a preset page layout, and obtaining a first calling end time corresponding to a drawing distribution function calling an outermost preset parent view, wherein the preset page layout is formed by nesting a layer of preset parent views in the outermost layer of the original page layout.
The original page layout may refer to an original view layout file of the active window component, so that view drawing may be performed based on the view layout file to obtain a page displayed on a screen. The preset parent view may be a preset parent view nested in an outermost layer of the original page layout, and at this time, the views in the original page layout are all used as child views of the preset parent view. The layout area of the preset parent view is the area of the whole screen, so that all views are drawn in the area of the preset parent view, and the end time of page drawing can be accurately monitored based on the preset parent view. The draw distribution function dispatchdraw may refer to a function for distributing to a child view control for drawing.
Specifically, after the creation function is called, an initialization operation may be performed in the creation function, for example, a preset page layout may be set to the active window component by calling a layout setting function setContentView, so as to perform view drawing according to the preset page layout, obtain a page displayed in the screen, and complete a page loading process. In the process of drawing the view, firstly drawing a preset parent view on the outermost layer, and then distributing and drawing the child view by calling a drawing distribution function in the preset parent view, thereby realizing the drawing layer by layer. When the drawing distribution function calling of the preset parent view is finished, the page drawing is finished, so that the first calling end time corresponding to the drawing distribution function calling the preset parent view can be used as the page drawing end time, namely the page loading end time. As shown in fig. 2, a recording point may be set at an end position of the drawing distribution function dispatchdraw call of the preset parent view to record a first call end time corresponding to when the page is drawn for the first time.
For example, the "view drawing according to the preset page layout" in S120 may include: drawing an outermost preset parent view in a preset page layout by calling a drawing function, wherein the preset parent view is an empty view; after the preset parent view is drawn, drawing each child view layer by calling a drawing distribution function of the preset parent view; and when the drawing of the child view at the innermost layer in the preset page layout is finished, returning to the preset parent view at the outermost layer by layer, and taking the current moment as the first calling ending moment corresponding to the drawing distribution function of the preset parent view.
Wherein, the drawing function may refer to, but is not limited to, a draw function and an onDraw function. Specifically, fig. 3 shows a view drawing example of a preset parent view. As shown in fig. 3, the preset parent view of the outermost layer is drawn first, that is, the draw function is called first, then the onDraw function is called, finally the drawing distribution function dispatchdraw is called, and the drawing process of each child view is executed layer by layer in the dispatchdraw. The process of layer-by-layer transfer is transferred to the child view by the dispatcterdraw function of the view itself. If the sub-view exists in the current view, the drawing function of the sub-view can be called by calling a dispatchDraw function; if the current view does not have the child view, the drawing of the child view at the innermost layer is finished, and at the moment, the child view at the outermost layer can be returned to the preset parent layout at the outermost layer by layer, so that the current moment of the preset parent layout returned to the outermost layer can be used as the first calling ending moment of the drawing distribution function of the preset parent view, and the moment when all the views are drawn, namely the page loading ending moment can be accurately obtained.
It should be noted that the preset parent view in this embodiment may be an empty view, so that the drawing time for drawing the preset parent view may be ignored, and the influence of drawing the preset parent view on the loading time is reduced.
S130, determining the difference value between the first calling starting time and the first calling ending time as the page loading duration of the active window assembly.
Specifically, the difference obtained by subtracting the first call start time from the first call end time is used as the page loading time of the active window component, that is, the interface start time. The obtained more accurate page loading time is provided for developers to further optimize the application software, so that the page loading time is further reduced, the waiting time of a user can be reduced, and the user experience is improved.
According to the technical scheme of the embodiment, the preset page layout is obtained by nesting a layer of preset parent view in the outermost layer of the original page layout of the active window assembly in advance, so that when the view drawing of the page is performed according to the preset page layout, the end time of the first drawing completion of the page, namely the actual page loading end time, can be obtained by monitoring the first calling end time of the drawing distribution function of the preset parent view, and therefore the more accurate page loading end time can be obtained based on a view drawing mechanism, and the accuracy of calculating the page loading duration is improved.
On the basis of the above technical solution, the method may further include: when drawing the view according to the preset page layout, obtaining a second calling starting moment corresponding to a drawing distribution function calling the outermost preset parent view; and determining the difference between the second calling starting time and the first calling ending time as the page drawing time length drawn for the first time.
Specifically, when the first page drawing is performed on the first created active window component, a recording point may be set at a drawing distribution function call start position of the preset parent view to record a second call start time corresponding to the drawing distribution function of the outermost preset parent view. The preset parent view is a layer of view additionally nested on the basis of the original page layout, so that the drawing starting time of the actual page refers to the calling starting time of a drawing distribution function calling the preset parent view, namely the starting time of drawing the original page layout. By recording the second call starting time and the first call ending time corresponding to the drawing distribution function calling the outermost preset parent view, the page drawing time used when the page is drawn for the first time can be determined, namely, the difference value obtained by subtracting the second call starting time from the first call ending time is used as the page drawing time drawn for the first time. The method can help the developer to further analyze the running performance of the application by determining the drawing time of the first drawn page, and is convenient to optimize.
On the basis of the above technical solution, the method may further include: when a page redrawing trigger instruction is detected, redrawing the view according to the preset page layout, and obtaining a third calling starting time and a second calling ending time corresponding to a drawing distribution function calling the outermost preset parent view in the redrawing; and determining the difference between the third calling starting time and the second calling ending time as the redrawing page drawing time length.
The page redrawing trigger instruction may refer to a trigger instruction generated when a page changes and used for redrawing the page. The page change can be caused by user operation or dynamic change of the page itself.
Specifically, when the page changes, a page redrawing trigger instruction is generated, and when the system detects the page redrawing trigger instruction, a drawing function is called, and the preset page layout which needs to be drawn at this time is subjected to view drawing again, so that the page is refreshed. By recording the third calling starting time and the second calling ending time corresponding to the drawing distribution function calling the outermost preset parent view in the redrawing process, the page drawing time used for drawing the page once can be accurately determined, so that the single-frame page drawing time is obtained, a developer is more facilitated to analyze the performance of the application software in the operation process, and the optimization effect is improved.
Example two
Fig. 4 is a flowchart of a method for determining a page loading duration according to a second embodiment of the present invention, where on the basis of the second embodiment of the present invention, a first time variable and a second time variable are used to respectively store a call start time and a call end time corresponding to a rendering distribution function that calls an outermost preset parent view during each rendering, and a page loading time of an active window component and a page loading duration during each rendering are determined based on the first time variable and the second time variable. Wherein explanations of the same or corresponding terms as those of the above-described embodiments are omitted.
Referring to fig. 4, the method for determining page loading duration provided in this embodiment specifically includes the following steps:
s210, obtaining a first calling starting moment corresponding to a creating function for calling the movable window component.
And S220, in the calling process of the created function, drawing the view according to the preset page layout, and respectively storing the calling start time and the calling end time corresponding to the drawing distribution function of the preset parent view of the outermost layer by using the first time variable and the second time variable during each drawing.
The first time variable may be a preset variable used for storing a call start time corresponding to a drawing distribution function calling an outermost preset parent view. The second time variable may be a preset variable used for storing a call end time corresponding to a drawing distribution function calling the outermost preset parent view.
Specifically, the obtained calling start time is stored by setting a first time variable at the calling start position of the drawing distribution function calling the outermost preset parent view, and the obtained calling end time is stored by setting a second time variable at the calling end position of the drawing distribution function calling the outermost preset parent view, so that the page drawing start time and the page drawing end time during single drawing only need to be recorded, the drawing start time and the drawing end time of all the drawings do not need to be recorded, the storage space is saved, and the operation efficiency is improved.
And S230, determining whether the drawing is drawn for the first time according to the current drawing identifier, if so, entering the step S240, and otherwise, entering the step S250.
The current drawing identifier may refer to an identifier used for characterizing the current drawing times. Drawing identifiers may refer to, but are not limited to, numbers, letters, and symbols. Illustratively, the first drawn identifier may be characterized by a first preset identifier. Illustratively, the drawing flag may be set to a boolean variable, and the first preset flag may be set to "False".
Specifically, whether the current drawing identifier is the first preset identifier or not is detected, so that the current drawing frequency can be determined, and the page loading duration can be accurately calculated. For example, whether the current drawing identifier is a first preset identifier is detected, if so, the current drawing identifier is determined to be drawn for the first time, and if not, the current drawing identifier is determined to be not drawn for the first time.
S240, determining the difference value between the currently stored second time variable and the first calling starting moment as the page loading duration of the active window assembly, and entering the step S250.
Specifically, when drawing for the first time, it indicates that the time when the current second time variable is stored is the page loading end time when drawing for the first time is ended, and at this time, a difference obtained by subtracting the first call start time from the second time variable may be determined as the page loading duration. And performs the operation of step S250 after determining the page loading time period, so that the page drawing time period at the time of the first drawing can be determined.
After determining the difference between the currently stored second time variable and the first call starting time as the page loading time length of the active window component, the method further includes: and switching the current drawing identifier from the first preset identifier to the second preset identifier.
The second preset identifier may refer to an identifier for characterizing non-first drawing. Illustratively, when the first preset flag is "False", the second preset flag is set to "True".
Specifically, since the page drawing can be performed again in the created active window component, the active window component is not involved in the re-creation, and therefore the page loading time corresponding to the page drawing does not need to be calculated. After the page loading duration is determined, the current drawing identifier is updated to be the second preset identifier, and recalculation of the page loading duration can be avoided.
And S250, determining the difference value between the first time variable and the second time variable stored in each drawing as the page drawing time length of each drawing.
Specifically, after each drawing is finished, the second time variable and the first time variable stored in the drawing can be subtracted, so that the page drawing time length of each drawing can be conveniently obtained.
According to the technical scheme, the calling starting time and the calling ending time corresponding to the drawing distribution function of the outermost preset parent view are called by utilizing the first time variable and the second time variable to store drawing at each time, so that the page drawing starting time and the page drawing ending time during single drawing only need to be recorded, the drawing starting time and the drawing ending time of all the drawings do not need to be recorded, the storage space is saved, the page loading time and the page drawing time during each drawing can be calculated more conveniently, and the operation efficiency is improved.
On the basis of the above technical solution, before S210, the method may further include: acquiring a compiled active window component file; analyzing the active window component file to obtain each function information and original page layout in the active window component file; traversing each function information, and when a creating function of the movable window component is detected, inserting a first preset code at a calling starting position of the creating function so as to obtain a first calling starting moment corresponding to the creating function for calling the movable window component through the first preset code; nesting a layer of preset parent view in the outermost layer of the original page layout, and inserting a second preset code at the calling end position of the drawing distribution function of the preset parent view so as to obtain a first calling end time corresponding to the drawing distribution function calling the preset parent view through the second preset code.
Each active window component in the application software corresponds to one active window component file. The active window component file may refer to a compiled class file. The first preset code may be code for implementing obtaining a first call start time corresponding to a creation function for calling the active window component. The second preset code may be a code for obtaining a first call end time corresponding to a drawing distribution function calling a preset parent view.
Specifically, the embodiment can dynamically modify the byte code of the active window component file by using the ASM technology in the compiling stage of the code through the Gradle. The ASM is a Java bytecode-level processing framework which can directly perform addition and deletion operations on class files. The ASM can either directly generate the binary class file or dynamically change the class behavior before the class is loaded into the Java virtual machine. After the ASM reads information from the class file, the ASM can change class behaviors, analyze class information and even generate a new class according to user requirements. According to the embodiment, all active window component files in the application software can be automatically and uniformly modified by utilizing the ASM technology, manual addition and modification are avoided, and the processing efficiency is improved.
The following is an embodiment of the apparatus for determining page loading duration provided in the embodiments of the present invention, and the apparatus and the method for determining page loading duration of the embodiments belong to the same inventive concept, and details that are not described in detail in the embodiment of the apparatus for determining page loading duration may refer to the embodiment of the method for determining page loading duration.
EXAMPLE III
Fig. 5 is a schematic structural diagram of a device for determining page loading duration according to a third embodiment of the present invention, which is applicable to a case of determining page loading duration of an Activity of a movable window component in Android application software, and the device specifically includes: a first call start time obtaining module 310, a first call end time obtaining module 320, and a page loading duration determining module 330.
The first call start time obtaining module 310 is configured to obtain a first call start time corresponding to a creation function for calling an active window component; a first call end time obtaining module 320, configured to perform view drawing according to a preset page layout in a call process of a created function, and obtain a first call end time corresponding to a drawing distribution function that calls an outermost preset parent view, where the preset page layout is a layer of preset parent views nested in an outermost layer of an original page layout; the page loading duration determining module 330 is 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.
Optionally, the apparatus further comprises:
the system comprises a first page drawing time length determining module, a second page drawing time length determining module and a first page drawing time length determining module, wherein the first page drawing time length determining module is used for obtaining a second calling starting moment corresponding to a drawing distribution function for calling an outermost preset parent view when drawing views according to a preset page layout; and determining the difference between the second calling starting time and the first calling ending time as the page drawing time length drawn for the first time.
Optionally, the apparatus further comprises:
the second page drawing duration determining module is used for re-drawing the view according to the preset page layout when a page re-drawing triggering instruction is detected, and obtaining a third calling starting time and a second calling ending time corresponding to a drawing distribution function calling the outermost preset parent view in the re-view drawing; and determining the difference between the third calling starting time and the second calling ending time as the redrawing page drawing time length.
Optionally, the first call end time obtaining module 320 is specifically configured to: respectively storing the calling start time and the calling end time corresponding to the drawing distribution function of the outermost preset parent view when each drawing is performed by using the first time variable and the second time variable;
accordingly, the page loading duration determining module 330 is specifically configured to: when the current drawing identifier is determined as the first drawing, determining the difference value between the currently stored second time variable and the first calling starting moment as the page loading duration of the active window component; and determining the difference value between the first time variable and the second time variable stored in each drawing as the page drawing time length of each drawing.
Optionally, the apparatus further comprises:
and the drawing identifier switching module is used for switching the current drawing identifier from a first preset identifier to a second preset identifier after determining a difference value between the currently stored second time variable and the first calling starting moment as the page loading duration of the active window component, wherein the first preset identifier is used for representing the first drawing identifier.
Optionally, the first call end time obtaining module 320 is further specifically configured to:
drawing an outermost preset parent view in a preset page layout by calling a drawing function, wherein the preset parent view is an empty view; after the preset parent view is drawn, drawing each child view layer by calling a drawing distribution function of the preset parent view; and when the drawing of the child view at the innermost layer in the preset page layout is finished, returning to the preset parent view at the outermost layer by layer, and taking the current moment as the first calling ending moment corresponding to the drawing distribution function of the preset parent view.
Optionally, the apparatus further comprises:
the active window component file acquisition module is used for acquiring a compiled active window component file before acquiring a first call starting moment corresponding to a creating function for calling the active window component;
the active window component file analysis module is used for analyzing the active window component file to obtain each function information and original page layout in the active window component file;
the first preset code inserting module is used for traversing each function information, and when a creating function of the movable window component is detected, a first preset code is inserted at the calling starting position of the creating function so as to obtain a first calling starting moment corresponding to the creating function for calling the movable window component through the first preset code;
and the second preset code insertion module is used for nesting a layer of preset parent view into the outermost layer of the original page layout, inserting a second preset code into the calling end position of the drawing and distributing function of the preset parent view, and acquiring a first calling end time corresponding to the drawing and distributing function calling the preset parent view through the second preset code.
The device for determining the page loading duration provided by the embodiment of the invention can execute the method for determining the page loading duration provided by any embodiment of the invention, and has the corresponding functional modules and beneficial effects of the method for determining the page loading duration.
Example four
Fig. 6 is a schematic structural diagram of an apparatus according to a fourth embodiment of the present invention. Fig. 6 illustrates a block diagram of an exemplary device 12 suitable for use in implementing embodiments of the present invention. The device 12 shown in fig. 6 is only an example and should not bring any limitations to the functionality and scope of use of the embodiments of the present invention.
As shown in FIG. 6, device 12 is in the form of a general purpose computing device. The components of device 12 may include, but are not limited to: one or more processors or processing units 16, a system memory 28, and a bus 18 that couples various system components including the system memory 28 and the processing unit 16.
Bus 18 represents one or more of any of several types of bus structures, including a memory bus or memory controller, a peripheral bus, an accelerated graphics port, and a processor or local bus using any of a variety of bus architectures. By way of example, such architectures include, but are not limited to, Industry Standard Architecture (ISA) bus, micro-channel architecture (MAC) bus, enhanced ISA bus, Video Electronics Standards Association (VESA) local bus, and Peripheral Component Interconnect (PCI) bus.
Device 12 typically includes a variety of computer system readable media. Such media may be any available media that is accessible by device 12 and includes both volatile and nonvolatile media, removable and non-removable media.
The 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/nonvolatile computer system storage media. By way of example only, storage system 34 may be used to read from and write to non-removable, nonvolatile magnetic media (not shown in FIG. 6, and commonly referred to as a "hard drive"). Although not shown in FIG. 6, a magnetic disk drive for reading from and writing to a removable, nonvolatile magnetic disk (e.g., a "floppy disk") and an optical disk drive for reading from or writing to a removable, nonvolatile optical disk (e.g., a CD-ROM, DVD-ROM, or other optical media) may be provided. In these cases, each drive may be connected to bus 18 by one or more data media interfaces. 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 carry out the functions of embodiments of the invention.
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 examples or some combination thereof may comprise an implementation of a network environment. Program modules 42 generally carry out the functions and/or methodologies of the described embodiments of the invention.
Device 12 may also communicate with one or more external devices 14 (e.g., keyboard, pointing device, display 24, etc.), with one or more devices that enable a user to interact with device 12, and/or with any devices (e.g., network card, modem, etc.) that enable device 12 to communicate with one or more other computing devices. Such communication may be through an input/output (I/O) interface 22. Also, the device 12 may communicate with one or more networks (e.g., a Local Area Network (LAN), a Wide Area Network (WAN), and/or a public network, such as the Internet) via the network adapter 20. As shown, the network adapter 20 communicates with the other modules of the device 12 via the bus 18. It should be understood that although not shown in the figures, other hardware and/or software modules may be used in conjunction with 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, among others.
The processing unit 16 executes various functional applications and data processing by running a program stored in the system memory 28, for example, implementing a method for determining a page loading duration provided by the embodiment of the present invention, the method includes:
acquiring a first calling starting moment corresponding to a creating function for calling the movable window component;
in the calling process of the creating function, drawing views according to a preset page layout, and obtaining a first calling end time corresponding to a drawing distribution function calling an outermost preset parent view, wherein the preset page layout is formed by nesting a layer of preset parent views in the outermost layer of an original page layout;
and determining the difference between the first calling starting time and the first calling ending time as the page loading time of the active window component.
Of course, those skilled in the art can understand that the processor may also implement the technical solution of the method for determining the page loading duration provided by any embodiment of the present invention.
EXAMPLE five
The fifth embodiment provides a computer-readable storage medium, on which a computer program is stored, where the computer program, when executed by a processor, implements the method for determining a page loading duration provided in any embodiment of the present invention, where the method includes:
acquiring a first calling starting moment corresponding to a creating function for calling the movable window component;
in the calling process of the creating function, drawing views according to a preset page layout, and obtaining a first calling end time corresponding to a drawing distribution function calling an outermost preset parent view, wherein the preset page layout is formed by nesting a layer of preset parent views in the outermost layer of an original page layout;
and determining the difference between the first calling starting time and the first calling ending time as the page loading time of the active window component.
Computer storage media for embodiments of the invention may employ any combination of one or more computer-readable media. The computer readable medium may be a computer readable signal medium or a computer readable storage medium. The computer-readable storage medium may be, for example but not limited to: an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination thereof. More specific examples (a non-exhaustive list) of the computer readable storage medium would include the following: an electrical connection having one or more wires, a portable computer diskette, 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 disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing. In the context of this document, a computer readable storage medium may be any tangible medium that can contain, or store a program for use by or in connection with an instruction execution system, apparatus, or device.
A computer readable signal medium may include a propagated data signal with computer readable program code embodied therein, for example, in baseband or as part of a carrier wave. Such a propagated data signal may take many forms, including, but not limited to, electro-magnetic, optical, or any suitable combination thereof. A computer readable signal medium may also be any computer readable medium that is not a computer readable storage medium and that can communicate, propagate, or transport a program for use by or in connection with an instruction execution system, apparatus, or device.
Program code embodied on a computer readable medium may be transmitted using any appropriate medium, including but not limited to: wireless, wire, fiber optic cable, RF, etc., or any suitable combination of the foregoing.
Computer program code for carrying out operations for aspects of the present invention may be written in any combination of one or more programming languages, including an object oriented programming language such as Java, Smalltalk, C + + or the like and conventional procedural programming languages, such as the "C" programming language or similar programming languages. The program code may execute entirely on the user's computer, partly on the user's computer, as a stand-alone software package, partly on the user's computer and partly on a remote computer or entirely on the remote computer or server. In the case of a remote computer, the remote computer may be connected to the user's computer through any type of network, including a Local Area Network (LAN) or a Wide Area Network (WAN), or the connection may be made to an external computer (for example, through the Internet using an Internet service provider).
It will be understood by those skilled in the art that the modules or steps of the invention described above may be implemented by a general purpose computing device, they may be centralized on a single computing device or distributed across a network of computing devices, and optionally they may be implemented by program code executable by a computing device, such that it may be stored in a memory device and executed by a computing device, or it may be separately fabricated into various integrated circuit modules, or it may be fabricated by fabricating a plurality of modules or steps thereof into a single integrated circuit module. Thus, the present invention is not limited to any specific combination of hardware and software.
It is to be noted that the foregoing is only illustrative of the preferred embodiments of the present invention and the technical principles employed. It will be understood by those skilled in the art that the present invention is not limited to the particular embodiments described herein, but is capable of various obvious changes, rearrangements and substitutions as will now become apparent to those skilled in the art without departing from the scope of the invention. Therefore, although the present invention has been described in greater detail by the above embodiments, the present invention is not limited to the above embodiments, and may include other equivalent embodiments without departing from the spirit of the present invention, and the scope of the present invention is determined by the scope of the appended claims.

Claims (10)

1. A method for determining page loading duration is characterized by comprising the following steps:
acquiring a first calling starting moment corresponding to a creating function for calling the movable window component;
in the calling process of the creating function, drawing a view according to a preset page layout, and obtaining a first calling end time corresponding to a drawing distribution function calling an outermost preset parent view, wherein the preset page layout is formed by nesting a layer of the preset parent view in the outermost layer of an original page layout;
and determining the difference between the first calling starting time and the first calling ending time as the page loading duration of the active window component.
2. The method of claim 1, further comprising:
when the view drawing is carried out according to the preset page layout, obtaining a second calling starting moment corresponding to a drawing distribution function calling the outermost preset parent view;
and determining the difference between the second calling starting time and the first calling ending time as the page drawing time length drawn for the first time.
3. The method of claim 1, further comprising:
when a page redrawing trigger instruction is detected, redrawing the view according to the preset page layout, and obtaining a third calling starting time and a second calling ending time corresponding to a drawing distribution function calling the outermost preset parent view in the redrawing;
and determining the difference between the third calling starting time and the second calling ending time as the redrawing page drawing time length.
4. The method of claim 1, wherein obtaining a first call end time corresponding to a drawing distribution function calling an outermost preset parent view comprises:
respectively storing the calling start time and the calling end time corresponding to the drawing distribution function of the outermost preset parent view when each drawing is performed by using the first time variable and the second time variable;
correspondingly, determining a difference value between the first call start time and the call end time as a page loading duration of the active window component, including:
when the current drawing identification is determined to be drawn for the first time, determining a difference value between the second time variable stored at present and the first calling starting moment as the page loading duration of the active window component;
and determining the difference value between the first time variable and the second time variable stored in each drawing as the page drawing time length of each drawing.
5. The method of claim 4, after determining a difference between the currently stored second time variable and the first call start time as a page load duration of the active window component, further comprising:
switching a current drawing identifier from a first preset identifier to a second preset identifier, wherein the first preset identifier is used for representing the first drawing.
6. The method of claim 1, wherein drawing the view according to a preset page layout comprises:
drawing an outermost preset parent view in a preset page layout by calling a drawing function, wherein the preset parent view is an empty view;
after the preset parent view is drawn, drawing each child view layer by calling a drawing distribution function of the preset parent view;
and when the drawing of the child view at the innermost layer in the preset page layout is finished, returning to the preset parent view at the outermost layer by layer, and taking the current moment as the first calling ending moment corresponding to the drawing distribution function of the preset parent view.
7. The method of any of claims 1-6, further comprising, prior to obtaining a first call start time corresponding to a create function that calls an active window component:
acquiring a compiled active window component file;
analyzing the active window component file to obtain each function information and original page layout in the active window component file;
traversing each function information, and when a creating function of the movable window component is detected, inserting a first preset code at the calling starting position of the creating function so as to obtain a first calling starting moment corresponding to the creating function for calling the movable window component through the first preset code;
nesting a layer of preset parent view in the outermost layer of the original page layout, and inserting a second preset code at the calling end position of the drawing distribution function of the preset parent view so as to obtain a first calling end time corresponding to the drawing distribution function calling the preset parent view through the second preset code.
8. An apparatus for determining page loading duration, comprising:
the first calling starting time acquisition module is used for acquiring a first calling starting time corresponding to a creating function for calling the movable window component;
a first call end time obtaining module, configured to perform view drawing according to a preset page layout in a call process of the creation function, and obtain a first call end time corresponding to a drawing distribution function that calls an outermost preset parent view, where the preset page layout is obtained by nesting a layer of the preset parent view in an outermost layer of an original page layout;
and the page loading duration determining module is used for determining the difference value between the first calling starting time and the first calling ending time as the page loading duration of the active window component.
9. An apparatus, characterized in that the apparatus comprises:
one or more processors;
a memory for storing one or more programs;
when executed by the one or more processors, cause the one or more processors to implement a method for determining page load time as recited in any of claims 1-7.
10. A computer-readable storage medium, on which a computer program is stored, which, when being executed by a processor, carries out the method for determining a page load time according to any one of claims 1 to 7.
CN201910872751.5A 2019-09-16 2019-09-16 Method, device, equipment and storage medium for determining page loading duration Pending CN112506592A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201910872751.5A CN112506592A (en) 2019-09-16 2019-09-16 Method, device, equipment and storage medium for determining page loading duration

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201910872751.5A CN112506592A (en) 2019-09-16 2019-09-16 Method, device, equipment and storage medium for determining page loading duration

Publications (1)

Publication Number Publication Date
CN112506592A true CN112506592A (en) 2021-03-16

Family

ID=74923999

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201910872751.5A Pending CN112506592A (en) 2019-09-16 2019-09-16 Method, device, equipment and storage medium for determining page loading duration

Country Status (1)

Country Link
CN (1) CN112506592A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114896013A (en) * 2022-05-12 2022-08-12 北京达佳互联信息技术有限公司 Page loading duration determining method and device, electronic equipment and storage medium

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US8135943B1 (en) * 2005-11-15 2012-03-13 American Megatrends, Inc. Method, apparatus, and computer-readable medium for generating a dispatching function
US20130298007A1 (en) * 2012-04-18 2013-11-07 International Business Machines Corporation Determining page loading of user interfaces of web applications
CN105630566A (en) * 2016-02-26 2016-06-01 北京奇虎科技有限公司 Application page loading duration determining method and application page loading duration determining device
CN109683994A (en) * 2018-12-12 2019-04-26 北京字节跳动网络技术有限公司 Determine method, apparatus, storage medium and the electronic equipment of view building time

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US8135943B1 (en) * 2005-11-15 2012-03-13 American Megatrends, Inc. Method, apparatus, and computer-readable medium for generating a dispatching function
US20130298007A1 (en) * 2012-04-18 2013-11-07 International Business Machines Corporation Determining page loading of user interfaces of web applications
CN105630566A (en) * 2016-02-26 2016-06-01 北京奇虎科技有限公司 Application page loading duration determining method and application page loading duration determining device
CN109683994A (en) * 2018-12-12 2019-04-26 北京字节跳动网络技术有限公司 Determine method, apparatus, storage medium and the electronic equipment of view building time

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114896013A (en) * 2022-05-12 2022-08-12 北京达佳互联信息技术有限公司 Page loading duration determining method and device, electronic equipment and storage medium

Similar Documents

Publication Publication Date Title
CN109634598B (en) Page display method, device, equipment and storage medium
CN109213611B (en) Cross-process communication method, device, terminal and storage medium
CN110825456B (en) Loading time calculation method, loading time calculation device, computer equipment and storage medium
CN110502357B (en) Stack backtracking method, device, medium and equipment
CN110865888A (en) Resource loading method and device, server and storage medium
CN109684573B (en) Target picture display method and device, storage medium and electronic equipment
CN113986402A (en) Function calling method and device, electronic equipment and storage medium
CN110362371B (en) View level control method, device and system, computer equipment and medium
CN112506592A (en) Method, device, equipment and storage medium for determining page loading duration
CN110286990B (en) User interface display method, device, equipment and storage medium
CN110045952B (en) Code calling method and device
CN111352644A (en) Applet updating method, device, server and storage medium
CN113127050B (en) Application resource packaging process monitoring method, device, equipment and medium
CN114647411A (en) Programming interface loading method and device, electronic equipment and storage medium
CN113760631A (en) Page loading duration determination method, device, equipment and storage medium
CN114237684A (en) Component management system, method, device, electronic device and storage medium
US9477448B2 (en) Screen-oriented computing program refactoring
CN112764802A (en) Business logic customization method and device, electronic equipment and storage medium
CN112689199A (en) Method and device for loading plug-in of television homepage, television and storage medium
CN111078317A (en) Scene data processing method and device, computer equipment and storage medium
CN113127051B (en) Application resource packaging process monitoring method, device, equipment and medium
CN113535660B (en) Android log storage method and device
CN112988150B (en) Page label operation method and device and electronic equipment
CN111813663B (en) Pointer type identification method, device, medium and equipment
CN111625192B (en) Metadata object access method, device, equipment and medium

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination