Page loading time length detection method and device, equipment and storage medium
A page loading and detection method technology, applied in the field of mobile Internet, can solve problems such as difficult to accurately detect page loading time, and achieve the effect of avoiding waste of monitoring resources and improving accuracy
Pending Publication Date: 2019-09-27
GUANGZHOU HUADUO NETWORK TECH
4 Cites 6 Cited by
AI-Extracted Technical Summary
Problems solved by technology
[0004] However, network requests in IOS are usually asynchronous requests, and the loaded page can only be displayed aft...
Method used
The detection device of the page load time length provided by the present embodiment, when the page is loaded by the loading start recording module, record the loading start time and start the timer; when the loading end recording module occurs the pre-configured reference object on the page, stop Timer; the loading time calculation module reads the current time of the timer, and determines the loading time of the page according to the difference between the current time and the loading start time, so as to solve the difficulty in determining the real moment when the page loading ends due to asynchronous network requests in the operating system , the asynchronous time is difficult to detect, which makes the detection of the loading time inaccurate. By configuring the reference object for the page, it is determined that the page loading is complete when the reference object appears, thereby improving the accuracy of the page loading time detection result.
The detection method of the page load time length that the present embodiment provides, by when page loads, record loading start time and start timer, when preconfigured reference object appears on the page, stop timer, read timer and stop The curre...
Abstract
The invention provides a page loading time length detection method and device, equipment and a storage medium, and relates to the technical field of mobile Internet, the page loading time length detection method comprises the following steps: recording the loading starting time and starting a timer during page loading; when a pre-configured reference object appears on the page, stopping the timer; and the current time of the timer is read, and the loading duration of the page is determined according to the difference value between the current time and the loading starting time. According to the technical scheme, the reference object is configured for the page, and the page loading is determined to be finished when the reference object appears, so that the accuracy of a page loading duration detection result is improved.
Application Domain
Software testing/debuggingWebsite content management +1
Technology Topic
Current timeStart time +3
Image
Examples
- Experimental program(1)
Example Embodiment
[0045] The embodiments of the present invention will be described in detail below. Examples of the embodiments are shown in the accompanying drawings, wherein the same or similar reference numerals indicate the same or similar elements or elements with the same or similar functions. The embodiments described below with reference to the accompanying drawings are exemplary, and are only used to explain the present invention, and cannot be construed as limiting the present invention.
[0046] Those skilled in the art can understand that, unless specifically stated otherwise, the singular forms "a", "an", "said" and "the" used herein may also include plural forms. It should be further understood that the term "comprising" used in the specification of the present invention refers to the presence of the described features, integers, steps, operations, elements and/or components, but does not exclude the presence or addition of one or more other features, Integers, steps, operations, elements, components, and/or groups thereof. It should be understood that when we refer to an element as being "connected" or "coupled" to another element, it can be directly connected or coupled to the other element, or intervening elements may also be present. In addition, “connected” or “coupled” used herein may include wireless connection or wireless coupling. The term "and/or" used herein includes all or any unit and all combinations of one or more associated listed items.
[0047] Those skilled in the art can understand that, unless otherwise defined, all terms (including technical and scientific terms) used herein have the same meanings as those commonly understood by those of ordinary skill in the art to which the present invention belongs. It should also be understood that terms such as those defined in a general dictionary should be understood as having a meaning consistent with the meaning in the context of the prior art, and unless specifically defined as here, they will not be idealized or overly Explain the formal meaning.
[0048] figure 1 It is a flowchart of a method for detecting page loading time provided by an embodiment. The method for detecting page loading time in this embodiment can be applied to multiple operating systems. In this embodiment, the IOS operating system is taken as an example for description.
[0049] Such as figure 1 As shown, the method for detecting the page loading time includes the following steps:
[0050] S110: When the page is loaded, record the loading start time and start a timer.
[0051] When the page is loaded, record the start time of page loading. In specific implementation, you can call a specific function or method at the beginning of page loading, or determine the time when an event is triggered as the loading start time, or you can set the first page loading time. The time of an element is determined as the loading start time.
[0052] In this embodiment, a global variable is used to record the loading start time. The global variable can be created by an object function or anywhere in the program; the global variable can be referenced by all objects or functions of the program, such as A specific function viewDidLoad method reference. The global variable referenced by the viewDidLoad method records the time point of the call as the start time point of loading.
[0053] When the page starts to load, the timer is automatically started. The timer is used to delay execution or repeatedly execute a method; for example, in the IOS operating system, the timer can include: NSTimer, CADisplayLink, GCD, etc.; when the page is loaded, the timer is automatically started to start timing.
[0054] S120: Stop the timer when a pre-configured reference object appears on the page.
[0055] In this embodiment, the reference (View) is used to mark that the page has been displayed or loaded. When a pre-configured reference object appears on the page, it means that the page load is over. The timer repeatedly searches for a reference object in the view hierarchy of the page. After finding the reference object, it determines whether the reference object is loaded or displayed. Once the loading is found, the timer is stopped. The reference object can be on the page Any interface element.
[0056] As the types of different pages may be different, the corresponding interface elements are also different. In order to facilitate the detection of the loading time of different pages, the corresponding interface elements are configured on different pages as references. When a specific page is detected, the corresponding interface element appears, indicating that the specific page has been loaded and the timer is stopped.
[0057] S130. Read the current time when the timer stops working, and determine the loading duration of the page according to the difference between the current time and the loading start time.
[0058] In this embodiment, when the page starts to load, the loading time is recorded through global variables, and a timer is started to find out whether a reference object appears on the page. When a reference object appears on the page, the page loading ends, the timer is stopped, and the timer stops working The current time of the time is used as the end time of loading.
[0059] By reading the current time when the timer stops working, the relative time point when the page loading ends is obtained; the relative time point when the page loading ends and the page loading start time are compared to calculate the page loading time.
[0060] The method for detecting page loading time provided in this embodiment records the loading start time and starts the timer when the page is loaded. When a pre-configured reference object appears on the page, the timer is stopped, and the current time when the timer stops working is read. Time is used as the loading end time, and the loading time of the page is determined according to the difference between the loading end time and the loading start time, which solves the problem of the asynchronous network request in the operating system to determine the real time when the page loading ends, resulting in inaccurate loading time detection In the solution of this embodiment, by configuring a reference object for the page, it is determined that the page loading is completed when the reference object appears, thereby improving the accuracy of the page loading duration detection result.
[0061] reference figure 2 , figure 2 It is another flow chart of the method for detecting page load duration provided by an embodiment. In one embodiment, before performing page loading, the method for detecting page load duration further includes:
[0062] S100. Obtain a configuration list, and determine whether the currently opened page is a designated detection page according to the configuration list.
[0063] In this embodiment, the finger detection page to be detected and the reference object of the designated detection page are configured in the background to form a configuration list, and the finger detection page and the reference object of the designated detection page are stored in the form of a data structure. Every time an application (Application, APP) is started, the configuration list will be pulled from the background.
[0064] image 3 Is a detailed flowchart of step S100 provided by an embodiment, such as image 3 As shown, for step S100, it may specifically include the following steps:
[0065] S1001, before the page is loaded, pull the configuration list from the configuration background and cache it.
[0066] Among them, the configuration list records the designated detection page that needs to be detected and the reference object of the designated detection page.
[0067] In order to improve the flexibility of page loading time detection, and to selectively monitor the loading time of one or certain pages, the designated detection page to be detected and the reference object of the designated detection page can be pre-configured in the configuration background. In this embodiment, the name of the designated detection page and its reference object type are saved in the configuration list to complete the pre-configuration of the designated detection page. Before the page loads, pull the configuration list from the configuration backend and cache the configuration list.
[0068] S1002. When the page is loaded, determine whether the currently opened page is the designated detection page, and if so, start the timer.
[0069] When the page is loaded, it is judged whether the currently opened page is the designated detection page, if it is, the timer is started to start the page loading duration detection, if not, the timer is not started, and the loading duration of the currently opened page is not detected.
[0070] Different from the waste of monitoring resources caused by the full detection scheme on the page, which results in the detection of loading time for some pages with low performance indicators, the scheme of this embodiment can save resources and improve the efficiency of page performance detection.
[0071] Further, in an embodiment, determining whether the currently opened page is a designated detection page in step S1002 may include:
[0072] S201. Obtain the currently opened page when the page is loaded.
[0073] In order to distinguish between different pages, a unique identifier can be set for each page, such as name, number, keyword, etc.; in the same way, the configuration list records the identifier corresponding to the designated detection page.
[0074] S202: Search for the currently open page in the configuration list; if so, execute S203, otherwise, execute S204.
[0075] In this embodiment, by specifying the identification of the detection page, the configuration list is used to search for the identification of the currently opened page, and the identification of the currently opened page is compared with the name of each specified detection page in the configuration list.
[0076] Exemplarily, after the page load starts and the timer is started, every short set time, such as the time corresponding to the frequency of screen refresh rate synchronization, obtain the currently opened page in the viewDidLoad method, and get the name of the currently opened page , Such as interface A, look for the same name as the currently opened page in the configuration list, namely interface A.
[0077] S203. Determine that the currently opened page is the designated detection page, and start the timer.
[0078] If there is a currently opened page in the configuration list, it means that the currently opened page is the designated detection page in the configuration list, and the loading time of the page needs to be detected. At this time, the timer is started to start the timing of the detection page loading time.
[0079] Exemplarily, the name of the currently opened page is interface A, and if the same name is found in the configuration list, it indicates that the currently opened page is the designated detection page.
[0080] S204: Do not start the timer.
[0081] If the currently opened page does not exist in the configuration list, it means that the currently opened page is not the detection page specified in the configuration list, the loading time of the test page is not required, and the timer is not started.
[0082] In order to make the technical solution of the present invention clearer and easier to understand, the specific implementation process and manner of each step in the technical solution are further described in detail below.
[0083] Due to the different types of reference objects, the conditions for determining whether the page has been loaded are also different. In this embodiment, when a pre-configured reference object appears on the page, it indicates that the page is loaded; for example, the type of the reference object can be a Web page (WebView) or a Table page (TableView). Different types of reference objects have different main interface elements. For example, on a Web page, the main interface element is a web page element, and on a Table page, the main interface element is a Tableview list.
[0084] In an embodiment, if the reference object is a Web page; the step of stopping the timer when a pre-configured reference object appears on the page in step S120 may include the following:
[0085] Detect web page elements pre-configured in the web page, and stop the timer when all the web page elements pre-configured in the web page appear.
[0086] Optionally, you can set the last web page element of the web page as the reference object. When the last web page element appears, it is judged that the page loading is finished; if the last web page element currently opened is a button, the button is used as The reference object, when the button appears, stop the timer.
[0087] What needs to be explained is that in the IOS system, WebView is a control to load H5 web resources. It comes with a loading end method. Since this method is used to detect the buried point in the callback method of the WebView loading, it needs to go deep into the business. In the WebView, it will cause business intrusion; and the solution provided in this embodiment serves as a condition for the end of loading when all webpage elements of the WebView are displayed, avoiding the risk of business intrusion and realizing non-intrusive detection.
[0088] In other embodiments, the following methods can also be used to determine that the Web page has been loaded, such as when the WebViewDidFinishLoad method is called to determine that the Web page is loaded, or when the OnDocumentComplete event is triggered to determine that the page is loaded.
[0089] In an embodiment, if the reference object is a Table page; in step S120, when a pre-configured reference object appears on the page, the step of stopping the timer may include:
[0090] Stop the timer when the cell element preconfigured in the Table page appears.
[0091] In this embodiment, the main element of the Table page is the TableView list. After the TableView list is refreshed, the cell element appears. When the cell element appears, it is determined that the Table page is loaded and the timer is stopped.
[0092] It should be noted that TableView is a control used to display the list. Its display timing is after the network request is completed to obtain the data, and then the list is refreshed to complete the display. It also needs to be detected in the method of completing the network request. It will also go deep into the business code to cause coupling. The technical solution provided in this embodiment uses cell elements in the Table page as the loading end condition, avoiding coupling and realizing decoupling detection.
[0093] In one embodiment, when the page loads in step S110, recording the loading start time and starting the timer includes the following steps:
[0094] S1101, when starting page loading, save the loading start time in the viewDidLoad method, and start a timer for timing at the same time.
[0095] Since the viewDidLoad method is used for initialization, it is called only when the reference object view is initialized. When the viewDidLoad method is called, it is determined that the page loading starts, and the time point when the viewDidLoad method is called is recorded as the loading start time point through a global variable, and the timer is notified to start at this time.
[0096] The timer can be a timer function, such as the CADisplayLink timer, which is called when the screen is refreshed. In this embodiment, by starting the CADisplayLink timer, in a very short period of time, the view hierarchy of the currently opened page is continuously searched for whether there is a reference object. After the reference object is found, it will be based on the reference object type, such as Generally, View, TableView, or WebView judge whether the reference object is loaded or displayed according to the corresponding method of the reference object type. Once the loading is found to be completed, the timer is stopped.
[0097] When it is determined that the currently opened page is the designated monitoring page, when the page is loaded, the viewDidLoad method is called when the reference object view is loaded, the time point of calling the viewDidLoad method is determined as the starting point of page loading, and the loading start time is recorded. In this embodiment, the loading start time is saved by a global variable in the viewDidLoad method.
[0098] Such as Figure 4 As shown, Figure 4 It is still another flowchart of the method for detecting page load duration provided by an embodiment. In one embodiment, after the step of determining the page load duration in step S130, it may further include:
[0099] Step S140: Establish an association relationship between the currently opened page and the loading time.
[0100] After the loading time is detected each time, an association relationship between the currently opened page and the loading time is established, so as to find the loading time of a specific page according to the association relationship.
[0101] For step S140, it may specifically include the following steps:
[0102] S1401: Obtain the currently opened page;
[0103] Optionally, acquiring a unique identifier of the currently opened page, such as a name, number, keywords, etc., may also be acquiring a frame image of the currently opened page.
[0104] S1402. Establish an association relationship between the currently opened page and the loading time, and store the association relationship in a designated directory.
[0105] Obtain the unique identifier of the currently opened page, and establish an association relationship between the identifier of the currently opened page and the loading duration, such as establishing the association relationship between the name of the currently opened page and the loading duration, or establishing the number and loading duration of the currently opened page And store the association relationship in the specified database for subsequent search and use.
[0106] In order to detect the loading time of a page more accurately, multiple loading time detections can be performed on the same page to establish an association relationship between the same page and multiple loading times, and save multiple association relationships of the same page in a specified database. Optionally, the average value of multiple loading durations can be averaged and the obtained average value can be saved.
[0107] Continue to refer Figure 4 Further, in an embodiment, the method for detecting page load time provided by this solution may further include:
[0108] Step S150: Search for the loading time of the designated detection page through the association relationship.
[0109] Wherein, the loading time is used to determine the loading performance of the designated detection page.
[0110] In the embodiment, in order to facilitate the query of the loading time of the specified detection page to improve the loading performance of the application page, the association relationship between the page and the loading time is obtained from the specified database to determine the loading performance of the specified detection page. For example, a specified threshold can be set. If the loading time of the specified detection page is greater than the set specified threshold, the loading time of the specified detection page is considered to be longer, and the developer needs to be reminded to improve the loading time of the specified detection page .
[0111] Optionally, for the specified detection page under different application versions, obtain the association relationship between the specified detection page and the loading time under different application versions, and find the loading time of the specified detection page under different application versions according to the association relationship, and obtain the Specify the loading performance of the detection page under different application versions. For example, the loading time of the specified detection page under the A application version is T1, and the loading time of the specified detection page under the B application version is T2. If T2 is greater than T1, the loading time of the specified detection page of the B application version is considered to be longer If it is longer, the developer needs to be reminded to improve the loading time of the designated detection page in the B application version.
[0112] The following describes in detail the relevant embodiments of the device for detecting the page loading time.
[0113] Figure 5 It is a schematic structural diagram of a device for detecting page loading time provided by an embodiment, such as Figure 5 As shown, the device for detecting the page loading duration includes: a loading start recording module 110, a loading end recording module 120, and a loading duration calculation module 130.
[0114] The loading start recording module 110 is used to record the loading start time and start a timer when the page is loaded; the loading end recording module 120 is used to stop the timer when a pre-configured reference object appears on the page The loading duration calculation module 130 is configured to read the current time when the timer stops working, and determine the loading duration of the page according to the difference between the current time and the loading start time.
[0115] In the device for detecting page loading time provided in this embodiment, the loading start recording module records the loading start time and starts a timer when the page is loaded; the loading end recording module stops the timer when a pre-configured reference object appears on the page; The loading duration calculation module reads the current time of the timer, and determines the loading duration of the page according to the difference between the current time and the loading start time, so as to solve the problem of the asynchronous network request in the operating system that it is difficult to determine the real time when the page loading ends, asynchronous time It is difficult to detect the problem of inaccurate loading time detection. By configuring a reference object for the page, the page loading is determined to be completed when the reference object appears, thereby improving the accuracy of the page loading time detection result.
[0116] In an embodiment, the device for detecting page loading time further includes a configuration judgment module, and the configuration judgment module includes:
[0117] The configuration list pulling unit is configured to pull the configuration list from the configuration background and cache it before the page is loaded; wherein the configuration list records the designated detection page and the reference of the designated detection page;
[0118] The page judgment unit is configured to judge whether the currently opened page is the designated detection page when the page is loaded, and if so, start the timer.
[0119] In an embodiment, the reference object is a Web page; the loading end recording module 120 is configured to stop the timer when all pre-configured web page elements in the Web page appear.
[0120] In an embodiment, the reference object is a Table page; the loading end recording module 120 is configured to stop the timer when a cell element pre-configured in the Table page appears.
[0121] In one embodiment, the loading start recording module 110 is used to save the loading start time in the viewDidLoad method when starting page loading, and at the same time start a timer for timing.
[0122] In one embodiment, the page judging unit is specifically configured to: when the page loads, obtain the currently opened page, and search for whether the currently opened page exists in the configuration list; if so, determine that the currently opened page is the Specify the detection page and start the timer, otherwise, the timer is not started.
[0123] In one embodiment, the device for detecting page loading time further includes an association relationship establishment module; the relationship establishment module is configured to obtain the currently opened page; establish an association relationship between the currently opened page and the loading time, and compare the The association relationship is stored in the specified directory.
[0124] In one embodiment, the device for detecting page loading duration further includes a loading duration searching module; the loading duration searching module is configured to find the loading duration of the designated detection page through the association relationship, and the loading duration is used to determine The loading performance of the designated detection page.
[0125] The device for detecting page loading time provided above has corresponding functions and beneficial effects when executing the method for detecting page loading time provided by any of the above embodiments.
[0126] An embodiment of the present invention also provides a computer device, including a memory, a processor, and a computer program stored in the memory and capable of running on the processor. When the processor executes the program, the implementation is as in any of the foregoing embodiments. The detection method of page loading time.
[0127] The computer device provided above has corresponding functions and beneficial effects when executing the method for detecting page loading time provided by any of the above embodiments.
[0128] The embodiment of the present invention also provides a storage medium containing computer-executable instructions, when the computer-executable instructions are executed by a computer processor, they are used to perform a method for detecting page loading time, including:
[0129] When the page loads, record the loading start time and start the timer;
[0130] Stop the timer when a pre-configured reference object appears on the page;
[0131] The current time of the timer is read, and the loading duration of the page is determined according to the difference between the current time and the loading start time.
[0132] Of course, a storage medium containing computer-executable instructions provided by an embodiment of the present invention is not limited to the above-mentioned page load time detection method operation, and can also execute the operations provided by any embodiment of the present invention. Related operations in the detection method of page loading time, and have corresponding functions and beneficial effects.
[0133] Through the above description of the embodiments, those skilled in the art can clearly understand that the present invention can be implemented by software and necessary general-purpose hardware. Of course, it can also be implemented by hardware, but in many cases the former is a better implementation. . Based on this understanding, the technical solution of the present invention essentially or the part that contributes to the existing technology can be embodied in the form of a software product. The computer software product can be stored in a computer-readable storage medium, such as a computer floppy disk. , Read-only memory (Read-Only Memory, ROM), random access memory (Random Access Memory, RAM), flash memory (FLASH), hard disk or optical disk, etc., including several instructions to make a computer device (may be a personal computer, A server, or a network device, etc.) executes the method for detecting the page load duration according to any embodiment of the present invention.
[0134] It should be understood that, although the various steps in the flowchart of the drawings are displayed in sequence as indicated by the arrows, these steps are not necessarily performed in sequence in the order indicated by the arrows. Unless explicitly stated in this article, the execution of these steps is not strictly limited in order, and they can be executed in other orders. Moreover, at least part of the steps in the flowchart of the drawings may include multiple sub-steps or multiple stages. These sub-steps or stages are not necessarily executed at the same time, but can be executed at different times, and the order of execution is also It is not necessarily performed sequentially, but may be performed alternately or alternately with other steps or at least a part of sub-steps or stages of other steps.
[0135] The above are only part of the embodiments of the present invention. It should be pointed out that for those of ordinary skill in the art, without departing from the principle of the present invention, several improvements and modifications can be made, and these improvements and modifications are also It should be regarded as the protection scope of the present invention.
PUM


Description & Claims & Application Information
We can also present the details of the Description, Claims and Application information to help users get a comprehensive understanding of the technical details of the patent, such as background art, summary of invention, brief description of drawings, description of embodiments, and other original content. On the other hand, users can also determine the specific scope of protection of the technology through the list of claims; as well as understand the changes in the life cycle of the technology with the presentation of the patent timeline. Login to view more.
Similar technology patents
Techniques for sentiment analysis of data using a convolutional neural network and a co-occurrence network
Owner:ORACLE INT CORP
Adaptive fault detection method for airplane rotation actuator driving device based on deep learning
Owner:BEIHANG UNIV
Video monitoring method and system
Owner:深圳辉锐天眼科技有限公司
Scene semantic segmentation method based on full convolution and long and short term memory units
Owner:UNIV OF ELECTRONIC SCI & TECH OF CHINA
Automatic or semi-automatic cooking equipment and batch charging mechanism thereof
Owner:AIC ROBOTICS TECH
Classification and recommendation of technical efficacy words
- improve accuracy
Golf club head with adjustable vibration-absorbing capacity
Owner:FUSHENG IND CO LTD
Stent delivery system with securement and deployment accuracy
Owner:BOSTON SCI SCIMED INC
Method for improving an HS-DSCH transport format allocation
Owner:NOKIA SOLUTIONS & NETWORKS OY
Catheter systems
Owner:ST JUDE MEDICAL ATRIAL FIBRILLATION DIV
Gaming Machine And Gaming System Using Chips
Owner:UNIVERSAL ENTERTAINMENT CORP