A method and device for obtaining time

By obtaining the moment when the element weight changes most in the page and the time when the multimedia resource rendering is completed when the page rendering process has been completed, the problem of inaccurate rendering moments in the existing technology is solved, and the user experience is improved.

CN113961839BActive Publication Date: 2025-04-04WUBA
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202111118414.0
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-09-23
Publication Date
2025-04-04
Estimated Expiration
2041-09-23

AI Technical Summary

Technical Problem

In the prior art, the time when the web page rendering is obtained is inaccurate, resulting in low user experience and may cause user churn.

Method used

When the rendering process has been completed, the moment when the weight sum of the elements in the page that have been rendered has changed the most (first moment) and the moment when the multimedia resource rendering has been completed (second moment) are obtained to determine the time when the rendering is completed.

Benefits of technology

Improves the accuracy of the rendered page moment, avoids errors in obtaining moments during the rendering period, and enhances the user experience.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN113961839B_ABST
    Figure CN113961839B_ABST
Patent Text Reader

Abstract

The present application shows a method and device for obtaining a moment. In the present application, when the process of rendering a page is completed, a first moment in the process of rendering the page and a second moment in the process of rendering the page are obtained, the first moment is the moment when the sum of the weights of the elements that have been rendered in the page changes the most, and the second moment is the moment when the multimedia resources in the page are rendered. Among them, the elements in the page have a cascading relationship in a tree structure, and the levels of the elements in the page in the tree structure are not all the same. The deeper the level, the later the elements are rendered and the greater the weight, and the shallower the level, the earlier the elements are rendered and the smaller the weight. The moment when the page is rendered is obtained according to the first moment and the second moment. Through the present application, the accuracy of the moment when the page is rendered can be improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of computer technology, and in particular to a time acquisition method and device. Background Art

[0002] Currently, users can use applications to browse the web. When users need to browse the web, they can enter the address of the web page in the application. The application can receive the address of the web page entered by the user, and then obtain the page data of the web page from the cloud according to the address of the web page, and then render the page according to the page data. In this way, users can see the content of the page on the application.

[0003] However, for the application, it takes a long time from receiving the webpage address input by the user to rendering the page. For the user, after entering the webpage address on the application, it takes a long time to wait before seeing the content of the page on the application. If the user waits for a long time, it will lead to poor user experience, which is likely to cause user loss and bring losses to the application developer.

[0004] Therefore, it is necessary to count the time it takes for the application to complete the process from receiving the address of the web page input by the user to rendering the page. If the time is long, the application can be optimized to reduce the time it takes to complete the process from receiving the address of the web page input by the user to rendering the page.

[0005] When it is necessary to count the time it takes for an application to complete the process of receiving the address of a web page input by a user and rendering the page, the application can obtain the time when the address of the web page input by the user is received and the time when the page is rendered on the application, and then obtain (for example, subtracting the two, etc.) the time it takes for the application to complete the process of receiving the address of the web page input by the user and rendering the page based on the time when the page is rendered on the application and the time when the address of the web page input by the user is received.

[0006] In one example, the moment when the page is rendered on the application can be obtained in the following manner: including: real-time counting the number of elements that have been rendered in the page at each moment within a period of time after the application starts to render the page according to the page data, and then using the moment corresponding to the largest number as the moment when the page is rendered on the application.

[0007] However, the inventors have discovered that the time at which the page rendering is completed on the application program obtained in the above manner is inaccurate. Summary of the invention

[0008] The present application shows a method and device for obtaining time.

[0009] In a first aspect, the present application provides a method for obtaining a time, the method comprising:

[0010] When the process of rendering the page is completed, obtaining a first moment in the process of rendering the page and obtaining a second moment in the process of rendering the page, wherein the first moment is the moment when the sum of weights of elements in the page that have been rendered changes to the greatest extent, and the second moment is the moment when the multimedia resources in the page are rendered, wherein the elements in the page have a cascading relationship in a tree structure, and the levels of the elements in the page in the tree structure are not all the same, and the deeper the level, the later the elements are rendered and the greater the weight, and the shallower the level, the earlier the elements are rendered and the smaller the weight;

[0011] The time when the page is rendered is obtained according to the first time and the second time.

[0012] In an optional implementation, obtaining the time when the page is rendered completely according to the first time and the second time includes:

[0013] When the first time is earlier than the second time, determining the second time as the time when the page is rendered;

[0014] or,

[0015] When the first time is later than the second time, the first time is determined as the time when the page is rendered.

[0016] In an optional implementation, obtaining the first moment in the process of rendering the page includes:

[0017] For any specific moment among the multiple specific moments, obtaining the sum of weights of all elements in the page that have been rendered at the specific moment;

[0018] For any two adjacent specific moments among the multiple specific moments, calculating the difference between the sum of the weights of the elements in the page that have been rendered at the later specific moment among the two adjacent specific moments and the sum of the weights of the elements in the page that have been rendered at the earlier specific moment among the two adjacent specific moments;

[0019] determining the largest difference among the calculated differences;

[0020] The first moment is obtained according to a later specific moment corresponding to the sum of the weights based on which the maximum difference is calculated.

[0021] In an optional implementation, obtaining the second moment in the process of rendering the page includes:

[0022] Obtaining the completion time when the elements of each multimedia attribute in the page are rendered respectively, and obtaining the completion time when the images in the styles of the elements in the page are rendered respectively;

