A method and device for statistically analyzing the page rendering duration

By recording start and end times of page rendering and using a timer to detect view presence, the method addresses inaccuracies in existing page rendering time measurements, ensuring accurate and complete rendering time calculation.

CN113760678BActive Publication Date: 2025-07-15BEIJING WODONG TIANJUN INFORMATION TECH CO LTD +1
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202110184887.4
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-02-10
Publication Date
2025-07-15
Estimated Expiration
2041-02-10

AI Technical Summary

Technical Problem

In the prior art, in the process of page rendering, there is a deviation between the page rendering time determined by burying points in each life cycle and the real rendering time, resulting in inaccurate statistics.

Method used

By recording the time point when the page starts rendering, determine whether the rendering time needs to be counted, turn on the timer to detect whether a specific view exists, record the time point when the page ends rendering, determine the rendering time based on the time points of the two, use the implementation order of the exchange viewDidLoad method, my_viewDidLoad method, and fetchData method, call the my_viewDidLoad method to record the start rendering time, and call the my_fetchData method to record the end rendering time.

Benefits of technology

It realizes accurate display of the first screen, improves the user experience, and obtains real page rendering time.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN113760678B_ABST
    Figure CN113760678B_ABST
Patent Text Reader

Abstract

The present invention discloses a method and device for counting the page rendering duration, which relates to the field of computer technology. The specific implementation of the method includes: recording the time point when the page starts to be rendered; determining whether it is necessary to count the page rendering duration, and if so, starting a timer to perform detection; after determining that it is necessary to count the page rendering duration, periodically detecting whether a specific view exists in the current page, and if so, recording the time point when the page ends to be rendered according to the determined specific view; determining the page rendering duration according to the time point when the page starts to be rendered and the time point when the page ends to be rendered. This implementation can completely and effectively display the first-screen image, enabling the main content of the page to be reflected, improving the user experience, and at the same time, accurate and real page rendering duration can be obtained.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of computer technology, and in particular, to a method and device for statistically calculating the page rendering duration. Background Art

[0002] Existing methods for statistically calculating the page rendering duration involve adding markers at various life cycles of the page, including life cycles such as page loading, initial page rendering completion, page display, page unloading, etc., and then determining the page rendering duration based on time points.

[0003] In the process of implementing the present invention, the inventors found that there are at least the following problems in the existing technology:

[0004] During the page rendering process, generally, the time from when the page starts to be created to the appearance of the first frame is used as the page rendering duration, but the first frame is not necessarily a complete and effective first rendering; when there are network requests or asynchronous rendering on the page, there is a certain deviation between the page rendering duration obtained by adding markers at each life cycle of the page and the actual page rendering duration. Therefore, in the above situations, the statistical calculation of the page rendering duration is inaccurate. Summary of the Invention

[0005] In view of this, embodiments of the present invention provide a method and device for statistically calculating the page rendering duration, which can completely and effectively display the first-screen image, enabling the main content of the page to be reflected, improving the user experience, and at the same time, obtaining an accurate and actual page rendering duration.

[0006] To achieve the above object, according to one aspect of the embodiments of the present invention, there is provided a method for statistically calculating the page rendering duration, including:

[0007] Recording the time point when the page starts to be rendered;

[0008] Determining whether it is necessary to statistically calculate the page rendering duration, and if so, starting a timer to perform detection;

[0009] After determining that it is necessary to statistically calculate the page rendering duration, periodically detecting whether a specific view exists in the current page, and if so, recording the time point when the page ends to be rendered according to the determined specific view;

[0010] Determining the page rendering duration according to the time point when the page starts to be rendered and the time point when the page ends to be rendered.

[0011] Optionally, the method further includes:

[0012] Before recording the time point when the page starts to be rendered, obtaining and saving page configuration data.

[0013] Optionally, the page configuration data includes the specific view.

[0014] Optionally, determining whether it is necessary to count the page rendering duration includes:

[0015] Comparing the current page configuration data with the saved page configuration data, and then determining whether it is necessary to count the page rendering duration.

[0016] Optionally, the method further includes:

[0017] Initializing the page after recording the time point when the page starts to be rendered.

