Method and device for determining page startup time consumption, electronic equipment and storage medium
Patent Information
- Application Number
- CN202211173617.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-09-26
- Publication Date
- 2026-09-22
- Estimated Expiration
- 2042-09-26
AI Technical Summary
[0005]本公开提供一种页面启动耗时的确定方法、装置、电子设备及存储介质,以至少解决相关技术中确定结果的准确性不足的问题
[0045]本公开实施例通过获取到目标页面的启动开始时间,向系统提供的页面渲染类注册目标类型的回调函数,在回调函数被调用的情况下,如果目标页面中的当前页面元素满足目标条件,则将当前时间点确定为目标页面的启动结束时间,根据启动开始时间和启动结束时间确定目标页面的启动耗时,由于在回调函数被调用的情况下,目标页面进行了刷新,这时将目标页面中的当前页面元素满足目标条件的时间点确定为目标页面的启动结束时间,确定的启动结束时间较为准确,从而提高了页面启动耗时确定的准确性。
Smart Images

Figure CN115599643B_ABST
Abstract
Description
Technical Field
[0001] This disclosure relates to the field of computer technology, and in particular to a method, apparatus, electronic device, and storage medium for determining page startup time. Background Technology
[0002] As mobile application pages carry more and more information, the issue of page startup time has become increasingly prominent, making it necessary to determine the page startup time.
[0003] In related technologies, after determining the page start time, the page end time is determined by timed calculation, and then the page startup time is determined based on the page start time and page end time.
[0004] However, the timed calculation method uses the time from the end of page startup to the next timed period as the startup end time, resulting in insufficient accuracy of the final determined page startup time. Summary of the Invention
[0005] This disclosure provides a method, apparatus, electronic device, and storage medium for determining page startup time, to at least address the problem of insufficient accuracy in the determination results of related technologies. The technical solution of this disclosure is as follows:
[0006] According to a first aspect of the present disclosure, a method for determining page startup time is provided, comprising:
[0007] Get the start time of the target page;
[0008] Register a callback function of the target type for the page rendering class provided by the system;
[0009] If the current page element in the target page meets the target condition when the callback function is called, the current time point is determined as the start-up and end time of the target page.
[0010] The startup time of the target page is determined based on the startup start time and the startup end time.
[0011] Optionally, when the callback function is invoked, if the current page element in the target page meets the target condition, then determining the current time point as the start / end time of the target page includes:
[0012] When the callback function is called, the projection of the current page element on the horizontal axis of the screen is determined to obtain the horizontal projection, and the projection of the current page element on the vertical axis of the screen is determined to obtain the vertical projection.
[0013] If the horizontal projection and the vertical projection satisfy the target projection conditions, then the current time point is determined as the start-up and end time of the target page.
[0014] Optionally, the target projection conditions include: the ratio of the horizontal axis projection to the horizontal axis of the screen is greater than or equal to a preset horizontal axis ratio, and the ratio of the vertical axis projection to the vertical axis of the screen is greater than or equal to a preset vertical axis ratio.
[0015] Optional, also includes:
[0016] If the current page element in the target page does not meet the target condition when the callback function is called, the above operations of registering the callback function with the page rendering class and determining whether the current page element in the target page meets the target condition when the callback function is called are executed repeatedly until the current page element meets the target condition, and the current time point is determined as the start-up and end time of the target page.
[0017] Optionally, registering a callback function of the target type with the page rendering class provided by the system includes:
[0018] After obtaining the page data of the target page, register a callback function of the target type with the page rendering class.
[0019] Optionally, obtaining the launch start time of the target page includes:
[0020] The time when the system calls the page creation method corresponding to the target page is determined as the startup start time of the target page.
[0021] Optionally, the name of the page rendering class is "Choreographer" and the target type is "Submission Type".
[0022] According to a second aspect of the present disclosure, an apparatus for determining page startup time is provided, comprising:
[0023] The start time acquisition module is configured to retrieve the startup start time of the target page;
[0024] The callback function registration module is configured to execute callback functions of the target type registered with the page rendering class provided by the system;
[0025] The first end time determination module is configured to, when the callback function is called, determine the current time point as the start-up end time of the target page if the current page element in the target page meets the target conditions.
[0026] The startup time determination module is configured to determine the startup time of the target page based on the startup start time and the startup end time.
[0027] Optionally, the first end time determination module includes:
[0028] The element projection determination unit is configured to, when the callback function is invoked, determine the projection of the current page element on the horizontal axis of the screen to obtain the horizontal projection, and determine the projection of the current page element on the vertical axis of the screen to obtain the vertical projection.
[0029] The end time determination unit is configured to determine the current time point as the start-up end time of the target page if the horizontal axis projection and the vertical axis projection satisfy the target projection conditions.
[0030] Optionally, the target projection conditions include: the ratio of the horizontal axis projection to the horizontal axis of the screen is greater than or equal to a preset horizontal axis ratio, and the ratio of the vertical axis projection to the vertical axis of the screen is greater than or equal to a preset vertical axis ratio.
[0031] Optionally, the device further includes:
[0032] The second end time determination module is configured to, when the callback function is called, if the current page element in the target page does not meet the target condition, repeatedly execute the above operations of registering the callback function with the page rendering class and determining whether the current page element in the target page meets the target condition when the callback function is called, until the current page element meets the target condition, and determine the current time point as the start-up end time of the target page.
[0033] Optionally, the callback function registration module is configured to execute:
[0034] After obtaining the page data of the target page, register a callback function of the target type with the page rendering class.
[0035] Optionally, the start time acquisition module is configured to execute:
[0036] The time when the system calls the page creation method corresponding to the target page is determined as the startup start time of the target page.
[0037] Optionally, the name of the page rendering class is "Choreographer" and the target type is "Submission Type".
[0038] According to a third aspect of the present disclosure, an electronic device is provided, comprising:
[0039] processor;
[0040] Memory used to store the processor's executable instructions;
[0041] The processor is configured to execute the instructions to implement the method for determining page startup time as described in the first aspect.
[0042] According to a fourth aspect of the present disclosure, a computer-readable storage medium is provided, which, when instructions in the computer storage medium are executed by a processor of an electronic device, enables the electronic device to perform the page startup time determination method as described in the first aspect.
[0043] According to a fifth aspect of the present disclosure, a computer program product is provided, including a computer program or computer instructions, wherein when the computer program or computer instructions are executed by a processor, the method for determining page startup time as described in the first aspect is implemented.
[0044] The technical solutions provided by the embodiments of this disclosure have at least the following beneficial effects:
[0045] This embodiment of the disclosure obtains the start time of the target page and registers a callback function of the target type with the page rendering class provided by the system. When the callback function is called, if the current page element in the target page meets the target condition, the current time point is determined as the start-end time of the target page. The start time of the target page is determined based on the start time and start-end time. Since the target page is refreshed when the callback function is called, the time point when the current page element in the target page meets the target condition is determined as the start-end time of the target page. The determined start-end time is more accurate, thereby improving the accuracy of the page start time determination.
[0046] It should be understood that the above general description and the following detailed description are exemplary and explanatory only, and are not intended to limit this disclosure. Attached Figure Description
[0047] The accompanying drawings, which are incorporated in and form part of this specification, illustrate embodiments consistent with this disclosure and, together with the description, serve to explain the principles of this disclosure, and are not intended to unduly limit this disclosure.
[0048] Figure 1 This is a flowchart illustrating a method for determining page startup time according to an exemplary embodiment;
[0049] Figure 2 This is a flowchart illustrating a method for determining page startup time according to an exemplary embodiment;
[0050] Figure 3This is a block diagram illustrating a device for determining page startup time according to an exemplary embodiment;
[0051] Figure 4 This is a block diagram illustrating an electronic device according to an exemplary embodiment. Detailed Implementation
[0052] To enable those skilled in the art to better understand the technical solutions of this disclosure, the technical solutions in the embodiments of this disclosure will be clearly and completely described below with reference to the accompanying drawings.
[0053] It should be noted that the terms "first," "second," etc., used in the specification, claims, and accompanying drawings of this disclosure are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that such data can be interchanged where appropriate so that the embodiments of this disclosure described herein can be implemented in orders other than those illustrated or described herein. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with this disclosure. Rather, they are merely examples of apparatuses and methods consistent with some aspects of this disclosure as detailed in the appended claims.
[0054] Figure 1 This is a flowchart illustrating a method for determining page startup time according to an exemplary embodiment, such as... Figure 1 As shown, the method for determining the page startup time is used in electronic devices such as mobile phones and tablets, and includes the following steps.
[0055] In step S11, the startup start time of the target page is obtained.
[0056] The start time of the target page can be determined by the time when the user's instruction to open the target page is received, or by the time when the target page begins to be created.
[0057] In one exemplary embodiment, obtaining the startup start time of the target page includes: determining the time point at which the system calls the page creation method corresponding to the target page as the startup start time of the target page.
[0058] When the system calls the page creation method corresponding to the target page, it indicates that the creation of the target page begins at this point, and this time is defined as the target page's startup start time. In the Android system, the page creation method is the onCreate method.
[0059] By determining the time when the system calls the page creation method corresponding to the target page as the startup start time of the target page, a more accurate startup start time of the target page can be obtained.
[0060] In step S12, a callback function of the target type is registered with the page rendering class provided by the system.
[0061] The page rendering class is used to implement page refresh; for example, the page rendering class is named Choreographer. Choreographer mainly works with Vsync (vertical sync) to provide a stable message processing opportunity for the rendering of upper-layer applications. That is, when Vsync arrives, the system controls the timing of each frame's drawing operation by adjusting the Vsync signal period. Vsync is a synchronization signal emitted after the screen has finished rendering one frame of data and before it begins rendering the next frame.
[0062] Registering a callback function of the target type with the system-provided page rendering class allows monitoring of when the system calls the page rendering class, i.e., when the page refreshes. Based on this timing, it determines whether the target page has finished starting, thus obtaining the startup completion time. The target type can be a commit type (CALLBACK_COMMIT). The callback function is used to execute callback tasks. The callback functions, in order of execution, can be: input event (CALLBACK_INPUT), animation (CALLBACK_ANIMATION), insert / update animation (CALLBACK_INSETS_ANIMATION), drawing (CALLBACK_TRAVERSAL), and commit (CALLBACK_COMMIT). That is, the callback function of the target type executes after tasks such as input events, animations, insert / update animations, and drawing are completed. Each execution refreshes the target page, updating its elements to some extent.
[0063] In one exemplary embodiment, registering a callback function of the target type with the page rendering class provided to the system includes: registering a callback function of the target type with the page rendering class after obtaining the page data of the target page.
[0064] After sending a page data retrieval request to the server and obtaining the page data of the target page from the server, a callback function of the target type is registered with the page rendering class. This callback function will only be called after the page data of the target page is obtained, and the current page element of the target page will be calculated when it is called. This avoids the waste of resources caused by calling the function before the page data of the target page is obtained and calculating the current page element, thus saving computing resources.
[0065] In step S13, if the callback function is called and the current page element in the target page meets the target condition, then the current time point is determined as the start-up and end time of the target page.
[0066] When the callback function is called, it indicates that the target page has completed a refresh. At this time, the current page elements will be updated to some extent compared to before the refresh. A check is then performed on the current page elements to determine if they meet the target conditions. If they do, it means the target page has finished launching, and the current time is set as the target page launch completion time. Target conditions could be, for example, that the projections of the current page elements on the horizontal and vertical axes of the screen meet a target projection condition, or that the coverage area of the current page elements is greater than or equal to an area threshold.
[0067] In an exemplary embodiment, the step of determining the current time point as the start / end time of the target page if the current page element in the target page satisfies the target condition when the callback function is called includes: determining the projection of the current page element on the horizontal axis of the screen to obtain the horizontal projection, and determining the projection of the current page element on the vertical axis of the screen to obtain the vertical projection; if the horizontal projection and the vertical projection satisfy the target projection condition, then determining the current time point as the start / end time of the target page.
[0068] The target projection conditions may include: the ratio of the horizontal axis projection to the horizontal axis of the screen is greater than or equal to a preset horizontal axis ratio, and the ratio of the vertical axis projection to the vertical axis of the screen is greater than or equal to a preset vertical axis ratio.
[0069] When the callback function is called, it indicates that the target page has completed a refresh. At this time, the current page element in the target page is projected onto the horizontal and vertical axes of the screen respectively, obtaining the horizontal projection of the current page element on the horizontal axis and the vertical projection of the current page element on the vertical axis of the screen. The ratio of the horizontal projection to the horizontal axis of the screen is determined, and it is checked whether this ratio is greater than or equal to the preset horizontal axis ratio. The ratio of the vertical projection to the vertical axis of the screen is also determined, and it is checked whether this ratio is greater than or equal to the preset vertical axis ratio. If the ratio of the horizontal projection to the horizontal axis of the screen is greater than or equal to the preset horizontal axis ratio, and the ratio of the vertical projection to the vertical axis of the screen is greater than or equal to the preset vertical axis ratio, it means that the target page has completed its startup, and the current time point is determined as the startup end time of the target page.
[0070] By determining the horizontal and vertical projections when the callback function is called, and determining whether the horizontal and vertical projections meet the target projection conditions, the current time point when the target projection conditions are met is determined as the start and end time of the target page. In this way, the start and end time can be determined by projection calculation, which can obtain a more accurate start and end time, and the amount of calculation is low, saving computing resources.
[0071] In step S14, the startup time of the target page is determined based on the startup start time and the startup end time.
[0072] The difference between the startup end time and startup start time of the target page is determined as the startup time of the target page.
[0073] The method for determining page startup time provided in this exemplary embodiment obtains the startup start time of the target page, registers a callback function of the target type with the page rendering class provided by the system, and when the callback function is called, if the current page element in the target page meets the target condition, the current time point is determined as the startup end time of the target page. The startup time of the target page is determined based on the startup start time and startup end time. Since the calling of the callback function indicates that the target page has been refreshed, the time point when the current page element in the target page meets the target condition is determined as the startup end time of the target page. The determined startup end time is more accurate, thereby improving the accuracy of page startup time determination.
[0074] Figure 2 This is a flowchart illustrating a method for determining page startup time according to an exemplary embodiment, such as... Figure 2 As shown, the method for determining the page startup time is used in electronic devices such as mobile phones and tablets, and includes the following steps.
[0075] In step S21, the startup start time of the target page is obtained.
[0076] In step S22, a callback function of the target type is registered with the page rendering class provided by the system.
[0077] For example, after obtaining the page data of the target page, registering a callback function of the target type with the page rendering class can avoid multiple judgments of the target page element caused by the callback function being called when the page data has not been obtained.
[0078] In step S23, when the callback function is called, it is determined whether the current page element in the target page meets the target condition. If it does not meet the condition, step S22 is executed; if it does meet the condition, step S24 is executed.
[0079] When the callback function is called, it means that the target page has completed a refresh. At this time, it is judged whether the current page element in the target page meets the target conditions. For example, it is judged whether the horizontal projection of the current page element is greater than or equal to the preset horizontal axis ratio and whether the vertical projection is greater than or equal to the preset vertical axis ratio. If the current page element does not meet the target conditions, steps S22 to S23 are executed repeatedly. The judgment is performed again after the next target page refresh is completed, until the current page element meets the target conditions, and then step S24 is executed.
[0080] In step S24, the current time point is determined as the start-up and end time of the target page.
[0081] The current time point when the target page elements meet the target conditions is determined as the start and end time of the target page.
[0082] In step S25, the startup time of the target page is determined based on the startup start time and the startup end time.
[0083] The method for determining page startup time provided in this exemplary embodiment, when a callback function is called, if the current page element in the target page does not meet the target condition, repeatedly executes the operations of registering a callback function with the page rendering class and determining whether the current page element in the target page meets the target condition when the callback function is called, until the current page element meets the target condition. The current time point is then determined as the startup end time of the target page. In this way, the determination of whether the current page element meets the target condition is only performed when the callback function is called. Since the target page has just finished refreshing when the callback function is called, the determined startup end time is more accurate, thereby improving the accuracy of page startup time determination. Moreover, it does not require periodic calculation, which saves calculations and optimizes computational performance.
[0084] Figure 3 This is a block diagram illustrating a device for determining page startup time according to an exemplary embodiment. (Refer to...) Figure 3 The device includes a start time acquisition module 31, a callback function registration module 32, a first end time determination module 33, and a startup time determination module 34.
[0085] The start time acquisition module 31 is configured to acquire the startup start time of the target page;
[0086] The callback function registration module 32 is configured to execute callback functions of the target type registered with the page rendering class provided by the system;
[0087] The first end time determination module 33 is configured to, when the callback function is called, determine the current time point as the start-up end time of the target page if the current page element in the target page meets the target conditions.
[0088] The startup time determination module 34 is configured to determine the startup time of the target page based on the startup start time and the startup end time.
[0089] Optionally, the first end time determination module includes:
[0090] The element projection determination unit is configured to, when the callback function is invoked, determine the projection of the current page element on the horizontal axis of the screen to obtain the horizontal projection, and determine the projection of the current page element on the vertical axis of the screen to obtain the vertical projection.
[0091] The end time determination unit is configured to determine the current time point as the start-up end time of the target page if the horizontal axis projection and the vertical axis projection satisfy the target projection conditions.
[0092] Optionally, the target projection conditions include: the ratio of the horizontal axis projection to the horizontal axis of the screen is greater than or equal to a preset horizontal axis ratio, and the ratio of the vertical axis projection to the vertical axis of the screen is greater than or equal to a preset vertical axis ratio.
[0093] Optionally, the device further includes:
[0094] The second end time determination module is configured to, when the callback function is called, if the current page element in the target page does not meet the target condition, repeatedly execute the above operations of registering the callback function with the page rendering class and determining whether the current page element in the target page meets the target condition when the callback function is called, until the current page element meets the target condition, and determine the current time point as the start-up end time of the target page.
[0095] Optionally, the callback function registration module is configured to execute:
[0096] After obtaining the page data of the target page, register a callback function of the target type with the page rendering class.
[0097] Optionally, the start time acquisition module is configured to execute:
[0098] The time when the system calls the page creation method corresponding to the target page is determined as the startup start time of the target page.
[0099] Optionally, the name of the page rendering class is "Choreographer" and the target type is "Submission Type".
[0100] Regarding the apparatus in the above embodiments, the specific manner in which each module performs its operation has been described in detail in the embodiments related to the method, and will not be elaborated upon here.
[0101] Figure 4 This is a block diagram illustrating an electronic device according to an exemplary embodiment. For example, the electronic device 400 may be a mobile phone, computer, digital broadcasting terminal, messaging device, game console, tablet device, medical device, fitness equipment, personal digital assistant, etc.
[0102] Reference Figure 4 The electronic device 400 may include one or more of the following components: processing component 402, memory 404, power supply component 406, multimedia component 408, audio component 410, input / output (I / O) interface 412, sensor component 414, and communication component 416.
[0103] Processing component 402 typically controls the overall operation of electronic device 400, such as operations associated with display, telephone calls, data communication, camera operation, and recording. Processing component 402 may include one or more processors 420 to execute instructions to perform all or part of the steps of the methods described above. Furthermore, processing component 402 may include one or more modules to facilitate interaction between processing component 402 and other components. For example, processing component 402 may include a multimedia module to facilitate interaction between multimedia component 408 and processing component 402.
[0104] Memory 404 is configured to store various types of data to support the operation of electronic device 400. Examples of this data include instructions for any application or method operating on electronic device 400, contact data, phonebook data, messages, pictures, videos, etc. Memory 404 can be implemented by any type of volatile or non-volatile storage device or a combination thereof, such as static random access memory (SRAM), electrically erasable programmable read-only memory (EEPROM), erasable programmable read-only memory (EPROM), programmable read-only memory (PROM), read-only memory (ROM), magnetic storage, flash memory, magnetic disk, or optical disk.
[0105] Power supply component 406 provides power to various components of electronic device 400. Power supply component 406 may include a power management system, one or more power supplies, and other components associated with generating, managing, and distributing power to electronic device 400.
[0106] Multimedia component 408 includes a screen that provides an output interface between the electronic device 400 and the user. In some embodiments, the screen may include a liquid crystal display (LCD) and a touch panel (TP). If the screen includes a touch panel, the screen may be implemented as a touchscreen to receive input signals from the user. The touch panel includes one or more touch sensors to sense touches, swipes, and gestures on the touch panel. The touch sensors may sense not only the boundaries of the touch or swipe action but also the duration and pressure associated with the touch or swipe operation. In some embodiments, multimedia component 408 includes a front-facing camera and / or a rear-facing camera. When the electronic device 400 is in an operating mode, such as a shooting mode or a video mode, the front-facing camera and / or the rear-facing camera may receive external multimedia data. Each front-facing camera and rear-facing camera may be a fixed optical lens system or have focal length and optical zoom capabilities.
[0107] Audio component 410 is configured to output and / or input audio signals. For example, audio component 410 includes a microphone (MIC) configured to receive external audio signals when electronic device 400 is in an operating mode, such as call mode, recording mode, and voice recognition mode. The received audio signals may be further stored in memory 404 or transmitted via communication component 416. In some embodiments, audio component 410 also includes a speaker for outputting audio signals.
[0108] I / O interface 412 provides an interface between processing component 402 and peripheral interface modules, such as keyboards, click wheels, buttons, etc. These buttons may include, but are not limited to, home buttons, volume buttons, power buttons, and lock buttons.
[0109] Sensor assembly 414 includes one or more sensors for providing state assessments of various aspects of electronic device 400. For example, sensor assembly 414 may detect the on / off state of electronic device 400, the relative positioning of components such as the display and keypad of electronic device 400, changes in position of electronic device 400 or a component of electronic device 400, the presence or absence of user contact with electronic device 400, orientation or acceleration / deceleration of electronic device 400, and temperature changes of electronic device 400. Sensor assembly 414 may include a proximity sensor configured to detect the presence of nearby objects without any physical contact. Sensor assembly 414 may also include a light sensor, such as a CMOS or CCD image sensor, for use in imaging applications. In some embodiments, sensor assembly 414 may also include an accelerometer, gyroscope, magnetometer, pressure sensor, or temperature sensor.
[0110] Communication component 416 is configured to facilitate wired or wireless communication between electronic device 400 and other devices. Electronic device 400 can access wireless networks based on communication standards, such as WiFi, carrier networks (such as 2G, 3G, 4G, or 5G), or combinations thereof. In one exemplary embodiment, communication component 416 receives broadcast signals or broadcast-related information from an external broadcast management system via a broadcast channel. In one exemplary embodiment, communication component 416 also includes a near-field communication (NFC) module to facilitate short-range communication. For example, the NFC module may be implemented based on radio frequency identification (RFID) technology, Infrared Data Association (IrDA) technology, ultra-wideband (UWB) technology, Bluetooth (BT) technology, and other technologies.
[0111] In an exemplary embodiment, the electronic device 400 may be implemented by one or more application-specific integrated circuits (ASICs), digital signal processors (DSPs), digital signal processing devices (DSPDs), programmable logic devices (PLDs), field-programmable gate arrays (FPGAs), controllers, microcontrollers, microprocessors, or other electronic components to perform the above-described method for determining page startup time.
[0112] In an exemplary embodiment, a computer-readable storage medium including instructions is also provided, such as a memory 404 including instructions, which can be executed by a processor 420 of an electronic device 400 to complete the method for determining page startup time. Optionally, the computer-readable storage medium may be a ROM, random access memory (RAM), CD-ROM, magnetic tape, floppy disk, and optical data storage device, etc.
[0113] In an exemplary embodiment, a computer program product is also provided, including a computer program or computer instructions, which, when executed by a processor, implement the above-described method for determining page startup time.
[0114] Other embodiments of this disclosure will readily occur to those skilled in the art upon consideration of the specification and practice of the invention disclosed herein. This application is intended to cover any variations, uses, or adaptations of this disclosure that follow the general principles of this disclosure and include common knowledge or customary techniques in the art not disclosed herein. The specification and examples are to be considered exemplary only, and the true scope and spirit of this disclosure are indicated by the following claims.
[0115] It should be understood that this disclosure is not limited to the precise structures described above and shown in the accompanying drawings, and various modifications and changes can be made without departing from its scope. The scope of this disclosure is limited only by the appended claims.
Claims
1. A method for determining page startup time, characterized in that, include: Get the start time of the target page; The launch start time of the target page is the time when the user's instruction to open the target page is received, or the time when the target page begins to be created. Register a callback function of the target type for the page rendering class provided by the system; If the current page element in the target page meets the target condition when the callback function is called, the current time point is determined as the start-up and end time of the target page. The target condition is that the projection of the current page element on the horizontal axis of the screen and the projection on the vertical axis of the screen satisfy the target projection condition, or the coverage area of the current page element is greater than or equal to the area threshold. The startup time of the target page is determined based on the startup start time and the startup end time. The method further includes: If the current page element in the target page does not meet the target condition when the callback function is called, the above operations of registering the callback function with the page rendering class and determining whether the current page element in the target page meets the target condition when the callback function is called are executed repeatedly until the current page element meets the target condition, and the current time point is determined as the start-up and end time of the target page.
2. The method according to claim 1, characterized in that, When the callback function is invoked, if the current page element in the target page meets the target condition, then the current time point is determined as the start / end time of the target page, including: When the callback function is called, the projection of the current page element on the horizontal axis of the screen is determined to obtain the horizontal projection, and the projection of the current page element on the vertical axis of the screen is determined to obtain the vertical projection. If the horizontal projection and the vertical projection satisfy the target projection conditions, then the current time point is determined as the start-up and end time of the target page.
3. The method according to claim 2, characterized in that, The target projection conditions include: the ratio of the horizontal axis projection to the horizontal axis of the screen is greater than or equal to a preset horizontal axis ratio, and the ratio of the vertical axis projection to the vertical axis of the screen is greater than or equal to a preset vertical axis ratio.
4. The method according to any one of claims 1-3, characterized in that, The callback function for the target type registered with the page rendering class provided to the system includes: After obtaining the page data of the target page, register a callback function of the target type with the page rendering class.
5. The method according to any one of claims 1-3, characterized in that, The process of obtaining the launch start time of the target page includes: The time when the system calls the page creation method corresponding to the target page is determined as the startup start time of the target page.
6. The method according to any one of claims 1-3, characterized in that, The page rendering class is named "Choreographer", and the target type is "Submission Type".
7. A device for determining page startup time, characterized in that, include: The start time acquisition module is configured to retrieve the startup start time of the target page; The launch start time of the target page is the time when the user's instruction to open the target page is received, or the time when the target page begins to be created. The callback function registration module is configured to execute callback functions of the target type registered with the page rendering class provided by the system; The end time determination module is configured to, when the callback function is called, determine the current time as the start-up end time of the target page if the current page element in the target page meets the target conditions. The target condition is that the projection of the current page element on the horizontal axis of the screen and the projection on the vertical axis of the screen satisfy the target projection condition, or the coverage area of the current page element is greater than or equal to the area threshold. The startup time determination module is configured to determine the startup time of the target page based on the startup start time and the startup end time. The device further includes: The second end time determination module is configured to, when the callback function is called, if the current page element in the target page does not meet the target condition, repeatedly execute the above operations of registering the callback function with the page rendering class and determining whether the current page element in the target page meets the target condition when the callback function is called, until the current page element meets the target condition, and determine the current time point as the start-up end time of the target page.
8. An electronic device, characterized in that, include: processor; Memory used to store the processor's executable instructions; The processor is configured to execute the instructions to implement the method for determining page startup time as described in any one of claims 1 to 6.
9. A computer-readable storage medium, wherein when instructions in the computer-readable storage medium are executed by a processor of an electronic device, the electronic device is enabled to perform a method for determining page startup time as described in any one of claims 1 to 6.
Citation Information
Patent Citations
Acquisition method and device of first screen time of page
CN108322359A
Detection method and device for visible time of home screen page and electronic equipment
CN111258877A
Method and device for determining completion of page rendering and electronic equipment
CN114925303A