[0023] The second time is acquired according to the latest completion time among the acquired completion times.

[0024] In a second aspect, the present application shows a time acquisition device, the device comprising:

[0025] A first acquisition module is used to acquire a first moment in the process of rendering the page when the process of rendering the page is completed, and a second acquisition module is used to acquire a second moment in the process of rendering the page, wherein the first moment is the moment when the sum of weights of elements in the page that have been rendered changes to the greatest extent, and the second moment is the moment when the multimedia resources in the page are rendered, wherein the elements in the page have a cascading relationship in a tree structure, and the levels of the elements in the page in the tree structure are not all the same, and the deeper the level, the later the elements are rendered and the greater the weight, and the shallower the level, the earlier the elements are rendered and the smaller the weight;

[0026] A third acquisition module is used to acquire a time when the page is rendered according to the first time and the second time.

[0027] In an optional implementation, the third acquisition module includes:

[0028] A first determining unit, configured to determine the second moment as a moment when the page is rendered when the first moment is earlier than the second moment;

[0029] or,

[0030] The second determining unit is configured to determine, when the first moment is later than the second moment, the moment when the rendering of the page is completed by using the first moment.

[0031] In an optional implementation, the first acquisition module includes:

[0032] A first acquisition unit is used to acquire, for any specific moment among the multiple specific moments, the sum of weights of all elements in the page that have been rendered at the specific moment;

[0033] a calculation unit, configured to calculate, for any two adjacent specific moments among the multiple specific moments, a difference between a sum of weights of all elements in the page that have been rendered at a later specific moment among the two adjacent specific moments and a sum of weights of all elements in the page that have been rendered at an earlier specific moment among the two adjacent specific moments;

[0034] A third determining unit, configured to determine a maximum difference value among the calculated differences;

[0035] The second acquisition unit is used to acquire the first moment according to a later specific moment corresponding to the sum of the weights based on which the maximum difference is calculated.

[0036] In an optional implementation, the second acquisition module includes:

[0037] A third acquisition unit is used to acquire the completion time when the elements of each multimedia attribute in the page are rendered respectively, and to acquire the completion time when the images in the styles of the elements in the page are rendered respectively;

[0038] The fourth acquisition unit is used to acquire the second time according to the latest completion time among the acquired completion times.

[0039] In a third aspect, the present application shows an electronic device, the electronic device comprising:

[0040] processor;

[0041] a memory for storing processor-executable instructions;

[0042] Wherein, the processor is configured to execute the moment acquisition method as described in the first aspect.

[0043] In a fourth aspect, the present application illustrates a non-temporary computer-readable storage medium, which, when instructions in the storage medium are executed by a processor of an electronic device, enables the electronic device to execute the moment acquisition method as described in the first aspect.

[0044] In a fifth aspect, the present application illustrates a computer program product. When instructions in the computer program product are executed by a processor of an electronic device, the electronic device is enabled to execute the moment acquisition method as described in the first aspect.

[0045] The technical solution provided by this application may have the following beneficial effects:

[0046] In the present application, when the process of rendering a page is completed, the first moment in the process of rendering the page and the second moment in the process of rendering the page are obtained, the first moment is the moment when the sum of the weights of the elements that have been rendered in the page changes the most, and the second moment is the moment when the multimedia resources in the page are rendered. Among them, the elements in the page have a cascading relationship in a tree structure, and the levels of the elements in the page in the tree structure are not all the same. The deeper the level, the later the elements are rendered and the greater the weight, and the shallower the level, the earlier the elements are rendered and the smaller the weight. The moment when the page is rendered is obtained according to the first moment and the second moment.

[0047] On the one hand, the process of obtaining the time when the rendering of the page is completed is not started until the page rendering process is completed, so as to avoid obtaining the time when the rendering of the page is completed during the period of the page rendering process (rendering is not completed), and further avoid the situation where the obtained time when the rendering of the page is completed is earlier than the actual time when the rendering of the page is completed. Therefore, the accuracy of the obtained time when the rendering of the page is completed can be improved.

[0048] On the other hand, after the page is rendered (equivalent to the page being rendered for the first time), if the user operates the page so that the electronic device renders the page for the second time, thereby causing a small part of the content of the page to change, in the case of the second rendering of the page, new elements may be rendered on the page, that is, the number of elements that have been rendered on the page will increase. However, since the second rendering usually renders the shallowest elements first, the elements with deeper levels will not be rendered until the shallowest elements are rendered, and since the deeper the elements are, the later they are rendered and the greater their weights, the shallower the elements are, the earlier they are rendered and the smaller their weights. Therefore, in the case where the second rendering only changes a small part of the content of the page, "the degree of change in the sum of the weights of the rendered elements in the page at each specific moment in the second rendering process" is less than "the maximum degree of change in the sum of the weights of the rendered elements in the page at each specific moment in the first rendering process".

[0049] Therefore, through the present application, after the page is rendered for the first time, even if the user operates the page so that the electronic device renders the page for the second time and thus changes a small part of the content of the page, the moment when the sum of the weights of the rendered elements in the page changes the most (first moment) will be a specific moment in the first rendering process, and a specific moment in the second rendering process will not be used as the moment when the sum of the weights of the rendered elements in the page changes the most (first moment), thereby improving the accuracy of the moment when the page is rendered. BRIEF DESCRIPTION OF THE DRAWINGS