[0018] Optionally, the timing detection of whether a specific view exists in the current page includes:

[0019] Traversing the sub-views of the current page and comparing whether the sub-views are the same as the specific view in the saved page configuration data.

[0020] Optionally, determining the page rendering duration according to the time point when the page starts to be rendered and the time point when the page ends to be rendered includes:

[0021] The difference between the time point when the page ends to be rendered and the time point when the page starts to be rendered is the page rendering duration.

[0022] According to another aspect of the embodiments of the present invention, there is provided a device for counting page rendering duration, including:

[0023] A recording module, configured to record the time point when the page starts to be rendered;

[0024] A judgment module, configured to judge whether it is necessary to count the page rendering duration. If so, start a timer to perform detection;

[0025] A search module, configured to, after determining that it is necessary to count the page rendering duration, periodically detect whether a specific view exists in the current page. If so, record the time point when the page ends to be rendered according to the determined specific view;

[0026] A data processing module, configured to determine the page rendering duration according to the time point when the page starts to be rendered and the time point when the page ends to be rendered.

[0027] According to another aspect of the embodiments of the present invention, there is provided a statistical electronic device for page rendering duration, including:

[0028] One or more processors;

[0029] A storage device, configured to store one or more programs,

[0030] When the one or more programs are executed by the one or more processors, the one or more processors implement the method for statistically analyzing the page rendering duration provided by the present invention.

[0031] According to another aspect of the embodiments of the present invention, there is provided a computer-readable medium having a computer program stored thereon, and when the program is executed by a processor, the method for statistically analyzing the page rendering duration provided by the present invention is implemented.

[0032] One embodiment of the above invention has the following advantages or beneficial effects: By adopting the technical means of swapping the implementation order of the viewDidLoad method and the my_viewDidLoad method, and the fetchData method and the my_fetchData method; calling the my_viewDidLoad method to record the time point when the page starts to be rendered; calling the my_fetchData method, and by executing the detcting method, comparing based on the tag value of a predetermined view to obtain the end time point endTime when the page finishes being rendered; and determining the page rendering duration according to the difference between the two, it overcomes the technical problems that during the page rendering process, it is impossible to determine the first effective rendering of the page; or, when there are network requests or asynchronous rendering on the page, there is a deviation between the page rendering duration determined by data embedding and the real page rendering duration, resulting in inaccurate statistics of the page rendering duration. Furthermore, it achieves the technical effects of being able to completely and effectively display the first-screen image, enabling the main content of the page to be reflected, improving the user experience, and at the same time, being able to obtain an accurate and real page rendering duration.

[0033] The further effects of the above non-conventional optional methods will be described in combination with specific embodiments below. BRIEF DESCRIPTION OF THE DRAWINGS

[0034] The drawings are used to better understand the present invention and do not constitute an improper limitation to the present invention. Among them:

[0035] Figure 1 is an exemplary system architecture diagram suitable for applying the method for statistically analyzing the page rendering duration or the device for statistically analyzing the page rendering duration according to the embodiments of the present invention;

[0036] Figure 2 is a schematic diagram of the main process of the method for statistically analyzing the page rendering duration according to the embodiments of the present invention;

[0037] Figure 3 is a schematic diagram of the detailed process of the method for statistically analyzing the page rendering duration according to the embodiments of the present invention;

[0038] Figure 4 is a schematic diagram of the main modules of the device for statistically analyzing the page rendering duration according to the embodiments of the present invention;

[0039] Figure 5 It is a schematic structural diagram of a computer system of a terminal device or a server suitable for implementing the embodiments of the present invention. Detailed implementation manners

[0040] The following describes exemplary embodiments of the present invention with reference to the accompanying drawings. Various details of the embodiments of the present invention are included to facilitate understanding, and they should be considered merely exemplary. Therefore, those of ordinary skill in the art should recognize that various changes and modifications can be made to the embodiments described herein without departing from the scope and spirit of the present invention. Similarly, for the sake of clarity and conciseness, descriptions of well-known functions and structures are omitted below.

