CN112685269A - Data acquisition method and device, electronic equipment and storage medium - Google Patents

Data acquisition method and device, electronic equipment and storage medium Download PDF

Info

Publication number
CN112685269A
CN112685269A CN202011522734.8A CN202011522734A CN112685269A CN 112685269 A CN112685269 A CN 112685269A CN 202011522734 A CN202011522734 A CN 202011522734A CN 112685269 A CN112685269 A CN 112685269A
Authority
CN
China
Prior art keywords
rendering
data
attribute
webpage
parameter
Prior art date
Legal status (The legal status 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 status listed.)
Pending
Application number
CN202011522734.8A
Other languages
Chinese (zh)
Inventor
王文杰
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Beijing Dajia Internet Information Technology Co Ltd
Original Assignee
Beijing Dajia Internet Information Technology Co Ltd
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 Beijing Dajia Internet Information Technology Co Ltd filed Critical Beijing Dajia Internet Information Technology Co Ltd
Priority to CN202011522734.8A priority Critical patent/CN112685269A/en
Publication of CN112685269A publication Critical patent/CN112685269A/en
Priority to PCT/CN2021/128390 priority patent/WO2022134875A1/en
Pending legal-status Critical Current

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

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

The disclosure relates to a data acquisition method, a data acquisition device, an electronic device and a storage medium, wherein the method comprises the following steps: acquiring rendering parameters of webpage data of a target webpage; generating an attribute value of the attribute type of the performance data according to the rendering parameter; and exporting the attribute value of the attribute type of the performance data to a webpage end performance monitoring interface of the browser based on the interface description language file, and calling a script to acquire the attribute value of the attribute type of the performance data from the webpage end performance monitoring interface. The method and the device for acquiring the attribute value of the attribute type of the performance data are based on the characteristic that the interface description language file is used as a bridge between a browser kernel and a script environment, the attribute value of the attribute type of the performance data is exported to a webpage-side performance monitoring interface of the script environment, the attribute value of the attribute type of the performance data is acquired from the webpage-side performance monitoring interface, the attribute value of the attribute type of the performance data of a webpage is automatically acquired, and the acquisition efficiency of the performance data is improved.

Description