[0050] Figure 1 It is a flowchart of the steps of a time acquisition method of the present application;

[0051] Figure 2 This is a structural block diagram of a time acquisition device of the present application;

[0052] Figure 3 is a block diagram of an electronic device shown in the present application;

[0053] Figure 4 It is a block diagram of an electronic device shown in the present application. DETAILED DESCRIPTION

[0054] In order to make the above-mentioned objects, features and advantages of the present application more obvious and easy to understand, the present application is further described in detail below in conjunction with the accompanying drawings and specific implementation methods.

[0055] In one possible scenario, the speed of rendering a page based on page data on an application is different in different situations, sometimes fast and sometimes slow.

[0056] When the speed is slow, the time spent on rendering the page according to the page data on the application is often longer than the time period mentioned above. In this case, the page has not been rendered at the end of the time period. The maximum number of elements that have been rendered on the page within the time period corresponds to a moment in the process of rendering the page on the application, not the moment when the page is rendered on the application. It can be seen that the moment when the page is rendered on the application is inaccurate.

[0057] When the speed is fast, the time spent on rendering the page according to the page data on the application is often less than the time period mentioned above. In this case, the page has been rendered on the application before the end of the time period, and the user can view the content of the page. Before the end of the time period, if the user operates on the content of the page after the first rendering of the page, the application will continue to render more elements on the web page. In this way, the time corresponding to the maximum number of elements that have been rendered on the page before the end of the time period is not the actual time when the page is rendered for the first time (this is the time when the page is rendered and needs to be obtained), but the time when the page is rendered for the second time. However, the above method will use the time when the page is rendered for the second time as the time when the page is rendered on the application. It can be seen that the time obtained when the page is rendered on the application is inaccurate.

[0058] Therefore, in order to improve the accuracy of the time when the rendered page is obtained, refer to Figure 1 , shows a flowchart of a method for obtaining a moment in the present application, which may specifically include the following steps:

[0059] In step S101, when the page rendering process is completed, the first moment in the page rendering process and the second moment in the page rendering process are obtained, the first moment is the moment when the total weight of the rendered elements in the page changes the most, and the second moment is the moment when the multimedia resources in the page are rendered. The elements in the page have a cascading relationship in a tree structure, and the levels of the elements in the page in the tree structure are not all the same. The deeper the level, the later the elements are rendered and the greater the weight, while the shallower the level, the earlier the elements are rendered and the smaller the weight.

[0060] In the present application, multimedia resources include elements of multimedia attributes, such as images, videos, and audios.

[0061] In the present application, the time intervals between multiple specific moments may be the same, etc. The time intervals include 100ms, 150ms or 200ms, etc., which may be determined according to actual conditions, and the present application does not limit this. The first moment may be the moment when the page is started to be rendered, etc.

[0062] In the present application, after the page rendering starts, the elements that have been rendered in the page will gradually increase. When all the elements in the page are rendered, no more rendered elements are added to the page. Therefore, it is possible to detect whether no more rendered elements are added to the page continuously within a preset time period. When no more rendered elements are added to the page continuously within a preset time period, it can be determined that the process of rendering the page is completed.

[0063] The preset duration may include 2 seconds, 2.5 seconds or 3 seconds, etc., which may be determined according to actual conditions and is not limited in this application.

[0064] Among them, whether the rendered elements are added to the page can be polled periodically, and the polling period can include 200ms, 250ms or 300ms, etc., which can be determined according to actual conditions and is not limited in this application.

[0065] If it is determined in a polling that a rendered element is added to the page, the timer is reset, for example, the timer is cleared to zero. If it is determined in a polling that no rendered element is added to the page, the timer may not be reset, for example, the timer is not cleared to zero and continues to count.

[0066] Each time it is determined whether a rendered element is added to the page, it can be determined based on the MutationObserver function. Of course, it can also be determined by other methods. This application does not limit the method of determining whether a rendered element is added to the page.

[0067] In this application, when rendering a page, the elements with a shallow hierarchy in the page are often rendered first, and then the elements with a deep hierarchy in the page are rendered.

[0068] For example, for any two elements of adjacent levels, one element has a shallower level and the other element has a deeper level. During the rendering process, the element with the shallower level is often rendered first, and then the element with the deeper level is rendered.

[0069] And because the deeper the level, the later the elements are rendered and the greater the weight, while the shallower the level, the earlier the elements are rendered and the smaller the weight. Therefore, in the tree structure, the element at the root node is rendered the earliest and has the smallest weight, and the element at the "node with more levels between it and the root node" is rendered later and has a greater weight.

[0070] Therefore, in the process of rendering a page, as time goes by, the number of elements that have been rendered in the page gradually increases, and the gradually increasing number of elements that have been rendered are often elements with increasingly larger weights. This makes it so that in the process of rendering a page, the sum of the weights of the elements that have been rendered in the page at a later specific moment is often greater than the sum of the weights of the elements that have been rendered in the page at an earlier specific moment. As a result, in the process of rendering a page, the difference between the sum of the weights of the elements that have been rendered in the page at a later specific moment and the sum of the weights of the elements that have been rendered in the page at an adjacent earlier specific moment is greater.

[0071] Among them, "the moment when the sum of the weights of the rendered elements in the page changes the most" may sometimes be the moment when the page is rendered, and sometimes may not be the moment when the page is rendered (for example, earlier than the moment when the page is rendered).