[0041] Figure 1 It shows an exemplary system architecture diagram of a method for statistically analyzing page rendering duration or a device for statistically analyzing page rendering duration applicable to the embodiments of the present invention. As Figure 1 shown, the exemplary system architecture of the method for statistically analyzing page rendering duration or the device for statistically analyzing page rendering duration in the embodiments of the present invention includes:

[0042] As Figure 1 shown, the system architecture 100 may include terminal devices 101, 102, 103, a network 104, and a server 105. The network 104 is used to provide a medium for communication links between the terminal devices 101, 102, 103 and the server 105. The network 104 may include various connection types, such as wired, wireless communication links, or fiber optic cables, etc.

[0043] Users can use the terminal devices 101, 102, 103 to interact with the server 105 through the network 104 to receive or send messages, etc. Various communication page front-end applications can be installed on the terminal devices 101, 102, 103, such as shopping applications, web browser applications, search applications, instant messaging tools, mailbox page front-ends, social platform software, etc.

[0044] The terminal devices 101, 102, 103 can be various electronic devices with a display screen and supporting web browsing, including but not limited to smart phones, tablet computers, laptop portable computers, and desktop computers, etc.

[0045] The server 105 can be a server providing various services. For example, it is a background management server that supports shopping websites browsed by users using the terminal devices 101, 102, 103. The background management server can analyze and process data such as product information query requests received, and feedback the processing results (such as product information) to the terminal devices 101, 102, 103.

[0046] It should be noted that the method for counting the page rendering duration provided by the embodiments of the present invention is generally executed by the server 105. Correspondingly, the device for counting the page rendering duration is generally set in the server 105.

[0047] It should be understood that Figure 1 the number of terminal devices, networks, and servers in

[0048] Figure 2 is a schematic diagram of the main process of the method for counting the page rendering duration according to the embodiments of the present invention. As Figure 2 shown, the method for counting the page rendering duration of the present invention includes:

[0049] Step S201, record the time point when the page starts to be rendered.

[0050] Exemplarily, the front end of the page sends a page configuration information request to the back end of the page, receives and saves the page configuration data sent by the back end of the page. The page configuration data may include the view controller, which is the listening object for the page rendering duration, the function ID of the page loading function, etc. The front end of the page uses the SwizzleMethod method to exchange the implementation order of the viewDidLoad method and the my_viewDidLoad method, and the fetchData method and the my_fetchData method, and overrides the +load method. Among them, the my_viewDidLoad method is used to record the time when the page starts to be rendered, and the my_fetchData method is used to record the time when the page ends to be rendered. The front end of the page creates a page according to the overridden +load method and calls the my_viewDidLoad method to record the time when the page starts to be rendered.

[0051] Step S202, determine whether it is necessary to count the page rendering duration. If so, start a timer to perform detection.

[0052] Exemplarily, the front end of the page calls the my_fetchData method, compares the current page configuration data with the stored page configuration data, and determines whether it is necessary to count the page rendering duration. If the class identifier in the current page configuration data and the function ID in the network request parameter are the same as the values of the viewController field and the functionId field in the stored page configuration data, the front end of the page starts a timer to execute the detcting method.

[0053] Step S203, after determining that the page rendering duration needs to be counted, periodically detect whether a specific view exists in the current page. If so, record the time point when the page finishes rendering according to the determined specific view.

[0054] Exemplarily, after the page front-end determines that the page rendering duration needs to be counted, it starts a timer to execute the detcting method. The page front-end calls the detcting method to compare whether the tag value of the sub-view is the same as the tag value of the specific view in the page configuration data. If they are the same, it is determined that the specific view exists in the current page and the first screen is fully loaded. The page front-end records the current time point as the time point when the page finishes rendering.

[0055] Step S204, determine the page rendering duration according to the time point when the page starts rendering and the time point when the page finishes rendering.

[0056] Exemplarily, according to the time point when the rendering starts recorded in step S202 and the time point when the page finishes rendering recorded in step S204, the page front-end calculates the difference between the time point when the page finishes rendering and the time point when the rendering starts. The difference between the time point when the page finishes rendering and the time point when the rendering starts is the page rendering duration.