Data acquisition method and device, electronic equipment and storage medium
Technical Field
The present disclosure relates to the field of computer technologies, and in particular, to a method and an apparatus for acquiring data, an electronic device, and a storage medium.
Background
The web page performance monitoring is an important function in the technical field of web page terminals, and a high-performance page can bring excellent experience to users, increase the user stickiness and improve the conversion rate of web pages.
In the related art, on one hand, the main object of the webpage can be manually marked, and then the loading event of the main object is monitored, so that the performance data of the webpage is obtained. However, listening for load events can affect web page performance. Manual tagging is not suitable for all web pages and requires a high level of technical expertise on the part of the technician. Alternatively, the performance data may be obtained from a developer tool in the browser. However, the developer tool needs to be manually turned on, and automation cannot be achieved. Moreover, the developer tool needs to reload the web page, which results in a time-consuming and inefficient performance data acquisition process.
Disclosure of Invention
The disclosure provides a data acquisition method, a data acquisition device, electronic equipment and a storage medium, which are used for at least solving the problems that performance data acquired in the related art affects the performance of a webpage, is not suitable for all webpages, has high requirements on technical personnel, and is time-consuming and low in efficiency in the process of acquiring the performance data and the performance data which cannot be automatically acquired. The technical scheme of the disclosure is as follows:
according to a first aspect of the embodiments of the present disclosure, there is provided a data acquisition method, which is applied to a browser, where an attribute type of performance data is set in an interface description language file of a performance timing interface of a kernel of the browser, and the method includes: acquiring rendering parameters of webpage data of a target webpage; generating an attribute value of the attribute type of the performance data according to the rendering parameter; and exporting the attribute value of the attribute type of the performance data to a webpage end performance monitoring interface of the browser based on the interface description language file, and calling a script to acquire the attribute value of the attribute type of the performance data from the webpage end performance monitoring interface.
Optionally, the obtaining rendering parameters of the web page data of the target web page includes: and calling a preset rendering notification method to acquire a rendering parameter of each frame of data after each frame of data of the webpage data is rendered.
Optionally, after the preset rendering notification method is called to obtain the rendering parameter of each frame of data, the method further includes: transmitting the rendering parameters to the performance timing interface.
Optionally, the rendering parameters include one or more of first rendering parameters, text rendering parameters, and picture rendering parameters; the attribute type of the performance data comprises one or more of first drawing time, first content drawing time and first effective drawing time; the generating an attribute value of an attribute type of the performance data according to the rendering parameter includes: and when the parameter value of the first rendering parameter belongs to a preset first parameter threshold value and the attribute value of the first rendering time is null, taking the current time point after rendering of frame data corresponding to the first rendering parameter is finished as the attribute value of the first rendering time.
Optionally, the generating an attribute value of an attribute type of the performance data according to the rendering parameter further includes: and when the parameter value of the character rendering parameter belongs to a preset second parameter threshold value and the attribute value of the first content rendering time is null, taking the current time point after rendering of frame data corresponding to the character rendering parameter is finished as the attribute value of the first content rendering time.
Optionally, the generating an attribute value of an attribute type of the performance data according to the rendering parameter further includes: and generating an attribute value of the first effective drawing time according to the character rendering parameter and/or the picture rendering parameter, the height of the target webpage, the screen height of the terminal where the browser is located, and the current time point after rendering of a frame of data corresponding to the character rendering parameter and/or the picture rendering parameter is finished.
Optionally, the generating an attribute value of the first effective drawing time according to the text rendering parameter and/or the picture rendering parameter, and the height of the target webpage, the screen height of the terminal where the browser is located, and the current time point after rendering of a frame of data corresponding to the text rendering parameter and/or the picture rendering parameter is completed includes: acquiring the number of webpage objects of which the webpage layout of the target webpage is changed according to the character rendering parameters and/or the picture rendering parameters; generating a ratio of the height of the target webpage to the height of the screen; comparing the ratio with a preset value to obtain a larger value of the ratio and the preset value, wherein the larger value is the ratio or the preset value; and taking the ratio of the number to the larger value as the attribute value of the first effective drawing time, wherein the current time point when the ratio is the maximum value.
Optionally, the taking a ratio of the number to the larger value as a current time point when the current time point is a maximum value as an attribute value of the first effective drawing time includes: and after the character objects and/or the picture objects in the target webpage are loaded, taking the current time point when the ratio of the number to the larger value is the maximum value as the attribute value of the first effective drawing time.
According to a second aspect of the embodiments of the present disclosure, there is provided an apparatus for acquiring data, the apparatus being installed in a browser, an attribute type of performance data being set in an interface description language file of a performance timing interface of a kernel of the browser, the apparatus including: the system comprises an acquisition module, a display module and a display module, wherein the acquisition module is configured to acquire rendering parameters of webpage data of a target webpage; a generation module configured to generate an attribute value of an attribute type of the performance data according to the rendering parameter; and the export module is configured to export the attribute value of the attribute type of the performance data to a webpage end performance monitoring interface of the browser based on the interface description language file, and call a script to acquire the attribute value of the attribute type of the performance data from the webpage end performance monitoring interface.
Optionally, the obtaining module is configured to, after rendering of each frame of data of the webpage data is finished, call a preset rendering notification method to obtain the rendering parameter of each frame of data.
Optionally, the apparatus further comprises: the transmission module is configured to transmit the rendering parameters to the performance timing interface after the acquisition module calls a preset rendering notification method to acquire the rendering parameters of each frame of data.
Optionally, the rendering parameters include one or more of first rendering parameters, text rendering parameters, and picture rendering parameters; the attribute type of the performance data comprises one or more of first drawing time, first content drawing time and first effective drawing time; the generating module is configured to, when a parameter value of the first rendering parameter belongs to a preset first parameter threshold and the attribute value of the first rendering time is null, take a current time point after rendering of frame data corresponding to the first rendering parameter is finished as the attribute value of the first rendering time.
Optionally, the generating module is further configured to, when a parameter value of the text rendering parameter belongs to a preset second parameter threshold and the attribute value of the first content rendering time is null, take a current time point after rendering of a frame of data corresponding to the text rendering parameter is completed as the attribute value of the first content rendering time.
Optionally, the generating module is further configured to generate the attribute value of the first effective drawing time according to the text rendering parameter and/or the picture rendering parameter, and the height of the target webpage, the screen height of the terminal where the browser is located, and the current time point after rendering of a frame of data corresponding to the text rendering parameter and/or the picture rendering parameter is completed.
Optionally, the generating module includes: a quantity obtaining module configured to obtain the quantity of the web page objects of which the web page layout of the target web page is changed according to the text rendering parameters and/or the picture rendering parameters; a ratio generation module configured to generate a ratio of a height of the target web page to the screen height; a ratio comparison module configured to compare the ratio with a preset value to obtain a larger value of the ratio and the preset value, wherein the larger value is the ratio or the preset value; and the time recording module is configured to take the ratio of the number to the larger value as the attribute value of the first effective drawing time, wherein the current time point when the ratio is the maximum value.
Optionally, the time recording module is configured to, after the text object and/or the picture object in the target webpage are loaded, take a current time point at which a ratio of the number to the larger value is a maximum value as the attribute value of the first effective rendering time.
According to a third aspect of the embodiments of the present disclosure, there is provided an electronic apparatus including: a processor; a memory for storing the processor-executable instructions; wherein the processor is configured to execute the instructions to implement the method of acquiring data according to the first aspect.
According to a fourth aspect of embodiments of the present disclosure, there is provided a storage medium, wherein instructions that, when executed by a processor of an electronic device, enable the electronic device to perform the method for acquiring data according to the first aspect.
According to a fifth aspect of embodiments of the present disclosure, there is provided a computer program product comprising readable program code executable by a processor of an electronic device to perform the method for acquiring data of the first aspect.
The technical scheme provided by the embodiment of the disclosure at least brings the following beneficial effects:
the data acquisition scheme provided by the embodiment of the present disclosure may be applied to a browser, and an attribute type of performance data is set in an Interface Description Language (IDL) file of a performance timing Interface of an kernel of the browser. And loading the target webpage by using the browser, acquiring rendering parameters of the webpage data after rendering of the webpage data of the target webpage is finished, and generating attribute values of the attribute types of the performance data according to the rendering parameters. And then, exporting the attribute value of the attribute type of the performance data to a webpage end performance monitoring interface of the browser based on the interface description language file, and calling a script to acquire the attribute value of the attribute type of the performance data from the webpage end performance monitoring interface.
When the attribute values of the attribute types of the performance data of the web pages are obtained, the embodiment of the disclosure does not need to manually mark the web page data and monitor loading events, reduces the requirements on the professional skills of technicians, does not influence the performance of the web pages, and can be applied to all the web pages. According to the method and the device, the browser kernel is modified, namely the attribute type of the performance data is set for the interface description language file of the performance timing interface of the browser kernel, the webpage data of the target webpage are loaded through the browser, then the attribute value of the attribute type of the performance data is exported to the webpage end performance monitoring interface of the script environment of the browser based on the characteristic that the interface description language file serves as a bridge between the browser kernel and the script environment, and then the script is called to obtain the attribute value of the attribute type of the performance data from the webpage end performance monitoring interface, so that the automatic obtaining of the attribute value of the attribute type of the performance data of the webpage is achieved. Moreover, a developer tool of a browser is not needed, the webpage cannot be reloaded, and the acquisition efficiency of the performance data is improved.
It is to be understood that both the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the disclosure.
Drawings
The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present disclosure and, together with the description, serve to explain the principles of the disclosure and are not to be construed as limiting the disclosure.
FIG. 1 is a flow chart illustrating a method of data acquisition according to an exemplary embodiment.
FIG. 2 is a schematic diagram illustrating a method of obtaining rendering parameters according to an example embodiment.
FIG. 3 is a diagram illustrating a time variation of attribute values for a first-time effective rendering time according to an example embodiment.
Fig. 4 is a block diagram illustrating an apparatus for acquiring data according to an exemplary embodiment.
FIG. 5 is a block diagram illustrating one type of data acquisition electronics, according to an exemplary embodiment.
FIG. 6 is a block diagram illustrating an electronic device for acquiring data in accordance with an exemplary embodiment.
Detailed Description
In order to make the technical solutions of the present disclosure better understood by those of ordinary skill in the art, the technical solutions in the embodiments of the present disclosure will be clearly and completely described below with reference to the accompanying drawings.
It should be noted that the terms "first," "second," and the like in the description and claims of the present disclosure and in the above-described drawings are used for distinguishing between similar elements and not necessarily for describing a particular sequential or chronological order. It is to be understood that the data so used is interchangeable under appropriate circumstances such that the embodiments of the disclosure described herein are capable of operation in sequences other than those illustrated or otherwise described herein. The implementations described in the exemplary embodiments below are not intended to represent all implementations consistent with the present disclosure. Rather, they are merely examples of apparatus and methods consistent with certain aspects of the present disclosure, as detailed in the appended claims.
Fig. 1 is a flowchart illustrating a data acquisition method according to an exemplary embodiment, where as shown in fig. 1, the data acquisition method may be applied to a browser, and an attribute type of performance data is set in an interface description language file of a performance timing interface of a kernel of the browser, and the data acquisition method may specifically include the following steps.
In step S11, the rendering parameters of the web page data of the target web page are acquired.
In the embodiment of the disclosure, the browser loads the webpage data of the target webpage, and in the loading process, the rendering engine of the browser renders the webpage data. After the rendering of the webpage data is finished, the rendering parameters of the webpage data can be acquired according to the performance timing interface.
In step S12, an attribute value of the attribute type of the performance data is generated from the rendering parameters.
In an embodiment of the present disclosure, the performance data may mainly include rendering time information of the target web page. In practical application, the performance data may include various drawing time information, and therefore, various rendering parameters need to be acquired, and an attribute value of an attribute type of the corresponding performance data is generated according to the various rendering parameters.
In step S13, the attribute values of the attribute types of the performance data are derived to the web-side performance monitoring interface of the browser based on the interface description language file, and a script is called to obtain the attribute values of the attribute types of the performance data from the web-side performance monitoring interface.
In an embodiment of the present disclosure, the interface description language is a computer language used to describe the software component interface. The interface description language describes the interface in a neutral manner so that objects running on different platforms and programs written in different languages can communicate with each other. The interface description language file may serve as a bridge between the kernel of the browser (e.g., written in the C + + language) and the scripting environment (e.g., JavaScript environment). Because the web page performance monitoring interface is located in the script environment, the attribute value of the attribute type of the performance data can be derived to the web page performance monitoring interface based on the interface description language file, and then the JavaScript script is called to obtain the attribute value of the attribute type of the performance data from the web page performance monitoring interface, namely to obtain the performance data of the target web page.
The data acquisition scheme provided by the embodiment of the disclosure can be applied to a browser, and the attribute type of the performance data is set in an interface description language file of a performance timing interface of a kernel of the browser. And loading the target webpage by using the browser, acquiring rendering parameters of the webpage data after rendering of the webpage data of the target webpage is finished, and generating attribute values of the attribute types of the performance data according to the rendering parameters. And then, exporting the attribute value of the attribute type of the performance data to a webpage end performance monitoring interface of the browser based on the interface description language file, and calling a script to acquire the attribute value of the attribute type of the performance data from the webpage end performance monitoring interface.
When the attribute values of the attribute types of the performance data of the web pages are obtained, the embodiment of the disclosure does not need to manually mark the web page data and monitor loading events, reduces the requirements on the professional skills of technicians, does not influence the performance of the web pages, and can be applied to all the web pages. According to the method and the device, the browser kernel is modified, namely the attribute type of the performance data is set for the interface description language file of the performance timing interface of the browser kernel, the webpage data of the target webpage are loaded through the browser, then the attribute value of the attribute type of the performance data is exported to the webpage end performance monitoring interface of the script environment of the browser based on the characteristic that the interface description language file serves as a bridge between the browser kernel and the script environment, and then the script is called to obtain the attribute value of the attribute type of the performance data from the webpage end performance monitoring interface, so that the automatic obtaining of the attribute value of the attribute type of the performance data of the webpage is achieved. Moreover, a developer tool of a browser is not needed, the webpage cannot be reloaded, and the acquisition efficiency of the performance data is improved.
In an exemplary embodiment of the present disclosure, in the execution process of the step S11, when the rendering parameter of the web page data of the target web page is obtained, after each frame of data of the web page data is rendered, a preset rendering notification method may be called to obtain the rendering parameter of each frame of data, and then the rendering parameter is transmitted to the performance timing interface.
In practical applications, the kernel of the browser may adopt open-source chrome (an open-source browser engine), and the rendering engine adopted by the chrome is blink (a browser typesetting engine). As shown in fig. 2, after each rendering frame of the rendering engine (i.e., rendering each frame of data) is finished, a NotifyPaint method (an obtaining method of a rendering notification) of a PaintTiming interface (an application program interface for a user to obtain rendering time information) may be called to obtain a rendering parameter of each frame of data. The rendering parameter may be a parameter of the NotifyPaint method, such as whether rendering is first time (is first paint), whether text content (text paint) is rendered, and whether picture (image paint) is rendered. That is, the rendering parameters may include one or more of first-time rendering parameters, text rendering parameters, and picture rendering parameters. The first rendering parameter is whether the first rendering is performed, the character rendering parameter is whether the character content is rendered, and the picture rendering parameter is whether the picture is rendered.
The process of loading the web page data of the target web page by the browser is a changed process. In this process, the browser renders each frame of data in the web page data. When the rendering parameters are obtained, the embodiment of the disclosure may obtain the rendering parameters of each frame of data by using a NotifyPaint method, so as to ensure that the rendering parameters corresponding to each frame of data can be obtained after each frame of data is rendered. That is, the acquired rendering parameters are in units of each frame data. In the process of loading the webpage data of the target webpage by the browser, the plurality of rendering parameters can be acquired, and the acquired plurality of rendering parameters are transmitted to the performance timing interface, so that a data basis is provided for the performance timing interface to generate the attribute value of the attribute type of the performance data. The method and the device avoid the condition that the rendering parameters are obtained after all webpage data are rendered, and improve the accuracy of the rendering parameters.
In an exemplary embodiment of the present disclosure, the attribute type of the performance data may include one or more of a first rendering time, a first content rendering time, and a first effective rendering time. And the first drawing time represents a current time point corresponding to the rendering completion of the first pixel in the target webpage. The first content drawing time refers to a time point at which an arbitrary Object in a Document Object Model (DOM) of a target web page is drawn for the first time. The first effective drawing time refers to a current time point corresponding to the completion of drawing the main object in the target webpage, and the main object can be understood as a main body part in the target webpage, such as a video object in a video webpage and a picture object in a picture webpage.
In practical application, when the attribute value of the attribute type of the performance data is generated according to the rendering parameter, the attribute value of the first rendering time may be generated according to the first rendering parameter, the first rendering time, and the current time point. Namely, when the parameter value of the first rendering parameter belongs to the preset first parameter threshold and the attribute value of the first rendering time is null, the current time point after rendering of a frame of data corresponding to the first rendering parameter is finished is taken as the attribute value of the first rendering time. For example, when a parameter value of a first rendering parameter of a certain frame data is "true" (true is a preset first parameter threshold), and an attribute value of a first rendering time is null, a current time point after the rendering of the certain frame data is ended may be recorded as the attribute value of the first rendering time, and the attribute value of the first rendering time may be stored into a variable of the first rendering time. According to the embodiment of the disclosure, the first rendering parameter in the rendering parameters is combined with the first drawing time in the attribute type of the performance data, and when the first rendering parameter of a certain frame of data and the first drawing time meet certain conditions (for example, the parameter value of the first rendering parameter is true, and the attribute value of the first drawing time is null), the current time point after the rendering of the frame of data is finished is taken as the attribute value of the first drawing time, so that the generation of the attribute value of the first drawing time by using the first rendering parameter, the first drawing time and the time point is realized, a loading event does not need to be monitored, a mark does not need to be manually added to a main object, a developer tool of a browser does not need to be manually started, the loading rate of a target webpage is increased, and the attribute value of the first drawing time of any target webpage can be quickly obtained.
In practical application, when the attribute value of the attribute type of the performance data is generated according to the rendering parameter, the attribute value of the first content rendering time may also be generated according to the text rendering parameter, the first content rendering time, and the current time point. Namely, when the parameter value of the text rendering parameter belongs to the preset second parameter threshold and the attribute value of the first content rendering time is null, the current time point after rendering of a frame of data corresponding to the text rendering parameter is finished is taken as the attribute value of the first content rendering time. For example, when a parameter value of a text rendering parameter of a certain frame of data is "true" (true is a preset second parameter threshold, in an actual application scenario, the first parameter threshold and the second parameter threshold may be the same or different), and an attribute value of a first content rendering time is null, a current time point after rendering of the certain frame of data is finished may be recorded as the attribute value of the first content rendering time, and the attribute value of the first content rendering time may be stored in a variable of the first content rendering time. Embodiments of the present disclosure combine text rendering parameters in the rendering parameters with first content rendering time in the attribute type of the performance data, when the text rendering parameter of a certain frame data and the first content rendering time satisfy a certain condition (e.g. the parameter value of the text rendering parameter is true, and the attribute value of the first content rendering time is null), the current time point after the rendering of the frame data is finished is used as the attribute value of the first content rendering time, the attribute value of the first content rendering time is generated by using the character rendering parameters, the first content rendering time and the time point, a loading event does not need to be monitored, a mark does not need to be manually added to a main object, a developer tool of a browser does not need to be manually started, the loading rate of a target webpage is increased, and the attribute value of the first content rendering time of any target webpage can be quickly acquired.
In practical application, when the attribute value of the attribute type of the performance data is generated according to the rendering parameter, the attribute value of the first effective rendering time can be generated according to the text rendering parameter and/or the picture rendering parameter, the height of the target webpage, the screen height of the terminal where the browser is located, and the current time point after rendering of one frame of data corresponding to the text rendering parameter and/or the picture rendering parameter is finished, and the attribute value of the first effective rendering time is stored in the variable of the first effective rendering time.
When generating the attribute value of the first effective rendering time, it may be determined whether a current time point after rendering of each frame data is the attribute value of the first effective rendering time. That is, the determination operation of the first effective drawing time may be performed once after each frame data is rendered. Taking the example that a certain frame of data is rendered, in the above determining operation process, first, the number of the web page objects of which the web page layout of the target web page is changed may be obtained according to the text rendering parameter and/or the picture rendering parameter of the certain frame of data. The web page object can be understood as a text object, a video object, a picture object, etc. in the target web page. For example, the number of web page objects acquired. The larger the number is, the larger the change of the webpage layout of the target webpage is, the more the operation process for rendering the frame data is represented; the smaller the number, the less the web page layout changes to the target web page representing the rendering operation of the frame of data. Then, a ratio of the height of the target web page to the screen height is generated. It should be noted that the height of the target web page may be the height of the target web page in the full screen display state. Then, the ratio is compared with a preset value, namely whether the ratio is larger or the preset value is larger is judged, and a larger value of the ratio and the preset value is obtained. Finally, the above number is divided by the above larger value to obtain a ratio (hereinafter referred to as an attribute ratio) of attribute values for determining whether the current time point is the first effective rendering time after the rendering of the frame data is finished. Similarly, whether the current time point after the rendering of the next frame data is finished is the attribute value of the first effective rendering time is judged, and the attribute ratio of the next frame data after the rendering is finished is obtained. As the browser loads the target web page, after the main web page object of the target web page is loaded, the web page layout of the target web page may also be changed, so that the number may gradually increase, and meanwhile, the ratio of the height of the target web page to the height of the screen may also increase, but the attribute ratio may gradually decrease. In summary, after obtaining the plurality of attribute ratios, the current time point when the attribute ratio is the maximum value is taken as the attribute value of the first effective rendering time. That is, the current time point when the attribute ratio is the maximum value is the current time point corresponding to the completion of loading the main web page object of the target web page. As shown in fig. 3, a diagram showing the change of the attribute value with time of the first effective rendering time is shown. In fig. 3, the abscissa represents the current time point when the browser renders each frame of data, the ordinate represents the number of web page objects loaded by the browser, and the irregular line is a variation curve of the attribute ratio after each frame of data is rendered, as can be seen from fig. 3, 6.047s is the attribute value of the first effective rendering time.
According to the embodiment of the disclosure, after each frame of data is rendered, the number of the webpage objects for changing the webpage layout, the height of the target webpage, the screen height and the like are used for calculating to obtain the attribute ratio, and the current time point when the attribute ratio is the maximum value is used as the attribute value of the first effective rendering time, so that the attribute value of the first effective rendering time is automatically generated by using the character rendering parameter and/or the picture rendering parameter, the height of the target webpage, the screen height and the time point, a loading event does not need to be monitored, a mark does not need to be manually added to a main object, a developer tool of a browser does not need to be manually opened, the loading rate of the target webpage is increased, and the attribute value of the first effective rendering time of any target webpage can be rapidly obtained.
In an exemplary embodiment of the present disclosure, if a text object and/or a picture object is included in a web page object of a target web page, an attribute value of a first effective drawing time needs to be determined after the text object and/or the picture object are loaded. That is, after the text object and/or the picture object in the target webpage are loaded, the current time point when the attribute ratio is the maximum value is used as the attribute value of the first effective rendering time. According to the embodiment of the disclosure, when the text object and/or the image object are not the main object of the target webpage, after the text object and/or the image object are loaded, the attribute value of the first effective drawing time is recorded, so that the recorded attribute value of the first effective drawing time is avoided under the condition that the text object and/or the image object cannot be loaded on the target webpage, the adaptation degree of the attribute value of the first effective drawing time is expanded, and the attribute value of the first effective drawing time is more in line with the actual loading condition of the target webpage.
According to the embodiment of the disclosure, the kernel can be compiled into a new browser again, any webpage can be loaded by using the new browser, and then performance data of any webpage is obtained, the webpage to be loaded does not need to be modified, marked and the like, so that the workload of detecting the performance of the webpage in batches is reduced, and the application range of webpage performance detection is expanded.
Fig. 4 is a block diagram illustrating an apparatus for acquiring data according to an exemplary embodiment. The device is installed in a browser, an attribute type of performance data is set in an interface description language file of a performance timing interface of a kernel of the browser, and the device specifically comprises the following modules.
An obtaining module 41 configured to obtain rendering parameters of web page data of a target web page;
a generating module 42 configured to generate an attribute value of an attribute type of the performance data according to the rendering parameter;
and the exporting module 43 is configured to export the attribute value of the attribute type of the performance data to the web page end performance monitoring interface of the browser based on the interface description language file, and call a script to obtain the attribute value of the attribute type of the performance data from the web page end performance monitoring interface.
In an exemplary embodiment of the disclosure, the obtaining module 41 is configured to call a preset rendering notification method to obtain the rendering parameter of each frame of data after the rendering of each frame of data of the webpage data is finished.
In an exemplary embodiment of the present disclosure, the apparatus further includes:
a transmission module configured to transmit the rendering parameter to the performance timing interface after the obtaining module 41 calls a preset rendering notification method to obtain the rendering parameter of each frame of data.
In an exemplary embodiment of the present disclosure, the rendering parameters include one or more of first-time rendering parameters, text rendering parameters, and picture rendering parameters; the attribute type of the performance data comprises one or more of first drawing time, first content drawing time and first effective drawing time;
the generating module 42 is configured to, when a parameter value of the first rendering parameter belongs to a preset first parameter threshold and an attribute value of the first rendering time is null, take a current time point after rendering of frame data corresponding to the first rendering parameter is finished as the attribute value of the first rendering time.
In an exemplary embodiment of the disclosure, the generating module 42 is further configured to, when a parameter value of the text rendering parameter belongs to a preset second parameter threshold and an attribute value of the first content rendering time is null, take a current time point after rendering of a frame of data corresponding to the text rendering parameter is finished as the attribute value of the first content rendering time.
In an exemplary embodiment of the disclosure, the generating module 42 is further configured to generate the attribute value of the first effective drawing time according to the text rendering parameter and/or the picture rendering parameter, and the height of the target webpage, the screen height of the terminal where the browser is located, and the current time point after rendering of a frame of data corresponding to the text rendering parameter and/or the picture rendering parameter is completed.
In an exemplary embodiment of the present disclosure, the generating module 42 includes:
a quantity obtaining module configured to obtain the quantity of the web page objects of which the web page layout of the target web page is changed according to the text rendering parameters and/or the picture rendering parameters;
a ratio generation module configured to generate a ratio of a height of the target web page to the screen height;
a ratio comparison module configured to compare the ratio with a preset value to obtain a larger value of the ratio and the preset value, wherein the larger value is the ratio or the preset value;
and the time recording module is configured to take the ratio of the number to the larger value as the attribute value of the first effective drawing time, wherein the current time point when the ratio is the maximum value.
In an exemplary embodiment of the disclosure, the time recording module is configured to, after loading of the text object and/or the picture object in the target webpage is completed, take a current time point when a ratio of the number to the larger value is a maximum value as an attribute value of the first effective rendering time.
With regard to the apparatus in the above-described embodiment, the specific manner in which each module performs the operation has been described in detail in the embodiment related to the method, and will not be elaborated here.
FIG. 5 is a block diagram illustrating one type of data acquisition electronics 500 in accordance with an exemplary embodiment. For example, the electronic device 500 may be a mobile phone, a computer, a digital broadcast terminal, a messaging device, a game console, a tablet device, a medical device, an exercise device, a personal digital assistant, and the like.
Referring to fig. 5, electronic device 500 may include 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 a communication component 516.
The processing component 502 generally controls 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 may include one or more processors 520 to execute instructions to perform all or a portion of the steps of the data acquisition method described above. Further, the processing component 502 can include one or more modules that facilitate interaction between the processing component 502 and other components. For example, the processing component 502 can include a multimedia module to facilitate interaction between the multimedia component 508 and the processing component 502.
The memory 504 is configured to store various types of data to support operations at the electronic device 500. Examples of such data include instructions for any application or method operating on the electronic device 500, contact data, phonebook data, messages, images, videos, and so forth. The memory 504 may be implemented by any type or combination of volatile or non-volatile memory devices 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 disks.
The power supply component 506 provides power to the various components of the electronic device 500. The power components 506 may include a power management system, one or more power sources, and other components associated with generating, managing, and distributing power for the electronic device 500.
The multimedia component 508 includes a screen that provides an output interface between the electronic device 500 and a user. In some embodiments, the screen may include a Liquid Crystal Display (LCD) and a Touch Panel (TP). If the screen includes a touch panel, the screen may be implemented as a touch screen to receive an input signal from a user. The touch panel includes one or more touch sensors to sense touch, slide, and gestures on the touch panel. The touch sensor may not only sense the boundary of a touch or slide action, but also detect the duration and pressure associated with the touch or slide operation. In some embodiments, the multimedia component 508 includes a front facing camera and/or a rear facing camera. The front camera and/or the rear camera may receive external multimedia data when the electronic device 500 is in an operating mode, such as a shooting mode or a video mode. Each front camera and rear camera may be a fixed optical lens system or have a focal length and optical zoom capability.
The audio component 510 is configured to output and/or input audio signals. For example, the audio component 510 includes a Microphone (MIC) configured to receive external audio signals when the electronic device 500 is in an operational mode, such as a call mode, a recording mode, and a voice recognition mode. The received audio signals may further be stored in the memory 504 or transmitted via the communication component 516. In some embodiments, audio component 510 further includes a speaker for outputting audio signals.
The I/O interface 512 provides an interface between the processing component 502 and peripheral interface modules, which may be keyboards, click wheels, buttons, etc. These buttons may include, but are not limited to: a home button, a volume button, a start button, and a lock button.
The sensor assembly 514 includes one or more sensors for providing various aspects of status assessment for the electronic device 500. For example, the sensor assembly 514 may detect an open/closed state of the electronic device 500, the relative positioning of components, such as a display and keypad of the electronic device 500, the sensor assembly 514 may detect a change in the position of the electronic device 500 or a component of the electronic device 500, the presence or absence of user contact with the electronic device 500, orientation or acceleration/deceleration of the electronic device 500, and a change in the temperature of the electronic device 500. The sensor assembly 514 may include a proximity sensor configured to detect the presence of a nearby object without any physical contact. The sensor assembly 514 may also include a light sensor, such as a CMOS or CCD image sensor, for use in imaging applications. In some embodiments, the sensor assembly 514 may also include an acceleration sensor, a gyroscope sensor, a magnetic sensor, a pressure sensor, or a temperature sensor.
The communication component 516 is configured to facilitate wired or wireless communication between the electronic device 500 and other devices. The electronic device 500 may access a wireless network based on a communication standard, such as WiFi, a carrier network (such as 2G, 3G, 4G, or 5G), or a combination thereof. In an exemplary embodiment, the communication component 516 receives a broadcast signal or broadcast related information from an external broadcast management system via a broadcast channel. In an exemplary embodiment, the communication component 516 further includes a Near Field Communication (NFC) module to facilitate short-range communications. For example, 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.
In an exemplary embodiment, the electronic device 500 may be implemented by one or more Application Specific Integrated Circuits (ASICs), Digital Signal Processors (DSPs), Digital Signal Processing Devices (DSPDs), Programmable Logic Devices (PLDs), Field Programmable Gate Arrays (FPGAs), controllers, micro-controllers, microprocessors or other electronic components for performing the above-described data acquisition methods.
In an exemplary embodiment, a storage medium comprising instructions, such as the memory 504 comprising instructions, executable by the processor 520 of the electronic device 500 to perform the above-described data acquisition method is also provided. Alternatively, the storage medium may be a non-transitory computer readable storage medium, which may be, for example, a ROM, a Random Access Memory (RAM), a CD-ROM, a magnetic tape, a floppy disk, an optical data storage device, and the like.
In an exemplary embodiment, a computer program product is also provided, which comprises readable program code executable by the processor 520 of the electronic device 500 to perform the above-mentioned data acquisition method. Alternatively, the program code may be stored in a storage medium of the electronic device 500, which may be a non-transitory computer-readable storage medium, for example, ROM, Random Access Memory (RAM), CD-ROM, magnetic tape, floppy disk, optical data storage device, and the like.
FIG. 6 is a block diagram illustrating an electronic device 600 for acquiring data in accordance with an example embodiment. For example, the electronic device 600 may be provided as a server. Referring to fig. 6, electronic device 600 includes a processing component 622 that further includes one or more processors, and memory resources, represented by memory 632, for storing instructions, such as applications, that are executable by processing component 622. The application programs stored in memory 632 may include one or more modules that each correspond to a set of instructions. Further, the processing component 622 is configured to execute instructions to perform the above-described data acquisition method.
The electronic device 600 may also include a power component 626 configured to perform power management for 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. The electronic device 600 may operate based on an operating system stored in the memory 632, such as Windows Server, Mac OS XTM, UnixTM, LinuxTM, FreeBSDTM, or the like.
Other embodiments of the disclosure will be apparent to those skilled in the art from consideration of the specification and practice of the disclosure disclosed herein. This application is intended to cover any variations, uses, or adaptations of the disclosure following, in general, the principles of the disclosure and including such departures from the present disclosure as come within known or customary practice within the art to which the disclosure pertains. It is intended that the specification and examples be considered as exemplary only, with a true scope and spirit of the disclosure being indicated by the following claims.
It will be understood that the present disclosure is not limited to the precise arrangements described above and shown in the drawings and that various modifications and changes may be made without departing from the scope thereof. The scope of the present disclosure is limited only by the appended claims.