[0072] For example, the elements in the present application also include elements of multimedia attributes. The "moment when the elements of multimedia attributes are rendered" may sometimes be earlier than the "moment when the sum of the weights of the elements that have been rendered in the page changes the most", and sometimes may be later than the "moment when the sum of the weights of the elements that have been rendered in the page changes the most".

[0073] When "the moment when the multimedia resources are rendered" is later than "the moment when the sum of the weights of the rendered elements in the page changes the most", "the moment when the multimedia resources are rendered" is closer to the moment when the page is rendered, or is more likely to be the moment when the page is rendered.

[0074] When "the moment when the multimedia resources are rendered" is earlier than "the moment when the sum of the weights of the rendered elements in the page changes the most", "the moment when the multimedia resources are rendered" is not the moment when the page is rendered, and "the moment when the sum of the weights of the rendered elements in the page changes the most" is closer to the moment when the page is rendered, or is more likely to be the moment when the page is rendered.

[0075] Therefore, when it is necessary to determine the moment when the page is rendered, in addition to obtaining the moment when the sum of the weights of the rendered elements in the page changes the most during the page rendering process, it is also necessary to obtain the moment when the multimedia resources in the page are rendered, and then execute step S102.

[0076] In step S102, the time when the page is rendered is obtained according to the first time and the second time.

[0077] In the present application, if the first moment is earlier than the second moment, the second moment can be determined as the moment when the page is rendered. Alternatively, if the first moment is later than the second moment, the first moment can be determined as the moment when the page is rendered.

[0078] In the present application, when the process of rendering a page is completed, the first moment in the process of rendering the page and the second moment in the process of rendering the page are obtained, the first moment is the moment when the sum of the weights of the elements that have been rendered in the page changes the most, and the second moment is the moment when the multimedia resources in the page are rendered. Among them, the elements in the page have a cascading relationship in a tree structure, and the levels of the elements in the page in the tree structure are not all the same. The deeper the level, the later the elements are rendered and the greater the weight, and the shallower the level, the earlier the elements are rendered and the smaller the weight. The moment when the page is rendered is obtained according to the first moment and the second moment.

[0079] On the one hand, the process of obtaining the time when the rendering of the page is completed is not started until the page rendering process is completed, so as to avoid obtaining the time when the rendering of the page is completed during the period of the page rendering process (rendering is not completed), and further avoid the situation where the obtained time when the rendering of the page is completed is earlier than the actual time when the rendering of the page is completed. Therefore, the accuracy of the obtained time when the rendering of the page is completed can be improved.

[0080] On the other hand, after the page is rendered (equivalent to the page being rendered for the first time), if the user operates the page so that the electronic device renders the page for the second time, thereby causing a small part of the content of the page to change, in the case of the second rendering of the page, new elements may be rendered on the page, that is, the number of elements that have been rendered on the page will increase. However, since the second rendering usually renders the shallowest elements first, the elements with deeper levels will not be rendered until the shallowest elements are rendered, and since the deeper the elements are, the later they are rendered and the greater their weights, the shallower the elements are, the earlier they are rendered and the smaller their weights. Therefore, in the case where the second rendering only changes a small part of the content of the page, "the degree of change in the sum of the weights of the rendered elements in the page at each specific moment in the second rendering process" is less than "the maximum degree of change in the sum of the weights of the rendered elements in the page at each specific moment in the first rendering process".

[0081] Therefore, through the present application, after the page is rendered for the first time, even if the user operates the page so that the electronic device renders the page for the second time and thus changes a small part of the content of the page, the moment when the sum of the weights of the rendered elements in the page changes the most (first moment) will be a specific moment in the first rendering process, and a specific moment in the second rendering process will not be used as the moment when the sum of the weights of the rendered elements in the page changes the most (first moment), thereby improving the accuracy of the moment when the page is rendered.

[0082] In one embodiment of the present application, when obtaining the first moment in the process of rendering a page, it can be implemented through the following process, including:

[0083] 11) For any specific moment among the multiple specific moments, the sum of the weights of the elements that have been rendered in the page at the specific moment is obtained.

[0084] For any specific moment among multiple specific moments, at least part of the elements in the page have been rendered at the specific moment, and the weights of each element that has been rendered at the specific moment can be obtained. For example, the level of the element in the tree structure of the page can be determined, and then the weight corresponding to the level can be obtained and used as the weight of the element, and then the sum of the weights of each element that has been rendered at the specific moment can be calculated.

[0085] The same is true for every other specific moment in the plurality of specific moments.

[0086] 12) For any two adjacent specific moments among the multiple specific moments, calculate the difference between "the sum of the weights of all elements that have been rendered on the page at the later specific moment among the two adjacent specific moments" and "the sum of the weights of all elements that have been rendered on the page at the earlier specific moment among the two adjacent specific moments".

[0087] The same is true for every other two adjacent specific moments in the plurality of specific moments.

[0088] 13) Determine the largest difference among the calculated differences.

[0089] 14) Obtain the first moment according to the later specific moment corresponding to the sum of the weights based on which the maximum difference is calculated.

[0090] In the present application, the calculation of the maximum difference in step 12) is based on the sum of two weights, one sum of weights corresponding to a specific moment in the front, and one sum of weights corresponding to a specific moment in the back. The specific moment in the back corresponding to the sum of weights based on which the maximum difference is calculated can be used as the first moment, etc.

