WO2022134875A1 - 数据的获取方法及电子设备 - Google Patents

数据的获取方法及电子设备 Download PDF

Info

Publication number
WO2022134875A1
WO2022134875A1 PCT/CN2021/128390 CN2021128390W WO2022134875A1 WO 2022134875 A1 WO2022134875 A1 WO 2022134875A1 CN 2021128390 W CN2021128390 W CN 2021128390W WO 2022134875 A1 WO2022134875 A1 WO 2022134875A1
Authority
WO
WIPO (PCT)
Prior art keywords
rendering
data
webpage
web page
attribute
Prior art date
Application number
PCT/CN2021/128390
Other languages
English (en)
French (fr)
Inventor
王文杰
Original Assignee
北京达佳互联信息技术有限公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 北京达佳互联信息技术有限公司 filed Critical 北京达佳互联信息技术有限公司
Publication of WO2022134875A1 publication Critical patent/WO2022134875A1/zh

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/30Monitoring
    • G06F11/34Recording or statistical evaluation of computer activity, e.g. of down time, of input/output operation ; Recording or statistical evaluation of user activity, e.g. usability assessment
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/90Details of database functions independent of the retrieved data types
    • G06F16/95Retrieval from the web
    • G06F16/958Organisation or management of web site content, e.g. publishing, maintaining pages or automatic linking

Definitions

  • the present disclosure relates to the field of computer technology, and in particular, to a data acquisition method and an electronic device.
  • Web page performance monitoring is an important function in the technical field of web pages.
  • High-performance pages can bring users an excellent experience, increase user stickiness, and improve the conversion rate of web pages.
  • a data acquisition method which is executed by an electronic device, where a browser is installed in the electronic device, and the browser includes an interface description language file, and the interface description language file contains An attribute type is set, and the attribute type indicates the type to which the performance data of the webpage belongs, and the method includes:
  • the attribute value of the attribute type contained in the interface description language file is transmitted to the performance monitoring interface of the browser, and the attribute value of the attribute type is obtained from the performance monitoring interface.
  • the obtaining, by using the browser, rendering parameters of web page data includes:
  • a rendering notification method is invoked to obtain the rendering parameters of the web page data for which this rendering is completed.
  • the kernel of the browser has a performance timing interface
  • the method further includes:
  • the generating the attribute value of the attribute type based on the rendering parameter includes:
  • the performance timing interface is called to generate the attribute value of the attribute type based on the rendering parameter.
  • the performance monitoring interface is an interface in a scripting environment of the browser
  • the obtaining the attribute value of the attribute type from the performance monitoring interface includes:
  • the calling script obtains the attribute value of the attribute type from the performance monitoring interface.
  • the rendering parameter includes a first rendering parameter, and the attribute type includes a first drawing time; the generating an attribute value of the attribute type based on the rendering parameter includes:
  • the time point when the rendering of the webpage data ends is determined as the first rendering time property value.
  • the rendering parameter includes text rendering parameters; the attribute type includes the first content rendering time; and the generating an attribute value of the attribute type based on the rendering parameter includes:
  • the time point when the rendering of the webpage data ends is determined as the first content The property value of the draw time.
  • the rendering parameters include text rendering parameters and/or image rendering parameters;
  • the attribute type includes the first effective drawing time; and the generating an attribute value of the attribute type based on the rendering parameter includes:
  • the attribute value of the first effective rendering time is generated based on the text rendering parameter and/or the picture rendering parameter of the webpage data, and the time point when the webpage data is rendered complete.
  • the target web page corresponds to multiple frames of the web page data, the text rendering parameters and/or the image rendering parameters based on the web page data, and the time when the web page data is rendered.
  • the attribute value of the first valid drawing time is generated, including:
  • For each frame of the webpage data obtain the number of target webpage objects based on the text rendering parameters and/or the picture rendering parameters of the webpage data, where the target webpage objects are webpage objects included in the target webpage, and the webpage layout of the target webpage is changed;
  • the time point when the webpage data corresponding to the largest second ratio is rendered is determined as the attribute value of the first effective rendering time.
  • the time point when the webpage data corresponding to the largest second ratio is rendered is determined as the attribute value of the first effective rendering time ,include:
  • an apparatus for acquiring data a browser is installed in the apparatus, the browser includes an interface description language file, and an attribute type is set in the interface description language file, The attribute type indicates the type to which the performance data of the webpage belongs, and the apparatus includes:
  • an acquisition module configured to acquire, through the browser, rendering parameters of web page data, where the web page data is data of a target web page;
  • a generating module configured to generate an attribute value of the attribute type based on the rendering parameter
  • the export module is configured to transmit the attribute value of the attribute type contained in the interface description language file to the performance monitoring interface of the browser based on the interface description language file, and obtain the attribute type from the performance monitoring interface property value.
  • the obtaining module is configured to, through the browser, call a rendering notification method to obtain the webpage whose rendering ends this time after each frame of the webpage data of the target webpage is rendered. Rendering parameters for the data.
  • the kernel of the browser has a performance timing interface
  • the apparatus further includes:
  • a transmission module configured to transmit the rendering parameters to the performance timing interface
  • the generating module is configured to call the performance timing interface to generate an attribute value of the attribute type based on the rendering parameter.
  • the performance monitoring interface is an interface in a scripting environment of the browser
  • the export module is configured to call a script to obtain the attribute value of the attribute type from the performance monitoring interface.
  • the rendering parameter includes a first rendering parameter;
  • the attribute type of the performance data includes a first rendering time;
  • the generating module is configured to, when the parameter value of the first rendering parameter is a first parameter threshold, And if the attribute value of the first rendering time is empty, the time point when the rendering of the webpage data ends is determined as the attribute value of the first rendering time.
  • the rendering parameter includes a text rendering parameter; the attribute type includes the first content rendering time; the generating module is further configured to be a second parameter threshold when the parameter value of the text rendering parameter is a second parameter threshold, and When the attribute value of the first content rendering time is empty, the time point when the rendering of the webpage data ends is determined as the attribute value of the first content rendering time.
  • the rendering parameters include text rendering parameters and/or image rendering parameters;
  • the attribute type includes the first effective drawing time;
  • the generating module is further configured to render the text based on the webpage data The parameter and/or the picture rendering parameter, and the time point when the webpage data is rendered complete, generate the attribute value of the first effective rendering time.
  • the target webpage corresponds to multiple frames of the webpage data
  • the generating module includes:
  • a quantity acquisition module configured to, for each frame of the web page data, acquire the number of target web page objects based on the text rendering parameters and/or the picture rendering parameters of the web page data, where the target web page objects are the The web page object contained in the target web page, and the web page layout of the target web page is changed;
  • a ratio generating module configured to generate a first ratio between the height of the target web page and the height of the screen
  • a ratio comparison module configured to determine a larger value between the first ratio and a preset value, and to determine a second ratio between the quantity and the larger value
  • the time recording module is configured to determine, based on the second ratio corresponding to the webpage data of each frame, the time point when the webpage data corresponding to the largest second ratio is rendered as the attribute value of the first effective rendering time.
  • the time recording module is configured to, after the text object and/or picture object in the target webpage is loaded, based on the second ratio corresponding to the webpage data of each frame, The time point when the rendering of the webpage data corresponding to the two ratios ends is determined as the attribute value of the first effective rendering time.
  • an electronic device comprising: a processor; a memory for storing instructions executable by the processor; wherein the electronic device is installed with a browser, the browser It includes an interface description language file, wherein an attribute type is set in the interface description language file, and the attribute type indicates the type to which the performance data of the web page belongs, and the processor is configured to execute the instruction to realize the following steps:
  • the attribute value of the attribute type contained in the interface description language file is transmitted to the performance monitoring interface of the browser, and the attribute value of the attribute type is obtained from the performance monitoring interface.
  • the processor is configured to execute the instructions to perform the following steps:
  • a rendering notification method is invoked to obtain the rendering parameters of the web page data for which this rendering is completed.
  • the kernel of the browser has a performance timing interface
  • the processor is configured to execute the instructions to implement the following steps:
  • the performance timing interface is called to generate the attribute value of the attribute type based on the rendering parameter.
  • the performance monitoring interface is an interface in a scripting environment of the browser; the processor is configured to execute the instructions to implement the following steps:
  • the calling script obtains the attribute value of the attribute type from the performance monitoring interface.
  • the rendering parameters include first rendering parameters, and the attribute type includes first rendering time;
  • the processor is configured to execute the instructions to achieve the following steps:
  • the time point when the rendering of the webpage data ends is determined as the first rendering time property value.
  • the rendering parameters include text rendering parameters; the attribute type includes first content rendering time; and the processor is configured to execute the instructions to implement the following steps:
  • the time point when the rendering of the webpage data ends is determined as the first content The property value of the draw time.
  • the rendering parameters include text rendering parameters and/or image rendering parameters;
  • the attribute type includes the first effective rendering time;
  • the processor is configured to execute the instructions to implement the following steps:
  • the attribute value of the first effective rendering time is generated based on the text rendering parameter and/or the picture rendering parameter of the webpage data, and the time point when the webpage data is rendered complete.
  • the target web page corresponds to multiple frames of the web page data
  • the processor is configured to execute the instructions to implement the following steps:
  • For each frame of the webpage data obtain the number of target webpage objects based on the text rendering parameters and/or the picture rendering parameters of the webpage data, where the target webpage objects are webpage objects included in the target webpage, and the webpage layout of the target webpage is changed;
  • the time point when the webpage data corresponding to the largest second ratio is rendered is determined as the attribute value of the first effective rendering time.
  • the processor is configured to execute the instructions to perform the following steps:
  • a non-volatile computer-readable storage medium which, when the instructions in the non-volatile computer-readable storage medium are executed by a processor of an electronic device, causes all the The electronic device can perform the following steps:
  • the attribute value of the attribute type contained in the interface description language file is transmitted to the performance monitoring interface of the browser, and the attribute value of the attribute type is obtained from the performance monitoring interface. .
  • a computer program product comprising readable program code executable by a processor of an electronic device to accomplish the following steps:
  • the attribute value of the attribute type contained in the interface description language file is transmitted to the performance monitoring interface of the browser, and the attribute value of the attribute type is obtained from the performance monitoring interface.
  • the method provided by the embodiment of the present disclosure does not need to manually mark the webpage data or monitor the loading event when acquiring the attribute value of the attribute type, which reduces the professional skill requirements for technical personnel, does not affect the performance of the webpage, and is suitable for on all web pages.
  • modifying the browser kernel that is, setting the attribute type in the description language file included in the browser, loading the web page data of the target web page through the browser, and then acting as a bridge between the browser kernel and the scripting environment based on the interface description language file It exports the attribute value of the attribute type to the performance monitoring interface of the scripting environment of the browser, and obtains the attribute value of the attribute type from the performance monitoring interface, which realizes the automatic acquisition of the performance data of the webpage.
  • it is not necessary to use the developer tool of the browser and the web page will not be reloaded, which improves the efficiency of acquiring the performance data.
  • Fig. 1 is a flowchart of a method for acquiring data according to an exemplary embodiment.
  • Fig. 2 is a schematic diagram of acquiring rendering parameters according to an exemplary embodiment.
  • FIG. 3 is a schematic diagram showing the change of the attribute value of the first valid drawing time with time according to an exemplary embodiment.
  • Fig. 4 is a block diagram of an apparatus for acquiring data according to an exemplary embodiment.
  • Fig. 5 is a block diagram of an electronic device for acquiring data according to an exemplary embodiment.
  • Fig. 6 is a block diagram of an electronic device for acquiring data according to an exemplary embodiment.
  • the object of the webpage is manually marked, and then the loading event of the object is monitored to obtain the performance data of the webpage.
  • monitoring the loading event will affect the performance of the web page, and manual tagging is not suitable for all web pages, and requires high professional skills of technicians.
  • performance data is obtained based on the developer tools in the browser.
  • the developer tool needs to be started manually, which cannot be automated, and the developer tool needs to reload the web page, which makes the process of obtaining performance data time-consuming and inefficient.
  • FIG. 1 is a flow chart of a method for acquiring data according to an exemplary embodiment.
  • the method for acquiring data is performed by an electronic device, and a browser is installed in the electronic device, and the browser includes An interface description language file, where an attribute type is set in the interface description language file, the attribute type indicates the type to which the performance data of the web page belongs, and the method for acquiring the data specifically includes the following steps.
  • step S11 through the browser, the rendering parameters of the webpage data are obtained, and the webpage data is the data of the target page.
  • the browser loads the webpage data of the target webpage, and during the loading process, the rendering engine of the browser renders the webpage data. After the webpage data is rendered, the rendering parameters of the webpage data can be obtained.
  • step S12 an attribute value of the attribute type is generated based on the rendering parameter.
  • the performance data mainly includes rendering time information of the target web page.
  • the performance data contains various kinds of drawing time information, therefore, it is necessary to obtain various kinds of rendering parameters, and then generate the attribute values of the corresponding attribute types of the performance data according to the various kinds of rendering parameters.
  • an attribute type is set in the interface description language file, the attribute type indicates the type to which the performance data of the webpage belongs, and the attribute value of the attribute type is the performance data of the webpage.
  • Drawing time information the attribute value of the attribute type generated based on the rendering parameters, is the drawing time information contained in the performance data.
  • multiple attribute types are set in the interface description language file, and different attribute types are types to which different performance data belong.
  • an attribute value of each attribute type is generated, and the attribute value of each attribute type is a kind of performance data of the webpage, that is, the attribute values of multiple attribute types are multiple performance parameters of the webpage.
  • the performance parameter includes various kinds of drawing time information, and the attribute value of each attribute type is a kind of drawing time information.
  • step S13 the attribute value of the attribute type is exported to the performance monitoring interface of the browser based on the interface description language file, and the script is invoked to obtain the attribute value of the attribute type from the performance monitoring interface.
  • the interface description language is a computer language used to describe software component interfaces.
  • the interface description language describes the interface in a neutral way, so that objects running on different platforms and programs written in different languages can communicate with each other.
  • the interface description language file acts as a bridge between the browser's kernel (eg, written in the C++ language) and the scripting environment (eg, the JavaScript environment). Since the performance monitoring interface is located in the scripting environment, the attribute value of the attribute type is exported based on the interface description language file to the performance monitoring interface, and the JavaScript script is called to obtain the attribute value of the attribute type from the performance monitoring interface, that is, the performance data of the target web page is obtained.
  • the process of acquiring rendering parameters of webpage data and the process of generating attribute values of attribute types based on the rendering parameters are executed in the kernel of the browser.
  • the interface description language file acts as a bridge between the browser's kernel and the scripting environment. After the attribute value of the attribute type is generated in the browser's kernel, the attribute value of the attribute type contained in the interface description file can be determined. Based on the interface description The language file can transmit the attribute value of the attribute type contained in the interface description language file to the performance monitoring interface located in the script environment, so that the calling script can obtain the attribute value of the attribute type from the performance monitoring interface, which realizes the browser's The interaction between the kernel and the scripting environment.
  • a script is called to obtain the attribute value of the attribute type from the performance monitoring interface, while in another embodiment, the script can be obtained from the performance monitoring interface in other ways without calling the script.
  • the attribute value of the attribute type is called to obtain the attribute value of the attribute type from the performance monitoring interface.
  • the data acquisition solution provided by the embodiments of the present disclosure is implemented by the electronic device through the installed browser, and the attribute type of the performance data is set in the interface description language file of the performance timing interface of the kernel of the browser.
  • the browser is used to load the target webpage, and after the webpage data of the target webpage is rendered, the rendering parameters of the webpage data are obtained, and the attribute value of the attribute type of the performance data is generated based on the rendering parameter. Then, based on the interface description language file, the attribute value of the attribute type of the performance data is exported to the performance monitoring interface of the browser, and the script is invoked to obtain the attribute value of the attribute type from the performance monitoring interface.
  • the data acquisition method provided by the embodiments of the present disclosure is realized by the electronic device through the installed browser, the electronic device obtains the rendering parameters of the webpage data through the installed browser, and through the browser, based on The rendering parameter generates the attribute value of the attribute type.
  • the attribute value of the attribute type is exported to the performance monitoring interface of the browser based on the interface description language file, and the attribute value of the attribute type is obtained from the performance monitoring interface.
  • the method provided by the embodiment of the present disclosure does not need to manually mark the webpage data or monitor the loading event when acquiring the attribute value of the attribute type, which reduces the professional skill requirements for technical personnel, does not affect the performance of the webpage, and is suitable for on all web pages.
  • modifying the browser kernel that is, setting the attribute type in the description language file included in the browser, loading the web page data of the target web page through the browser, and then acting as a bridge between the browser kernel and the scripting environment based on the interface description language file It exports the attribute value of the attribute type to the performance monitoring interface of the scripting environment of the browser, and obtains the attribute value of the attribute type from the performance monitoring interface, which realizes the automatic acquisition of the performance data of the webpage.
  • it is not necessary to use the developer tool of the browser and the web page will not be reloaded, which improves the efficiency of acquiring the performance data.
  • the kernel of the browser adopts the open source Chromium (an open source browser engine), and the rendering engine adopted by Chromium is blink (a browser typesetting engine).
  • the NotifyPaint method (a kind of drawing time) of the PaintTiming interface (an application program interface for users to obtain drawing time information) is called.
  • Notification acquisition method to obtain the rendering parameters of each frame of web page data.
  • the rendering parameter is the parameter of the NotifyPaint method, for example, whether it is the first rendering (is first paint), whether the text content is rendered (text painted), and whether the image is rendered (image painted).
  • the rendering parameters include one or more of first rendering parameters, text rendering parameters, and picture rendering parameters.
  • the first rendering parameter is whether it is the first rendering
  • the text rendering parameter is whether the text content is rendered
  • the image rendering parameter is whether the image is rendered.
  • the first rendering parameter indicates whether the first pixel is rendered in the page when the corresponding webpage data is rendered
  • the text rendering parameter indicates whether the text content is rendered in the page when the corresponding webpage data is rendered
  • image rendering The parameter indicates whether the image is rendered in the page when the corresponding web page data is rendered.
  • the rendering notification method is called, the rendering parameters are transmitted to the performance timing interface, the performance timing interface is called, and the attribute value of the attribute type is generated based on the rendering parameters.
  • the target web page corresponds to multiple frames of web page data
  • the attribute value of this attribute type is generated based on the rendering parameters in the multi-frame web page data.
  • the browser calls the rendering notification method to obtain each The rendering parameters of the web page data of the frame, and the rendering parameters of each frame of web page data are transmitted to the performance timing interface.
  • the performance timing interface is called to generate the attribute value of the attribute type based on the rendering parameters of the multi-frame web page data.
  • the process of the browser loading the web page data of the target web page is a changing process.
  • the browser renders each frame of web page data.
  • the embodiment of the present disclosure can use the NotifyPaint method to obtain the rendering parameters of each frame of webpage data, so as to ensure that after rendering each frame of webpage data, the rendering parameters corresponding to each frame of webpage data are obtained, and the obtained rendering parameters
  • the unit of web page data is per frame.
  • the browser can obtain the rendering parameters of each frame of webpage data, transmit the rendering parameters of each frame of webpage data to the performance timing interface, and provide the attribute value of the attribute type for the subsequent performance timing interface generation.
  • the data foundation is avoided, and the rendering parameters are not obtained after all the webpage data has been rendered, which improves the accuracy of the rendering parameters.
  • the attribute value of the attribute type is generated by calling the performance timing interface after transferring the rendering parameters to the performance timing interface by invoking the rendering notification method. After the notification method obtains the rendering parameters, there is no need to transmit the rendering parameters to the performance timing interface, and other methods can be used to generate attribute values of the attribute type based on the rendering parameters.
  • the attribute type includes one or more of first drawing time, first content drawing time, and first valid drawing time.
  • the first rendering time represents the time point when the first pixel in the target web page is rendered.
  • the first content rendering time refers to the time point at which any object in the Document Object Model (DOM for short) of the target web page is rendered for the first time.
  • the first effective drawing time refers to the time point when the target object in the target webpage is drawn, and the target object is the main part of the target webpage, such as the video object in the video webpage, and the picture object in the picture webpage.
  • the attribute value of the first rendering time can be generated based on the first rendering parameter, the first rendering time and the time point when the webpage data is rendered. That is, when the parameter value of the first rendering parameter is the first parameter threshold, and the attribute value of the first rendering time is empty, the time point when the webpage data corresponding to the first rendering parameter is rendered is determined as the first rendering time. property value. For example, true is the first parameter threshold. When the parameter value of the first rendering parameter of a certain frame of webpage data is "true", and the attribute value of the first rendering time is empty, it can be used when the webpage data is rendered.
  • the time point is recorded as the property value of the first drawing time, and the property value of the first drawing time is stored in the variable of the first drawing time.
  • the variable of the first drawing time is used to record the corresponding attribute value.
  • the attribute value is assigned to the variable of the first drawing time, so that the assigned variable can represent the target webpage.
  • First draw time In this embodiment of the present disclosure, the first rendering parameter in the rendering parameters is combined with the first rendering time in the attribute type, and the first rendering time and the first rendering parameter of a certain frame of webpage data satisfy the first target condition (such as the first rendering parameter of the first rendering parameter).
  • the time point when the page data is rendered is determined as the attribute value of the first rendering time, which realizes the use of the first rendering parameters, the first rendering time and the webpage.
  • the property value of the first drawing time is generated. In this process, there is no need to listen to the loading event, and no need to manually add tags to the target object, and no need to manually open the browser's developer tools. The loading rate of the target web page is improved, and the attribute value of the first drawing time of any target web page can be quickly obtained.
  • the target web page corresponds to multiple frames of web page data
  • the browser sequentially acquires the rendering parameters of each frame of web page data.
  • it is judged in turn whether the first rendering time and the first rendering parameters of each frame of webpage data satisfy the above-mentioned first target condition, and if the first rendering time and the first rendering parameters of any frame of webpage data satisfy
  • the time point when the rendering of the webpage data ends is determined as the attribute value of the first rendering time.
  • the attribute value of the first drawing time is stored in the variable of the first drawing time, while in another embodiment, only the first drawing time is determined.
  • the property value is enough, after that, there is no need to store the property value of the first drawing time in the variable of the first drawing time.
  • the attribute value of the first content rendering time can also be generated based on the text rendering parameters, the first content rendering time, and the time point when the webpage data is rendered. That is, when the parameter value of the text rendering parameter is the second parameter threshold, and the attribute value of the first content rendering time is empty, the time point when the webpage data corresponding to the text rendering parameter is rendered is determined as the first content rendering.
  • the time attribute value For example, true is the second parameter threshold. In an actual application scenario, the first parameter threshold and the second parameter threshold are the same, or the first parameter threshold and the second parameter threshold are different.
  • the time point when the rendering of the webpage data ends is recorded as the time of the first content rendering time.
  • Property value store the property value of the first content drawing time into the variable of the first content drawing time.
  • the variable of the first content rendering time is used to record the corresponding attribute value, and after determining the attribute value of the first content rendering time, the attribute value is assigned to the variable of the first content rendering time, so that the assigned variable can represent the target The first content paint time of the web page.
  • the text rendering parameters in the rendering parameters are combined with the first content rendering time in the attribute type, and the first content rendering time and the text rendering parameters of a certain frame of webpage data satisfy the second target condition (such as text rendering If the parameter value of the parameter is true, and the attribute value of the first content rendering time is empty), the time point when the webpage data is rendered is determined as the attribute value of the first content rendering time, which realizes the use of text rendering parameters.
  • the first content rendering time and the time point when the web page data is rendered generate the attribute value of the first content rendering time.
  • the target web page corresponds to multiple frames of web page data
  • the browser sequentially acquires the rendering parameters of each frame of web page data.
  • the first content rendering time and the text rendering parameters of each frame of webpage data satisfy the above-mentioned second target condition. If the parameter satisfies the above-mentioned second target condition, the time point at which the rendering of the webpage data ends is determined as the attribute value of the first content rendering time. After that, when it has been determined that the attribute value of the first content rendering time is not empty, the step of judging whether the first content rendering time and the text rendering parameters of the rest of the webpage data satisfy the second target condition is no longer performed.
  • the attribute value of the first content rendering time is stored in the variable of the first content rendering time, while in another embodiment, only the first content rendering time is determined.
  • the property value of the content drawing time is sufficient. After that, there is no need to store the property value of the first content drawing time in the variable of the first content drawing time.
  • the attribute value of the attribute type when the attribute value of the attribute type is generated based on the rendering parameter, it can also be based on the text rendering parameter and/or image rendering parameter of the webpage data, as well as the height of the target webpage, the screen height of the terminal where the browser is located, and the webpage data.
  • the property value of the first valid drawing time is generated, and the property value of the first valid drawing time is stored in the variable of the first valid drawing time.
  • the variable of the first effective drawing time is used to record the corresponding attribute value.
  • the attribute value is assigned to the variable of the first effective drawing time, so that the assigned variable can represent the target The first valid draw time of the web page.
  • the process of generating the attribute value of the first effective rendering time it is determined whether the time point when the rendering of each frame of webpage data ends is the attribute value of the first effective rendering time. That is to say, after each frame of web page data is rendered, a first effective rendering time judgment operation is performed. Taking the rendering of a certain frame of webpage data as an example, in the above judgment operation process, first, the number of target webpage objects is obtained based on the text rendering parameters and/or image rendering parameters of the webpage data, and the target webpage object is the target webpage. Contains the web page object that changes the web page layout of the target web page.
  • the target webpage object is a text object, a video object, a picture object, etc. in the target webpage.
  • a first ratio of the height of the target web page to the height of the screen is generated.
  • the height of the target web page is the height of the target web page in a full-screen display state.
  • the first ratio is compared with the preset value, that is, it is determined whether the first ratio is larger or the preset value is larger, and the larger value between the first ratio and the preset value is obtained, and the comparison between the above-mentioned quantity and the preset value is obtained.
  • the second ratio between the large values that is, dividing the above-mentioned quantity by the above-mentioned large value.
  • the second ratio is used to determine whether the time point when the webpage data is rendered is completed is the first valid rendering time, and the second ratio can also be called an attribute ratio.
  • it is determined whether the time point when the next frame of webpage data is rendered is the attribute value of the first effective rendering time, and the attribute ratio corresponding to the next frame of webpage data to be rendered is obtained.
  • the height of the target web page and the screen height The ratio will also increase, however, the attribute ratio will gradually decrease.
  • the attribute ratio corresponding to each frame of webpage data can be obtained, that is, multiple attribute ratios can be obtained.
  • the time point when the webpage data corresponding to the second largest ratio among the multiple attribute ratios is finished being rendered is determined as the attribute value at the first effective rendering time. That is to say, the time point when the webpage data corresponding to the largest attribute ratio is rendered is the time point when the webpage object of the target webpage is loaded. As shown in FIG.
  • FIG. 3 it is a schematic diagram showing the change of the attribute value of the first valid drawing time with time.
  • the abscissa represents the time point when the browser renders each frame of webpage data
  • the ordinate represents the number of webpage objects loaded by the browser
  • the irregular line is the change curve of the attribute ratio corresponding to each frame of webpage data. From Figure 3 It can be seen from the above that 6.047s is the attribute value of the first valid drawing time.
  • the attribute ratio is calculated by using the number of target webpage objects that change the webpage layout, the height of the target webpage, the screen height, etc., and based on the obtained multiple attribute ratios, the largest
  • the time point when the webpage data corresponding to the attribute ratio is rendered is determined as the attribute value of the first effective rendering time, which realizes the automatic generation of the first time using the text rendering parameters and/or image rendering parameters, the height of the target webpage, the screen height and the time point.
  • the attribute value of the effective drawing time is determined as the attribute value of the first effective rendering time, which realizes the automatic generation of the first time using the text rendering parameters and/or image rendering parameters, the height of the target webpage, the screen height and the time point.
  • the attribute value of the first valid drawing time needs to be determined after the text objects and/or picture objects are loaded. That is to say, after the text object and/or image object in the target webpage is loaded, based on the obtained multiple attribute ratios, the time point when the webpage data corresponding to the largest attribute ratio is rendered is determined as the first effective rendering The time attribute value.
  • the attribute value of the first valid drawing time is recorded, so as to avoid the failure to load the text object on the target web page. and/or picture objects, the recorded property value of the first valid drawing time expands the adaptability of the property value of the first valid drawing time, so that the property value of the first valid drawing time is more in line with the actual loading situation of the target web page.
  • the embodiments of the present disclosure are based on text rendering parameters and/or image rendering parameters of web page data, as well as the height of the target web page, the screen height of the terminal where the browser is located, and the time point when the web page data is rendered.
  • the attribute value of the first effective rendering time is generated, and in another embodiment, without performing the above steps, it can be generated based on the text rendering parameters and/or image rendering parameters of the webpage data, and the time point when the webpage data is rendered.
  • Property value for first valid draw time is generated, and in another embodiment, without performing the above steps, it can be generated based on the text rendering parameters and/or image rendering parameters of the webpage data, and the time point when the webpage data is rendered.
  • the embodiments of the present disclosure can recompile the above-mentioned kernel into a new browser, use the new browser to load any web page, and then obtain the performance data of any web page, without the need to modify, mark, etc. the web page to be loaded, thus reducing the batch size
  • the workload of detecting web page performance also expands the scope of application of web page performance detection.
  • Fig. 4 is a block diagram of an apparatus for acquiring data according to an exemplary embodiment.
  • a browser is installed in the device.
  • the browser includes an interface description language file.
  • the interface description language file is provided with attribute types of performance data.
  • the attribute type indicates the type of the performance data of the webpage.
  • the device includes the following modules.
  • the obtaining module 41 is configured to obtain the rendering parameters of the webpage data through the browser, and the webpage data is the data of the target webpage;
  • the generating module 42 is configured to generate the attribute value of the attribute type based on the rendering parameter
  • the export module 43 is configured to transmit the attribute value of the attribute type contained in the interface description language file to the performance monitoring interface of the browser based on the interface description language file, and obtain the attribute value of the attribute type from the performance monitoring interface.
  • the obtaining module 41 is configured to, through the browser, call a rendering notification method to obtain the rendering of the webpage data for which the rendering ends this time after each frame of webpage data of the target webpage is rendered. parameter.
  • the kernel of the browser has a performance timing interface
  • the apparatus further includes:
  • a transmission module configured to transmit rendering parameters to the performance timing interface
  • the generating module 42 is configured to call the performance timing interface to generate the attribute value of the attribute type based on the rendering parameter.
  • the performance monitoring interface is an interface in a scripting environment of a browser
  • the export module 43 is configured to call a script to obtain the attribute value of the attribute type from the performance monitoring interface.
  • the rendering parameter includes the first rendering parameter;
  • the attribute type of the performance data includes the first rendering time;
  • the generating module 42 is configured to be the first parameter threshold when the parameter value of the first rendering parameter is the first parameter threshold, and If the property value of the first drawing time is empty, the time point when the rendering of the web page data ends is determined as the property value of the first drawing time.
  • the rendering parameter includes a text rendering parameter; the attribute type includes the first content rendering time; the generating module 42 is further configured to set the parameter value of the text rendering parameter to a second parameter threshold, and If the attribute value of the first content rendering time is empty, the time point when the rendering of the web page data ends is determined as the attribute value of the first content rendering time.
  • the rendering parameters include text rendering parameters and/or image rendering parameters; the attribute type includes the first valid rendering time; the generating module 42 is further configured to be based on the text rendering parameters and/or the webpage data. Or image rendering parameters, and the time point when the webpage data is rendered, generate the attribute value of the first valid rendering time.
  • the target web page corresponds to multiple frames of web page data
  • the generating module 42 includes:
  • the quantity acquisition module is configured to, for each frame of web page data, acquire the number of target web page objects based on text rendering parameters and/or image rendering parameters of the web page data, where the target web page objects are web page objects contained in the target web page, and the target web page is changed web page layout;
  • a ratio generating module configured to generate a first ratio between the height of the target web page and the height of the screen
  • a ratio comparison module configured to determine the larger value between the first ratio and the preset value, and to determine the second ratio between the quantity and the larger value
  • the time recording module is configured to, based on the second ratio corresponding to each frame of webpage data, determine the time point when the webpage data corresponding to the largest second ratio is rendered as the attribute value of the first effective rendering time.
  • the time recording module is configured to, after the text objects and/or picture objects in the target webpage are loaded, based on the second ratio corresponding to each frame of webpage data, record the largest first The time point when the webpage data corresponding to the two ratios is rendered is determined as the attribute value of the first effective rendering time.
  • An embodiment of the present disclosure further provides an electronic device, including: a processor; a memory for storing executable instructions of the processor; wherein the electronic device is installed with a browser, and the browser includes an interface description language file, and the interface description language file
  • the attribute type is set in the attribute type, and the attribute type indicates the type of the performance data of the webpage.
  • the processor is configured to execute the instruction to realize the following operations: through the browser, the rendering parameters of the webpage data are obtained, and the webpage data is the data of the target webpage. ; Based on the rendering parameters, the attribute value of the attribute type is generated; based on the interface description language file, the attribute value of the attribute type contained in the interface description language file is transmitted to the performance monitoring interface of the browser, and the attribute value of the attribute type is obtained from the performance monitoring interface.
  • the processor is configured to execute an instruction to implement the following steps: by using the browser, after each frame of webpage data of the target webpage is rendered, call a rendering notification method to obtain the rendering of the webpage data for which the rendering has ended. parameter.
  • the kernel of the browser has a performance timing interface
  • the processor is configured to execute an instruction to implement the following steps: transmitting rendering parameters to the performance timing interface; calling the performance timing interface to generate an attribute of the attribute type based on the rendering parameter value.
  • the performance monitoring interface is an interface in the scripting environment of the browser; the processor is configured to execute an instruction to implement the following steps: invoking a script to obtain the attribute value of the attribute type from the performance monitoring interface.
  • the rendering parameter includes the first rendering parameter
  • the attribute type includes the first rendering time
  • the processor is configured to execute the instruction to implement the following steps: when the parameter value of the first rendering parameter is the first parameter threshold, and the first rendering time When the attribute value is empty, the time point when the rendering of the web page data ends is determined as the attribute value of the first drawing time.
  • the rendering parameter includes a text rendering parameter; the attribute type includes the first content rendering time; the processor is configured to execute the instruction to implement the following steps: when the parameter value of the text rendering parameter is the second parameter threshold, and the first content rendering When the attribute value of time is empty, the time point when the rendering of the webpage data ends is determined as the attribute value of the first content rendering time.
  • the rendering parameters include text rendering parameters and/or image rendering parameters;
  • the attribute type includes the first valid rendering time;
  • the processor is configured to execute instructions to implement the following steps: text rendering parameters and/or images based on web page data Rendering parameters, as well as the time point when the web page data is rendered, generate the property value of the first valid drawing time.
  • the target web page corresponds to multiple frames of web page data
  • the processor is configured to execute instructions to implement the following steps: for each frame of web page data, obtain the target web page based on text rendering parameters and/or image rendering parameters of the web page data
  • the number of objects, the target webpage object is the webpage object contained in the target webpage, and the webpage layout of the target webpage is changed; the first ratio between the height of the target webpage and the screen height is generated; the larger value between the first ratio and the preset value is determined , determine the second ratio between the number and the larger value; based on the second ratio corresponding to each frame of webpage data, determine the time point when the webpage data corresponding to the largest second ratio is rendered as the first effective rendering time property value.
  • the processor is configured to execute the instructions to implement the following steps: after the text objects and/or picture objects in the target webpage are loaded, based on the second ratio corresponding to each frame of webpage data, the largest second The time point at the end of rendering of the webpage data corresponding to the ratio is determined as the attribute value of the first valid rendering time.
  • FIG. 5 is a block diagram of an electronic device 500 according to an exemplary embodiment.
  • the electronic device 500 is provided as a terminal.
  • electronic device 500 is a mobile phone, computer, digital broadcast terminal, messaging device, game console, tablet device, medical device, fitness device, personal digital assistant, and the like.
  • an electronic device 500 includes one or more of the following components: a processing component 502, a memory 504, a power component 506, a multimedia component 508, an audio component 510, an input/output (I/O) interface 512, a sensor component 514, and communication component 516 .
  • the processing component 502 generally controls the overall operation of the electronic device 500, such as operations associated with display, telephone calls, data communications, camera operations, and recording operations.
  • the processing component 502 includes one or more processors 520 to execute the instructions to complete all or part of the steps of the above data acquisition method.
  • processing component 502 includes one or more modules that facilitate interaction between processing component 502 and other components.
  • processing component 502 includes a multimedia module to facilitate interaction between multimedia component 508 and processing component 502.
  • Memory 504 is configured to store various types of data to support operation at electronic device 500 . Examples of such data include instructions for any application or method operating on electronic device 500, contact data, phonebook data, messages, images, videos, and the like. Memory 504 is implemented by any type of volatile or non-volatile storage device or 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 or Optical Disk.
  • SRAM Static Random Access Memory
  • EEPROM Electrically Erasable Programmable Read Only Memory
  • EPROM Erasable Programmable Read Only Memory
  • PROM Programmable Read Only Memory
  • ROM Read Only Memory
  • Magnetic Memory Flash Memory
  • Magnetic or Optical Disk Magnetic Memory
  • Power supply assembly 506 provides power to various components of electronic device 500 .
  • Power supply components 506 include a power management system, one or more power supplies, and other components associated with generating, managing, and distributing power to electronic device 500 .
  • Multimedia component 508 includes a screen that provides an output interface between electronic device 500 and the user.
  • the screen includes a liquid crystal display (LCD) and a touch panel (TP).
  • the screen is implemented as a touch screen to receive input signals from a user.
  • the touch panel includes one or more touch sensors to sense touch, swipe, and gestures on the touch panel.
  • a touch sensor not only senses the boundaries of a touch or swipe action, but also detects the duration and pressure associated with the touch or swipe action.
  • the multimedia component 508 includes a front-facing camera and/or a rear-facing camera. When the electronic device 500 is in an operation mode, such as a shooting mode or a video mode, the front camera and/or the rear camera can receive external multimedia data.
  • Each of the front and rear cameras can be a fixed optical lens system or have focal length and optical zoom capability.
  • Audio component 510 is configured to output and/or input audio signals.
  • audio component 510 includes a microphone (MIC) that is configured to receive external audio signals when electronic device 500 is in operating modes, such as call mode, recording mode, and voice recognition mode.
  • the received audio signal can be further stored in memory 504 or transmitted via communication component 516 .
  • the audio component 510 also includes a speaker for outputting audio signals.
  • I/O interface 512 provides an interface between processing component 502 and peripheral interface modules, which can be keyboards, click wheels, buttons, and the like. These buttons may include, but are not limited to: home button, volume buttons, start button, and lock button.
  • Sensor assembly 514 includes one or more sensors for providing status assessments of various aspects of electronic device 500 .
  • the sensor assembly 514 can detect the open/closed state of the electronic device 500, the relative positioning of the components, such as the display and keypad of the electronic device 500, and the sensor assembly 514 can also detect the electronic device 500 or a component of the electronic device 500. Changes in position, presence or absence of user contact with the electronic device 500 , orientation or acceleration/deceleration of the electronic device 500 , and temperature changes in the electronic device 500 .
  • Sensor assembly 514 includes a proximity sensor configured to detect the presence of nearby objects in the absence of any physical contact.
  • Sensor assembly 514 also includes a light sensor, such as a CMOS or CCD image sensor, for use in imaging applications.
  • the sensor assembly 514 also includes an acceleration sensor, a gyroscope sensor, a magnetic sensor, a pressure sensor, or a temperature sensor.
  • Communication component 516 is configured to facilitate wired or wireless communication between electronic device 500 and other devices.
  • Electronic device 500 is capable of accessing wireless networks based on communication standards, such as WiFi, carrier networks (eg, 2G, 3G, 4G, or 5G), or a combination thereof.
  • the communication component 516 receives broadcast signals or broadcast related information from an external broadcast management system via a broadcast channel.
  • the communication component 516 also includes a near field communication (NFC) module to facilitate short-range communication.
  • the NFC module may be implemented based on radio frequency identification (RFID) technology, infrared data association (IrDA) technology, ultra-wideband (UWB) technology, Bluetooth (BT) technology and other technologies.
  • RFID radio frequency identification
  • IrDA infrared data association
  • UWB ultra-wideband
  • Bluetooth Bluetooth
  • electronic device 500 is 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 A gate array (FPGA), a controller, a microcontroller, a microprocessor or other electronic components are implemented for implementing the above data acquisition method.
  • ASICs application specific integrated circuits
  • DSPs digital signal processors
  • DSPDs digital signal processing devices
  • PLDs programmable logic devices
  • FPGA field programmable A gate array
  • controller a controller
  • microcontroller a microcontroller
  • microprocessor or other electronic components are implemented for implementing the above data acquisition method.
  • a storage medium including instructions such as a memory 504 including instructions, is also provided, and the above-mentioned instructions can be executed by the processor 520 of the electronic device 500 to complete the above-mentioned data acquisition method.
  • the storage medium is a non-transitory computer-readable storage medium, or, alternatively, a non-transitory computer-readable storage medium, eg, a non-transitory computer-readable storage medium is ROM, random access memory (RAM), CD-ROM, magnetic tape, floppy disk or optical data storage device, etc.
  • the electronic device can perform the following steps: obtaining the rendering parameters of the web page data through the browser installed in the electronic device, and the web page data is The data of the target web page; based on the rendering parameters, the attribute value of the attribute type is generated; based on the interface description language file, the attribute value of the attribute type contained in the interface description language file is transmitted to the performance monitoring interface of the browser, and the attribute type is obtained from the performance monitoring interface property value.
  • the instructions in the non-volatile computer-readable storage medium when executed by the processor of the electronic device, enable the electronic device to perform the following steps: through the browser, each frame of web page data of the target web page is After the rendering is completed, the rendering notification method is called to obtain the rendering parameters of the web page data at the end of the rendering.
  • the kernel of the browser has a performance timing interface
  • the instructions in the non-volatile computer-readable storage medium when executed by the processor of the electronic device, enable the electronic device to perform the steps of: transmitting rendering parameters to Performance timing interface; call the performance timing interface to generate the attribute value of the attribute type based on the rendering parameters.
  • the performance monitoring interface is an interface in the scripting environment of the browser; when the instructions in the non-volatile computer-readable storage medium are executed by the processor of the electronic device, the electronic device can perform the following steps:
  • the calling script obtains the attribute value of the attribute type from the performance monitoring interface.
  • the rendering parameters include first rendering parameters, and the attribute type includes first rendering time; when the instructions in the non-volatile computer-readable storage medium are executed by the processor of the electronic device, the electronic device can perform the following steps: When the parameter value of the first rendering parameter is the first parameter threshold, and the attribute value of the first rendering time is empty, the time point when the rendering of the webpage data ends is determined as the attribute value of the first rendering time.
  • the rendering parameters include text rendering parameters; the attribute type includes the first content rendering time; when the instructions in the non-volatile computer-readable storage medium are executed by the processor of the electronic device, the electronic device can perform the following steps : When the parameter value of the text rendering parameter is the second parameter threshold, and the attribute value of the first content rendering time is empty, the time point when the webpage data is rendered is determined as the attribute value of the first content rendering time.
  • the rendering parameters include text rendering parameters and/or picture rendering parameters;
  • the attribute type includes the first valid drawing time;
  • the instructions in the non-volatile computer-readable storage medium are executed by the processor of the electronic device, the The electronic device can perform the following steps: based on the text rendering parameters and/or picture rendering parameters of the webpage data, and the time point when the webpage data is rendered, generate the attribute value of the first effective drawing time.
  • the target web page corresponds to multiple frames of web page data
  • the electronic device can perform the following steps: for each frame of web page data , based on the text rendering parameters and/or image rendering parameters of the web page data, obtain the number of target web page objects, the target web page objects are web page objects contained in the target web page, and change the web page layout of the target web page; generate the height and screen height of the target web page determine the first ratio between the first ratio and the preset value, and determine the second ratio between the quantity and the larger value; based on the second ratio corresponding to each frame of webpage data, the largest second ratio corresponds to The time point when the web page data is rendered is determined as the property value of the first valid drawing time.
  • the electronic device when the instructions in the non-volatile computer-readable storage medium are executed by the processor of the electronic device, the electronic device can perform the following steps: the text object and/or the picture object in the target web page is loaded Then, based on the second ratio corresponding to each frame of webpage data, the time point when the webpage data corresponding to the largest second ratio is rendered is determined as the attribute value of the first effective rendering time.
  • a computer program product comprising readable program code executable by the processor 520 of the electronic device 500 to perform the steps of:
  • the browser installed in the device obtains the rendering parameters of the webpage data, and the webpage data is the data of the target webpage; based on the rendering parameters, the attribute value of the attribute type is generated; based on the interface description language file, the attribute type of the attribute type contained in the interface description language file is converted into The value is transmitted to the performance monitoring interface of the browser, and the attribute value of the attribute type is obtained from the performance monitoring interface.
  • the readable program code can be executed by the processor of the electronic device to complete the following steps: through the browser, after each frame of web page data of the target web page is rendered, call a rendering notification method to obtain the end of this rendering The rendering parameters of the web page data.
  • the kernel of the browser has a performance timing interface
  • the readable program code can be executed by the processor of the electronic device to complete the following steps: transmitting rendering parameters to the performance timing interface; calling the performance timing interface, based on the rendering parameters, Generates the attribute value of the attribute type.
  • the performance monitoring interface is an interface in the scripting environment of the browser; the readable program code can be executed by the processor of the electronic device to complete the following steps:
  • the calling script obtains the attribute value of the attribute type from the performance monitoring interface.
  • the rendering parameter includes the first rendering parameter
  • the attribute type includes the first rendering time
  • the readability program code can be executed by the processor of the electronic device to complete the following steps: when the parameter value of the first rendering parameter is the first parameter threshold, And if the property value of the first drawing time is empty, the time point when the rendering of the web page data ends is determined as the property value of the first drawing time.
  • the rendering parameter includes a text rendering parameter; the attribute type includes the first content rendering time; the readability program code can be executed by the processor of the electronic device to complete the following steps: when the parameter value of the text rendering parameter is the second parameter threshold , and if the attribute value of the first content rendering time is empty, the time point when the rendering of the webpage data ends is determined as the attribute value of the first content rendering time.
  • the rendering parameters include text rendering parameters and/or image rendering parameters;
  • the attribute type includes first valid drawing time;
  • the readability program code can be executed by the processor of the electronic device to complete the following steps: text rendering based on web page data Parameters and/or image rendering parameters, as well as the time point when the webpage data is rendered, generate the attribute value of the first valid rendering time.
  • the target web page corresponds to multiple frames of web page data
  • the readable program code can be executed by the processor of the electronic device to complete the following steps: for each frame of web page data, text rendering parameters and/or image rendering based on the web page data parameter, obtains the number of target web page objects, the target web page objects are web page objects contained in the target web page, and the web page layout of the target web page is changed; the first ratio between the height of the target web page and the screen height is generated; the first ratio and the preset value are determined Determine the second ratio between the number and the larger value; based on the second ratio corresponding to each frame of webpage data, determine the time point when the webpage data corresponding to the largest second ratio is rendered as the first The property value of the next valid draw time.
  • the readability program code can be executed by the processor of the electronic device to complete the following steps: after the text object and/or the picture object in the target webpage is loaded, based on the second ratio corresponding to each frame of webpage data, The time point when the rendering of the webpage data corresponding to the largest second ratio is completed is determined as the attribute value of the first effective rendering time.
  • the program code is stored in a storage medium of the electronic device 500, which is a non-transitory computer-readable storage medium, or a non-transitory computer-readable storage medium, eg, a non-transitory computer-readable storage medium
  • the read storage medium is ROM, random access memory (RAM), CD-ROM, magnetic tape, floppy disk, or optical data storage device, or the like.
  • FIG. 6 is a block diagram of another electronic device 600 according to an exemplary embodiment.
  • the electronic device 600 is provided as a server.
  • electronic device 600 includes a processing component 622, which further includes one or more processors, and a memory resource, represented by memory 632, for storing instructions executable by processing component 622, such as applications.
  • the application program stored in memory 632 includes one or more modules, each corresponding to a set of instructions.
  • the processing component 622 is configured to execute instructions to perform the above-described data acquisition method.
  • the electronic device 600 also includes a power supply assembly 626 configured to perform power management of the electronic device 600, a wired or wireless network interface 650 configured to connect the electronic device 600 to a network, and an input output (I/O) interface 658.
  • Electronic device 600 is capable of operating based on an operating system stored in memory 632, such as Windows ServerTM, Mac OS XTM, UnixTM, LinuxTM, FreeBSDTM or the like.

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • General Engineering & Computer Science (AREA)
  • Databases & Information Systems (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Data Mining & Analysis (AREA)
  • Computer Hardware Design (AREA)
  • Quality & Reliability (AREA)
  • Information Transfer Between Computers (AREA)

Abstract

一种数据的获取方法及电子设备,由浏览器执行,所述浏览器包括接口描述语言文件,所述接口描述语言文件中设置有属性类型,所述属性类型指示网页的性能数据所属的类型,所述方法包括:通过该浏览器,获取网页数据的渲染参数,网页数据为目标网页的数据(S11);基于渲染参数,生成属性类型的属性值(S12);基于接口描述语言文件,将接口描述语言文件包含的属性类型的属性值传输至浏览器的性能监控接口,从性能监控接口获取属性类型的属性值(S13)。

Description

数据的获取方法及电子设备
本公开要求于2020年12月21日提交、申请号为202011522734.8的中国专利申请的优先权,其全部内容通过引用结合在本公开中。
技术领域
本公开涉及计算机技术领域,尤其涉及一种数据的获取方法及电子设备。
背景技术
网页性能监控是网页端技术领域中的一个重要功能,高性能的页面能为用户带来优秀的体验,增加用户粘性,提高网页的转化率。
发明内容
根据本公开实施例的一方面,提供了一种数据的获取方法,由电子设备执行,所述电子设备中安装有浏览器,所述浏览器包括接口描述语言文件,所述接口描述语言文件中设置有属性类型,所述属性类型指示网页的性能数据所属的类型,所述方法包括:
通过所述浏览器,获取网页数据的渲染参数,所述网页数据为目标网页的数据;
基于所述渲染参数,生成所述属性类型的属性值;
基于所述接口描述语言文件,将所述接口描述语言文件包含的属性类型的属性值传输至所述浏览器的性能监控接口,从所述性能监控接口获取所述属性类型的属性值。
在一些实施例中,所述通过所述浏览器,获取网页数据的渲染参数,包括:
通过所述浏览器,在所述目标网页的每帧所述网页数据被渲染结束之后,调用渲染通知方法获取本次渲染结束的所述网页数据的渲染参数。
在一些实施例中,所述浏览器的内核具有性能计时接口,所述方法还包括:
将所述渲染参数传输至所述性能计时接口;
所述基于所述渲染参数,生成所述属性类型的属性值,包括:
调用所述性能计时接口,基于所述渲染参数,生成所述属性类型的属性值。
在一些实施例中,所述性能监控接口为所述浏览器的脚本环境中的接口;
所述从所述性能监控接口获取所述属性类型的属性值,包括:
调用脚本从所述性能监控接口获取所述属性类型的属性值。
在一些实施例中,所述渲染参数包含首次渲染参数,所述属性类型包含首次绘制时间;所述基于所述渲染参数,生成所述属性类型的属性值,包括:
在所述首次渲染参数的参数值为第一参数阈值,且所述首次绘制时间的属性值为空的情况下,将所述网页数据被渲染结束时的时间点,确定为所述首次绘制时间的属性值。
在一些实施例中,所述渲染参数包含文字渲染参数;所述属性类型包含首次内容绘制时间;所述基于所述渲染参数,生成所述属性类型的属性值,包括:
在所述文字渲染参数的参数值为第二参数阈值,且所述首次内容绘制时间的属性值为空的情况下,将所述网页数据被渲染结束时的时间点,确定为所述首次内容绘制时间的属性值。
在一些实施例中,所述渲染参数包含文字渲染参数和/或图片渲染参数;所述属性类型包含首次有效绘制时间;所述基于所述渲染参数,生成所述属性类型的属性值,包括:
基于所述网页数据的所述文字渲染参数和/或所述图片渲染参数,以及所述网页数据被渲染结束时的时间点,生成所述首次有效绘制时间的属性值。
在一些实施例中,所述目标网页对应有多帧所述网页数据,所述基于所述网页数据的所述文字渲染参数和/或所述图片渲染参数,以及所述网页数据被渲染结束时的时间点,生成所述首次有效绘制时间的属性值,包括:
对于每帧所述网页数据,基于所述网页数据的所述文字渲染参数和/或所述图片渲染参数,获取目标网页对象的数量,所述目标网页对象为所述目标网页包含的网页对象,且改变了所述目标网页的网页布局;
生成所述目标网页的高度与所述屏幕高度的第一比值;
确定所述第一比值与预设数值中的较大值,确定所述数量与所述较大值之间的第二比值;
基于每帧所述网页数据对应的第二比值,将最大的第二比值对应的网页数据被渲染结束时的时间点,确定为所述首次有效绘制时间的属性值。
在一些实施例中,所述基于每帧所述网页数据对应的第二比值,将最大的第二比值对应的网页数据被渲染结束时的时间点,确定为所述首次有效绘制时间的属性值,包括:
在所述目标网页中的文字对象和/或图片对象加载完毕之后,基于每帧所述网页数据对应的第二比值,将最大的第二比值对应的网页数据被渲染结束时的时间点,确定为所述首次有效绘制时间的属性值。
根据本公开实施例的另一方面,提供了一种数据的获取装置,所述装置中安装有浏览器,所述浏览器包括接口描述语言文件,所述接口描述语言文件中设置有属性类型,所述属性类型指示网页的性能数据所属的类型,所述装置包括:
获取模块,被配置为通过所述浏览器,获取网页数据的渲染参数,所述网页数据为目标网页的数据;
生成模块,被配置为基于所述渲染参数,生成所述属性类型的属性值;
导出模块,被配置为基于所述接口描述语言文件,将所述接口描述语言文件包含的属性类型的属性值传输至所述浏览器的性能监控接口,从所述性能监控接口获取所述属性类型的属性值。
在一些实施例中,所述获取模块,被配置为通过所述浏览器,在所述目标网页的每帧所述网页数据被渲染结束之后,调用渲染通知方法获取本次渲染结束的所述网页数据的渲染参数。
在一些实施例中,所述浏览器的内核具有性能计时接口,所述装置还包括:
传输模块,被配置为将所述渲染参数传输至所述性能计时接口;
所述生成模块,被配置为调用所述性能计时接口,基于所述渲染参数,生成所述属性类型的属性值。
在一些实施例中,所述性能监控接口为所述浏览器的脚本环境中的接口;
所述导出模块,被配置为调用脚本从所述性能监控接口获取所述属性类型的属性值。
在一些实施例中,所述渲染参数包含首次渲染参数;所述性能数据的属性类型包含首次绘制时间;所述生成模块,被配置为在所述首次渲染参数的参数值为第一参数阈值,且所述首次绘制时间的属性值为空的情况下,将所述网页数据被渲染结束时的时间点,确定为所述首次绘制时间的属性值。
在一些实施例中,所述渲染参数包含文字渲染参数;所述属性类型包含首次内容绘制时间;所述生成模块,还被配置为在所述文字渲染参数的参数值为第二参数阈值,且所述首次内容绘制时间的属性值为空的情况下,将所述网页数据被渲染结束时的时间点,确定为所述首次内容绘制时间的属性值。
在一些实施例中,所述渲染参数包含文字渲染参数和/或图片渲染参数;所述属性类型包含首次有效绘制时间;所述生成模块,还被配置为基于所述网页数据的所述文字渲染参数和/或所述图片渲染参数,以及所述网页数据被渲染结束时的时间点,生成所述首次有效绘制时间的属性值。
在一些实施例中,所述目标网页对应有多帧所述网页数据,所述生成模块,包括:
数量获取模块,被配置为对于每帧所述网页数据,基于所述网页数据的所述文字渲染参数和/或所述图片渲染参数,获取目标网页对象的数量,所述目标网页对象为所述目标网页包含的网页对象,且改变了所述目标网页的网页布局;
比值生成模块,被配置为生成所述目标网页的高度与所述屏幕高度的第一比值;
比值比较模块,被配置为确定所述第一比值与预设数值中的较大值,确定所述数量与所述较大值之间的第二比值;
时间记录模块,被配置为基于每帧所述网页数据对应的第二比值,将最大的第二比值对应的网页数据被渲染结束时的时间点,确定为所述首次有效绘制时间的属性值。
在一些实施例中,所述时间记录模块,被配置为在所述目标网页中的文字对象和/或图片对象加载完毕之后,基于每帧所述网页数据对应的第二比值,将最大的第二比值对应的网页数据被渲染结束时的时间点,确定为所述首次有效绘制时间的属性值。
根据本公开实施例的另一方面,提供了一种电子设备,包括:处理器;用于存储所述处理器可执行指令的存储器;其中,所述电子设备安装有浏览器,所述浏览器包括接口描述语言文件,所述接口描述语言文件中设置有属性类型,所述属性类型指示网页的性能数据所属的类型,所述处理器被配置为执行所述指令,实现以下步骤:
通过所述浏览器,获取网页数据的渲染参数,所述网页数据为目标网页的数据;
基于所述渲染参数,生成所述属性类型的属性值;
基于所述接口描述语言文件,将所述接口描述语言文件包含的属性类型的属性值传输至所述浏览器的性能监控接口,从所述性能监控接口获取所述属性类型的属性值。
在一些实施例中,所述处理器被配置为执行所述指令,实现以下步骤:
通过所述浏览器,在所述目标网页的每帧所述网页数据被渲染结束之后,调用渲染通知方法获取本次渲染结束的所述网页数据的渲染参数。
在一些实施例中,所述浏览器的内核具有性能计时接口,所述处理器被配置为执行所述指令,实现以下步骤:
将所述渲染参数传输至所述性能计时接口;
调用所述性能计时接口,基于所述渲染参数,生成所述属性类型的属性值。
在一些实施例中,所述性能监控接口为所述浏览器的脚本环境中的接口;所述处理器被配置为执行所述指令,实现以下步骤:
调用脚本从所述性能监控接口获取所述属性类型的属性值。
在一些实施例中,所述渲染参数包含首次渲染参数,所述属性类型包含首次绘制时间;所述处理器被配置为执行所述指令,实现以下步骤:
在所述首次渲染参数的参数值为第一参数阈值,且所述首次绘制时间的属性值为空的情况下,将所述网页数据被渲染结束时的时间点,确定为所述首次绘制时间的属性值。
在一些实施例中,所述渲染参数包含文字渲染参数;所述属性类型包含首次内容绘制时间;所述处理器被配置为执行所述指令,实现以下步骤:
在所述文字渲染参数的参数值为第二参数阈值,且所述首次内容绘制时间的属性值为空的情况下,将所述网页数据被渲染结束时的时间点,确定为所述首次内容绘制时间的属性值。
在一些实施例中,所述渲染参数包含文字渲染参数和/或图片渲染参数;所述属性类型包含首次有效绘制时间;所述处理器被配置为执行所述指令,实现以下步骤:
基于所述网页数据的所述文字渲染参数和/或所述图片渲染参数,以及所述网页数据被渲染结束时的时间点,生成所述首次有效绘制时间的属性值。
在一些实施例中,所述目标网页对应有多帧所述网页数据,所述处理器被配置为执行所述指令,实现以下步骤:
对于每帧所述网页数据,基于所述网页数据的所述文字渲染参数和/或所述图片渲染参数,获取目标网页对象的数量,所述目标网页对象为所述目标网页包含的网页对象,且改变了所述目标网页的网页布局;
生成所述目标网页的高度与所述屏幕高度的第一比值;
确定所述第一比值与预设数值中的较大值,确定所述数量与所述较大值之间的第二比值;
基于每帧所述网页数据对应的第二比值,将最大的第二比值对应的网页数据被渲染结束时的时间点,确定为所述首次有效绘制时间的属性值。
在一些实施例中,所述处理器被配置为执行所述指令,实现以下步骤:
在所述目标网页中的文字对象和/或图片对象加载完毕之后,基于每帧所述网页数据对应的第二比值,将最大的第二比值对应的网页数据被渲染结束时的时间点,确定为所述首次有效绘制时间的属性值。
根据本公开实施例的另一方面,提供了一种非易失性计算机可读存储介质,当所述非易失性计算机可读存储介质中的指令由电子设备的处理器执行时,使得所述电子设备能够执行如下步骤:
通过所述电子设备中安装的浏览器,通过所述电子设备中安装的浏览器,获取网页数据的渲染参数,所述网页数据为目标网页的数据;
基于所述渲染参数,生成所述属性类型的属性值;
基于所述接口描述语言文件,将所述接口描述语言文件包含的属性类型的属性值传输至所述浏览器的性能监控接口,从所述性能监控接口获取所述属性类型的属性值。。
根据本公开实施例的另一方面,提供了一种计算机程序产品,包括可读性程序代码,所述可读性程序代码可由电子设备的处理器执行以完成下步骤:
通过所述电子设备中安装的浏览器,获取网页数据的渲染参数,所述网页数据为目标网页的数据;
基于所述渲染参数,生成所述属性类型的属性值;
基于所述接口描述语言文件,将所述接口描述语言文件包含的属性类型的属性值传输至所述浏览器的性能监控接口,从所述性能监控接口获取所述属性类型的属性值。
本公开的实施例提供的方法,获取属性类型的属性值时,不需要手动对网页数据进行标记,也不需要监听加载事件,降低了对技术人员的专业技能要求,不影响网页的性能,适用于所有的网页。通过对浏览器内核进行修改,即在浏览器包括的描述语言文件中设置了属性类型,通过浏览器加载目标网页的网页数据,然后基于接口描述语言文件作为浏览器内核与脚本环境之间的桥梁的特性,导出属性类型的属性值至浏览器的脚本环境的性能监控接口,从性能监控接口获取属性类型的属性值,实现了自动化获取网页的性能数据。而且,在获取网页的性能数据的过程中,不需要利用浏览器的开发者工具,不会重新加载网页,提升了性能数据的获取效率。
附图说明
图1是根据一示例性实施例示出的一种数据的获取方法的流程图。
图2是根据一示例性实施例示出的一种获取渲染参数的示意图。
图3是根据一示例性实施例示出的首次有效绘制时间的属性值随时间变化的示意图。
图4是根据一示例性实施例示出的一种数据的获取装置的框图。
图5是根据一示例性实施例示出的一种数据的获取电子设备的框图。
图6是根据一示例性实施例示出的一种用于获取数据的电子设备的框图。
具体实施方式
需要说明的是,本公开的说明书和权利要求书及上述附图中的术语“第一”、“第二”等是用于区别类似的对象,而不必用于描述特定的顺序或先后次序。应该理解这样使用的 数据在适当情况下能够互换,以便这里描述的本公开的实施例能够以除了在这里图示或描述的那些以外的顺序实施。
相关技术中,为了进行网页性能监控,一方面,手动对网页的对象进行标记,再监听对象的加载事件,获得网页的性能数据。但是,监听加载事件会影响网页性能,手动进行标记不适用于所有的网页,且对技术人员的专业技能要求较高。另一方面,基于浏览器中的开发者工具获取性能数据。但是,开发者工具需要手动开启,无法实现自动化,而且,开发者工具需要重新加载网页,导致性能数据的获取过程比较耗时、效率低。
图1是根据一示例性实施例示出的一种数据的获取方法的流程图,如图1所示,该数据的获取方法由电子设备执行,该电子设备中安装有浏览器,该浏览器包括接口描述语言文件,该接口描述语言文件中设置有属性类型,该属性类型指示网页的性能数据所属的类型,该数据的获取方法具体包括以下步骤。
在步骤S11中,通过该浏览器,获取网页数据的渲染参数,该网页数据为目标页面的数据。
在本公开的实施例中,浏览器对目标网页的网页数据进行加载,在加载过程中,浏览器的渲染引擎对网页数据进行渲染。在网页数据被渲染结束之后,能够获取网页数据的渲染参数。
在步骤S12中,基于渲染参数,生成该属性类型的属性值。
在本公开的实施例中,性能数据主要包含目标网页的绘制时间信息。在实际应用中,性能数据包含多种绘制时间信息,因此,需要获取多种渲染参数,进而根据多种渲染参数生成对应的性能数据的属性类型的属性值。
在本公开实施例中,接口描述语言文件中设置有属性类型,该属性类型指示网页的性能数据所属的类型,该属性类型的属性值即为网页的性能数据,例如,性能数据包含目标网页的绘制时间信息,基于渲染参数生成的属性类型的属性值,即为性能数据包含的绘制时间信息。在一些实施例中,该接口描述语言文件中设置有多种属性类型,不同的属性类型为不同的性能数据所属的类型。基于渲染参数,生成每种属性类型的属性值,每种属性类型的属性值即为网页的一种性能数据,即多种属性类型的属性值为网页的多种性能参数。例如,性能参数包括多种绘制时间信息,每种属性类型的属性值即为一种绘制时间信息。
在步骤S13中,基于接口描述语言文件导出属性类型的属性值至浏览器的性能监控接口,并调用脚本从性能监控接口获取属性类型的属性值。
在本公开的实施例中,接口描述语言是用来描述软件组件接口的一种计算机语言。接 口描述语言通过一种中立的方式来描述接口,使得在不同平台上运行的对象和用不同语言编写的程序之间相互通信交流。该接口描述语言文件作为浏览器的内核(例如,利用C++语言编写)与脚本环境(例如,JavaScript环境)之间的桥梁。由于性能监控接口位于脚本环境中,因此,基于接口描述语言文件导出属性类型的属性值至性能监控接口,调用JavaScript脚本从性能监控接口获取属性类型的属性值,即获取目标网页的性能数据。
在本公开实施例中,获取网页数据的渲染参数过程,及基于渲染参数生成属性类型的属性值的过程,是在浏览器的内核中执行的。该接口描述语言文件作为浏览器的内核与脚本环境之间的桥梁,在浏览器的内核中生成属性类型的属性值后,能够确定该接口描述文件包含的属性类型的属性值,基于该接口描述语言文件,能够将接口描述语言文件包含的属性类型的属性值,传输至位于脚本环境中的性能监控接口,以便调用脚本能够从该性能监控接口中获取属性类型的属性值,实现了浏览器的内核与脚本环境之间的交互。
需要说明的是,本公开实施例的S13中,是调用脚本从性能监控接口获取属性类型的属性值的,而在另一实施例,能够无需调用脚本,能够采取其他方式,从性能监控接口获取属性类型的属性值。
本公开的实施例提供的数据的获取方案,由电子设备通过安装的浏览器来实现的,该浏览器的内核的性能计时接口的接口描述语言文件中设置有性能数据的属性类型。利用该浏览器加载目标网页,在目标网页的网页数据渲染完毕之后,获取网页数据的渲染参数,基于渲染参数生成性能数据的属性类型的属性值。然后,基于接口描述语言文件导出性能数据的属性类型的属性值至浏览器的性能监控接口,并调用脚本从性能监控接口获取属性类型的属性值。
需要说明的是,本公开实施例提供的数据的获取方法,是由电子设备通过安装的浏览器来实现的,电子设备通过安装的浏览器,获取网页数据的渲染参数,通过该浏览器,基于渲染参数生成该属性类型的属性值,通过该浏览器,基于接口描述语言文件导出属性类型的属性值至浏览器的性能监控接口,从性能监控接口获取属性类型的属性值。
本公开的实施例提供的方法,获取属性类型的属性值时,不需要手动对网页数据进行标记,也不需要监听加载事件,降低了对技术人员的专业技能要求,不影响网页的性能,适用于所有的网页。通过对浏览器内核进行修改,即在浏览器包括的描述语言文件中设置了属性类型,通过浏览器加载目标网页的网页数据,然后基于接口描述语言文件作为浏览器内核与脚本环境之间的桥梁的特性,导出属性类型的属性值至浏览器的脚本环境的性能监控接口,从性能监控接口获取属性类型的属性值,实现了自动化获取网页的性能数据。 而且,在获取网页的性能数据的过程中,不需要利用浏览器的开发者工具,不会重新加载网页,提升了性能数据的获取效率。
在本公开的一种示例性实施例中,通过该浏览器,在目标网页的每帧网页数据被渲染结束之后,调用渲染通知方法获取本次渲染结束的网页数据的渲染参数,然后将渲染参数传输至性能计时接口。
在实际应用中,浏览器的内核采用开源的Chromium(一种开源的浏览器引擎),Chromium采用的渲染引擎为blink(一种浏览器排版引擎)。如图2所示,在渲染引擎的每一个渲染帧(即对每帧网页数据进行渲染)结束后,调用PaintTiming接口(一种用户获取绘制时间信息的应用程序接口)的NotifyPaint方法(一种绘制通知的获取方法)获取每帧网页数据的渲染参数。该渲染参数为NotifyPaint方法的参数,例如,是否为首次渲染(is first paint)、是否渲染了文字内容(text painted)、是否渲染了图片(image painted)。在一些实施例中,渲染参数包含首次渲染参数、文字渲染参数和图片渲染参数中的一种或多种。其中,首次渲染参数即是否为首次渲染,文字渲染参数即是否渲染了文字内容,图片渲染参数即是否渲染了图片。例如,该首次渲染参数指示对应的网页数据被渲染时,是否在页面中渲染出第一个像素;文字渲染参数指示对应的网页数据被渲染时,是否在页面中渲染出了文字内容;图片渲染参数指示对应的网页数据被渲染时,是否在页面中渲染出了图片。
在一些实施例中,调用渲染通知方法,将渲染参数传输至性能计时接口,调用该性能计时接口,基于渲染参数,生成该属性类型的属性值。
例如,目标网页对应有多帧网页数据,该属性类型的属性值是基于多帧网页数据中的渲染参数生成的,在浏览器加载目标网页的网页数据的过程中,调用渲染通知方法,获取每帧网页数据的渲染参数,将每帧网页数据的渲染参数传输至性能计时接口。之后,调用该性能计时接口,基于多帧网页数据的渲染参数,生成该属性类型的属性值。
浏览器加载目标网页的网页数据的过程,是一个变化的过程。在浏览器加载目标网页的网页数据的过程中,浏览器对每帧网页数据进行渲染。本公开的实施例在获取渲染参数时,能够利用NotifyPaint方法获取每帧网页数据的渲染参数,以保证在渲染每帧网页数据之后,得到与每帧网页数据对应的渲染参数,获取到的渲染参数以每帧网页数据为单位。在浏览器加载目标网页的网页数据的过程中,能够获取到每帧网页数据的渲染参数,将每帧网页数据的渲染参数传输至性能计时接口,为后续性能计时接口生成属性类型的属性值提供了数据基础,避免了在全部网页数据都渲染完毕之后才获取渲染参数,提升了渲染参数的准确性。
需要说明的是,本公开实施例是通过调用渲染通知方法,将渲染参数传输至性能计时接口后,调用性能计时接口来生成属性类型的属性值的,而在另一实施例中,在通过渲染通知方法获取到渲染参数后,无需将渲染参数传输至性能计时接口,能够采取其他方式,基于渲染参数,生成属性类型的属性值。
在本公开的一种示例性实施例中,属性类型包含首次绘制时间、首次内容绘制时间和首次有效绘制时间中的一种或多种。其中,首次绘制时间表示目标网页中的第一个像素渲染完毕时的时间点。首次内容绘制时间指目标网页的文档对象模型(Document Object Model,简称DOM)中的任意对象首次被绘制的时间点。首次有效绘制时间指目标网页中目标对象绘制完毕时的时间点,目标对象为目标网页中的主体部分,如视频网页中的视频对象,图片网页中的图片对象。
在实际应用中,在基于渲染参数生成属性类型的属性值时,能够基于首次渲染参数、首次绘制时间和网页数据被渲染结束时的时间点,生成首次绘制时间的属性值。即在首次渲染参数的参数值为第一参数阈值,且首次绘制时间的属性值为空的情况下,将该首次渲染参数对应的网页数据被渲染结束时的时间点,确定为首次绘制时间的属性值。例如,true为第一参数阈值,在某一帧网页数据的首次渲染参数的参数值为“true”,且首次绘制时间的属性值为空的情况下,能够将该网页数据被渲染结束时的时间点记录为首次绘制时间的属性值,将首次绘制时间的属性值存储至首次绘制时间的变量中。其中,该首次绘制时间的变量用于记录对应的属性值,在确定该首次绘制时间的属性值后,将该属性值赋值给该首次绘制时间的变量,使得赋值后的变量能够表示目标网页的首次绘制时间。本公开的实施例将渲染参数中的首次渲染参数,与属性类型中的首次绘制时间相结合,在首次绘制时间以及某一帧网页数据的首次渲染参数满足第一目标条件(如首次渲染参数的参数值为true,且首次绘制时间的属性值为空)时,将该网页数据被渲染结束时的时间点,确定为首次绘制时间的属性值,实现了利用首次渲染参数、首次绘制时间和网页数据被渲染结束时的时间点,生成首次绘制时间的属性值,在此过程中,不需要监听加载事件,也不需要对目标对象手动添加标记,还不需要手动开启浏览器的开发者工具,提升了目标网页的加载速率,能够快速地获取任意目标网页的首次绘制时间的属性值。
例如,目标网页对应有多帧网页数据,在浏览器加载目标网页的网页数据的过程中,依次获取每帧网页数据的渲染参数。在获取到每帧网页数据的首次渲染参数后,依次判断首次绘制时间及每帧网页数据的首次渲染参数是否满足上述第一目标条件,在首次绘制时间及任一帧网页数据的首次渲染参数满足上述第一目标条件的情况下,将该网页数据被渲 染结束时的时间点,确定为该首次绘制时间的属性值。之后,在已经确定首次绘制时间的属性值不为空的情况下,不再执行判断基于首次绘制时间及其余的网页数据的首次渲染参数是否满足第一目标条件的步骤。
需要说明的是,本公开实施例是在确定首次绘制时间的属性值后,将首次绘制时间的属性值存在首次绘制时间的变量中的,而在另一实施例中,仅确定首次绘制时间的属性值即可,之后,无需将首次绘制时间的属性值存在首次绘制时间的变量中。
在实际应用中,基于渲染参数生成属性类型的属性值时,也能够基于文字渲染参数、首次内容绘制时间和网页数据被渲染结束时的时间点,生成首次内容绘制时间的属性值。即在文字渲染参数的参数值为第二参数阈值,且首次内容绘制时间的属性值为空的情况下,将该文字渲染参数对应的网页数据被渲染结束时的时间点,确定为首次内容绘制时间的属性值。例如,true为第二参数阈值,在实际应用场景中,第一参数阈值和第二参数阈值相同,或者,第一参数阈值和第二参数阈值不相同。在某一帧数据的文字渲染参数的参数值为“true”,且首次内容绘制时间的属性值为空的情况下,将该网页数据被渲染结束时的时间点,记录为首次内容绘制时间的属性值,将首次内容绘制时间的属性值存储至首次内容绘制时间的变量中。其中,该首次内容绘制时间的变量用于记录对应的属性值,在确定该首次内容绘制时间的属性值后,将该属性值赋值给首次内容绘制时间的变量,使得赋值后的变量能够表示目标网页的首次内容绘制时间。本公开的实施例将渲染参数中的文字渲染参数,与属性类型中的首次内容绘制时间相结合,在首次内容绘制时间以及某一帧网页数据的文字渲染参数满足第二目标条件(如文字渲染参数的参数值为true,且首次内容绘制时间的属性值为空)的情况下,将该网页数据被渲染结束时的时间点,确定为首次内容绘制时间的属性值,实现了利用文字渲染参数、首次内容绘制时间和网页数据被渲染结束时的时间点,生成首次内容绘制时间的属性值,在此过程中,不需要监听加载事件,也不需要对目标对象手动添加标记,还不需要手动开启浏览器的开发者工具,提升了目标网页的加载速率,能够快速地获取任意目标网页的首次内容绘制时间的属性值。
例如,目标网页对应有多帧网页数据,在浏览器加载目标网页的网页数据的过程中,依次获取每帧网页数据的渲染参数。在获取到每帧网页数据的文字渲染参数后,依次判断首次内容绘制时间及每帧网页数据的文字渲染参数是否满足上述第二目标条件,在首次内容绘制时间及任一帧网页数据的文字渲染参数满足上述第二目标条件的情况下,将该网页数据被渲染结束是的时间点,确定为该首次内容绘制时间的属性值。之后,在已经确定首次内容绘制时间的属性值不为空的情况下,不再执行判断首次内容绘制时间及其余的网页 数据的文字渲染参数是否满足第二目标条件的步骤。
需要说明的是,本公开实施例是在确定首次内容绘制时间的属性值后,将首次内容绘制时间的属性值存在首次内容绘制时间的变量中的,而在另一实施例中,仅确定首次内容绘制时间的属性值即可,之后,无需将首次内容绘制时间的属性值存在首次内容绘制时间的变量中。
在实际应用中,基于渲染参数生成属性类型的属性值时,还能够基于网页数据的文字渲染参数和/或图片渲染参数,以及目标网页的高度、浏览器所在的终端的屏幕高度和该网页数据被渲染结束时的时间点,生成首次有效绘制时间的属性值,将首次有效绘制时间的属性值存储在首次有效绘制时间的变量中。其中,该首次有效绘制时间的变量用于记录对应的属性值,在确定该首次有效绘制时间的属性值后,将该属性值赋值给首次有效绘制时间的变量,使得赋值后的变量能够表示目标网页的首次有效绘制时间。
在生成上述首次有效绘制时间的属性值的过程中,判断每帧网页数据被渲染结束时的时间点是否为首次有效绘制时间的属性值。也就是说,在每帧网页数据被渲染结束后,执行一次首次有效绘制时间的判断操作。以某一帧网页数据被渲染结束之后为例,在上述判断操作过程中,首先,基于该网页数据的文字渲染参数和/或图片渲染参数获取目标网页对象的数量,该目标网页对象为目标网页包含的网页对象,且改变了目标网页的网页布局。其中,目标网页对象为目标网页中的文字对象、视频对象、图片对象等等。例如,获取到目标网页对象的数量越大,表示该网页数据被渲染的过程,对目标网页的网页布局改变越大;获取到目标网页对象的数量越小,表示该网页数据被渲染的过程,对目标网页的网页布局改变越小。然后,生成目标网页的高度与屏幕高度的第一比值。在一些实施例中,目标网页的高度为目标网页处于全屏展示状态下的高度。之后,将第一比值与预设数值进行比较,即判断上述第一比值较大,还是预设数值较大,得到上述第一比值与预设数值中的较大值,确定上述数量与该较大值之间的第二比值,即将上述数量与上述较大值相除。该第二比值用于判断该网页数据被渲染结束时的时间点是否为首次有效绘制时间,该第二比值也能够称为属性比值。同理,判断下一帧网页数据被渲染结束时的时间点是否为首次有效绘制时间的属性值,得到下一帧网页数据被渲染对应的属性比值。随着浏览器加载目标网页,在目标网页的网页对象加载完毕之后,目标网页的网页布局也可能发生改变,因此,上述目标网页对象的数量会逐渐增大,同时,目标网页的高度与屏幕高度的比值也会增大,但是,属性比值会逐渐减少。综上,在目标页面对应有多帧网页数据的情况下,基于每帧网页数据的渲染参数,能够得到每帧网页数据对应的属性比值,即得到多个属性比值。在 得到多个属性比值之后,将多个属性比值中最大的第二比值对应的网页数据被渲染结束时的时间点,确定为首次有效绘制时间的属性值。也就是说,最大的属性比值应的网页数据被渲染结束时的时间点即为目标网页的网页对象加载完毕时的时间点。如图3所示,示出了首次有效绘制时间的属性值随时间变化的示意图。图3中,横坐标表示浏览器渲染每帧网页数据时的时间点,纵坐标表示浏览器加载的网页对象的数量,不规则线条为每帧网页数据对应的属性比值的变化曲线,从图3中可知,6.047s即首次有效绘制时间的属性值。
本公开的实施例在每帧网页数据被渲染结束后,利用改变网页布局的目标网页对象的数量、目标网页的高度、屏幕高度等计算得到属性比值,基于得到的多个属性比值,将最大的属性比值对应的网页数据被渲染结束时的时间点,确定为首次有效绘制时间的属性值,实现了利用文字渲染参数和/或图片渲染参数、目标网页的高度、屏幕高度和时间点自动生成首次有效绘制时间的属性值,在此过程中,不需要监听加载事件,也不需要对目标对象手动添加标记,还不需要手动开启浏览器的开发者工具,提升了目标网页的加载速率,能够快速地获取任意目标网页的首次有效绘制时间的属性值。
在本公开的一种示例性实施例中,目标网页的网页对象中包含文字对象和/或图片对象,则需要在文字对象和/或图片对象加载完毕之后,确定首次有效绘制时间的属性值。也就是说,在目标网页中的文字对象和/或图片对象加载完毕之后,基于得到的多个属性比值,将最大的属性比值对应的网页数据被渲染结束时的时间点,确定为首次有效绘制时间的属性值。本公开的实施例在文字对象和/或图像对象并非目标网页的目标对象时,在文字对象和/或图片对象加载完毕之后,记录首次有效绘制时间的属性值,避免在目标网页无法加载文字对象和/或图片对象的情况下,记录的首次有效绘制时间的属性值,扩展了首次有效绘制时间的属性值的适应程度,使首次有效绘制时间的属性值更加符合实际的目标网页加载情况。
需要说明的是,本公开实施例是基于网页数据的文字渲染参数和/或图片渲染参数,以及目标网页的高度、浏览器所在的终端的屏幕高度和该网页数据被渲染结束时的时间点,生成首次有效绘制时间的属性值的,而在另一实施例中,无需执行上述步骤,能够基于网页数据的文字渲染参数和/或图片渲染参数,以及网页数据被渲染结束时的时间点,生成首次有效绘制时间的属性值。
本公开的实施例能够将上述内核重新编译成一个新的浏览器,利用新的浏览器加载任意网页,进而获取任意网页的性能数据,不需要对待加载的网页进行修改、标记等,减少了批量检测网页性能的工作量,也扩大了网页性能检测的适用范围。
图4是根据一示例性实施例示出的一种数据的获取装置的框图。装置中安装有浏览器,浏览器包括接口描述语言文件,接口描述语言文件中设置有性能数据的属性类型,属性类型指示网页的性能数据所属的类型,装置包括如下模块。
获取模块41,被配置为通过该浏览器,获取网页数据的渲染参数,网页数据为目标网页的数据;
生成模块42,被配置为基于渲染参数,生成属性类型的属性值;
导出模块43,被配置为基于接口描述语言文件,将接口描述语言文件包含的属性类型的属性值传输至浏览器的性能监控接口,从性能监控接口获取属性类型的属性值。
在本公开的一种示例性实施例中,获取模块41,被配置为通过浏览器,在目标网页的每帧网页数据被渲染结束之后,调用渲染通知方法获取本次渲染结束的网页数据的渲染参数。
在本公开的一种示例性实施例中,浏览器的内核具有性能计时接口,装置还包括:
传输模块,被配置为将渲染参数传输至性能计时接口;
生成模块42,被配置为调用性能计时接口,基于渲染参数,生成属性类型的属性值。
在本公开的一种示例性实施例中,性能监控接口为浏览器的脚本环境中的接口;
导出模块43,被配置为调用脚本从性能监控接口获取属性类型的属性值。
在本公开的一种示例性实施例中,渲染参数包含首次渲染参数;性能数据的属性类型包含首次绘制时间;生成模块42,被配置为在首次渲染参数的参数值为第一参数阈值,且首次绘制时间的属性值为空的情况下,将网页数据被渲染结束时的时间点,确定为首次绘制时间的属性值。
在本公开的一种示例性实施例中,渲染参数包含文字渲染参数;属性类型包含首次内容绘制时间;生成模块42,还被配置为为在文字渲染参数的参数值为第二参数阈值,且首次内容绘制时间的属性值为空的情况下,将网页数据被渲染结束时的时间点,确定为首次内容绘制时间的属性值。
在本公开的一种示例性实施例中,渲染参数包含文字渲染参数和/或图片渲染参数;属性类型包含首次有效绘制时间;生成模块42,还被配置为基于网页数据的文字渲染参数和/或图片渲染参数,以及网页数据被渲染结束时的时间点,生成首次有效绘制时间的属性值。
在本公开的一种示例性实施例中,目标网页对应有多帧网页数据,生成模块42,包括:
数量获取模块,被配置为对于每帧网页数据,基于网页数据的文字渲染参数和/或图 片渲染参数,获取目标网页对象的数量,目标网页对象为目标网页包含的网页对象,且改变了目标网页的网页布局;
比值生成模块,被配置为生成目标网页的高度与屏幕高度的第一比值;
比值比较模块,被配置为确定第一比值与预设数值中的较大值,确定数量与较大值之间的第二比值;
时间记录模块,被配置为基于每帧网页数据对应的第二比值,将最大的第二比值对应的网页数据被渲染结束时的时间点,确定为首次有效绘制时间的属性值。
在本公开的一种示例性实施例中,时间记录模块,被配置为在目标网页中的文字对象和/或图片对象加载完毕之后,基于每帧网页数据对应的第二比值,将最大的第二比值对应的网页数据被渲染结束时的时间点,确定为首次有效绘制时间的属性值。
关于上述实施例中的装置,其中各个模块执行操作的具体方式已经在有关该方法的实施例中进行了详细描述,此处将不做详细阐述说明。
本公开实施例还提供了一种电子设备,包括:处理器;用于存储该处理器可执行指令的存储器;其中,电子设备安装有浏览器,浏览器包括接口描述语言文件,接口描述语言文件中设置有属性类型,属性类型指示网页的性能数据所属的类型,处理器被配置为执行该指令,以实现如下操作:通过该浏览器,获取网页数据的渲染参数,网页数据为目标网页的数据;基于渲染参数,生成属性类型的属性值;基于接口描述语言文件,将接口描述语言文件包含的属性类型的属性值传输至浏览器的性能监控接口,从性能监控接口获取属性类型的属性值。
在一些实施例中,处理器被配置为执行指令,实现以下步骤:通过该浏览器,在目标网页的每帧网页数据被渲染结束之后,调用渲染通知方法获取本次渲染结束的网页数据的渲染参数。
在一些实施例中,浏览器的内核具有性能计时接口,处理器被配置为执行指令,实现以下步骤:将渲染参数传输至性能计时接口;调用性能计时接口,基于渲染参数,生成属性类型的属性值。
在一些实施例中,性能监控接口为浏览器的脚本环境中的接口;处理器被配置为执行指令,实现以下步骤:调用脚本从性能监控接口获取属性类型的属性值。
在一些实施例中,渲染参数包含首次渲染参数,属性类型包含首次绘制时间;处理器被配置为执行指令,实现以下步骤:在首次渲染参数的参数值为第一参数阈值,且首次绘 制时间的属性值为空的情况下,将网页数据被渲染结束时的时间点,确定为首次绘制时间的属性值。
在一些实施例中,渲染参数包含文字渲染参数;属性类型包含首次内容绘制时间;处理器被配置为执行指令,实现以下步骤:在文字渲染参数的参数值为第二参数阈值,且首次内容绘制时间的属性值为空的情况下,将网页数据被渲染结束时的时间点,确定为首次内容绘制时间的属性值。
在一些实施例中,渲染参数包含文字渲染参数和/或图片渲染参数;属性类型包含首次有效绘制时间;处理器被配置为执行指令,实现以下步骤:基于网页数据的文字渲染参数和/或图片渲染参数,以及网页数据被渲染结束时的时间点,生成首次有效绘制时间的属性值。
在一些实施例中,目标网页对应有多帧网页数据,处理器被配置为执行指令,实现以下步骤:对于每帧网页数据,基于网页数据的文字渲染参数和/或图片渲染参数,获取目标网页对象的数量,目标网页对象为目标网页包含的网页对象,且改变了目标网页的网页布局;生成目标网页的高度与屏幕高度的第一比值;确定第一比值与预设数值中的较大值,确定数量与较大值之间的第二比值;基于每帧网页数据对应的第二比值,将最大的第二比值对应的网页数据被渲染结束时的时间点,确定为首次有效绘制时间的属性值。
在一些实施例中,处理器被配置为执行指令,实现以下步骤:在目标网页中的文字对象和/或图片对象加载完毕之后,基于每帧网页数据对应的第二比值,将最大的第二比值对应的网页数据被渲染结束时的时间点,确定为首次有效绘制时间的属性值。
图5是根据一示例性实施例示出的一种电子设备500的框图。在一些实施例中,电子设备500被提供为终端。例如,电子设备500是移动电话,计算机,数字广播终端,消息收发设备,游戏控制台,平板设备,医疗设备,健身设备,个人数字助理等。
参照图5,电子设备500包括以下一个或多个组件:处理组件502,存储器504,电力组件506,多媒体组件508,音频组件510,输入/输出(I/O)的接口512,传感器组件514,以及通信组件516。
处理组件502通常控制电子设备500的整体操作,诸如与显示,电话呼叫,数据通信,相机操作和记录操作相关联的操作。处理组件502包括一个或多个处理器520来执行指令,以完成上述数据的获取方法的全部或部分步骤。此外,处理组件502包括一个或多个模块,便于处理组件502和其他组件之间的交互。例如,处理组件502包括多媒体模块,以方便多媒体组件508和处理组件502之间的交互。
存储器504被配置为存储各种类型的数据以支持在电子设备500的操作。这些数据的示例包括用于在电子设备500上操作的任何应用程序或方法的指令,联系人数据,电话簿数据,消息,图像,视频等。存储器504由任何类型的易失性或非易失性存储设备或者它们的组合实现,如静态随机存取存储器(SRAM),电可擦除可编程只读存储器(EEPROM),可擦除可编程只读存储器(EPROM),可编程只读存储器(PROM),只读存储器(ROM),磁存储器,快闪存储器,磁盘或光盘。
电源组件506为电子设备500的各种组件提供电力。电源组件506包括电源管理系统,一个或多个电源,及其他与为电子设备500生成、管理和分配电力相关联的组件。
多媒体组件508包括在电子设备500和用户之间的提供一个输出接口的屏幕。在一些实施例中,屏幕包括液晶显示器(LCD)和触摸面板(TP)。在屏幕包括触摸面板的情况下,屏幕被实现为触摸屏,以接收来自用户的输入信号。触摸面板包括一个或多个触摸传感器以感测触摸、滑动和触摸面板上的手势。触摸传感器不仅感测触摸或滑动动作的边界,而且还检测与触摸或滑动操作相关的持续时间和压力。在一些实施例中,多媒体组件508包括一个前置摄像头和/或后置摄像头。在电子设备500处于操作模式,如拍摄模式或视频模式的情况下,前置摄像头和/或后置摄像头能够接收外部的多媒体数据。每个前置摄像头和后置摄像头能够是一个固定的光学透镜系统或具有焦距和光学变焦能力。
音频组件510被配置为输出和/或输入音频信号。例如,音频组件510包括一个麦克风(MIC),在电子设备500处于操作模式,如呼叫模式、记录模式和语音识别模式的情况下,麦克风被配置为接收外部音频信号。所接收的音频信号能够被进一步存储在存储器504或经由通信组件516发送。在一些实施例中,音频组件510还包括一个扬声器,用于输出音频信号。
I/O接口512为处理组件502和外围接口模块之间提供接口,上述外围接口模块能够是键盘,点击轮,按钮等。这些按钮可包括但不限于:主页按钮、音量按钮、启动按钮和锁定按钮。
传感器组件514包括一个或多个传感器,用于为电子设备500提供各个方面的状态评估。例如,传感器组件514能够检测到电子设备500的打开/关闭状态,组件的相对定位,例如组件为电子设备500的显示器和小键盘,传感器组件514还能够检测电子设备500或电子设备500一个组件的位置改变,用户与电子设备500接触的存在或不存在,电子设备500方位或加速/减速和电子设备500的温度变化。传感器组件514包括接近传感器,被配置用来在没有任何的物理接触时检测附近物体的存在。传感器组件514还包括光传感器,如CMOS 或CCD图像传感器,用于在成像应用中使用。在一些实施例中,该传感器组件514还包括加速度传感器,陀螺仪传感器,磁传感器,压力传感器或温度传感器。
通信组件516被配置为便于电子设备500和其他设备之间有线或无线方式的通信。电子设备500能够接入基于通信标准的无线网络,如WiFi,运营商网络(如2G、3G、4G或5G),或它们的组合。在一个示例性实施例中,通信组件516经由广播信道接收来自外部广播管理系统的广播信号或广播相关信息。在一个示例性实施例中,通信组件516还包括近场通信(NFC)模块,以促进短程通信。例如,在NFC模块可基于射频识别(RFID)技术,红外数据协会(IrDA)技术,超宽带(UWB)技术,蓝牙(BT)技术和其他技术来实现。
在示例性实施例中,电子设备500被一个或多个应用专用集成电路(ASIC)、数字信号处理器(DSP)、数字信号处理设备(DSPD)、可编程逻辑器件(PLD)、现场可编程门阵列(FPGA)、控制器、微控制器、微处理器或其他电子元件实现,用于执行上述数据的获取方法。
在示例性实施例中,还提供了一种包括指令的存储介质,例如包括指令的存储器504,上述指令可由电子设备500的处理器520执行以完成上述数据的获取方法。在一些实施例中,存储介质是非临时性计算机可读存储介质,或者,是非易失性计算机可读存储介质,例如,非临时性计算机可读存储介质是ROM、随机存取存储器(RAM)、CD-ROM、磁带、软盘或光数据存储设备等。当非易失性计算机可读存储介质中的指令由电子设备的处理器执行时,使得电子设备能够执行如下步骤:通过该电子设备中安装的浏览器,获取网页数据的渲染参数,网页数据为目标网页的数据;基于渲染参数,生成属性类型的属性值;基于接口描述语言文件,将接口描述语言文件包含的属性类型的属性值传输至浏览器的性能监控接口,从性能监控接口获取属性类型的属性值。
在一些实施例中,该非易失性计算机可读存储介质中的指令由电子设备的处理器执行时,使得电子设备能够执行如下步骤:通过该浏览器,在目标网页的每帧网页数据被渲染结束之后,调用渲染通知方法获取本次渲染结束的网页数据的渲染参数。
在一些实施例中,浏览器的内核具有性能计时接口,该非易失性计算机可读存储介质中的指令由电子设备的处理器执行时,使得电子设备能够执行如下步骤:将渲染参数传输至性能计时接口;调用性能计时接口,基于渲染参数,生成属性类型的属性值。
在一些实施例中,性能监控接口为浏览器的脚本环境中的接口;该非易失性计算机可读存储介质中的指令由电子设备的处理器执行时,使得电子设备能够执行如下步骤:
调用脚本从性能监控接口获取属性类型的属性值。
在一些实施例中,渲染参数包含首次渲染参数,属性类型包含首次绘制时间;该非易失性计算机可读存储介质中的指令由电子设备的处理器执行时,使得电子设备能够执行如下步骤:在首次渲染参数的参数值为第一参数阈值,且首次绘制时间的属性值为空的情况下,将网页数据被渲染结束时的时间点,确定为首次绘制时间的属性值。
在一些实施例中,渲染参数包含文字渲染参数;属性类型包含首次内容绘制时间;该非易失性计算机可读存储介质中的指令由电子设备的处理器执行时,使得电子设备能够执行如下步骤:在文字渲染参数的参数值为第二参数阈值,且首次内容绘制时间的属性值为空的情况下,将网页数据被渲染结束时的时间点,确定为首次内容绘制时间的属性值。
在一些实施例中,渲染参数包含文字渲染参数和/或图片渲染参数;属性类型包含首次有效绘制时间;该非易失性计算机可读存储介质中的指令由电子设备的处理器执行时,使得电子设备能够执行如下步骤:基于网页数据的文字渲染参数和/或图片渲染参数,以及网页数据被渲染结束时的时间点,生成首次有效绘制时间的属性值。
在一些实施例中,目标网页对应有多帧网页数据,该非易失性计算机可读存储介质中的指令由电子设备的处理器执行时,使得电子设备能够执行如下步骤:对于每帧网页数据,基于网页数据的文字渲染参数和/或图片渲染参数,获取目标网页对象的数量,目标网页对象为目标网页包含的网页对象,且改变了目标网页的网页布局;生成目标网页的高度与屏幕高度的第一比值;确定第一比值与预设数值中的较大值,确定数量与较大值之间的第二比值;基于每帧网页数据对应的第二比值,将最大的第二比值对应的网页数据被渲染结束时的时间点,确定为首次有效绘制时间的属性值。
在一些实施例中,该非易失性计算机可读存储介质中的指令由电子设备的处理器执行时,使得电子设备能够执行如下步骤:在目标网页中的文字对象和/或图片对象加载完毕之后,基于每帧网页数据对应的第二比值,将最大的第二比值对应的网页数据被渲染结束时的时间点,确定为首次有效绘制时间的属性值。
在示例性实施例中,还提供了一种计算机程序产品,该计算机程序产品包括可读性程序代码,该可读性程序代码可由电子设备500的处理器520执行以完成如下步骤:通过该电子设备中安装的浏览器,获取网页数据的渲染参数,网页数据为目标网页的数据;基于渲染参数,生成属性类型的属性值;基于接口描述语言文件,将接口描述语言文件包含的属性类型的属性值传输至浏览器的性能监控接口,从性能监控接口获取属性类型的属性值。
在一些实施例中,可读性程序代码可由电子设备的处理器执行以完成如下步骤:通过该浏览器,在目标网页的每帧网页数据被渲染结束之后,调用渲染通知方法获取本次渲染结束的网页数据的渲染参数。
在一些实施例中,浏览器的内核具有性能计时接口,可读性程序代码可由电子设备的处理器执行以完成如下步骤:将渲染参数传输至性能计时接口;调用性能计时接口,基于渲染参数,生成属性类型的属性值。
在一些实施例中,性能监控接口为浏览器的脚本环境中的接口;可读性程序代码可由电子设备的处理器执行以完成如下步骤:
调用脚本从性能监控接口获取属性类型的属性值。
在一些实施例中,渲染参数包含首次渲染参数,属性类型包含首次绘制时间;可读性程序代码可由电子设备的处理器执行以完成如下步骤:在首次渲染参数的参数值为第一参数阈值,且首次绘制时间的属性值为空的情况下,将网页数据被渲染结束时的时间点,确定为首次绘制时间的属性值。
在一些实施例中,渲染参数包含文字渲染参数;属性类型包含首次内容绘制时间;可读性程序代码可由电子设备的处理器执行以完成如下步骤:在文字渲染参数的参数值为第二参数阈值,且首次内容绘制时间的属性值为空的情况下,将网页数据被渲染结束时的时间点,确定为首次内容绘制时间的属性值。
在一些实施例中,渲染参数包含文字渲染参数和/或图片渲染参数;属性类型包含首次有效绘制时间;可读性程序代码可由电子设备的处理器执行以完成如下步骤:基于网页数据的文字渲染参数和/或图片渲染参数,以及网页数据被渲染结束时的时间点,生成首次有效绘制时间的属性值。
在一些实施例中,目标网页对应有多帧网页数据,可读性程序代码可由电子设备的处理器执行以完成如下步骤:对于每帧网页数据,基于网页数据的文字渲染参数和/或图片渲染参数,获取目标网页对象的数量,目标网页对象为目标网页包含的网页对象,且改变了目标网页的网页布局;生成目标网页的高度与屏幕高度的第一比值;确定第一比值与预设数值中的较大值,确定数量与较大值之间的第二比值;基于每帧网页数据对应的第二比值,将最大的第二比值对应的网页数据被渲染结束时的时间点,确定为首次有效绘制时间的属性值。
在一些实施例中,可读性程序代码可由电子设备的处理器执行以完成如下步骤:在目标网页中的文字对象和/或图片对象加载完毕之后,基于每帧网页数据对应的第二比值, 将最大的第二比值对应的网页数据被渲染结束时的时间点,确定为首次有效绘制时间的属性值。
在一些实施例中,该程序代码存储在电子设备500的存储介质中,该存储介质是非临时性计算机可读存储介质,或者,是非易失性计算机可读存储介质,例如,非临时性计算机可读存储介质是ROM、随机存取存储器(RAM)、CD-ROM、磁带、软盘或光数据存储设备等。
图6是根据一示例性实施例示出的另一种电子设备600的框图。例如,电子设备600被提供为一服务器。参照图6,电子设备600包括处理组件622,其进一步包括一个或多个处理器,以及由存储器632所代表的存储器资源,用于存储可由处理组件622的执行的指令,例如应用程序。存储器632中存储的应用程序包括一个或一个以上的每一个对应于一组指令的模块。此外,处理组件622被配置为执行指令,以执行上述数据的获取方法。
电子设备600还包括一个电源组件626被配置为执行电子设备600的电源管理,一个有线或无线网络接口650被配置为将电子设备600连接到网络,和一个输入输出(I/O)接口658。电子设备600能够操作基于存储在存储器632的操作系统,例如Windows ServerTM,Mac OS XTM,UnixTM,LinuxTM,FreeBSDTM或类似。
本公开所有实施例均能够单独被执行,也能够与其他实施例相结合被执行,均视为本公开要求的保护范围。

Claims (29)

  1. 一种数据的获取方法,由电子设备执行,所述电子设备中安装有浏览器,所述浏览器包括接口描述语言文件,所述接口描述语言文件中设置有属性类型,所述属性类型指示网页的性能数据所属的类型,所述方法包括:
    通过所述浏览器,获取网页数据的渲染参数,所述网页数据为目标网页的数据;
    基于所述渲染参数,生成所述属性类型的属性值;
    基于所述接口描述语言文件,将所述接口描述语言文件包含的属性类型的属性值传输至所述浏览器的性能监控接口,从所述性能监控接口获取所述属性类型的属性值。
  2. 根据权利要求1所述的方法,其中,所述通过所述浏览器,获取网页数据的渲染参数,包括:
    通过所述浏览器,在所述目标网页的每帧所述网页数据被渲染结束之后,调用渲染通知方法获取本次渲染结束的所述网页数据的渲染参数。
  3. 根据权利要求2所述的方法,其中,所述浏览器的内核具有性能计时接口,所述方法还包括:
    将所述渲染参数传输至所述性能计时接口;
    所述基于所述渲染参数,生成所述属性类型的属性值,包括:
    调用所述性能计时接口,基于所述渲染参数,生成所述属性类型的属性值。
  4. 根据权利要求1所述的方法,其中,所述性能监控接口为所述浏览器的脚本环境中的接口;所述从所述性能监控接口获取所述属性类型的属性值,包括:
    调用脚本从所述性能监控接口获取所述属性类型的属性值。
  5. 根据权利要求1所述的方法,其中,所述渲染参数包含首次渲染参数,所述属性类型包含首次绘制时间;所述基于所述渲染参数,生成所述属性类型的属性值,包括:
    在所述首次渲染参数的参数值为第一参数阈值,且所述首次绘制时间的属性值为空的情况下,将所述网页数据被渲染结束时的时间点,确定为所述首次绘制时间的属性值。
  6. 根据权利要求1所述的方法,其中,所述渲染参数包含文字渲染参数;所述属性类型包含首次内容绘制时间;所述基于所述渲染参数,生成所述属性类型的属性值,包括:
    在所述文字渲染参数的参数值为第二参数阈值,且所述首次内容绘制时间的属性值为空的情况下,将所述网页数据被渲染结束时的时间点,确定为所述首次内容绘制时间的属性值。
  7. 根据权利要求1所述的方法,其中,所述渲染参数包含文字渲染参数和/或图片渲染参数;所述属性类型包含首次有效绘制时间;所述基于所述渲染参数,生成所述属性类型的属性值,包括:
    基于所述网页数据的所述文字渲染参数和/或所述图片渲染参数,以及所述网页数据被渲染结束时的时间点,生成所述首次有效绘制时间的属性值。
  8. 根据权利要求7所述的方法,其中,所述目标网页对应有多帧所述网页数据,所述基于所述网页数据的所述文字渲染参数和/或所述图片渲染参数,以及所述网页数据被渲染结束时的时间点,生成所述首次有效绘制时间的属性值,包括:
    对于每帧所述网页数据,基于所述网页数据的所述文字渲染参数和/或所述图片渲染参数,获取目标网页对象的数量,所述目标网页对象为所述目标网页包含的网页对象,且改变了所述目标网页的网页布局;
    生成所述目标网页的高度与所述屏幕高度的第一比值;
    确定所述第一比值与预设数值中的较大值,确定所述数量与所述较大值之间的第二比值;
    基于每帧所述网页数据对应的第二比值,将最大的第二比值对应的网页数据被渲染结束时的时间点,确定为所述首次有效绘制时间的属性值。
  9. 根据权利要求8所述的方法,其中,所述基于每帧所述网页数据对应的第二比值,将最大的第二比值对应的网页数据被渲染结束时的时间点,确定为所述首次有效绘制时间的属性值,包括:
    在所述目标网页中的文字对象和/或图片对象加载完毕之后,基于每帧所述网页数据对应的第二比值,将最大的第二比值对应的网页数据被渲染结束时的时间点,确定为所述首次有效绘制时间的属性值。
  10. 一种数据的获取装置,所述装置中安装有浏览器,所述浏览器包括接口描述语言文件,所述接口描述语言文件中设置有属性类型,所述属性类型指示网页的性能数据所属的类型,所述装置包括:
    获取模块,被配置为通过所述浏览器,获取网页数据的渲染参数,所述网页数据为目标网页的数据;
    生成模块,被配置为基于所述渲染参数,生成所述属性类型的属性值;
    导出模块,被配置为基于所述接口描述语言文件,将所述接口描述语言文件包含的属 性类型的属性值传输至所述浏览器的性能监控接口,从所述性能监控接口获取所述属性类型的属性值。
  11. 根据权利要求10所述的装置,其中,所述获取模块,被配置为通过所述浏览器,在所述目标网页的每帧所述网页数据被渲染结束之后,调用渲染通知方法获取本次渲染结束的所述网页数据的渲染参数。
  12. 根据权利要求11所述的装置,其中,所述浏览器的内核具有性能计时接口,所述装置还包括:
    传输模块,被配置为将所述渲染参数传输至所述性能计时接口;
    所述生成模块,被配置为调用所述性能计时接口,基于所述渲染参数,生成所述属性类型的属性值。
  13. 根据权利要求10所述的装置,其中,所述性能监控接口为所述浏览器的脚本环境中的接口;
    所述导出模块,被配置为调用脚本从所述性能监控接口获取所述属性类型的属性值。
  14. 根据权利要求10所述的装置,其中,所述渲染参数包含首次渲染参数;所述属性类型包含首次绘制时间;所述生成模块,被配置为在所述首次渲染参数的参数值为第一参数阈值,且所述首次绘制时间的属性值为空的情况下,将所述网页数据被渲染结束时的时间点,确定为所述首次绘制时间的属性值。
  15. 根据权利要求10所述的装置,其中,所述渲染参数包含文字渲染参数;所述属性类型包含首次内容绘制时间;所述生成模块,还被配置为在所述文字渲染参数的参数值为第二参数阈值,且所述首次内容绘制时间的属性值为空的情况下,将所述网页数据被渲染结束时的时间点,确定为所述首次内容绘制时间的属性值。
  16. 根据权利要求10所述的装置,其中,所述渲染参数包含文字渲染参数和/或图片渲染参数;所述属性类型包含首次有效绘制时间;所述生成模块,还被配置为基于所述网页数据的所述文字渲染参数和/或所述图片渲染参数,以及所述网页数据被渲染结束时的时间点,生成所述首次有效绘制时间的属性值。
  17. 根据权利要求16所述的装置,其中,所述目标网页对应有多帧所述网页数据,所述生成模块,包括:
    数量获取模块,被配置为对于每帧所述网页数据,基于所述网页数据的所述文字渲染参数和/或所述图片渲染参数,获取目标网页对象的数量,所述目标网页对象为所述目标网页包含的网页对象,且改变了所述目标网页的网页布局;
    比值生成模块,被配置为生成所述目标网页的高度与所述屏幕高度的第一比值;
    比值比较模块,被配置为确定所述第一比值与预设数值中的较大值,确定所述数量与所述较大值之间的第二比值;
    时间记录模块,被配置为基于每帧所述网页数据对应的第二比值,将最大的第二比值对应的网页数据被渲染结束时的时间点,确定为所述首次有效绘制时间的属性值。
  18. 根据权利要求17所述的装置,其中,所述时间记录模块,被配置为在所述目标网页中的文字对象和/或图片对象加载完毕之后,基于每帧所述网页数据对应的第二比值,将最大的第二比值对应的网页数据被渲染结束时的时间点,确定为所述首次有效绘制时间的属性值。
  19. 一种电子设备,其中,包括:
    处理器;
    用于存储所述处理器可执行指令的存储器;
    其中,所述电子设备安装有浏览器,所述浏览器包括接口描述语言文件,所述接口描述语言文件中设置有属性类型,所述属性类型指示网页的性能数据所属的类型,所述处理器被配置为执行所述指令,实现以下步骤:
    通过所述浏览器,获取网页数据的渲染参数,所述网页数据为目标网页的数据;
    基于所述渲染参数,生成所述属性类型的属性值;
    基于所述接口描述语言文件,将所述接口描述语言文件包含的属性类型的属性值传输至所述浏览器的性能监控接口,从所述性能监控接口获取所述属性类型的属性值。
  20. 根据权利要求19所述的电子设备,其中,所述处理器被配置为执行所述指令,实现以下步骤:
    通过所述浏览器,在所述目标网页的每帧所述网页数据被渲染结束之后,调用渲染通知方法获取本次渲染结束的所述网页数据的渲染参数。
  21. 根据权利要求20所述的电子设备,其中,所述浏览器的内核具有性能计时接口,所述处理器被配置为执行所述指令,实现以下步骤:
    将所述渲染参数传输至所述性能计时接口;
    调用所述性能计时接口,基于所述渲染参数,生成所述属性类型的属性值。
  22. 根据权利要求19所述的电子设备,其中,所述性能监控接口为所述浏览器的脚本环境中的接口;所述处理器被配置为执行所述指令,实现以下步骤:
    调用脚本从所述性能监控接口获取所述属性类型的属性值。
  23. 根据权利要求19所述的电子设备,其中,所述渲染参数包含首次渲染参数,所述属性类型包含首次绘制时间;所述处理器被配置为执行所述指令,实现以下步骤:
    在所述首次渲染参数的参数值为第一参数阈值,且所述首次绘制时间的属性值为空的情况下,将所述网页数据被渲染结束时的时间点,确定为所述首次绘制时间的属性值。
  24. 根据权利要求19所述的电子设备,其中,所述渲染参数包含文字渲染参数;所述属性类型包含首次内容绘制时间;所述处理器被配置为执行所述指令,实现以下步骤:
    在所述文字渲染参数的参数值为第二参数阈值,且所述首次内容绘制时间的属性值为空的情况下,将所述网页数据被渲染结束时的时间点,确定为所述首次内容绘制时间的属性值。
  25. 根据权利要求19所述的电子设备,其中,所述渲染参数包含文字渲染参数和/或图片渲染参数;所述属性类型包含首次有效绘制时间;所述处理器被配置为执行所述指令,实现以下步骤:
    基于所述网页数据的所述文字渲染参数和/或所述图片渲染参数,以及所述网页数据被渲染结束时的时间点,生成所述首次有效绘制时间的属性值。
  26. 根据权利要求25所述的电子设备,其中,所述目标网页对应有多帧所述网页数据,所述处理器被配置为执行所述指令,实现以下步骤:
    对于每帧所述网页数据,基于所述网页数据的所述文字渲染参数和/或所述图片渲染参数,获取目标网页对象的数量,所述目标网页对象为所述目标网页包含的网页对象,且改变了所述目标网页的网页布局;
    生成所述目标网页的高度与所述屏幕高度的第一比值;
    确定所述第一比值与预设数值中的较大值,确定所述数量与所述较大值之间的第二比值;
    基于每帧所述网页数据对应的第二比值,将最大的第二比值对应的网页数据被渲染结束时的时间点,确定为所述首次有效绘制时间的属性值。
  27. 根据权利要求26所述的电子设备,其中,所述处理器被配置为执行所述指令,实现以下步骤:
    在所述目标网页中的文字对象和/或图片对象加载完毕之后,基于每帧所述网页数据对应的第二比值,将最大的第二比值对应的网页数据被渲染结束时的时间点,确定为所述首次有效绘制时间的属性值。
  28. 一种非易失性计算机可读存储介质,当所述非易失性计算机可读存储介质中的指令由电子设备的处理器执行时,使得所述电子设备能够执行如下步骤:
    通过所述电子设备中安装的浏览器,获取网页数据的渲染参数,所述网页数据为目标网页的数据;
    基于所述渲染参数,生成所述属性类型的属性值;
    基于所述接口描述语言文件,将所述接口描述语言文件包含的属性类型的属性值传输至所述浏览器的性能监控接口,从所述性能监控接口获取所述属性类型的属性值。
  29. 一种计算机程序产品,包括可读性程序代码,所述可读性程序代码可由电子设备的处理器执行以完成如下步骤:
    通过所述电子设备中安装的浏览器,获取网页数据的渲染参数,所述网页数据为目标网页的数据;
    基于所述渲染参数,生成所述属性类型的属性值;
    基于所述接口描述语言文件,将所述接口描述语言文件包含的属性类型的属性值传输至所述浏览器的性能监控接口,从所述性能监控接口获取所述属性类型的属性值。
PCT/CN2021/128390 2020-12-21 2021-11-03 数据的获取方法及电子设备 WO2022134875A1 (zh)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN202011522734.8 2020-12-21
CN202011522734.8A CN112685269A (zh) 2020-12-21 2020-12-21 数据的获取方法、装置、电子设备及存储介质

Publications (1)

Publication Number Publication Date
WO2022134875A1 true WO2022134875A1 (zh) 2022-06-30

Family

ID=75450139

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2021/128390 WO2022134875A1 (zh) 2020-12-21 2021-11-03 数据的获取方法及电子设备

Country Status (2)

Country Link
CN (1) CN112685269A (zh)
WO (1) WO2022134875A1 (zh)

Families Citing this family (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112685269A (zh) * 2020-12-21 2021-04-20 北京达佳互联信息技术有限公司 数据的获取方法、装置、电子设备及存储介质
CN113177176A (zh) * 2021-05-21 2021-07-27 脸萌有限公司 特征构建方法、内容显示方法及相关装置

Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104881273A (zh) * 2014-02-27 2015-09-02 腾讯科技(深圳)有限公司 一种网页渲染的分析方法和终端设备
CN108205487A (zh) * 2016-12-20 2018-06-26 广州市动景计算机科技有限公司 一种监控浏览器性能的方法、装置及用户终端
CN110162451A (zh) * 2019-04-22 2019-08-23 腾讯科技(深圳)有限公司 一种性能分析方法、装置、服务器及存储介质
US20200104232A1 (en) * 2018-09-28 2020-04-02 Ebay Inc. Automated Determination of Web Page Rendering Performance
CN111290912A (zh) * 2020-01-22 2020-06-16 北京百度网讯科技有限公司 单页面应用性能监控方法、装置和电子设备
US20200241996A1 (en) * 2019-01-30 2020-07-30 Salesforce.Com, Inc. Distributed web page performance monitoring methods and systems
CN112685269A (zh) * 2020-12-21 2021-04-20 北京达佳互联信息技术有限公司 数据的获取方法、装置、电子设备及存储介质

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN108536594B (zh) * 2018-04-02 2022-03-08 腾讯科技(武汉)有限公司 页面测试方法、装置及存储设备

Patent Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104881273A (zh) * 2014-02-27 2015-09-02 腾讯科技(深圳)有限公司 一种网页渲染的分析方法和终端设备
CN108205487A (zh) * 2016-12-20 2018-06-26 广州市动景计算机科技有限公司 一种监控浏览器性能的方法、装置及用户终端
US20200104232A1 (en) * 2018-09-28 2020-04-02 Ebay Inc. Automated Determination of Web Page Rendering Performance
US20200241996A1 (en) * 2019-01-30 2020-07-30 Salesforce.Com, Inc. Distributed web page performance monitoring methods and systems
CN110162451A (zh) * 2019-04-22 2019-08-23 腾讯科技(深圳)有限公司 一种性能分析方法、装置、服务器及存储介质
CN111290912A (zh) * 2020-01-22 2020-06-16 北京百度网讯科技有限公司 单页面应用性能监控方法、装置和电子设备
CN112685269A (zh) * 2020-12-21 2021-04-20 北京达佳互联信息技术有限公司 数据的获取方法、装置、电子设备及存储介质

Also Published As

Publication number Publication date
CN112685269A (zh) 2021-04-20

Similar Documents

Publication Publication Date Title
WO2019109564A1 (zh) 屏幕显示控制的方法和装置
US20170060260A1 (en) Method and device for connecting external equipment
WO2022134875A1 (zh) 数据的获取方法及电子设备
US10708512B2 (en) Method and device for capturing image and storage medium
CN106547547B (zh) 数据采集方法及装置
US20220342706A1 (en) Method for data processing and apparatus, and electronic device
EP3012750A1 (en) Method and device for identifying encoding of web page
US20220343056A1 (en) Method for loading image and electronic device
CN112711723A (zh) 一种恶意网址检测方法、装置及电子设备
CN105808304B (zh) 代码部署方法、装置及系统
US20160364459A1 (en) Search method and search device
US11210449B2 (en) Page display method and device and storage medium
WO2022134390A1 (zh) 标注方法及装置、电子设备和存储介质
CN112331158B (zh) 终端显示调节方法、装置、设备及存储介质
CN104572230B (zh) 脚本文件的加载方法、脚本文件生成方法及装置
CN109491655B (zh) 一种输入事件处理方法及装置
WO2023046105A1 (zh) 消息发送方法、装置和电子设备
CN113204443B (zh) 基于联邦学习框架的数据处理方法、设备、介质及产品
CN112083841B (zh) 信息输入方法、装置和存储介质
CN111596980B (zh) 一种信息处理方法及装置
CN110784721A (zh) 一种图片数据压缩方法、装置、电子设备及存储介质
US9679076B2 (en) Method and device for controlling page rollback
CN111414245B (zh) 一种控制闪存读写速率的方法、装置及介质
CN111538486B (zh) 布局文件嵌套层数筛查方法、装置及电子设备
CN110659081B (zh) 用于程序对象的文件处理方法、装置及电子设备

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 21908876

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 21908876

Country of ref document: EP

Kind code of ref document: A1

32PN Ep: public notification in the ep bulletin as address of the adressee cannot be established

Free format text: NOTING OF LOSS OF RIGHTS PURSUANT TO RULE 112(1) EPC (EPO FORM 1205A DATED 160124)