Claims (10)

1. The method for acquiring the data is applied to a browser, and the attribute type of the performance data is set in an interface description language file of a performance timing interface of a kernel of the browser, and the method comprises the following steps:
acquiring rendering parameters of webpage data of a target webpage;
generating an attribute value of the attribute type of the performance data according to the rendering parameter;
and exporting the attribute value of the attribute type of the performance data to a webpage end performance monitoring interface of the browser based on the interface description language file, and calling a script to acquire the attribute value of the attribute type of the performance data from the webpage end performance monitoring interface.
2. The method of claim 1, wherein the obtaining rendering parameters of the web page data of the target web page comprises:
and calling a preset rendering notification method to acquire a rendering parameter of each frame of data after each frame of data of the webpage data is rendered.
3. The method according to claim 2, wherein after the calling the preset rendering notification method to obtain the rendering parameters of each frame of data, the method further comprises:
transmitting the rendering parameters to the performance timing interface.
4. The method of claim 1, wherein the rendering parameters include one or more of first-time rendering parameters, text rendering parameters, and picture rendering parameters; the attribute type of the performance data comprises one or more of first drawing time, first content drawing time and first effective drawing time;
the generating an attribute value of an attribute type of the performance data according to the rendering parameter includes:
and when the parameter value of the first rendering parameter belongs to a preset first parameter threshold value and the attribute value of the first rendering time is null, taking the current time point after rendering of frame data corresponding to the first rendering parameter is finished as the attribute value of the first rendering time.
5. The method of claim 4, wherein generating attribute values for attribute types of the performance data according to the rendering parameters further comprises:
and when the parameter value of the character rendering parameter belongs to a preset second parameter threshold value and the attribute value of the first content rendering time is null, taking the current time point after rendering of frame data corresponding to the character rendering parameter is finished as the attribute value of the first content rendering time.
6. The method of claim 4, wherein generating attribute values for attribute types of the performance data according to the rendering parameters further comprises:
and generating an attribute value of the first effective drawing time according to the character rendering parameter and/or the picture rendering parameter, the height of the target webpage, the screen height of the terminal where the browser is located, and the current time point after rendering of a frame of data corresponding to the character rendering parameter and/or the picture rendering parameter is finished.
7. The device for acquiring data is characterized in that the device is installed in a browser, and attribute types of performance data are set in an interface description language file of a performance timing interface of a kernel of the browser, and the device comprises:
the system comprises an acquisition module, a display module and a display module, wherein the acquisition module is configured to acquire rendering parameters of webpage data of a target webpage;
a generation module configured to generate an attribute value of an attribute type of the performance data according to the rendering parameter;
and the export module is configured to export the attribute value of the attribute type of the performance data to a webpage end performance monitoring interface of the browser based on the interface description language file, and call a script to acquire the attribute value of the attribute type of the performance data from the webpage end performance monitoring interface.
8. An electronic device, comprising:
a processor;
a memory for storing the processor-executable instructions;
wherein the processor is configured to execute the instructions to implement the method of acquiring data of any one of claims 1 to 6.
9. A storage medium, characterized in that instructions in the storage medium, when executed by a processor of an electronic device, enable the electronic device to perform a method of acquiring data according to any one of claims 1 to 6.
10. A computer program product comprising readable program code executable by a processor of an electronic device to perform the method of acquiring data according to any one of claims 1 to 6.
CN202011522734.8A 2020-12-21 2020-12-21 Data acquisition method and device, electronic equipment and storage medium Pending CN112685269A (en)