[0091] In one embodiment of the present application, when obtaining the second moment in the process of rendering the page, it can be implemented through the following process, including:

[0092] 21) Obtaining the completion time when the elements of each multimedia attribute in the page are rendered respectively, and obtaining the completion time when the images in the styles of the elements in the page are rendered respectively.

[0093] In the present application, the elements in the page that need to be rendered can be located in the "body" element. Of course, the "body" element may also contain elements in the page that do not need to be rendered.

[0094] After rendering the page, you can get the elements in the "body" element through the "document" function.

[0095] For any element obtained, it is possible to determine whether the element has been rendered on the page. If the element has been rendered on the page, it is possible to determine whether the element is an element with multimedia attributes. For example, it is possible to determine whether there are multimedia attributes in the name of the element, such as IMG (used to represent images), etc. If there are multimedia attributes in the name of the element, it can be determined that the element is an element with multimedia attributes. If there are no multimedia attributes in the name of the element, it can be determined that the element is not an element with multimedia attributes.

[0096] In the case where the element is an element of a multimedia attribute, the address of the element of the multimedia attribute is stored in the array.

[0097] When the element is not an element of multimedia attributes, it is determined whether there is an image (such as a background image, etc.) in the style attributes of the element. For example, the getComputedStyle function can be used to determine whether there is an image in the style attributes of the element.

[0098] When an image exists in the style of the element, the address of the image existing in the style of the element is stored in the array.

[0099] If no image exists in the element's style, determine if the element has any child elements.

[0100] If there is a child element in the element, the above process of "determining whether the element has been rendered on the page" is returned to the child element.

[0101] If there are no child elements in this element, the process ends for this element.

[0102] For each other element obtained, perform the above operation in the same way.

[0103] After that, you can get the addresses in the array, which include the address of the element including the multimedia attribute and the address of the image in the style attribute in the element, etc.

[0104] The time when the element of the multimedia attribute is rendered can be obtained according to the address of the element of the multimedia attribute by using the performance.getEntriesByName function, and used as the completion time when the element of the multimedia attribute is rendered.

[0105] And, by using the performance.getEntriesByName function, the time when the image in the style attribute of the element is rendered is obtained according to the address of the image in the style attribute of the element, and the time when the image in the style of the element is rendered is used as the completion time.

[0106] 22) Obtain the second time according to the latest completion time among the obtained completion times.

[0107] The latest completion time can be selected from the acquired completion times and used as the second time in the process of rendering the page.

[0108] In the scene of rendering a page, sometimes the multimedia resources in the page include not only elements with multimedia attributes, but also images (such as background images) in the style of elements without multimedia attributes.

[0109] Sometimes the completion time of the image in the style of the element with non-multimedia attributes in the rendered page is later than the rendering time of the element with multimedia attributes in the rendered page. Therefore, in this case, the completion time of the image in the style of the element in the rendered page is closer to the actual rendering time of the page.

[0110] Therefore, in order to improve the accuracy of the moment when the rendering of the page is completed, in the present application, when obtaining the second moment in the process of rendering the page, in addition to referring to the completion moment when the elements of each multimedia attribute in the page are rendered separately, it is also necessary to refer to the completion moment when the image in the style of the element in the page is rendered separately. For example, among the completion moment when the elements of each multimedia attribute in the page are rendered separately and the completion moment when the image in the style of the element in the page is rendered separately, the latest completion moment is selected as the second moment in the process of rendering the page, etc.

[0111] It should be noted that, for the method embodiments, for the sake of simplicity, they are all expressed as a series of action combinations, but those skilled in the art should be aware that the present application is not limited by the order of the actions described, because according to the present application, certain steps can be performed in other orders or simultaneously. Secondly, those skilled in the art should also be aware that the embodiments described in the specification are all optional embodiments, and the actions involved are not necessarily required by the present application.

[0112] Reference Figure 2 , shows a structural block diagram of a time acquisition device of the present application, which may specifically include the following modules:

[0113] A first acquisition module 11 is used to acquire a first moment in the process of rendering the page when the process of rendering the page has been completed, and a second acquisition module 12 is used to acquire a second moment in the process of rendering the page, wherein the first moment is the moment when the sum of the weights of the elements that have been rendered in the page has changed the most, and the second moment is the moment when the multimedia resources in the page have been rendered, wherein the elements in the page have a cascading relationship in a tree structure, and the levels of the elements in the page in the tree structure are not all the same, the deeper the level, the later the elements are rendered and the greater the weight, and the shallower the level, the earlier the elements are rendered and the smaller the weight;

[0114] The third acquisition module 13 is used to acquire the time when the page is rendered according to the first time and the second time.

[0115] In an optional implementation, the third acquisition module includes:

[0116] A first determining unit, configured to determine the second moment as a moment when the page is rendered when the first moment is earlier than the second moment;

[0117] or,

[0118] The second determining unit is configured to determine, when the first moment is later than the second moment, the moment when the rendering of the page is completed by using the first moment.

[0119] In an optional implementation, the first acquisition module includes:

[0120] A first acquisition unit is used to acquire, for any specific moment among the multiple specific moments, the sum of weights of all elements in the page that have been rendered at the specific moment;

[0121] a calculation unit, configured to calculate, for any two adjacent specific moments among the multiple specific moments, a difference between a sum of weights of all elements in the page that have been rendered at a later specific moment among the two adjacent specific moments and a sum of weights of all elements in the page that have been rendered at an earlier specific moment among the two adjacent specific moments;

[0122] A third determining unit, configured to determine a maximum difference value among the calculated differences;

[0123] The second acquisition unit is used to acquire the first moment according to a later specific moment corresponding to the sum of the weights based on which the maximum difference is calculated.

[0124] In an optional implementation, the second acquisition module includes:

[0125] A third acquisition unit is used to acquire the completion time when the elements of each multimedia attribute in the page are rendered respectively, and to acquire the completion time when the images in the styles of the elements in the page are rendered respectively;

[0126] The fourth acquisition unit is used to acquire the second time according to the latest completion time among the acquired completion times.

[0127] In the present application, when the process of rendering a page is completed, the first moment in the process of rendering the page and the second moment in the process of rendering the page are obtained, the first moment is the moment when the sum of the weights of the elements that have been rendered in the page changes the most, and the second moment is the moment when the multimedia resources in the page are rendered. Among them, the elements in the page have a cascading relationship in a tree structure, and the levels of the elements in the page in the tree structure are not all the same. The deeper the level, the later the elements are rendered and the greater the weight, and the shallower the level, the earlier the elements are rendered and the smaller the weight. The moment when the page is rendered is obtained according to the first moment and the second moment.

[0128] On the one hand, the process of obtaining the time when the rendering of the page is completed is not started until the page rendering process is completed, so as to avoid obtaining the time when the rendering of the page is completed during the period of the page rendering process (rendering is not completed), and further avoid the situation where the obtained time when the rendering of the page is completed is earlier than the actual time when the rendering of the page is completed. Therefore, the accuracy of the obtained time when the rendering of the page is completed can be improved.

[0129] On the other hand, after the page is rendered (equivalent to the page being rendered for the first time), if the user operates the page so that the electronic device renders the page for the second time, thereby causing a small part of the content of the page to change, in the case of the second rendering of the page, new elements may be rendered on the page, that is, the number of elements that have been rendered on the page will increase. However, since the second rendering usually renders the shallowest elements first, the elements with deeper levels will not be rendered until the shallowest elements are rendered, and since the deeper the elements are, the later they are rendered and the greater their weights, the shallower the elements are, the earlier they are rendered and the smaller their weights. Therefore, in the case where the second rendering only changes a small part of the content of the page, "the degree of change in the sum of the weights of the rendered elements in the page at each specific moment in the second rendering process" is less than "the maximum degree of change in the sum of the weights of the rendered elements in the page at each specific moment in the first rendering process".

[0130] Therefore, through the present application, after the page is rendered for the first time, even if the user operates the page so that the electronic device renders the page for the second time and thus changes a small part of the content of the page, the moment when the sum of the weights of the rendered elements in the page changes the most (first moment) will be a specific moment in the first rendering process, and a specific moment in the second rendering process will not be used as the moment when the sum of the weights of the rendered elements in the page changes the most (first moment), thereby improving the accuracy of the moment when the page is rendered.

[0131] As for the device embodiment, since it is basically similar to the method embodiment, the description is relatively simple, and the relevant parts can be referred to the partial description of the method embodiment.

[0132] Figure 3 800 is a block diagram of an electronic device 800 shown in the present application. For example, the electronic device 800 may be a mobile phone, a computer, a digital broadcast terminal, a messaging device, a game console, a tablet device, a medical device, a fitness device, a personal digital assistant, etc.

[0133] Reference Figure 3 , the electronic device 800 may include one or more of the following components: a processing component 802 , a memory 804 , a power component 806 , a multimedia component 808 , an audio component 810 , an input / output (I / O) interface 812 , a sensor component 814 , and a communication component 816 .

[0134] The processing component 802 generally controls the overall operation of the electronic device 800, such as operations associated with display, phone calls, data communications, camera operations, and recording operations. The processing component 802 may include one or more processors 820 to execute instructions to complete all or part of the steps of the above method. In addition, the processing component 802 may include one or more modules to facilitate the interaction between the processing component 802 and other components. For example, the processing component 802 may include a multimedia module to facilitate the interaction between the multimedia component 808 and the processing component 802.

[0135] The memory 804 is configured to store various types of data to support operations on the device 800. Examples of such data include instructions for any application or method operating on the electronic device 800, contact data, phone book data, messages, images, videos, etc. The memory 804 can be implemented by any type of volatile or non-volatile storage device or a combination thereof, such as static random access memory (SRAM), electrically erasable programmable read-only memory (EEPROM), erasable programmable read-only memory (EPROM), programmable read-only memory (PROM), read-only memory (ROM), magnetic memory, flash memory, magnetic disk or optical disk.

[0136] The power supply component 806 provides power to the various components of the electronic device 800. The power supply component 806 may include a power management system, one or more power supplies, and other components associated with generating, managing, and distributing power to the electronic device 800.

[0137] The multimedia component 808 includes a screen that provides an output interface between the electronic device 800 and the user. In some embodiments, the screen may include a liquid crystal display (LCD) and a touch panel (TP). If the screen includes a touch panel, the screen may be implemented as a touch screen to receive input signals from the user. The touch panel includes one or more touch sensors to sense touch, slide, and gestures on the touch panel. The touch sensor may not only sense the boundaries of the touch or slide action, but also detect the duration and pressure associated with the touch or slide operation. In some embodiments, the multimedia component 808 includes a front camera and / or a rear camera. When the device 800 is in an operating mode, such as a shooting mode or a video mode, the front camera and / or the rear camera may receive external multimedia data. Each front camera and the rear camera may be a fixed optical lens system or have a focal length and optical zoom capability.