[0057] In the embodiment of the present invention, by recording the time point when the page starts rendering; determining whether the page rendering duration needs to be counted, and if so, starting a timer to perform detection; after determining that the page rendering duration needs to be counted, periodically detecting whether a specific view exists in the current page, and if so, recording the time point when the page finishes rendering according to the determined specific view; determining the page rendering duration according to the time point when the page starts rendering and the time point when the page finishes rendering and other steps, it is possible to completely and effectively display the first-screen image, so that the main content of the page is reflected, improving the user experience. At the same time, accurate and real page rendering duration can be obtained.

[0058] Figure 3 is a schematic diagram of the detailed process of the method for counting the page rendering duration according to the embodiment of the present invention. As Figure 3 shown, the method for counting the page rendering duration of the present invention includes:

[0059] Step S301, send a request for the configuration information of the page to the page back-end.

[0060] Exemplarily, when a user accesses a page through the page front-end, the page front-end sends a configuration information request to the page back-end. The configuration information request includes the configuration information of the page for statistically calculating the page rendering duration. The configuration information of the page includes: the listening object for the page rendering duration, representing the object to be listened to, denoted by viewController; the end determination criterion for the page rendering duration, representing the tag value of a specific sub-view when the timing ends, denoted by tag; the loading function of the page, representing the network request to be linked, denoted by functionId.

[0061] Step S302, receive and save the page configuration data.

[0062] Exemplarily, after the page front-end sends a configuration information request for the page to the page back-end, it receives the configuration information of the page returned by the page back-end, including information such as the listening object for the page rendering duration, the end determination criterion, and the loading function of the page, that is, the specific data of viewController, tag, and functionId. After obtaining the specific data of the page configuration information, that is, the page configuration data, the page configuration data is saved to PageRenderingManager.

[0063] Furthermore, the page configuration information data may include:

[0064] ”viewcontroller”: ”TestViewController”;

[0065] ”tag”: ”123”;

[0066] ”functionId”: “getPostDetailPageData”;

[0067] ”functionId”: ”getTopicHomePageData;

[0068] ”functionId”: ”getPostList”.

[0069] Step S303, create a UI listener and an A network library.

[0070] Exemplarily, after the page front-end receives and saves the page configuration data sent by the page back-end, it creates a UI listener and an A network library, that is, UIViewController and ANetwork. UIViewController is used to listen to page UI actions, and ANetwork is used to record the resource information of network requests on the page (such as status, type, size, time, etc.).

[0071] Step S304, rewrite the +load method.

[0072] Exemplarily, after the page front-end creates the UI listener and the A network library, it rewrites the +load method through the SwizzleMethod method. SwizzleMethod is a method for implementing swapping in the IOS page front-end, which can swap the implementation order of the existing methods in the +load method. The page front-end rewrites the +load method through the SwizzleMethod method, including swapping the implementation order of the viewDidLoad method and the my_viewDidLoad method, and swapping the implementation order of the fetchData method and the my_fetchData method.

[0073] Furthermore, since the page front-end rewrites the +load method through the SwizzleMethod method and swaps the implementation order of the viewDidLoad method and the my_viewDidLoad method, and the fetchData method and the my_fetchData method, during the page creation process, when the page front-end executes, it first calls the my_viewDidLoad method and then the viewDidLoad method; when the page front-end executes, it first calls the my_fetchData method and then the fetchData method.

[0074] Step S305, call the my_viewDidLoad method.

[0075] Exemplarily, after the page front-end rewrites the +load method, when it first accesses the view of the UIViewController, it calls the loadview method to create the view. At the beginning of the page life cycle, it first calls the my_viewDidLoad method, and records the time point when the page starts to render through the my_viewDidLoad method, and defines the time point when the page starts to render as startTime. By defining the start time point of page rendering, that is, the time point from page initialization to the display of the first UI element, the display of the first UI element can be a waiting animation for data loading or the like. It is not just starting from the UI thread as the start time point of page rendering, which can more accurately determine the start time of page rendering.

[0076] Step S306, call the viewDidLoad method.

[0077] Exemplarily, when the page front-end first accesses the view of UIViewController, the loadview method is called to create the view; after the view is created, the viewDidLoad method is called to initialize the interface elements; among them, the viewDidLoad method is used to initialize the interface elements.

[0078] Exemplarily, after the page front-end calls the my_viewDidLoad method to record the start time point of page rendering as startTime, it then calls the viewDidLoad method to initialize the page. During the process of calling viewDidLoad, the page front-end can initiate a network request to the page back-end at any time. By calling the fetchPageData method, it requests the data of each Page, and at the same time records the resource information of the network request on the page through ANetwork. After receiving the request, the page back-end sends the file of the network request to the page front-end. After receiving the file sent by the page back-end, the page front-end fills the data for the UI and re-renders. When there is a network request on the page, there is a deviation between the page rendering duration obtained by the data embedding method and the actual page rendering duration, which will lead to inaccurate statistics of the page rendering duration.

[0079] Step S307, call the my_fetchData method.

[0080] Exemplarily, during the process of filling data for the UI and re-rendering after the page front-end receives the file sent by the page back-end, it calls the my_fetchData method to determine whether to count the page rendering duration. The my_fetchData method makes a judgment based on the current page configuration data to determine whether to count the page rendering duration. The class selector corresponding to the current page configuration data corresponds to the viewController field stored in the PageRenderingManager; the functionId in the network request parameter of the current page configuration data corresponds to the functionId field stored in the PageRenderingManager.

[0081] Exemplarily, the page front-end determines based on the class identifier corresponding to the current page configuration data, including: whether the value of the class identifier of the current page is the same as the value of the viewController field in the page configuration data stored in the PageRenderingManager; the page front-end determines based on the functionId in the network request parameters in the current page configuration data, including: whether the functionId in the network request parameters in the current page is the same as the value of the functionId field in the page configuration data stored in the PageRenderingManager. If the class selector corresponding to the current page configuration data and the functionId in the network request parameters exist in the page configuration information data of the PageRenderingManager, the page front-end starts a timer to execute the detcting method.

[0082] Further, for example, if the class identifier in the current page configuration data is "TestViewController" and the functionId in the network request parameters is "getPostDetailPageData", and the value of the viewController field in the page configuration data stored in the PageRenderingManager is "TestViewController" and the value of the functionId field is "getPostDetailPageData", then start a timer to execute the detcting method.

[0083] Step S308, start a timer and execute the detcting method.

[0084] Exemplarily, if the class identifier in the current page configuration data and the functionId in the network request parameters are the same as the value of the viewController field and the value of the functionId field in the page configuration data stored in the PageRenderingManager, the page front-end starts a timer to execute the detcting method. The detcting method is used to find whether a specific view exists in the current page to determine whether the first-screen loading is completed; among them, when finding a specific view, it is judged by comparing the tag value of the view.

[0085] Exemplarily, after the front-end of the page starts a timer to execute the detcting method, it traverses the sub-views of the page at regular intervals, and compares whether the tag value of the sub-view is the same as the tag value of the specific view in the page configuration data of the PageRenderingManager for the current page, so as to determine whether the specific view exists in the current page. If it is determined that the specific view exists in the current page, it means that the first effective rendering is completed, the interface elements (or page content) of the first screen are fully loaded, and the front-end of the page records the current time point as the time point when the page finishes rendering, and defines the time point when the page finishes rendering as endTime.

[0086] Furthermore, the front-end of the page pre-sets a traversal time threshold. If the traversal of the sub-views of the page by calling the detcting method exceeds the pre-set traversal time threshold, the search is stopped and a traversal timeout message is prompted.

[0087] Step S309, determine the page rendering duration.

[0088] Exemplarily, the front-end of the page obtains the startTime when the page starts rendering by calling the my_viewDidLoad method according to step S305 and calls the my_fetchData method in steps S307 - S308. By executing the detcting method and making a comparison based on the tag value of the predetermined view, the endTime when the page finishes rendering is obtained. The page rendering duration cost = endTime - startTime is calculated according to the difference between endTime and startTime, that is, the real page rendering duration. After determining the page rendering duration, the front-end of the page reports the page rendering duration cost to the back-end of the page.

[0089] The page rendering duration determined according to the traditional data tracking method can only be the time from when the page is created to when it is initialized. When there is a network request, there is a deviation between the page rendering duration obtained by data tracking and the real page rendering duration, resulting in inaccurate statistics of the real page rendering duration (the time from when the page is initialized to when the final UI drawing is completed), that is, inaccurate statistics of the page rendering duration for completing the first effective rendering to obtain a complete first-screen page. In the present invention, the startTime when the page starts rendering is obtained by calling the my_viewDidLoad method, the endTime when the page finishes rendering is obtained by calling the my_fetchData method, and the page rendering duration is determined according to the difference between the two, so that the real and accurate page rendering duration can be obtained.

[0090] Step S310, call the fetchData method.

[0091] Exemplarily, the page front-end first calls the my_viewDidLoad method to obtain the start time point startTime of page rendering, then calls the my_fetchData method to obtain the end time point endTime of page rendering, calculates the page rendering duration cost based on the difference between endTime and startTime, that is, the real page rendering duration, and then calls the fetchData method to continue obtaining other data; where the fetchData method is a method for extracting data.

[0092] In the embodiment of the present invention, by sending a page configuration information request to the page back-end; receiving and saving page configuration data; creating a UI listener and an A network library; overriding the +load method; calling the my_viewDidLoad method; calling the viewDidLoad method; calling the my_fetchData method; starting a timer to execute the detcting method; determining the page rendering duration; calling the fetchData method and other steps, the first-screen image can be completely and effectively displayed, enabling the main content of the page to be reflected, improving the user experience, and at the same time, an accurate and real page rendering duration can be obtained.

[0093] Figure 4 It is a schematic diagram of the main modules of the page rendering duration statistical device according to the embodiment of the present invention, as Figure 4 shown, the page rendering duration statistical device 400 of the present invention includes:

[0094] A recording module 401, configured to record the time point when the page starts to be rendered.

[0095] Exemplarily, the page front-end sends a page configuration information request to the page back-end, and receives and saves the page configuration data sent by the page back-end. The page configuration data may include a view controller which is a listening object for the page rendering duration, a function ID of the page loading function, etc. The page front-end uses the SwizzleMethod method to exchange the implementation order of the viewDidLoad method and the my_viewDidLoad method, and the fetchData method and the my_fetchData method, and overrides the +load method. Among them, the my_viewDidLoad method is used to record the start time of page rendering, and the my_fetchData method is used to record the end time of page rendering. The page front-end creates a page according to the overridden +load method, and the recording module 401 calls the my_viewDidLoad method to record the time point when the page starts to be rendered

[0096] A judgment module 402, configured to judge whether it is necessary to count the page rendering duration, and if so, start a timer to execute detection.

[0097] Exemplarily, the front-end of the page calls the my_fetchData method, compares the current page configuration data with the stored page configuration data, and determines whether to count the page rendering duration through the determination module 402. If the class identifier in the current page configuration data and the functionId in the network request parameters are the same as the values of the viewController field and the functionId field in the stored page configuration data, the front-end of the page determines through the determination module 403 that it is necessary to count the page rendering duration, and the front-end of the page starts a timer to execute the detcting method.

[0098] The search module 403 is used to periodically detect whether a specific view exists in the current page after determining that it is necessary to count the page rendering duration. If so, record the time point when the page finishes rendering according to the determined specific view.

[0099] Exemplarily, after the front-end of the page determines through the determination module 402 that it is necessary to count the page rendering duration, it starts a timer to execute the detcting method. The front-end of the page calls the detcting method, and through the search module 403, compares whether the tag value of the sub-view is the same as the tag value of the specific view in the page configuration data. If they are the same, it is determined that the specific view exists in the current page and the first screen is fully loaded. The front-end of the page records the current time point as the time point when the page finishes rendering through the recording module 401.

[0100] The data processing module 404 is used to determine the page rendering duration according to the time point when the page starts rendering and the time point when the page finishes rendering.

[0101] Exemplarily, according to the time point when the rendering starts recorded by the recording module 401 and the time point when the page finishes rendering, the data processing module 404 at the front-end of the page calculates the difference between the time point when the page finishes rendering and the time point when the rendering starts. The difference between the time point when the page finishes rendering and the time point when the rendering starts is the page rendering duration.

[0102] In the embodiments of the present invention, through modules such as the recording module, the determination module, the search module, and the data processing module, the first-screen image can be completely and effectively displayed, enabling the main content of the page to be reflected, improving the user experience, and at the same time, an accurate and real page rendering duration can be obtained.

[0103] Figure 5 It is a schematic structural diagram of a computer system of a terminal device suitable for implementing the embodiments of the present invention. As Figure 5 shown, the computer system 500 of the terminal device in the embodiments of the present invention includes:

[0104] A central processing unit (CPU) 501 that can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM) 502 or a program loaded from a storage section 508 into a random access memory (RAM) 503. In the RAM 503, various programs and data required for the operation of the system 500 are also stored. The CPU 501, the ROM 502, and the RAM 503 are connected to each other via a bus 504. An input / output (I / O) interface 505 is also connected to the bus 504.

[0105] The following components are connected to the I / O interface 505: an input section 506 including a keyboard, a mouse, etc.; an output section 507 including a cathode ray tube (CRT), a liquid crystal display (LCD), etc. and a speaker, etc.; a storage section 508 including a hard disk, etc.; and a communication section 509 including a network interface card such as a LAN card, a modem, etc. The communication section 509 performs communication processing via a network such as the Internet. A drive 510 is also connected to the I / O interface 505 as needed. A removable medium 511, such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, etc., is mounted on the drive 510 as needed so that a computer program read from it can be installed into the storage section 508 as needed.

[0106] Specifically, according to the embodiments disclosed in the present invention, the processes described above with reference to the flowcharts can be implemented as computer software programs. For example, the embodiments disclosed in the present invention include a computer program product that includes a computer program carried on a computer-readable medium, and the computer program contains program codes for performing the methods shown in the flowcharts. In such an embodiment, the computer program can be downloaded and installed from a network via the communication section 509, and / or installed from the removable medium 511. When the computer program is executed by the central processing unit (CPU) 501, the above-described functions defined in the system of the present invention are executed.

[0107] It should be noted that the computer-readable medium shown in the present invention can be a computer-readable signal medium, a computer-readable storage medium, or any combination of the above two. The computer-readable storage medium can be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination of the above. More specific examples of the computer-readable storage medium can include, but are not limited to: an electrical connection with one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above. In the present invention, the computer-readable storage medium can be any tangible medium that contains or stores a program, and this program can be used by or in conjunction with an instruction execution system, apparatus, or device. In the present invention, the computer-readable signal medium can include a data signal propagated in a baseband or as part of a carrier wave, in which the computer-readable program code is carried. Such a propagated data signal can take various forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination of the above. The computer-readable signal medium can also be any computer-readable medium other than the computer-readable storage medium, and this computer-readable medium can send, propagate, or transmit a program for use by or in conjunction with an instruction execution system, apparatus, or device. The program code contained on the computer-readable medium can be transmitted by any suitable medium, including but not limited to: wireless, wire, optical cable, RF, etc., or any suitable combination of the above.

[0108] The flowcharts and block diagrams in the accompanying drawings illustrate the possible architectures, functions, and operations of systems, methods, and computer program products according to various embodiments of the present invention. In this regard, each block in the flowchart or block diagram can represent a module, a program segment, or a part of code, and the above module, program segment, or part of code contains one or more executable instructions for implementing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the blocks may occur in a different order than marked in the accompanying drawings. For example, two consecutive blocks shown can actually be executed substantially in parallel, and they can sometimes be executed in the reverse order, depending on the functions involved. It should also be noted that each block in the block diagram or flowchart, and the combination of blocks in the block diagram or flowchart, can be implemented by a dedicated hardware-based system for performing the specified functions or operations, or can be implemented by a combination of dedicated hardware and computer instructions.

[0109] The modules involved in the embodiments of the present invention can be implemented in software or in hardware. The described modules can also be provided in a processor. For example, it can be described as: a processor includes a recording module, a judging module, a searching module, and a data processing module. Among them, the names of these modules do not constitute a limitation on the modules themselves in some cases. For example, the data processing module can also be described as "a module for calculating the page rendering duration based on the start time point and the end time point of page rendering".

[0110] As another aspect, the present invention also provides a computer-readable medium, which can be included in the device described in the above embodiments; or it can exist alone without being assembled into the device. The above computer-readable medium carries one or more programs. When the above one or more programs are executed by the device, the device includes: recording the start time point of page rendering; judging whether it is necessary to count the page rendering duration. If so, start a timer to perform detection; after determining that it is necessary to count the page rendering duration, periodically detect whether a specific view exists in the current page. If so, record the end time point of page rendering according to the determined specific view; determine the page rendering duration according to the start time point of page rendering and the end time point of page rendering.

[0111] According to the technical solution of the embodiments of the present invention, the first-screen image can be completely and effectively displayed, so that the main content of the page can be reflected, the user experience can be improved, and at the same time, an accurate page rendering duration can be obtained.

[0112] The above specific embodiments do not constitute a limitation on the protection scope of the present invention. Those skilled in the art should understand that various modifications, combinations, sub-combinations, and substitutions can occur depending on design requirements and other factors. Any modifications, equivalent substitutions, and improvements made within the spirit and principle of the present invention shall be included within the protection scope of the present invention.

Claims

1. A method for counting the page rendering duration, characterized in that, Including: Rewrite the +load method, where the +load method is used to load the page; swap the implementation order of the viewDidLoad method and the my_viewDidLoad method, and swap the implementation order of the fetchData method and the my_fetchData method; among them, the my_viewDidLoad method is used to record the start time of page rendering, the my_fetchData method is used to record the end time of page rendering, the viewDidLoad method is used to initialize interface elements, and the fetchData method is used to continue to obtain data after determining the page rendering duration; Record the start time point of page rendering; Judge whether it is necessary to count the page rendering duration. If so, start a timer to perform detection; After determining that it is necessary to count the page rendering duration, regularly detect whether a specific view exists in the current page. If so, record the end time point of page rendering according to the determined specific view; Determine the page rendering duration according to the start time point and the end time point of page rendering.

2. The method according to claim 1, characterized in that, The method further includes: Before recording the start time point of page rendering, obtain and save page configuration data, where the page configuration data includes the specific view.

3. The method according to claim 2, wherein The judgment of whether it is necessary to count the page rendering duration includes: Compare the current page configuration data with the saved page configuration data, and then judge whether it is necessary to count the page rendering duration.

4. The method according to claim 2, characterized in that, The regular detection of whether a specific view exists in the current page includes: Traverse the subviews of the current page and compare whether the subviews are the same as the specific view in the saved page configuration data.

5. The method according to claim 1, wherein Rewrite the +load method through the SwizzleMethod method.

6. The method according to claim 1, wherein Determine the page rendering duration according to the start time point and the end time point of page rendering, including: The difference between the end time point of page rendering and the start time point of page rendering is the page rendering duration.

7. An electronic device for statistically calculating the page rendering duration, characterized in that, Including: One or more processors; A storage device 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 according to any one of claims 1-6.

8. A computer-readable medium having a computer program stored thereon, characterized in that, When the program is executed by the processor, it implements the method according to any one of claims 1-6.

9. A statistical device for page rendering duration, characterized in that, Including: A recording module for recording the start time point of page rendering; A judgment module for judging whether it is necessary to count the page rendering duration. If so, start a timer to perform detection; A search module for regularly detecting whether a specific view exists in the current page after determining that it is necessary to count the page rendering duration. If so, record the end time point of page rendering according to the determined specific view; A data processing module for determining the page rendering duration according to the start time point and the end time point of page rendering; The recording module is further used for: Rewrite the +load method, where the +load method is used to load the page; Swap the implementation order of the viewDidLoad method and the my_viewDidLoad method, and the implementation order of the fetchData method and the my_fetchData method; among them, the my_viewDidLoad method is used to record the time when the page starts to be rendered, the my_fetchData method is used to record the time when the page ends to be rendered, the viewDidLoad method is used to initialize the interface elements, and the fetchData method is used to continue to obtain data after determining the page rendering duration.

Citation Information

Patent Citations

  • Method and system for calculating page first screen rendering time

    CN109344044A

  • Application above-the-fold rendering measurements

    US20120204094A1