Priority Applications (2)

Application Number Priority Date Filing Date Title
CN202011522734.8A CN112685269A (en) 2020-12-21 2020-12-21 Data acquisition method and device, electronic equipment and storage medium
PCT/CN2021/128390 WO2022134875A1 (en) 2020-12-21 2021-11-03 Data acquisition method and electronic device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202011522734.8A CN112685269A (en) 2020-12-21 2020-12-21 Data acquisition method and device, electronic equipment and storage medium

Publications (1)

Publication Number Publication Date
CN112685269A true CN112685269A (en) 2021-04-20

Family

ID=75450139

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202011522734.8A Pending CN112685269A (en) 2020-12-21 2020-12-21 Data acquisition method and device, electronic equipment and storage medium

Country Status (2)

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

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113177176A (en) * 2021-05-21 2021-07-27 脸萌有限公司 Feature construction method, content display method and related device
WO2022134875A1 (en) * 2020-12-21 2022-06-30 北京达佳互联信息技术有限公司 Data acquisition method and electronic device

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN108205487A (en) * 2016-12-20 2018-06-26 广州市动景计算机科技有限公司 A kind of method, apparatus and user terminal for monitoring browser performance
CN108536594A (en) * 2018-04-02 2018-09-14 腾讯科技(武汉)有限公司 Page test method, device and storage device
US20200104232A1 (en) * 2018-09-28 2020-04-02 Ebay Inc. Automated Determination of Web Page Rendering Performance
CN111290912A (en) * 2020-01-22 2020-06-16 北京百度网讯科技有限公司 Single-page application performance monitoring method and device and electronic equipment