[0138] The audio component 810 is configured to output and / or input audio signals. For example, the audio component 810 includes a microphone (MIC), and when the electronic device 800 is in an operating mode, such as a call mode, a recording mode, and a voice recognition mode, the microphone is configured to receive an external audio signal. The received audio signal can be further stored in the memory 804 or sent via the communication component 816. In some embodiments, the audio component 810 also includes a speaker for outputting audio signals.

[0139] I / O interface 812 provides an interface between processing component 802 and peripheral interface modules, such as keyboards, click wheels, buttons, etc. These buttons may include but are not limited to: home button, volume button, start button, and lock button.

[0140] The sensor assembly 814 includes one or more sensors for providing various aspects of status assessment for the electronic device 800. For example, the sensor assembly 814 can detect the open / closed state of the device 800, the relative positioning of components, such as the display and keypad of the electronic device 800, and the sensor assembly 814 can also detect the position change of the electronic device 800 or a component of the electronic device 800, the presence or absence of contact between the user and the electronic device 800, the orientation or acceleration / deceleration of the electronic device 800, and the temperature change of the electronic device 800. The sensor assembly 814 may include a proximity sensor configured to detect the presence of nearby objects without any physical contact. The sensor assembly 814 may also include an optical sensor, such as a CMOS or CCD image sensor, for use in imaging applications. In some embodiments, the sensor assembly 814 may also include an accelerometer, a gyroscope sensor, a magnetic sensor, a pressure sensor, or a temperature sensor.

[0141] The communication component 816 is configured to facilitate wired or wireless communication between the electronic device 800 and other devices. The electronic device 800 can access a wireless network based on a communication standard, such as WiFi, a carrier network (such as 2G, 3G, 4G or 5G), or a combination thereof. In an exemplary embodiment, the communication component 816 receives a broadcast signal or broadcast operation information from an external broadcast management system via a broadcast channel. In an exemplary embodiment, the communication component 816 also includes a near field communication (NFC) module to facilitate short-range communication. For example, the NFC module can be implemented based on radio frequency identification (RFID) technology, infrared data association (IrDA) technology, ultra-wideband (UWB) technology, Bluetooth (BT) technology and other technologies.

[0142] In an exemplary embodiment, the electronic device 800 may be implemented by one or more application-specific integrated circuits (ASICs), digital signal processors (DSPs), digital signal processing devices (DSPDs), programmable logic devices (PLDs), field programmable gate arrays (FPGAs), controllers, microcontrollers, microprocessors, or other electronic components to perform the above methods.

[0143] In an exemplary embodiment, a non-transitory computer-readable storage medium including instructions is also provided, such as a memory 804 including instructions, and the instructions can be executed by a processor 820 of an electronic device 800 to perform the above method. For example, the non-transitory computer-readable storage medium can be a ROM, a random access memory (RAM), a CD-ROM, a magnetic tape, a floppy disk, an optical data storage device, etc.

[0144] Figure 4 1 is a block diagram of an electronic device 1900 shown in the present application. For example, the electronic device 1900 may be provided as a server.

[0145] Reference Figure 4 , the electronic device 1900 includes a processing component 1922, which further includes one or more processors, and a memory resource represented by a memory 1932 for storing instructions executable by the processing component 1922, such as an application. The application stored in the memory 1932 may include one or more modules, each corresponding to a set of instructions. In addition, the processing component 1922 is configured to execute instructions to perform the above method.

[0146] The electronic device 1900 may also include a power supply component 1926 configured to perform power management of the electronic device 1900, a wired or wireless network interface 1950 configured to connect the electronic device 1900 to a network, and an input / output (I / O) interface 1958. The electronic device 1900 may operate based on an operating system stored in the memory 1932, such as Windows Server™, Mac OS X™, Unix™, Linux™, FreeBSD™ or the like.

[0147] The various embodiments in this specification are described in a progressive manner, and each embodiment focuses on the differences from other embodiments. The same or similar parts between the various embodiments can be referenced to each other.

[0148] Those skilled in the art will appreciate that the embodiments of the present application may be provided as methods, devices, or computer program products. Therefore, the present application may adopt the form of a complete hardware embodiment, a complete software embodiment, or an embodiment in combination with software and hardware. Moreover, the present application may adopt the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) that contain computer-usable program code.

[0149] The present application is described with reference to the flowcharts and / or block diagrams of the methods, terminal devices (systems), and computer program products according to the present application. It should be understood that each process and / or block in the flowchart and / or block diagram, as well as the combination of the processes and / or blocks in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable processor of a terminal device to generate a machine, so that the instructions executed by the processor of the computer or other programmable processor of the terminal device are used to implement the process in the process. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.

[0150] These computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable time acquisition terminal device to operate in a specific manner, so that the instructions stored in the computer-readable memory produce a manufactured product including an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.

[0151] These computer program instructions can also be loaded onto a computer or other programmable time acquisition terminal device so that a series of operating steps are executed on the computer or other programmable terminal device to produce a computer-implemented process, thereby providing instructions executed on the computer or other programmable terminal device for implementing the process. Figure 1 A process or multiple processes and / or boxes Figure 1 The steps for the functions specified in one or more boxes.

[0152] Although the preferred embodiments of the present application have been described, those skilled in the art may make additional changes and modifications to these embodiments once they have learned the basic creative concept. Therefore, the appended claims are intended to be interpreted as including the preferred embodiments and all changes and modifications falling within the scope of the present application.

[0153] Finally, it should be noted that, in this article, relational terms such as first and second, etc. are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or terminal device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or terminal device. In the absence of further restrictions, the elements defined by the sentence "comprise a ..." do not exclude the existence of other identical elements in the process, method, article or terminal device including the elements.

[0154] The above is a detailed introduction to a moment acquisition method and device provided by the present application. Specific examples are used in this article to illustrate the principles and implementation methods of the present application. The description of the above embodiments is only used to help understand the method of the present application and its core idea; at the same time, for general technical personnel in this field, according to the idea of ​​the present application, there will be changes in the specific implementation method and application scope. In summary, the content of this specification should not be understood as a limitation on the present application.

Claims

1. A time acquisition method, characterized in that: The method comprises: When the process of rendering the page is completed, obtaining a first moment in the process of rendering the page and obtaining a second moment in the process of rendering the page, wherein the first moment is the moment when the sum of weights of elements in the page that have been rendered changes to the greatest extent, and the second moment is the moment when the multimedia resources in the page are rendered, wherein the elements in the page have a cascading relationship in a tree structure, and the levels of the elements in the page in the tree structure are not all the same, and the deeper the level, the later the elements are rendered and the greater the weight, and the shallower the level, the earlier the elements are rendered and the smaller the weight; Acquire a time when the page is rendered according to the first time and the second time; The obtaining of the first moment in the process of rendering the page includes: For any specific moment among the multiple specific moments, obtaining the sum of weights of all elements in the page that have been rendered at the specific moment; For any two adjacent specific moments among the multiple specific moments, calculating the difference between the sum of the weights of the elements in the page that have been rendered at the later specific moment among the two adjacent specific moments and the sum of the weights of the elements in the page that have been rendered at the earlier specific moment among the two adjacent specific moments; determining the largest difference among the calculated differences; Obtaining the first moment according to a later specific moment corresponding to the sum of the weights based on which the maximum difference is calculated; The acquiring the time when the rendering of the page is completed according to the first time and the second time includes: When the first time is earlier than the second time, determining the second time as the time when the page is rendered; or, When the first time is later than the second time, the first time is determined as the time when the page is rendered.

2. The method according to claim 1, characterized in that Get the second moment in the process of rendering the page, including: Obtaining the completion time when the elements of each multimedia attribute in the page are rendered respectively, and obtaining the completion time when the images in the styles of the elements in the page are rendered respectively; The second time is acquired according to the latest completion time among the acquired completion times.

3. A time acquisition device, characterized in that: The device comprises: A first acquisition module is used to acquire a first moment in the process of rendering the page when the process of rendering the page is completed, and a second acquisition module is used to acquire a second moment in the process of rendering the page, wherein the first moment is the moment when the sum of weights of elements in the page that have been rendered changes to the greatest extent, and the second moment is the moment when the multimedia resources in the page are rendered, wherein the elements in the page have a cascading relationship in a tree structure, and the levels of the elements in the page in the tree structure are not all the same, and the deeper the level, the later the elements are rendered and the greater the weight, and the shallower the level, the earlier the elements are rendered and the smaller the weight; A third acquisition module, used for acquiring a time when the page is rendered according to the first time and the second time; The first acquisition module includes: A first acquisition unit is used to acquire, for any specific moment among a plurality of specific moments, the sum of weights of all elements in the page that have been rendered at the specific moment; a calculation unit, configured to calculate, for any two adjacent specific moments among the multiple specific moments, a difference between a sum of weights of all elements in the page that have been rendered at a later specific moment among the two adjacent specific moments and a sum of weights of all elements in the page that have been rendered at an earlier specific moment among the two adjacent specific moments; A third determining unit, configured to determine a maximum difference value among the calculated differences; A second acquiring unit, configured to acquire the first moment according to a later specific moment corresponding to the sum of weights based on which the maximum difference is calculated; The third acquisition module includes: A first determining unit, configured to determine the second moment as a moment when the page is rendered when the first moment is earlier than the second moment; or, The second determining unit is configured to determine, when the first moment is later than the second moment, the moment when the rendering of the page is completed by using the first moment.

4. The device according to claim 3, characterized in that The second acquisition module includes: A third acquisition unit is used to acquire the completion time when the elements of each multimedia attribute in the page are rendered respectively, and to acquire the completion time when the images in the styles of the elements in the page are rendered respectively; The fourth acquisition unit is used to acquire the second time according to the latest completion time among the acquired completion times.

5. An electronic device, characterized in that: The electronic device comprises: processor; a memory for storing processor-executable instructions; The processor is configured to execute the moment acquisition method as described in any one of claims 1-2.

6. A non-transitory computer-readable storage medium, when the instructions in the storage medium are executed by a processor of an electronic device, the electronic device is enabled to execute the moment acquisition method as described in any one of claims 1-2.

Citation Information

Patent Citations

  • Method and system for structured-document rendering

    CN102663002A

  • Detection method and device for visible time of home screen page and electronic equipment

    CN111258877A