Method, device, equipment and storage medium for determining page loading time
By detecting preset trigger events and updating waiting time, the problem of inability to evaluate page loading performance is solved, and accurate evaluation and performance evaluation of page loading time is achieved.
Patent Information
- Application Number
- CN202010711050.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2020-07-22
- Publication Date
- 2025-03-14
- Estimated Expiration
- 2040-07-22
AI Technical Summary
The prior art cannot accurately evaluate page loading performance because it is impossible to know in real time when the main page data is loaded.
By detecting the preset trigger event, the waiting time is determined, and the waiting time is updated based on the execution time of the current logic until the preset condition is met, the page load time is determined.
It realizes the loading time of the target page through thread idle and busy notifications, thereby evaluating page loading performance.
Smart Images

Figure CN111930438B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of computer technology, and in particular to a method, device, equipment and storage medium for determining a page loading time. Background Art
[0002] With the development of computer technology, various applications have gradually entered people's lives. When people use applications, the applications will display different pages to show users corresponding information. The process of displaying pages can be as follows:
[0003] The terminal receives the page data of the target page and first loads the main page data, for example, all the text content of an article and the corresponding page design, and then the terminal loads other data, for example, advertisements. After the above loading is completed, the terminal can display the complete page.
[0004] In the process of implementing this application, the inventor found that the prior art has at least the following problems:
[0005] During the process of loading page data, testers cannot know when the main page data is loaded, and thus cannot evaluate the page loading performance. Summary of the invention
[0006] The embodiment of the present application provides a method, device, equipment and storage medium for determining the page loading time, which can solve the problem of being unable to evaluate the page loading performance. The technical solution is as follows:
[0007] In one aspect, a method for determining a page loading time is provided, the method comprising:
[0008] Load the target page;
[0009] When a preset trigger event is detected, the waiting time is determined as an initial value, and an execution end event of the first logic currently executed by the target page is detected. When the execution end event is detected, the time between the execution end time point and the time point of the preset trigger event is determined as the execution time of the first logic currently executed;
[0010] The waiting time is updated based on the execution time of the currently executed first logic, and the loading of the target page is detected after each updated waiting time, until a preset condition is met to determine the page loading time of the target page.
[0011] Optionally, the loading of the target page is detected after each updated waiting time, until a preset condition is met to determine the page loading time of the target page, including:
[0012] After the waiting time is updated, detecting an execution end event of the second logic currently executed by the target page, and when the execution end event is detected, determining the duration between the execution end time point and the previous execution end time point as the execution duration of the second logic currently executed;
[0013] If the execution durations determined within the preset duration do not exceed the first duration threshold, then based on the start time point of the preset duration and the start loading time point of the target page, determine the page loading duration of the target page; and / or,
[0014] If the determined execution time exceeds the first time threshold within the preset time, the process switches to updating the waiting time based on the execution time of the second logic currently being executed.
[0015] Optionally, when a preset triggering event is detected, determining the waiting time as an initial value includes:
[0016] After it is detected that the loading of the main page data of the target page is completed, the waiting time is determined as an initial value.
[0017] Optionally, the updating of the waiting time based on the execution time of the currently executed first logic includes:
[0018] If the execution time is greater than the first time threshold, the waiting time is subjected to a first reduction process; and / or,
[0019] If the execution duration is less than the first duration threshold, and the difference between the waiting duration and the execution duration is greater than the second duration threshold, the waiting duration remains unchanged; and / or,
[0020] If the execution time is less than the first time threshold, and the difference between the waiting time and the execution time is less than the second time threshold, and the waiting time is less than the third time threshold, the waiting time is amplified; and / or,
[0021] If the execution time is less than the first time threshold, and the difference between the waiting time and the execution time is less than the second time threshold, and the waiting time is greater than the third time threshold, the waiting time is subjected to a second reduction processing, wherein the execution time corresponding to the second reduction processing is less than the execution time corresponding to the first reduction processing.
[0022] Optionally, if the execution time is less than the first time threshold, and the difference between the waiting time and the execution time is less than the second time threshold, and the waiting time is less than the third time threshold, amplifying the waiting time includes:
[0023] If the execution duration is less than the first duration threshold, and the difference between the waiting duration and the execution duration is less than the second duration threshold, and the waiting duration is less than a fourth duration threshold, then the waiting duration is doubled, wherein the fourth duration threshold is less than the third duration threshold; and / or,
[0024] If the execution duration is less than the first duration threshold, and the difference between the waiting duration and the execution duration is less than the second duration threshold, and the waiting duration is greater than the fourth duration threshold and less than the third duration threshold, then the waiting duration is increased by 1.
[0025] Optionally, if the execution time is less than the first time threshold, and the difference between the waiting time and the execution time is less than a second time threshold, and the waiting time is greater than a third time threshold, performing a second reduction process on the waiting time includes:
[0026] If the execution duration is less than the first duration threshold, the difference between the waiting duration and the execution duration is less than the second duration threshold, and the waiting duration is greater than the third duration threshold, the waiting duration is adjusted to the third duration threshold.
[0027] Optionally, if the execution time is greater than the first time threshold, performing a first reduction process on the waiting time includes:
[0028] If the execution time is greater than the first time threshold, and half of the waiting time is greater than the lower limit, the waiting time is reduced by half; and / or,
[0029] If the execution time is greater than the first time threshold and half of the waiting time is less than the lower limit, the waiting time is adjusted to the lower limit.
[0030] In another aspect, a device for determining a page loading duration is provided, the device comprising:
[0031] Loading module, used to load the target page;
[0032] A determination module, configured to, when a preset trigger event is detected, determine the waiting time as an initial value, detect an execution end event of the first logic currently executed by the target page, and when the execution end event is detected, determine the time between the execution end time point and the time point of the preset trigger event as the execution time of the first logic currently executed;
[0033] An updating module, configured to update the waiting time based on the execution time of the first logic currently being executed;
[0034] The detection module is used to detect the loading of the target page every time the updated waiting time passes, until a preset condition is met to determine the page loading time of the target page.
[0035] Optionally, the update module is used to:
[0036] After the waiting time is updated, detecting an execution end event of the second logic currently executed by the target page, and when the execution end event is detected, determining the duration between the execution end time point and the previous execution end time point as the execution duration of the second logic currently executed;
[0037] If the execution durations determined within the preset duration do not exceed the first duration threshold, then based on the start time point of the preset duration and the start loading time point of the target page, determine the page loading duration of the target page; and / or,
[0038] If the determined execution time exceeds the first time threshold within the preset time, the process switches to executing the process of updating the waiting time based on the execution time of the currently executed second logic.
[0039] Optionally, the determining module is used to:
[0040] After it is detected that the loading of the main page data of the target page is completed, the waiting time is determined as an initial value.
[0041] Optionally, the update module is used to:
[0042] If the execution time is greater than the first time threshold, the waiting time is subjected to a first reduction process; and / or,
[0043] If the execution duration is less than the first duration threshold, and the difference between the waiting duration and the execution duration is greater than the second duration threshold, the waiting duration remains unchanged; and / or,
[0044] If the execution time is less than the first time threshold, and the difference between the waiting time and the execution time is less than the second time threshold, and the waiting time is less than the third time threshold, the waiting time is amplified; and / or,
[0045] If the execution time is less than the first time threshold, and the difference between the waiting time and the execution time is less than the second time threshold, and the waiting time is greater than the third time threshold, the waiting time is subjected to a second reduction processing, wherein the execution time corresponding to the second reduction processing is less than the execution time corresponding to the first reduction processing.
[0046] Optionally, the update module is used to:
[0047] If the execution duration is less than the first duration threshold, and the difference between the waiting duration and the execution duration is less than the second duration threshold, and the waiting duration is less than a fourth duration threshold, then the waiting duration is doubled, wherein the fourth duration threshold is less than the third duration threshold; and / or,
[0048] If the execution duration is less than the first duration threshold, and the difference between the waiting duration and the execution duration is less than the second duration threshold, and the waiting duration is greater than the fourth duration threshold and less than the third duration threshold, then the waiting duration is increased by 1.
[0049] Optionally, the update module is used to:
[0050] If the execution duration is less than the first duration threshold, the difference between the waiting duration and the execution duration is less than the second duration threshold, and the waiting duration is greater than the third duration threshold, the waiting duration is adjusted to the third duration threshold.
[0051] Optionally, the update module is used to:
[0052] If the execution time is greater than the first time threshold, and half of the waiting time is greater than the lower limit, the waiting time is reduced by half; and / or,
[0053] If the execution time is greater than the first time threshold and half of the waiting time is less than the lower limit, the waiting time is adjusted to the lower limit.
[0054] On the other hand, a computer device is provided, which includes a processor and a memory, wherein the memory stores instructions, and the processor executes the instructions to enable the computer device to implement the method for determining the page loading time.
[0055] On the other hand, a computer-readable storage medium is provided, wherein the computer-readable storage medium stores instructions, and a computer device executes the instructions so that the computer device implements the method for determining the page loading duration.
[0056] The beneficial effects of the technical solution provided by the embodiment of the present application are:
[0057] This application obtains the execution time of the currently executed first logic, and updates the waiting time based on the execution time of the currently executed first logic, and then obtains the execution time of the currently executed second logic according to the updated waiting time. If the execution time determined within the preset time does not exceed the first time threshold, a thread idle notification will be generated, that is, the terminal can respond to the user's operation in a timely manner at this time, then the loading time of the target page is determined based on the starting time point of the preset time and the starting loading time point of the target page. If the execution time determined within the preset time exceeds the first time threshold, a thread busy notification will be generated, that is, the terminal cannot respond to the user's operation in a timely manner at this time, then the execution will be transferred to the processing of updating the waiting time based on the execution time of the currently executed second logic. Through the above scheme, the tester can know the loading time of the target page through the thread busy notification and the thread idle notification, and then the page loading performance can be evaluated according to the loading time of the target page. BRIEF DESCRIPTION OF THE DRAWINGS
[0058] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings required for use in the description of the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work.
[0059] Figure 1 It is a schematic diagram of the environment provided by the embodiment of the present application;
[0060] Figure 2 This is a flow chart of a method for determining page loading time provided by an embodiment of the present application;
[0061] Figure 3 It is a schematic diagram of the execution logic of a method for determining page loading time provided in an embodiment of the present application;
[0062] Figure 4 It is a schematic diagram of the structure of a device for determining page loading time provided by an embodiment of the present application;
[0063] Figure 5 It is a schematic diagram of the structure of a terminal provided by an embodiment of the present invention. DETAILED DESCRIPTION
[0064] In order to make the objectives, technical solutions and advantages of the present application clearer, the implementation methods of the present application will be further described in detail below with reference to the accompanying drawings.
[0065] The embodiment of the present application provides a method for image display, which can be implemented by a terminal. The terminal can be a mobile phone, a desktop computer, a tablet computer, a laptop computer, a smart wearable device, etc. The terminal can have data transceiver components, a central processing unit, a graphics card, a screen and other components. The terminal can have the function of displaying images and the function of delay processing. The terminal can be installed with applications, such as live broadcast applications, chat applications, music playback applications, etc. It should be noted that this solution does not limit the applications to be detected. All applications that can display pages can be used to be detected, and the page loading of all applications is performed through a single thread, which will not be repeated hereafter.
[0066] When an application is opened, or when a target control in an application is triggered, Figure 1 As shown, the terminal will send a page data acquisition request to the server. When the server receives the page data acquisition request, it will send the corresponding page data to the terminal. The terminal will load the page data to display the page. There are two stages when loading the page data. First, the terminal will load the main page data, for example, all the text content of an article, and the corresponding page design. Second, the terminal will load other data, for example, advertisements. After the above loading is completed, the terminal can display the complete page.
[0067] Figure 2 is a flow chart of a method for determining page loading time provided by an embodiment of the present application. Figure 2 , the process includes:
[0068] Step 201: Load the target page.
[0069] In practice, after the application is updated, the tester can operate the application to make the terminal display the previous page of the target page, which is the page actually updated when the application is updated. Then, the tester can trigger the target control to make the terminal obtain the data of the target page from the server and load the data of the target page.
[0070] Optionally, the update of the application may be an update of the initial page of the application, that is, the target page is the initial page of the application, and after the application is updated, the tester can display the application list page of the terminal. When the tester triggers the start control of the application, the terminal obtains the data of the target page from the server and loads the data of the target page.
[0071] Step 202: When a preset trigger event is detected, the waiting time is determined as the initial value, and the execution end event of the first logic currently executed by the target page is detected. When the execution end event is detected, the duration between the execution end time point and the time point of the preset trigger event is determined as the execution duration of the first logic currently executed.
[0072] In implementation, after the terminal loads the data of the target page, the terminal can continuously detect whether a preset trigger event occurs, and the preset trigger event can be that the main page data of the target page is loaded. After detecting that the main page data of the target page is loaded, the terminal can call the timer and set the waiting time for the timer. The initial value of the waiting time can be an experience value set by the tester, and the minimum waiting time that the timer can set is 1ms, that is, the lower limit value is 1ms. After the setting is completed, the timer is turned on, and the terminal can detect the execution end event of the first logic currently executed by the target page through the timer, that is, the terminal can insert a target logic into the idle thread. After the insertion, the target logic can obtain the time from the start of the timer to the insertion of the target logic. The target logic can be used to return the time from the start of the timer to the time after the waiting time. The time for calculating the time from the start of the timer to the insertion of the target logic is very short, which is 0.1ms, and it is ignored in this solution. When the target logic can be inserted into the thread, it proves that there is idleness in the thread, that is, the execution end event of the first logic currently executed by the target page is detected. Then, the target logic can be executed in the thread of the terminal, and the duration between the execution end time point and the preset trigger event time point can be calculated by the first logic. Then, the terminal can subtract the waiting time from the time length to obtain the execution duration of the currently executed first logic.
[0073] For example, the terminal starts loading page data from 0ms, and at 100ms the terminal completes loading the main page data of the target page, and then other data can be loaded in the thread. The other data can be an advertisement, and the logic of the advertisement needs to be executed in the thread for 50ms. At the same time, the terminal calls the timer to start delay timing, and the waiting time is set to 1ms. The timer is turned on. If the current thread is idle, that is, no other logic is executed in the current thread, the target logic can be inserted. If the logic of the above advertisement has not been executed, that is, the logic of calculating the duration cannot be inserted into the thread, the target logic can only be inserted into the thread after 150ms. After inserting the logic of calculating the duration, after a waiting time of 1ms and a calculated duration of 0.1ms, 50ms minus 1ms can be used to obtain the execution time of the logic of the above advertisement, which is 49ms.
[0074] Step 203: Update the waiting time based on the execution time of the currently executed first logic, and detect the loading of the target page after each updated waiting time, until a preset condition is met to determine the page loading time of the target page.
[0075] In implementation, after obtaining the execution time of the currently executed first logic, the terminal may determine whether the execution time of the currently executed first logic exceeds a first time threshold, where the first time threshold may be an empirical value set by a tester. Then, the terminal may perform the following processing according to the determination result:
[0076] If the execution time is longer than the first time threshold, the waiting time is reduced by the first process, and the specific process is as follows:
[0077] If the execution time is greater than the first time threshold and half of the waiting time is greater than the lower limit, the waiting time is reduced by half.
[0078] For example, the first duration threshold is 50ms, the execution duration is 60ms, the waiting time is 10ms, and the lower limit is 1ms. When it is detected that the execution time 60ms is greater than the first duration threshold 50ms, half of the waiting time is 5ms, which is greater than the lower limit 1ms, then the waiting time is set to 5ms.
[0079] If the execution time is greater than the first time threshold and half of the waiting time is less than the lower limit, the waiting time is adjusted to the lower limit.
[0080] For example, the first duration threshold is 50ms, the execution duration is 60ms, the waiting time is 1ms, and the lower limit is 1ms. When it is detected that the execution time 60ms is greater than the first duration threshold 50ms, half of the waiting time is 0.5ms, which is less than the lower limit 1ms, then the waiting time is set to 1ms.
[0081] If the execution time is less than the first time threshold, and the difference between the waiting time and the execution time is greater than the second time threshold, the waiting time remains unchanged.
[0082] For example, the first duration threshold is 50ms, the execution duration is 30ms, the waiting duration is 10ms, the second duration threshold is 10ms, and the lower limit is 1ms. When it is detected that the execution duration 30ms is less than the first duration threshold 50ms, the difference between the waiting duration 10ms and the execution duration 30ms is calculated, and the difference is 20ms. After comparison, the difference 20ms is greater than the second duration threshold 10ms, and the terminal does not change the waiting duration.
[0083] If the execution time is less than the first time threshold, the difference between the waiting time and the execution time is less than the second time threshold, and the waiting time is less than the third time threshold, the waiting time is amplified. The specific processing is as follows:
[0084] If the execution time is less than the first time threshold, the difference between the waiting time and the execution time is less than the second time threshold, and the waiting time is less than the fourth time threshold, the waiting time is doubled.
[0085] Among them, the fourth duration threshold is smaller than the third duration threshold.
[0086] For example, the first duration threshold is 50ms, the execution duration is 15ms, the waiting duration is 10ms, the second duration threshold is 10ms, the lower limit is 1ms, the fourth duration threshold is 16ms, and the third duration threshold is 25ms. When it is detected that the execution duration 15ms is less than the first duration threshold 50ms, the difference between the waiting duration 10ms and the execution duration 15ms is calculated, and the difference is 5ms. After comparison, the difference 5ms is less than the second duration threshold 10ms, and the waiting duration 10ms is less than the fourth duration 16ms, then the waiting duration is doubled, that is, the waiting duration is set to 20ms.
[0087] If the execution time is less than the first time threshold, and the difference between the waiting time and the execution time is less than the second time threshold, and the waiting time is greater than the fourth time threshold and less than the third time threshold, the waiting time is increased by 1.
[0088] For example, the first duration threshold is 50ms, the execution duration is 25ms, the waiting duration is 20ms, the second duration threshold is 10ms, the lower limit is 1ms, the fourth duration threshold is 16ms, and the third duration threshold is 25ms. When it is detected that the execution duration 20ms is less than the first duration threshold 50ms, the difference between the waiting duration 20ms and the execution duration 25ms is calculated, and the difference is 5ms. After comparison, the difference 5ms is less than the second duration threshold 10ms, and the waiting duration 20ms is greater than the fourth duration 16ms, and less than the third duration threshold 25ms, then the waiting duration is increased by 1, that is, the waiting duration is set to 21ms.
[0089] If the execution time is less than the first time threshold, the difference between the waiting time and the execution time is less than the second time threshold, and the waiting time is greater than the third time threshold, the waiting time is subjected to a second reduction process.
[0090] The specific processing is as follows:
[0091] If the execution time is less than the first time threshold, the difference between the waiting time and the execution time is less than the second time threshold, and the waiting time is greater than the third time threshold, the waiting time is adjusted to the third time threshold.
[0092] For example, the first duration threshold is 50ms, the execution duration is 35ms, the waiting duration is 30ms, the second duration threshold is 10ms, the lower limit is 1ms, the fourth duration threshold is 16ms, and the third duration threshold is 25ms. When it is detected that the execution duration 35ms is less than the first duration threshold 50ms, the difference between the waiting duration 30ms and the execution duration 35ms is calculated, and the difference is 5ms. After comparison, the difference 5ms is less than the second duration threshold 10ms, and the waiting duration 30ms is greater than the third duration threshold 25ms, then the waiting duration is adjusted to the third duration threshold.
[0093] It should be noted here that if the execution time is greater than the first time threshold, the terminal can generate a thread busy notification, which means that the application cannot respond to the user's operations in a timely manner during the execution time. If the execution time is less than the first time threshold, the terminal can generate a thread idle notification, which means that the application can respond to the user's operations in a timely manner during the execution time. These will not be elaborated hereafter.
[0094] Specifically, the process of updating the waiting time can be as follows: Figure 3 As shown, after executing the logic of calculating the duration, the following processing can be performed:
[0095] The first duration threshold is 50ms, the second duration threshold is 10ms, the third duration threshold is 25ms, and the fourth duration threshold is 16ms. D represents the execution duration, and T represents the waiting duration.
[0096] The terminal can determine whether D is greater than 50ms. If so, a thread busy notification is generated and whether T / 2 is less than 1ms. If so, T is set to 1ms and the next detection is started. If not less than 1ms, T is set to T / 2 and the next detection is started.
[0097] If it is determined that D is not greater than 50ms, a thread idle notification is generated, and DT is determined to be less than 10ms. If it is not less than 10ms, the waiting time does not change, and the next detection is started. If it is less than 10ms, determine whether T is less than 16ms. If it is less than 16ms, set T to 2T, and start the next detection. If it is not less than 16ms, determine whether T is less than 25ms. If it is less than 25ms, set T to T+1, and start the timer based on the waiting time. If it is not less than 25ms, set T to 25ms, and start the next detection.
[0098] After the waiting time is updated, the following processing can be performed:
[0099] After the waiting time is updated, the execution end event of the second logic currently executed by the target page is detected. When the execution end event is detected, the duration between the execution end time point and the previous execution end time point is determined as the execution duration of the second logic currently executed; if the execution times determined within the preset time period do not exceed the first time period threshold, the page loading time of the target page is determined based on the start time point of the preset time period and the start loading time point of the target page; and / or, if the execution time determined within the preset time period exceeds the first time period threshold, the process of updating the waiting time based on the execution time of the second logic currently executed is executed.
[0100] In implementation, after the waiting time is updated, the timer is started again, and the terminal can insert the target logic into the thread. If there is no idle time in the current thread, the target logic will be inserted when the idle time appears next time. When the above target logic is inserted into the thread, that is, when the terminal detects the execution end event of the second logic currently executed by the target page, the above target logic is executed, and then the duration between the execution end time point and the previous execution end time point can be calculated through the target logic. Then, the terminal can subtract the waiting time from the duration to obtain the execution duration of the second logic currently being executed. Then, the terminal can determine whether the execution duration of the second logic currently being executed exceeds the first duration threshold. The first duration threshold can be an empirical value set by the tester, for example, 50ms. If the execution duration is greater than the first duration threshold, the terminal can generate a thread busy notification. If the execution duration is less than the first duration threshold, the terminal can generate a thread idle notification. Then, the terminal can detect whether all the notifications generated by the terminal within the preset duration are thread idle notifications. If so, the loading duration of the target page is calculated by subtracting the starting time point of the preset duration from the starting loading time point of the target page, and the loading duration is displayed on the screen. The tester can also intuitively see how long the updated application needs to load before it can respond to the user's operation in a timely manner. If not, the process of executing the waiting time based on the execution time of the second logic currently being executed is executed to update the processing, that is, re-execute the above step 203, and repeat step 204 until all the notifications generated by the terminal within the preset duration are thread idle notifications.
[0101] It should be noted that, in the entire detection process, all of the above embodiments may or may not occur. For example, in the entire detection process, if the execution time detected each time is less than the first time threshold, and the difference between the waiting time and the execution time is less than the second time threshold, the waiting time is set to the initial value until the execution time determined within the preset time does not exceed the first time threshold. Then, based on the start time point of the preset time and the start loading time point of the target page, the page loading time of the target page is determined. All similar situations will not be repeated hereafter.
[0102] This application obtains the execution time of the currently executed first logic, and updates the waiting time based on the execution time of the currently executed first logic, and then obtains the execution time of the currently executed second logic according to the updated waiting time. If the execution time determined within the preset time does not exceed the first time threshold, a thread idle notification will be generated, that is, the terminal can respond to the user's operation in a timely manner at this time, then the loading time of the target page is determined based on the starting time point of the preset time and the starting loading time point of the target page. If the execution time determined within the preset time exceeds the first time threshold, a thread busy notification will be generated, that is, the terminal cannot respond to the user's operation in a timely manner at this time, then the execution will be transferred to the processing of updating the waiting time based on the execution time of the currently executed second logic. Through the above scheme, the tester can know the loading time of the target page through the thread busy notification and the thread idle notification, and then the page loading performance can be evaluated according to the loading time of the target page.
[0103] All the above optional technical solutions can be arbitrarily combined to form optional embodiments of the present disclosure, and will not be described in detail here.
[0104] Figure 4 is a schematic diagram of a device for determining page loading time provided in an embodiment of the present application. The device may be a terminal in the above embodiment. Figure 4 , the device comprises:
[0105] A loading module 410 is used to load a target page;
[0106] The determination module 420 is used to determine the waiting time as an initial value when a preset trigger event is detected, detect an execution end event of the first logic currently executed by the target page, and when the execution end event is detected, determine the time between the execution end time point and the time point of the preset trigger event as the execution time of the first logic currently executed;
[0107] An updating module 430, configured to update the waiting time based on the execution time of the first logic currently being executed;
[0108] The detection module is used to detect the loading of the target page every time the updated waiting time passes, until a preset condition is met to determine the page loading time of the target page.
[0109] Optionally, the updating module 430 is used to:
[0110] After the waiting time is updated, detecting an execution end event of the second logic currently executed by the target page, and when the execution end event is detected, determining the duration between the execution end time point and the previous execution end time point as the execution duration of the second logic currently executed;
[0111] If the execution durations determined within the preset duration do not exceed the first duration threshold, then based on the start time point of the preset duration and the start loading time point of the target page, determine the page loading duration of the target page; and / or,
[0112] If the determined execution time exceeds the first time threshold within the preset time, the process switches to executing the process of updating the waiting time based on the execution time of the currently executed second logic.
[0113] Optionally, the determining module 420 is used to:
[0114] After it is detected that the loading of the main page data of the target page is completed, the waiting time is determined as an initial value.
[0115] Optionally, the updating module 430 is used to:
[0116] If the execution time is greater than the first time threshold, the waiting time is subjected to a first reduction process; and / or,
[0117] If the execution duration is less than the first duration threshold, and the difference between the waiting duration and the execution duration is greater than the second duration threshold, the waiting duration remains unchanged; and / or,
[0118] If the execution time is less than the first time threshold, and the difference between the waiting time and the execution time is less than the second time threshold, and the waiting time is less than the third time threshold, the waiting time is amplified; and / or,
[0119] If the execution time is less than the first time threshold, and the difference between the waiting time and the execution time is less than the second time threshold, and the waiting time is greater than the third time threshold, the waiting time is subjected to a second reduction processing, wherein the execution time corresponding to the second reduction processing is less than the execution time corresponding to the first reduction processing.
[0120] Optionally, the updating module 430 is used to:
[0121] If the execution duration is less than the first duration threshold, and the difference between the waiting duration and the execution duration is less than the second duration threshold, and the waiting duration is less than a fourth duration threshold, then the waiting duration is doubled, wherein the fourth duration threshold is less than the third duration threshold; and / or,
[0122] If the execution duration is less than the first duration threshold, and the difference between the waiting duration and the execution duration is less than the second duration threshold, and the waiting duration is greater than the fourth duration threshold and less than the third duration threshold, then the waiting duration is increased by 1.
[0123] Optionally, the updating module 430 is used to:
[0124] If the execution duration is less than the first duration threshold, the difference between the waiting duration and the execution duration is less than the second duration threshold, and the waiting duration is greater than the third duration threshold, the waiting duration is adjusted to the third duration threshold.
[0125] Optionally, the updating module 430 is used to:
[0126] If the execution time is greater than the first time threshold, and half of the waiting time is greater than the lower limit, the waiting time is reduced by half; and / or,
[0127] If the execution time is greater than the first time threshold and half of the waiting time is less than the lower limit, the waiting time is adjusted to the lower limit.
[0128] This application obtains the execution time of the currently executed first logic, and updates the waiting time based on the execution time of the currently executed first logic, and then obtains the execution time of the currently executed second logic according to the updated waiting time. If the execution time determined within the preset time does not exceed the first time threshold, a thread idle notification will be generated, that is, the terminal can respond to the user's operation in a timely manner at this time, then the loading time of the target page is determined based on the starting time point of the preset time and the starting loading time point of the target page. If the execution time determined within the preset time exceeds the first time threshold, a thread busy notification will be generated, that is, the terminal cannot respond to the user's operation in a timely manner at this time, then the execution will be transferred to the processing of updating the waiting time based on the execution time of the currently executed second logic. Through the above scheme, the tester can know the loading time of the target page through the thread busy notification and the thread idle notification, and then the page loading performance can be evaluated according to the loading time of the target page.
[0129] It should be noted that: the device for determining the page loading time provided in the above embodiment only uses the division of the above functional modules as an example when determining the page loading time. In actual applications, the above functions can be assigned to different functional modules as needed, that is, the internal structure of the device can be divided into different functional modules to complete all or part of the functions described above. In addition, the method embodiment for determining the page loading time provided in the above embodiment belongs to the same concept. The specific implementation process is detailed in the method embodiment, which will not be repeated here.
[0130] Figure 5 The structure block diagram of a terminal 500 provided by an exemplary embodiment of the present application is shown. The terminal may be the above-mentioned terminal, and the terminal 500 may be: a smart phone, a tablet computer, an MP3 player (Moving Picture Experts Group Audio Layer III, Moving Picture Experts Group Audio Layer 3), an MP4 (Moving Picture Experts Group Audio Layer IV, Moving Picture Experts Group Audio Layer 4) player, a laptop computer or a desktop computer. The terminal 500 may also be called a user device, a portable terminal, a laptop terminal, a desktop terminal or other names.
[0131] Typically, the terminal 500 includes a processor 501 and a memory 502 .
[0132] The processor 501 may include one or more processing cores, such as a 4-core processor, an 8-core processor, etc. The processor 501 may be implemented in at least one hardware form of DSP (Digital Signal Processing), FPGA (Field-Programmable Gate Array), and PLA (Programmable Logic Array). The processor 501 may also include a main processor and a coprocessor. The main processor is a processor for processing data in the awake state, also known as a CPU (Central Processing Unit); the coprocessor is a low-power processor for processing data in the standby state. In some embodiments, the processor 501 may be integrated with a GPU (Graphics Processing Unit), which is responsible for rendering and drawing the content to be displayed on the display screen. In some embodiments, the processor 501 may also include an AI (Artificial Intelligence) processor, which is used to process computing operations related to machine learning.
[0133] The memory 502 may include one or more computer-readable storage media, which may be non-transitory. The memory 502 may also include a high-speed random access memory, and a non-volatile memory, such as one or more disk storage devices, flash memory storage devices. In some embodiments, the non-transitory computer-readable storage medium in the memory 502 is used to store at least one instruction, which is used to be executed by the processor 501 to implement the method for determining the page loading time provided in the method embodiment of the present application.
[0134] In some embodiments, the terminal 500 may further optionally include: a peripheral device interface 503 and at least one peripheral device. The processor 501, the memory 502 and the peripheral device interface 503 may be connected via a bus or a signal line. Each peripheral device may be connected to the peripheral device interface 503 via a bus, a signal line or a circuit board. Specifically, the peripheral device includes: at least one of a radio frequency circuit 504, a touch display screen 505, a camera 506, an audio circuit 507, a positioning component 508 and a power supply 509.
[0135] The peripheral device interface 503 may be used to connect at least one peripheral device related to I / O (Input / Output) to the processor 501 and the memory 502. In some embodiments, the processor 501, the memory 502, and the peripheral device interface 503 are integrated on the same chip or circuit board; in some other embodiments, any one or two of the processor 501, the memory 502, and the peripheral device interface 503 may be implemented on a separate chip or circuit board, which is not limited in this embodiment.
[0136] The radio frequency circuit 504 is used to receive and transmit RF (Radio Frequency) signals, also known as electromagnetic signals. The radio frequency circuit 504 communicates with the communication network and other communication devices through electromagnetic signals. The radio frequency circuit 504 converts the electrical signal into an electromagnetic signal for transmission, or converts the received electromagnetic signal into an electrical signal. Optionally, the radio frequency circuit 504 includes: an antenna system, an RF transceiver, one or more amplifiers, a tuner, an oscillator, a digital signal processor, a codec chipset, a user identity module card, and the like. The radio frequency circuit 504 can communicate with other terminals through at least one wireless communication protocol. The wireless communication protocol includes, but is not limited to: a metropolitan area network, various generations of mobile communication networks (2G, 3G, 4G and 5G), a wireless local area network and / or a WiFi (Wireless Fidelity) network. In some embodiments, the radio frequency circuit 504 may also include circuits related to NFC (Near Field Communication), which is not limited in this application.
[0137] The display screen 505 is used to display a UI (User Interface). The UI may include graphics, text, icons, videos, and any combination thereof. When the display screen 505 is a touch display screen, the display screen 505 also has the ability to collect touch signals on the surface or above the surface of the display screen 505. The touch signal can be input to the processor 501 as a control signal for processing. At this time, the display screen 505 can also be used to provide virtual buttons and / or virtual keyboards, also known as soft buttons and / or soft keyboards. In some embodiments, the display screen 505 can be one, and the front panel of the terminal 500 is set; in other embodiments, the display screen 505 can be at least two, which are respectively set on different surfaces of the terminal 500 or are folded; in some other embodiments, the display screen 505 can be a flexible display screen, which is set on the curved surface or folded surface of the terminal 500. Even, the display screen 505 can also be set to a non-rectangular irregular shape, that is, a special-shaped screen. The display screen 505 can be made of materials such as LCD (Liquid Crystal Display), OLED (Organic Light-Emitting Diode, organic light-emitting diode).
[0138] The camera assembly 506 is used to capture images or videos. Optionally, the camera assembly 506 includes a front camera and a rear camera. Typically, the front camera is arranged on the front panel of the terminal, and the rear camera is arranged on the back of the terminal. In some embodiments, there are at least two rear cameras, which are any one of a main camera, a depth of field camera, a wide-angle camera, and a telephoto camera, so as to realize the fusion of the main camera and the depth of field camera to realize the background blur function, the fusion of the main camera and the wide-angle camera to realize the panoramic shooting and VR (Virtual Reality) shooting function or other fusion shooting functions. In some embodiments, the camera assembly 506 may also include a flash. The flash can be a monochrome temperature flash or a dual-color temperature flash. A dual-color temperature flash refers to a combination of a warm light flash and a cold light flash, which can be used for light compensation at different color temperatures.
[0139] The audio circuit 507 may include a microphone and a speaker. The microphone is used to collect sound waves from the user and the environment, and convert the sound waves into electrical signals and input them into the processor 501 for processing, or input them into the radio frequency circuit 504 to achieve voice communication. For the purpose of stereo acquisition or noise reduction, there may be multiple microphones, which are respectively arranged at different parts of the terminal 500. The microphone may also be an array microphone or an omnidirectional acquisition microphone. The speaker is used to convert the electrical signal from the processor 501 or the radio frequency circuit 504 into sound waves. The speaker may be a traditional film speaker or a piezoelectric ceramic speaker. When the speaker is a piezoelectric ceramic speaker, it can not only convert the electrical signal into sound waves audible to humans, but also convert the electrical signal into sound waves inaudible to humans for purposes such as ranging. In some embodiments, the audio circuit 507 may also include a headphone jack.
[0140] The positioning component 508 is used to locate the current geographical location of the terminal 500 to implement navigation or LBS (Location Based Service). The positioning component 508 can be a positioning component based on the US GPS (Global Positioning System), China's Beidou system, Russia's Grenas system or the European Union's Galileo system.
[0141] The power supply 509 is used to power various components in the terminal 500. The power supply 509 can be an alternating current, a direct current, a disposable battery, or a rechargeable battery. When the power supply 509 includes a rechargeable battery, the rechargeable battery can support wired charging or wireless charging. The rechargeable battery can also be used to support fast charging technology.
[0142] In some embodiments, the terminal 500 further includes one or more sensors 510 , including but not limited to: an acceleration sensor 511 , a gyroscope sensor 512 , a pressure sensor 513 , a fingerprint sensor 514 , an optical sensor 515 , and a proximity sensor 516 .
[0143] The acceleration sensor 511 can detect the magnitude of acceleration on the three coordinate axes of the coordinate system established by the terminal 500. For example, the acceleration sensor 511 can be used to detect the components of gravity acceleration on the three coordinate axes. The processor 501 can control the touch screen 505 to display the user interface in a horizontal view or a vertical view according to the gravity acceleration signal collected by the acceleration sensor 511. The acceleration sensor 511 can also be used for collecting game or user motion data.
[0144] The gyro sensor 512 can detect the body direction and rotation angle of the terminal 500, and the gyro sensor 512 can cooperate with the acceleration sensor 511 to collect the user's 3D actions on the terminal 500. The processor 501 can implement the following functions based on the data collected by the gyro sensor 512: motion sensing (such as changing the UI according to the user's tilt operation), image stabilization during shooting, game control, and inertial navigation.
[0145] The pressure sensor 513 can be set on the side frame of the terminal 500 and / or the lower layer of the touch display screen 505. When the pressure sensor 513 is set on the side frame of the terminal 500, it can detect the user's holding signal of the terminal 500, and the processor 501 performs left and right hand recognition or shortcut operation according to the holding signal collected by the pressure sensor 513. When the pressure sensor 513 is set on the lower layer of the touch display screen 505, the processor 501 controls the operability controls on the UI interface according to the user's pressure operation on the touch display screen 505. The operability controls include at least one of a button control, a scroll bar control, an icon control, and a menu control.
[0146] The fingerprint sensor 514 is used to collect the user's fingerprint, and the processor 501 identifies the user's identity based on the fingerprint collected by the fingerprint sensor 514, or the fingerprint sensor 514 identifies the user's identity based on the collected fingerprint. When the user's identity is identified as a trusted identity, the processor 501 authorizes the user to perform relevant sensitive operations, which include unlocking the screen, viewing encrypted information, downloading software, paying, and changing settings. The fingerprint sensor 514 can be set on the front, back, or side of the terminal 500. When a physical button or a manufacturer logo is set on the terminal 500, the fingerprint sensor 514 can be integrated with the physical button or the manufacturer logo.
[0147] The optical sensor 515 is used to collect the ambient light intensity. In one embodiment, the processor 501 can control the display brightness of the touch display screen 505 according to the ambient light intensity collected by the optical sensor 515. Specifically, when the ambient light intensity is high, the display brightness of the touch display screen 505 is increased; when the ambient light intensity is low, the display brightness of the touch display screen 505 is reduced. In another embodiment, the processor 501 can also dynamically adjust the shooting parameters of the camera assembly 506 according to the ambient light intensity collected by the optical sensor 515.
[0148] The proximity sensor 516, also called a distance sensor, is usually arranged on the front panel of the terminal 500. The proximity sensor 516 is used to collect the distance between the user and the front of the terminal 500. In one embodiment, when the proximity sensor 516 detects that the distance between the user and the front of the terminal 500 is gradually decreasing, the processor 501 controls the touch display screen 505 to switch from the screen-on state to the screen-off state; when the proximity sensor 516 detects that the distance between the user and the front of the terminal 500 is gradually increasing, the processor 501 controls the touch display screen 505 to switch from the screen-off state to the screen-on state.
[0149] Those skilled in the art will understand that Figure 5 The structure shown in the figure does not constitute a limitation on the terminal 500, and the terminal 500 may include more or less components than those shown in the figure, or combine some components, or adopt a different component arrangement.
[0150] In an exemplary embodiment, a computer-readable storage medium is also provided, such as a memory including instructions, and the instructions can be executed by a processor in a terminal to complete the method for determining the page loading time in the above embodiment. For example, the computer-readable storage medium can be a read-only memory (ROM), a random access memory (RAM), a CD-ROM, a magnetic tape, a floppy disk, an optical data storage device, etc.
[0151] A person skilled in the art will understand that all or part of the steps to implement the above embodiments may be accomplished by hardware or by instructing related hardware through a program, and the program may be stored in a computer-readable storage medium, and the above-mentioned storage medium may be a read-only memory, a disk or an optical disk, etc.
[0152] The above description is only an optional embodiment of the present application and is not intended to limit the present application. Any modifications, equivalent substitutions, improvements, etc. made within the spirit and principles of the present application shall be included in the protection scope of the present application.
Claims
1. A method for determining page loading time, characterized in that: The method comprises: Load the target page; When a preset trigger event is detected, the waiting time is determined as an initial value, and an execution end event of the first logic currently executed by the target page is detected. When the execution end event is detected, the time between the execution end time point and the time point of the preset trigger event is determined as the execution time of the first logic currently executed; The waiting time is updated based on the execution time of the currently executed first logic, and after the waiting time is updated, an execution end event of the currently executed second logic of the target page is detected, and when the execution end event is detected, the time between the execution end time point and the previous execution end time point is determined as the execution time of the currently executed second logic; If the execution durations determined within the preset duration do not exceed the first duration threshold, then based on the start time point of the preset duration and the start loading time point of the target page, determine the page loading duration of the target page; and / or, If the determined execution time exceeds the first time threshold within the preset time, the process of updating the waiting time based on the execution time of the second logic currently being executed is executed is performed; The updating of the waiting time based on the execution time of the currently executed first logic includes: If the execution time is greater than the first time threshold, the waiting time is subjected to a first reduction process; and / or, If the execution duration is less than the first duration threshold, and the difference between the waiting duration and the execution duration is greater than the second duration threshold, the waiting duration remains unchanged; and / or, If the execution time is less than the first time threshold, and the difference between the waiting time and the execution time is less than the second time threshold, and the waiting time is less than the third time threshold, the waiting time is amplified; and / or, If the execution time is less than the first time threshold, and the difference between the waiting time and the execution time is less than the second time threshold, and the waiting time is greater than the third time threshold, the waiting time is subjected to a second reduction processing, wherein the execution time corresponding to the second reduction processing is less than the execution time corresponding to the first reduction processing.
2. The method according to claim 1, characterized in that The step of determining the waiting time as an initial value when a preset triggering event is detected includes: After it is detected that the loading of the main page data of the target page is completed, the waiting time is determined as an initial value.
3. The method according to claim 1, characterized in that: If the execution time is less than the first time threshold, and the difference between the waiting time and the execution time is less than the second time threshold, and the waiting time is less than the third time threshold, amplifying the waiting time includes: If the execution duration is less than the first duration threshold, and the difference between the waiting duration and the execution duration is less than the second duration threshold, and the waiting duration is less than a fourth duration threshold, then the waiting duration is doubled, wherein the fourth duration threshold is less than the third duration threshold; and / or, If the execution duration is less than the first duration threshold, and the difference between the waiting duration and the execution duration is less than the second duration threshold, and the waiting duration is greater than the fourth duration threshold and less than the third duration threshold, then the waiting duration is increased by 1.
4. The method according to claim 1, characterized in that: If the execution time is less than the first time threshold, and the difference between the waiting time and the execution time is less than the second time threshold, and the waiting time is greater than the third time threshold, performing a second reduction process on the waiting time, including: If the execution duration is less than the first duration threshold, the difference between the waiting duration and the execution duration is less than the second duration threshold, and the waiting duration is greater than the third duration threshold, the waiting duration is adjusted to the third duration threshold.
5. The method according to claim 1, characterized in that If the execution time is greater than the first time threshold, the waiting time is subjected to a first reduction process, including: If the execution time is greater than the first time threshold, and half of the waiting time is greater than the lower limit, the waiting time is reduced by half; and / or, If the execution time is greater than the first time threshold and half of the waiting time is less than the lower limit, the waiting time is adjusted to the lower limit.
6. A device for determining page loading time, characterized in that: The device comprises: Loading module, used to load the target page; A determination module, configured to, when a preset trigger event is detected, determine the waiting time as an initial value, detect an execution end event of the first logic currently executed by the target page, and when the execution end event is detected, determine the time between the execution end time point and the time point of the preset trigger event as the execution time of the first logic currently executed; An updating module, configured to, if the execution time is greater than a first time threshold, perform a first reduction processing on the waiting time; and / or, if the execution time is less than the first time threshold, and the difference between the waiting time and the execution time is greater than a second time threshold, the waiting time remains unchanged; and / or, if the execution time is less than the first time threshold, and the difference between the waiting time and the execution time is less than the second time threshold, and the waiting time is less than a third time threshold, perform a magnification processing on the waiting time; and / or, if the execution time is less than the first time threshold, and the difference between the waiting time and the execution time is less than the second time threshold, and the waiting time is greater than the third time threshold, perform a second reduction processing on the waiting time, wherein the execution time corresponding to the second reduction processing is less than the execution time corresponding to the first reduction processing; A detection module is used to detect an execution end event of the second logic currently being executed on the target page after the waiting time is updated. When the execution end event is detected, the duration between the execution end time point and the previous execution end time point is determined as the execution duration of the second logic currently being executed; if the execution times determined within the preset time period do not exceed the first time period threshold, then based on the start time point of the preset time period and the start loading time point of the target page, determine the page loading duration of the target page; and / or, if there is an execution time determined within the preset time period that exceeds the first time period threshold, then switch to executing a process of updating the waiting time based on the execution time of the second logic currently being executed.
7. A computer device, characterized in that: The computer device includes a processor and a memory, wherein the memory stores at least one instruction, and the at least one instruction is loaded and executed by the processor to implement the operation performed by the method for determining the page loading time as described in any one of claims 1 to 5.
8. A computer-readable storage medium, characterized in that: The storage medium stores at least one instruction, and the at least one instruction is loaded and executed by the processor to implement the operation performed by the method for determining the page loading duration as described in any one of claims 1 to 5.
Citation Information
Patent Citations
Webpage loading method, device and equipment
CN104156401A
Application page loading duration determining method and application page loading duration determining device
CN105630566A