Family Cites Families (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104881273B (en) * 2014-02-27 2019-03-15 腾讯科技(深圳)有限公司 A kind of analysis method and terminal device of webpage rendering
US11210198B2 (en) * 2019-01-30 2021-12-28 Salesforce.Com, Inc Distributed web page performance monitoring methods and systems
CN110162451B (en) * 2019-04-22 2022-03-25 腾讯科技(深圳)有限公司 Performance analysis method, performance analysis device, server and storage medium
CN112685269A (en) * 2020-12-21 2021-04-20 北京达佳互联信息技术有限公司 Data acquisition method and device, electronic equipment and storage medium

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN108205487A (en) * 2016-12-20 2018-06-26 广州市动景计算机科技有限公司 A kind of method, apparatus and user terminal for monitoring browser performance
CN108536594A (en) * 2018-04-02 2018-09-14 腾讯科技(武汉)有限公司 Page test method, device and storage device
US20200104232A1 (en) * 2018-09-28 2020-04-02 Ebay Inc. Automated Determination of Web Page Rendering Performance
CN111290912A (en) * 2020-01-22 2020-06-16 北京百度网讯科技有限公司 Single-page application performance monitoring method and device and electronic equipment

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2022134875A1 (en) * 2020-12-21 2022-06-30 北京达佳互联信息技术有限公司 Data acquisition method and electronic device
CN113177176A (en) * 2021-05-21 2021-07-27 脸萌有限公司 Feature construction method, content display method and related device

Also Published As

Publication number Publication date
WO2022134875A1 (en) 2022-06-30

Similar Documents

Publication Publication Date Title
CN107329743B (en) Application page display method and device and storage medium
CN106547547B (en) data acquisition method and device
CN106851695B (en) Method, device and system for testing network speed
CN105808305B (en) Static resource loading method and device
CN107659717B (en) State detection method, device and storage medium
CN110502444B (en) Testing method and testing device for image processing algorithm
CN107220059B (en) Application interface display method and device
WO2022134875A1 (en) Data acquisition method and electronic device
CN112433724A (en) Target component style generation method and device, electronic equipment and storage medium
CN112559309B (en) Page performance acquisition algorithm adjusting method and device
CN107402756B (en) Method, device and terminal for drawing page
CN111596980B (en) Information processing method and device
CN111079040B (en) Resource sniffing method, device, terminal, server and storage medium
CN112256563A (en) Android application stability testing method and device, electronic equipment and storage medium
CN112433787A (en) Target object serialization method and device, electronic device and storage medium
CN109491655B (en) Input event processing method and device
CN114896165A (en) Testing method and device of conversation robot system, electronic equipment and storage medium
CN111667827B (en) Voice control method and device for application program and storage medium
CN116347060A (en) Camera performance evaluation method, device, readable storage medium and system
CN113467854A (en) Application program starting method and device, electronic equipment and storage medium
CN112631695A (en) Data verification method and device, electronic equipment and storage medium
CN111061633A (en) Method, device, terminal and medium for detecting first screen time of webpage
CN113473233B (en) Log splicing method and device, electronic equipment, storage medium and product
CN113138036B (en) Temperature detection method and device and electronic equipment
CN113835797B (en) Display method and device for aggregated page information, electronic equipment and storage medium

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination