WO2019085598A1 - 计算页面首屏渲染时长的方法、装置及电子设备 - Google Patents

计算页面首屏渲染时长的方法、装置及电子设备 Download PDF

Info

Publication number
WO2019085598A1
WO2019085598A1 PCT/CN2018/101541 CN2018101541W WO2019085598A1 WO 2019085598 A1 WO2019085598 A1 WO 2019085598A1 CN 2018101541 W CN2018101541 W CN 2018101541W WO 2019085598 A1 WO2019085598 A1 WO 2019085598A1
Authority
WO
WIPO (PCT)
Prior art keywords
screen
page
sampling points
rendering
pixel values
Prior art date
Application number
PCT/CN2018/101541
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 WO2019085598A1 publication Critical patent/WO2019085598A1/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
    • G06F11/3466Performance evaluation by tracing or monitoring
    • G06F11/349Performance evaluation by tracing or monitoring for interfaces, buses
    • 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

Definitions

  • the present specification relates to the field of page processing technologies, and in particular, to a method, a device, and an electronic device for calculating a rendering time of a first screen of a page.
  • the page When using an electronic device, the page is often browsed, such as a browser accessing a web page, a local native page displayed in a client, a client accessing an HTML5 page, and the like.
  • the implementation of these pages is different, but from the time of opening to the final display to the device screen, the basic process is: the browser or client reads the page code and gets the page resources, and renders some or all of the pages according to the page resources. On the device screen.
  • the page content may be more, and the size of the device screen is limited.
  • the device screen may only display part of the page.
  • the screen that can be seen by the user without scrolling the page is called the first screen.
  • the first screen rendering time of the first screen is finally displayed, which may be affected by various factors such as page code, server response speed, server processing power or database performance. Therefore, the first screen rendering time of different pages may be different, and the length of the first screen rendering time will affect the user experience.
  • the developer needs to determine the first screen rendering time of the page for page optimization.
  • the present specification provides a method, a device, and an electronic device for calculating a rendering time of a first screen of a page.
  • a method of calculating the duration of a page's first screen rendering including:
  • the pixel value of the sampling point is acquired multiple times according to a preset time interval
  • the first screen rendering duration of the page to be tested is calculated according to the number of times the pixel value of the sampling point is acquired and the time interval.
  • the setting is distributed on multiple sampling points on the screen of the device, including:
  • the device screen is divided into a plurality of sub-areas, and one or more sampling points distributed in the plurality of sub-areas are set.
  • the plurality of sampling points are randomly distributed or uniformly distributed.
  • the multiple sampling points are distributed on the device screen for displaying a display area of the page to be tested.
  • the display area is an area on the device screen other than the navigation bar and the view switching bar.
  • the method includes:
  • the sampling points obtained by successive N times of different pixel values are deleted, and the N is a first preset integer.
  • the acquiring, by the preset time interval, the pixel values of each of the sampling points including:
  • the pixel value of the sampling point is stopped, and the M is a second preset integer.
  • the step of acquiring the pixel values of each of the sampling points multiple times according to the preset time interval is re-executed.
  • the determining whether the device screen completes the first screen rendering comprises:
  • the calculating the first screen rendering duration of the page to be tested according to the number of times the pixel value of the sampling point is acquired and the time interval including:
  • a device for calculating the duration of a first screen rendering of a page including:
  • a setting module configured to: set a plurality of sampling points distributed on a screen of the device;
  • the obtaining module is configured to: after the page to be tested starts loading, acquire the pixel value of the sampling point multiple times according to a preset time interval;
  • a judging module configured to: determine, according to whether the pixel values acquired by the sampling point are the same, for a plurality of the sampling points, whether the screen of the device completes the first screen rendering;
  • the calculation module is configured to: after determining that the device screen completes the first screen rendering, calculate a first screen rendering duration of the page to be tested according to the number of times the pixel value of the sampling point is acquired and the time interval.
  • the setting module is further configured to:
  • the device screen is divided into a plurality of sub-areas, and one or more sampling points distributed in the plurality of sub-areas are set.
  • the plurality of sampling points are randomly distributed or uniformly distributed.
  • the multiple sampling points are distributed on the device screen for displaying a display area of the page to be tested.
  • the display area is an area on the device screen other than the navigation bar and the view switching bar.
  • the determining module is further configured to:
  • the sampling points that are different in pixel values obtained for consecutive N times are deleted, and the N is a first preset integer.
  • the obtaining module is further configured to:
  • the pixel value of the sampling point is stopped, and the M is a second preset integer.
  • the obtaining module is further configured to:
  • the step of acquiring the pixel values of each of the sampling points multiple times according to the preset time interval is re-executed.
  • the determining module is further configured to: after all the sampling points stop acquiring the pixel values, determine to determine that the device screen completes the first screen rendering.
  • the calculating module is further configured to:
  • An electronic device comprising:
  • a memory for storing processor executable instructions
  • processor is configured to:
  • the pixel value of the sampling point is acquired multiple times according to a preset time interval
  • the first screen rendering duration of the page to be tested is calculated according to the number of times the pixel value of the sampling point is acquired and the time interval.
  • the embodiments of the present specification can be applied to different types of pages developed by various programming languages.
  • the probability that all sampling points are in the animation or in the background color can be reduced, and it is ensured that some sampling points can be in the content area of the page; whether the pixel values obtained by multiple times are the same, Determining whether the device screen completes the first screen rendering can effectively identify the sampling point in the animation or in the background color, thereby improving the accuracy of the first screen rendering duration.
  • FIG. 1 is a schematic diagram of a page according to an exemplary embodiment of the present specification.
  • FIG. 2A is a schematic flow chart of calculating a first screen rendering duration of a page according to an exemplary embodiment of the present disclosure.
  • FIG. 2B is a schematic diagram of setting a sampling point according to an exemplary embodiment of the present specification.
  • FIG. 2C is a schematic flow chart of another calculation time period of a first screen of a page according to an exemplary embodiment of the present disclosure.
  • FIG. 3 is a hardware structural diagram of an electronic device in which a device for calculating a first screen rendering duration of a page is displayed according to an exemplary embodiment of the present disclosure.
  • FIG. 4 is a block diagram of an apparatus for calculating a page first screen rendering duration according to an exemplary embodiment of the present disclosure.
  • first, second, third, etc. may be used in this specification to describe various information, such information should not be limited to these terms. These terms are only used to distinguish the same type of information from each other.
  • first information may also be referred to as the second information without departing from the scope of the present description.
  • second information may also be referred to as the first information.
  • word "if” as used herein may be interpreted as "when” or “when” or “in response to a determination.”
  • the page in the embodiment of the present specification may include a web page opened by a browser, a local Native page opened by a client, an HTML5 page opened by a client, and the like, which may be displayed on an electronic device screen.
  • FIG. 1 it is a schematic diagram of a page shown in the embodiment of the present description.
  • the left side of FIG. 1 shows a complete page, and the right dotted line frame in FIG. 1 is an area on the electronic device screen for displaying a page. Due to the limited screen size of the electronic device, the size of the area on the screen used to display the page may be smaller than the page size.
  • the electronic device After the page is started, the electronic device reads the page code, obtains the page resource, and renders the page based on the page resource, so that the page content is displayed in the page display area set on the screen, that is, the right dotted frame in FIG.
  • the content of the present specification is referred to as the first screen, that is, the page area that can be displayed by the user on the screen of the electronic device without scrolling after the page is started.
  • the length of time from the start of the page to the completion of the first screen rendering on the electronic device screen is referred to as the first screen rendering duration.
  • the first screen rendering time is an important indicator for evaluating the performance of the page.
  • the developer can determine the first screen rendering time of the page to optimize the page based on the first screen rendering time.
  • the embodiment of the present disclosure provides a solution for calculating the duration of the first screen rendering of the page.
  • the solution sets a plurality of sampling points distributed on the screen of the device, and after the page to be tested starts loading, multiple times are acquired according to the preset time interval. The pixel value of the sample point. Then, according to whether the pixel values acquired multiple times according to the sampling point are the same, it is determined whether the device screen completes the first screen rendering, and then calculates the first screen rendering duration.
  • the embodiment of the present specification determines whether the device screen completes the first screen rendering by setting a plurality of sampling points on the screen of the device and analyzing whether the pixel values of the sampling points acquired multiple times are the same. Therefore, the embodiments of the present specification can be applied to different types of pages developed by various programming languages.
  • the probability that all sampling points are in the animation or in the background color can be reduced, and it is ensured that some sampling points can be in the content area of the page; whether the pixel values obtained by multiple times are the same, Determining whether the device screen completes the first screen rendering can effectively identify the sampling point in the animation or in the background color, thereby improving the accuracy of the first screen rendering duration.
  • FIG. 2A it is a schematic flowchart of calculating a rendering time of a first screen of a page, which is applicable to an electronic device, and includes the following steps:
  • step 202 a plurality of sampling points distributed on a screen of the device are set;
  • step 204 after the page to be tested starts loading, the pixel value of the sampling point is acquired multiple times according to a preset time interval;
  • step 206 it is determined whether the device screen completes the first screen rendering according to whether the pixel values acquired multiple times according to the sampling point are the same for the plurality of sampling points;
  • step 208 after determining that the device screen completes the first screen rendering, the first screen rendering duration of the page to be tested is calculated according to the number of times the pixel value of the sampling point is acquired and the time interval.
  • the embodiments of the present specification can be applied to a scenario in which the rendering time of the first screen of the page needs to be calculated, wherein the electronic device can include a personal computer, a tablet computer, a smart phone, or a PDA (Personal Digital Assistant) or the like that can display the page.
  • the electronic device can apply the solution provided by the embodiment to calculate the first screen rendering duration of the page on the electronic device.
  • the number of the plurality of sampling points and the specific distribution manner may be flexibly set according to requirements, which is not limited in the embodiment of the present specification.
  • FIG. 2B a schematic diagram of setting sampling points is shown, including a case of random distribution, including a case of uniform distribution; and dividing the screen of the device into a plurality of sub-areas, setting a distribution In the case of one or more sampling points in the plurality of sub-regions, wherein the plurality of sub-regions may be randomly distributed or uniformly distributed.
  • a plurality of sampling points may be distributed on the device screen for displaying a display area of the page to be tested.
  • the display area may be determined according to actual device screen display requirements or page display requirements. For example, when some applications or pages are developed, the page display area may be preset. In this case, Determined by reading the page code.
  • the view switch bar may be set in the application where the page is located, and the navigation bar is also set on the device screen. Therefore, the display area may be an area on the device screen other than the navigation bar and the view switch bar.
  • the location of the navigation bar on the device screen can be determined by calling an interface provided by the operating system, and the view switching bar can be determined by the specific settings of the application where the page is located. In an actual application, it may be determined by using other methods in combination with a specific application scenario, which is not limited in this embodiment.
  • the user can start the page to be tested.
  • the pixel values of the sampling points can be obtained multiple times according to the preset time interval.
  • the preset time interval may be 50 ms or 100 ms, etc., and the actual application may be flexibly configured according to the accuracy requirement and the device performance.
  • the content of the page is characterized by diversity and complexity.
  • the page may include videos, dynamic pictures, or flash (interactive vector and web animation standards) animations, etc.
  • the characteristics of such pages are constantly changing. It is also possible to set the background color in the page.
  • the characteristics of this type of page content is that after the page starts loading, the background color is first rendered, and then the other page content is rendered on the background color.
  • the embodiment of the present specification can determine whether the device screen completes the first screen rendering according to whether the pixel values acquired by the sampling point are the same. It can be understood that the first screen rendering needs to be completed in a certain period of time, and the pixel values acquired multiple times may be different for sampling points in areas such as animations that are continuously changing dynamically. Therefore, in order to improve the accuracy of the data, the sampling points that are different in the pixel values obtained in the continuous N times in this embodiment can be regarded as sampling points in an area such as an animation that continuously changes dynamically, so such sampling can be ignored as needed. Click to remove such sample points.
  • the N is a preset integer, for example, a value of 3, 5, or 7, and can be flexibly set in an actual application, which is not limited in this embodiment.
  • the obtaining, by the preset time interval, the pixel values of each of the sampling points may include:
  • the pixel value of the sampling point is stopped, and the M is a second preset integer.
  • the page content corresponding to the sampling point can be considered to complete the first screen rendering, so the pixel value of the sampling point can be stopped.
  • the M is a preset integer, for example, a value of 3, 5, or 7, and can be flexibly set in an actual application, which is not limited in this embodiment.
  • the background color or background image may be rendered first, and then the other page content may be drawn based on the background color or the background image. Assuming that other page content resources are acquired for a long time, it may take some time from rendering the background color or background image to rendering other page content. At this time, it is possible that the sampling point of the background color or the background image is acquired multiple times. The pixel values are the same, so it is considered to have finished rendering. In order to solve the above problem, when all the sampling points stop acquiring the pixel values, it can be judged that the pixel values of all the sampling points are the same.
  • the sampling point can be regarded as being in the above background color or background image.
  • the step of acquiring the pixel values of each of the sampling points multiple times according to the preset time interval may be re-executed.
  • the device screen After the above process is completed, after all the sampling points stop acquiring the pixel values, it can be determined that the device screen completes the first screen rendering, and then the calculation of the first screen rendering duration is performed. Among them, the calculation of the first screen rendering duration, in some examples, may be based on the time between the moment the page starts loading and the moment when the pixel value is finally stopped.
  • the sampling point end is determined after the sampling points having the same pixel value acquired for consecutive M times are determined, in order to further improve the data accuracy, it may be determined that:
  • the product of the time interval of the M and the time interval of the first screen is determined according to the difference between the length of time from the start of loading of the page to be tested and the stop of acquiring the pixel value and the product. For example, the time between the time when the page starts loading and the time when the pixel value is finally stopped is acquired, and the product of the M and the time interval is subtracted, and the finally calculated data is used as the first screen rendering duration.
  • FIG. 2C is a schematic diagram of another method for calculating the first screen rendering duration of a page according to an exemplary embodiment of the present specification, including the following parts:
  • sampling point setting manner may be a random distribution setting or a uniform distribution setting; or the page is divided into different sub-areas, and sampling points are set in each sub-area.
  • the pixel value of that point can be taken.
  • a plurality of pixel values of each sampling point are acquired according to a preset time interval.
  • the current pixel value and the last acquired pixel value can be compared after each pixel value is acquired.
  • the embodiment sets a state for each sampling point, including three types: unknown, ignored, and completed.
  • Unknown state Initial state, the state of each sampling point is set to an unknown state.
  • Ignore state If the pixel value of the sample point is different from the previous one, a change is recorded. If a sample point has a cumulative change of N (for example, a value of 5 or more), it can be considered that the sample point may be in an area where the animation continues to change, and it is marked as ignored, which also means that the point is deleted, that is, after the calculation. This sampling point is not considered in the process.
  • N for example, a value of 5 or more
  • Completed state When a pixel has the same pixel value for M consecutive times (for example, a value of 5), the point can be marked as completed.
  • the rendering end can be basically considered, and the pixel value can be stopped. Since the page may display a background color first, wait for a period of time to obtain other page content resources, and continue to render other page content based on the background color. Therefore, the completed sampling points can be verified if the sampling points are based on the sampling points. The pixel value determines that all the sampling points are of the same color, and then the current picture has only the background color, and the rendering has not been completed. At this time, the state of these points is reset to unknown, and the step of acquiring the pixel value is continued. If the test does not consider it to be all background colors, then the rendering is considered complete.
  • the calculating process may be: determining a product of the M and the time interval, and determining the first screen according to a difference between a duration of the page to be tested and a stop acquiring pixel value and the product Rendering time.
  • the page may have a background color or the like. If only one point is set, it is likely to be on the background color. If the picking point is fixed, then for a certain page, there will be two situations, each time on the page content or each time in the background color, so data may not be available for some pages. If the position is randomly selected, the probability of selecting the content is: the pixel occupied by the content / the total pixel of the page, and the ratio may be less than 80%, so the result is not impressive.
  • the method of setting a plurality of sampling points can solve the problem well. If the content of a page is 60%, assuming 10 points are randomly selected, at least one of the ten points has a probability of adopting a point in the page content of 1–0.4 ⁇ 10>99.9%. This basically guarantees the validity of the data. In practical applications, the technician expects that as many sample points as possible can be in the page content area, and the page may be divided into several block renderings, so it is expected to cover all the blocks as much as possible, so the number of sampling points can be set more. This number can be flexibly adjusted according to the performance of the specific program or the distribution of the page content.
  • the continuously changing area such as animation interferes with the detection. Therefore, in the case where the multiple pixel values are found to be different, the sampling point can be ignored, thereby avoiding the point-to-point detection of the animation and the like. interference.
  • the present specification also provides an apparatus for calculating the rendering duration of the first screen of the page and an embodiment of the electronic device to which it is applied.
  • Embodiments of the apparatus for calculating the first screen rendering duration of the page may be applied to an electronic device.
  • the device embodiment may be implemented by software, or may be implemented by hardware or a combination of hardware and software.
  • the processor of the electronic device in which the computer is located reads the corresponding computer program instructions in the non-volatile memory into the memory. From the hardware level, as shown in FIG.
  • the electronic device in which the device 331 is located in the embodiment may further include other hardware according to the actual function of the electronic device, and details are not described herein again.
  • FIG. 4 is a block diagram of an apparatus for calculating a first screen rendering duration of a page according to an exemplary embodiment of the present specification, where the apparatus includes:
  • a setting module 41 configured to: set a plurality of sampling points distributed on a screen of the device;
  • the obtaining module 42 is configured to: after the page to be tested starts loading, acquire the pixel value of the sampling point multiple times according to a preset time interval;
  • the determining module 43 is configured to determine, according to whether the pixel values acquired multiple times by the sampling point are the same for the plurality of sampling points, determine whether the device screen completes the first screen rendering;
  • the calculation module 44 is configured to: after determining that the device screen completes the first screen rendering, calculate a first screen rendering duration of the page to be tested according to the number of times the pixel value of the sampling point is acquired and the time interval.
  • the setting module is further configured to:
  • the device screen is divided into a plurality of sub-areas, and one or more sampling points distributed in the plurality of sub-areas are set.
  • the plurality of sampling points are randomly distributed or uniformly distributed.
  • the multiple sampling points are distributed on the device screen for displaying a display area of the page to be tested.
  • the display area is an area on the device screen other than the navigation bar and the view switching bar.
  • the determining module is further configured to:
  • the sampling points that are different in pixel values obtained for consecutive N times are deleted, and the N is a first preset integer.
  • the obtaining module is further configured to:
  • the pixel value of the sampling point is stopped, and the M is a second preset integer.
  • the obtaining module is further configured to:
  • the step of acquiring the pixel values of each of the sampling points multiple times according to the preset time interval is re-executed.
  • the determining module is further configured to: after all the sampling points stop acquiring the pixel values, determine to determine that the device screen completes the first screen rendering.
  • the calculating module is further configured to:
  • an electronic device including:
  • a memory for storing processor executable instructions
  • processor is configured to:
  • the pixel value of the sampling point is acquired multiple times according to a preset time interval
  • the first screen rendering duration of the page to be tested is calculated according to the number of times the pixel value of the sampling point is acquired and the time interval.
  • the device embodiment since it basically corresponds to the method embodiment, reference may be made to the partial description of the method embodiment.
  • the device embodiments described above are merely illustrative, wherein the modules described as separate components may or may not be physically separate, and the components displayed as modules may or may not be physical modules, ie may be located A place, or it can be distributed to multiple network modules. Some or all of the modules may be selected according to actual needs to achieve the objectives of the present specification. Those skilled in the art can understand and implement without any creative work.

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)
  • User Interface Of Digital Computer (AREA)
  • Controls And Circuits For Display Device (AREA)

Abstract

一种计算页面首屏渲染时长的方法、装置及电子设备,通过设置在设备屏幕上的多个采样点,并通过分析多次获取的采样点的像素值是否相同来判断设备屏幕是否完成首屏渲染;所述方法可应用于各类页面,通过设置多个采样点,可以降低所有采样点都处于动画或处于背景颜色上的概率;通过分析多次获取的像素值是否相同来判断设备屏幕是否完成渲染,可有效识别出处于动画或处于背景颜色上的采样点,提高首屏渲染时长计算的准确性。

Description

计算页面首屏渲染时长的方法、装置及电子设备 技术领域
本说明书涉及页面处理技术领域,尤其涉及计算页面首屏渲染时长的方法、装置及电子设备。
背景技术
在使用电子设备时常常会浏览页面,例如浏览器访问网页、客户端中展示本地Native页面、客户端访问HTML5页面等等。这些页面的实现方式虽然各有不同,但是从开启至最终展示到设备屏幕上,基本过程都是:浏览器或客户端读取页面代码并获取页面资源,根据页面资源将部分或全部页面渲染在设备屏幕上。
通常,页面内容可能较多,而设备屏幕的大小有限,页面打开后设备屏幕可能只展示部分页面。页面打开后,在不滚动页面的情况下能被用户看到的画面称为首屏。从页面从开启至设备屏幕最终展示首屏的首屏渲染时长,可能受页面代码、服务器响应速度、服务器处理能力或数据库性能等等多种因素影响。因此,不同页面的首屏渲染时长可能不同,而首屏渲染时长的长短将会影响到用户体验,开发人员需要确定页面的首屏渲染时长,以进行页面的优化。
发明内容
为克服相关技术中存在的问题,本说明书提供了计算页面首屏渲染时长的方法、装置及电子设备。
一种计算页面首屏渲染时长的方法,包括:
设置分布于设备屏幕上的多个采样点;
在待测页面开始加载后,按照预设时间间隔多次获取所述采样点的像素值;
对于多个所述采样点,根据所述采样点多次获取的像素值是否相同,判断所述设备屏幕是否完成首屏渲染;
在确定所述设备屏幕完成首屏渲染后,根据所述采样点的像素值的获取次数及所述时间间隔,计算所述待测页面的首屏渲染时长。
可选的,所述设置分布于设备屏幕上的多个采样点,包括:
将所述设备屏幕划分为多个子区域,设置分布于所述多个子区域内的一个或多个采样点。
可选的,所述多个采样点随机分布或者是均匀分布。
可选的,所述多个采样点分布在所述设备屏幕上用于展示所述待测页面的展示区域。
可选的,所述展示区域为所述设备屏幕上除导航栏和视图切换栏之外的区域。
可选的,在判断所述设备屏幕是否完成首屏渲染前,所述方法包括:
删除连续N次所获取的像素值都不同的采样点,所述N为第一预设整数。
可选的,所述按照预设时间间隔多次获取各所述采样点的像素值,包括:
对于连续M次所获取的像素值相同的采样点,停止获取该采样点的像素值,所述M为第二预设整数。
可选的,当所有采样点都停止获取像素值后,若所有采样点的像素值都相同,则重新执行所述按照预设时间间隔多次获取各所述采样点的像素值的步骤。
可选的,所述判断所述设备屏幕是否完成首屏渲染,包括:
在所有采样点都停止获取像素值后,确定判断所述设备屏幕完成首屏渲染。
可选的,所述根据所述采样点的像素值的获取次数及所述时间间隔,计算所述待测页面的首屏渲染时长,包括:
确定所述M与所述时间间隔的乘积,根据所述待测页面从开始加载至停止获取像素值的时长与所述乘积的差值确定所述首屏渲染时长。
一种计算页面首屏渲染时长的装置,包括:
设置模块,用于:设置分布于设备屏幕上的多个采样点;
获取模块,用于:在待测页面开始加载后,按照预设时间间隔多次获取所述采样点的像素值;
判断模块,用于:对于多个所述采样点,根据所述采样点多次获取的像素值是否相 同,判断所述设备屏幕是否完成首屏渲染;
计算模块,用于:在确定所述设备屏幕完成首屏渲染后,根据所述采样点的像素值的获取次数及所述时间间隔,计算所述待测页面的首屏渲染时长。
可选的,所述设置模块,还用于:
将所述设备屏幕划分为多个子区域,设置分布于所述多个子区域内的一个或多个采样点。
可选的,所述多个采样点随机分布或者是均匀分布。
可选的,所述多个采样点分布在所述设备屏幕上用于展示所述待测页面的展示区域。
可选的,所述展示区域为所述设备屏幕上除导航栏和视图切换栏之外的区域。
可选的,所述判断模块,还用于:
在判断所述设备屏幕是否完成首屏渲染前,删除连续N次所获取的像素值都不同的采样点,所述N为第一预设整数。
可选的,所述获取模块,还用于:
对于连续M次所获取的像素值相同的采样点,停止获取该采样点的像素值,所述M为第二预设整数。
可选的,所述获取模块,还用于:
当所有采样点都停止获取像素值后,若所有采样点的像素值都相同,则重新执行所述按照预设时间间隔多次获取各所述采样点的像素值的步骤。
可选的,所述判断模块,还用于:在所有采样点都停止获取像素值后,确定判断所述设备屏幕完成首屏渲染。
可选的,所述计算模块,还用于:
确定所述M与所述时间间隔的乘积,根据所述待测页面从开始加载至停止获取像素值的时长与所述乘积的差值确定所述首屏渲染时长。
一种电子设备,包括:
处理器;
用于存储处理器可执行指令的存储器;
其中,所述处理器被配置为:
设置分布于设备屏幕上的多个采样点;
在待测页面开始加载后,按照预设时间间隔多次获取所述采样点的像素值;
对于多个所述采样点,根据所述采样点多次获取的像素值是否相同,判断所述设备屏幕是否完成首屏渲染;
在确定所述设备屏幕完成首屏渲染后,根据所述采样点的像素值的获取次数及所述时间间隔,计算所述待测页面的首屏渲染时长。
本说明书的实施例提供的技术方案可以包括以下有益效果:
本说明书中,通过设置在设备屏幕上的多个采样点,并通过分析多次获取的采样点的像素值是否相同来判断设备屏幕是否完成首屏渲染。因此本说明书实施例可以应用于各类不同编程语言开发的、不同类型的页面。
另一方面,页面中可能存在会持续变化的内容,如动画或视频等等,也可能存在背景颜色等无变化的内容,这些内容可能会影响首屏渲染时长的准确性。而本说明书实施例通过设置多个采样点,可以降低所有采样点都处于动画或处于背景颜色上的概率,保证有部分采样点可以处于页面内容区域上;通过多次获取的像素值是否相同,判断所述设备屏幕是否完成首屏渲染,可以有效识别出处于动画或处于背景颜色上的采样点,从而提高首屏渲染时长的准确性。
应当理解的是,以上的一般描述和后文的细节描述仅是示例性和解释性的,并不能限制本说明书。
附图说明
此处的附图被并入说明书中并构成本说明书的一部分,示出了符合本说明书的实施例,并与说明书一起用于解释本说明书的原理。
图1是本说明书根据一示例性实施例示出的一种页面示意图。
图2A是本说明书根据一示例性实施例示出的一种计算页面首屏渲染时长的流程示意图。
图2B是本说明书根据一示例性实施例示出的一种设置采样点的示意图。
图2C是本说明书根据一示例性实施例示出的另一种计算页面首屏渲染时长的流程示意图。
图3是本说明书根据一示例性实施例示出的计算页面首屏渲染时长的装置所在电子设备的一种硬件结构图。
图4是本说明书根据一示例性实施例示出的一种计算页面首屏渲染时长的装置的框图。
具体实施方式
这里将详细地对示例性实施例进行说明,其示例表示在附图中。下面的描述涉及附图时,除非另有表示,不同附图中的相同数字表示相同或相似的要素。以下示例性实施例中所描述的实施方式并不代表与本说明书相一致的所有实施方式。相反,它们仅是与如所附权利要求书中所详述的、本说明书的一些方面相一致的装置和方法的例子。
在本说明书使用的术语是仅仅出于描述特定实施例的目的,而非旨在限制本说明书。在本说明书和所附权利要求书中所使用的单数形式的“一种”、“所述”和“该”也旨在包括多数形式,除非上下文清楚地表示其他含义。还应当理解,本文中使用的术语“和/或”是指并包含一个或多个相关联的列出项目的任何或所有可能组合。
应当理解,尽管在本说明书可能采用术语第一、第二、第三等来描述各种信息,但这些信息不应限于这些术语。这些术语仅用来将同一类型的信息彼此区分开。例如,在不脱离本说明书范围的情况下,第一信息也可以被称为第二信息,类似地,第二信息也可以被称为第一信息。取决于语境,如在此所使用的词语“如果”可以被解释成为“在……时”或“当……时”或“响应于确定”。
本说明书实施例中的页面可以包括通过浏览器开启的web页面、利用客户端开启的本地Native页面、利用客户端开启的HTML5页面等等可在电子设备屏幕上展示的页面。如图1所示,是本说明实施例示出的一种页面示意图,图1中左侧示出了一个完整页面,图1中右侧虚线框内是电子设备屏幕上用于展示页面的区域。由于电子设备的屏幕大小有限,屏幕上用于展示页面的区域大小可能小于页面大小。当页面启动后,电子设备读取页面代码,获取到页面资源,基于页面资源在屏幕上进行渲染,使页面内容在屏幕上所设置的页面展示区域中进行展示,即图1中右侧虚线框内的内容,本说明书实施例称 为首屏,也即是页面启动后,电子设备屏幕上所能展示的用户无需滚动即可看到的页面区域。从页面开始启动至电子设备屏幕上完成首屏渲染的时长,本说明书实施例称为首屏渲染时长。
可以理解,用户在启动页面后通常都期望能够更快看到页面内容,因此,首屏渲染时长是评价页面性能的一个重要指标。页面开发完成后,开发人员可以确定页面的首屏渲染时长,以根据首屏渲染时长优化页面。
基于此,本说明书实施例提供一种计算页面首屏渲染时长的方案,该方案设置多个分布在设备屏幕上的采样点,并在待测页面开始加载后,按照预设时间间隔多次获取所述采样点的像素值。之后根据采样点多次获取的像素值是否相同,判断所述设备屏幕是否完成首屏渲染,进而计算首屏渲染时长。
因此,本说明书实施例至少具有以下优势:
首先,本说明书实施例通过设置在设备屏幕上的多个采样点,并通过分析多次获取的采样点的像素值是否相同来判断设备屏幕是否完成首屏渲染。因此本说明书实施例可以应用于各类不同编程语言开发的、不同类型的页面。
另一方面,页面中可能存在会持续变化的内容,如动画或视频等等,也可能存在背景颜色等无变化的内容,这些内容可能会影响首屏渲染时长的准确性。而本说明书实施例通过设置多个采样点,可以降低所有采样点都处于动画或处于背景颜色上的概率,保证有部分采样点可以处于页面内容区域上;通过多次获取的像素值是否相同,判断所述设备屏幕是否完成首屏渲染,可以有效识别出处于动画或处于背景颜色上的采样点,从而提高首屏渲染时长的准确性。
接下来对本说明书实施例方案进行详细说明。
如图2A所示,是本说明实施例示出的一种计算页面首屏渲染时长的流程示意图,该方法可应用于电子设备中,包括如下步骤:
在步骤202中,设置分布于设备屏幕上的多个采样点;
在步骤204中,在待测页面开始加载后,按照预设时间间隔多次获取所述采样点的像素值;
在步骤206中,对于多个所述采样点,根据所述采样点多次获取的像素值是否相同,判断所述设备屏幕是否完成首屏渲染;
在步骤208中,在确定所述设备屏幕完成首屏渲染后,根据所述采样点的像素值的获取次数及所述时间间隔,计算所述待测页面的首屏渲染时长。
本说明书实施例可应用于需要计算页面首屏渲染时长的场景,其中电子设备可以包括个人计算机、平板电脑、智能手机或PDA(个人数字助理)等等可展示页面的设备中。当电子设备开始启动页面,电子设备可以应用本实施例所提供的方案,从而计算得出该页面在该电子设备上的首屏渲染时长。
其中,上述多个采样点的个数和具体的分布方式可以根据需要灵活设置,本说明书实施例对此不作限定。作为一个实施例,如图2B所示,示出了设置采样点的示意图,其中包括有随机分布的情况,也包括均匀分布的情况;还有将所述设备屏幕划分为多个子区域,设置分布于所述多个子区域内的一个或多个采样点的情况,其中,在该多个子区域内,可以是随机分布,也可以是均匀分布。
实际应用中,设备屏幕上有可能不是全部用于展示页面,因此,为了防止在页面的展示区域外设置采样点而造成的干扰较多、数据准确性较低的问题,本实施例中,所述多个采样点可以分布在所述设备屏幕上用于展示所述待测页面的展示区域。具体的,在一些例子中,该展示区域可以根据实际的设备屏幕展示需求或页面展示需求而确定,例如某些应用或页面在开发时,可能已预先设置了页面展示区域,此种情况下可以通过读取页面代码而确定。
在另一些例子中,可能页面所在应用中设置了视图切换栏,而设备屏幕上也设置了导航栏,因此,展示区域可以是所述设备屏幕上除导航栏和视图切换栏之外的区域。其中,导航栏在设备屏幕上的位置可以通过调用操作系统所提供的接口而确定,而视图切换栏可以通过由页面所在应用的具体设置而确定。实际应用中,还可以结合具体应用场景而灵活采用其他方式而确定,本实施例对此不作限定。
在设置好上述多个采样点后,用户可以启动待测页面,当待测页面开始加载,可以开始按照预设时间间隔多次获取所述采样点的像素值。其中,该预设时间间隔可以是50ms或100ms等等时长,实际应用中可以根据精度需要和设备性能而灵活配置。
通过研究发现,在实际应用中,页面内容具有多样性和复杂性的特点。例如,页面中可能包括视频、动态图片或flash(交互式矢量图和Web动画标准)动画等等内容,这类页面内容的特点是持续在变化。页面中也有可能设置背景颜色,这类页面内容的特点是页面开始加载后,首先渲染背景颜色,再在背景颜色上渲染其他页面内容。
基于此,本说明书实施例可以根据所述采样点多次获取的像素值是否相同,判断所述设备屏幕是否完成首屏渲染。可以理解,首屏渲染需要一定时间完成,对于处于持续动态变化的动画等区域内的采样点,多次获取的像素值都可能会不同。因此,为了提高数据准确性,本实施例对于连续N次所获取的像素值都不同的采样点,可以认为是处于持续动态变化的动画等区域内的采样点,因此可以根据需要忽略此类采样点,将此类采样点删除。其中,N为预先设定的整数,例如3、5或7等数值,实际应用中可以灵活设定,本实施例对此不作限定。
对于处于其他不会持续变化区域内的采样点,在完成首屏渲染后,该采样点多次获取的像素值将不会变化。因此,本说明书实施例中,所述按照预设时间间隔多次获取各所述采样点的像素值,可以包括:
对于连续M次所获取的像素值相同的采样点,停止获取该采样点的像素值,所述M为第二预设整数。
对于连续M次所获取的像素值相同的采样点,则可以认为该采样点所对应的页面内容完成了首屏渲染,因此可以停止获取该采样点的像素值。其中,M为预先设定的整数,例如3、5或7等数值,实际应用中可以灵活设定,本实施例对此不作限定。
对于包括有背景颜色或背景图片的页面,页面在加载后,可能是先渲染背景颜色或背景图片,之后在背景颜色或背景图片的基础上再绘制其他页面内容。假设其他页面内容资源的获取时间较长,从渲染渲染背景颜色或背景图片之后到渲染其他页面内容可能需要一定时间,而此时,有可能处于背景颜色或背景图片的采样点由于多次获取的像素值都相同,因此被认为已经渲染结束。为了解决上述问题,当所有采样点都停止获取像素值后,可以判断所有采样点的像素值都相同,若所有采样点的像素值都相同,可以认为采样点处于上述的背景颜色或背景图片的区域内,而且背景颜色或背景图片上还未渲染新的页面内容,因此可以重新执行所述按照预设时间间隔多次获取各所述采样点的像素值的步骤。
在完成上述流程,在所有采样点都停止获取像素值后,则可以确定所述设备屏幕完成首屏渲染,之后进行首屏渲染时长的计算。其中,首屏渲染时长的计算,在一些例子中,可以根据页面开始加载的时刻与最终停止获取像素值的时刻之间的时长。在另一些例子中,考虑到某些实施例中由于设置了在连续M次所获取的像素值相同的采样点后认定采样点渲染结束,为了进一步提高数据准确性,还可以是:确定所述M与所述时间间隔的乘积,根据所述待测页面从开始加载至停止获取像素值的时长与所述乘积的差 值确定所述首屏渲染时长。例如,可以是根据页面开始加载的时刻与最终停止获取像素值的时刻之间的时长,减去所述M与所述时间间隔的乘积,最终计算得出的数据作为首屏渲染时长。
接下来通过一具体例子再次说明本说明书所提供的方案。如图2C所示,是本说明书根据一示例性实施例示出的另一种计算页面首屏渲染时长的方法示意图,包括如下几部分内容:
一、参数配置
主要为设置采样点的个数,确定电子设备屏幕导航栏的位置,以及确定页面底部视图切换栏的位置。
二、设置采样点
电子设备屏幕上除去导航栏和视图切换栏之后的剩余区域上设置多个采样点。其中,采样点的设置方式,可以是随机分布设置,也可以是均匀分布设置;或者是将页面分为不同子区域,在每个子区域内设置采样点。
三、获取采样点的像素值
对于每个采样点,都可以取到该点的像素值。本实施例根据预设时间间隔多个获取各个采样点的像素值。
四、比较之前的像素值并记录
对于每个采样点,可以在每次获取像素值后,比较当前像素值与上一次所获取的像素值。
可选的,本实施例对每个采样点设置状态,包括三种:未知,忽略,已完成。
未知状态:初始状态,各个采样点的状态都设置为未知状态。
忽略状态:如果采样点的像素值与上一次不同,则记录一次变化。若一个采样点累计变化N(例如5等数值)次以上,则可以认为这个采样点可能处于动画等持续变化的区域,将其标记为忽略,也表示将该点删除,即是在之后的计算过程中不考虑该采样点。
已完成状态:当一个点连续M次(例如5等数值)的像素值都相同,可以将该点标记为已完成。
五、判断是否渲染完成
当所有未被忽略的采样点的状态都为已完成时,可基本认为渲染结束,可以停止像素值的采集。由于页面有可能会先显示一个背景颜色,等待一段时间才获得其他页面内容资源,才在背景颜色的基础上继续渲染其他页面内容,因此,可以对已完成的采样点进行检验,如果根据采样点的像素值判断所有采样点都为同一种颜色,则认为当前画面只有背景颜色,渲染还没有完成,此时将这些点的状态重新设为未知,继续执行获取像素值的步骤。如果检验认为并不全是背景颜色,则认为渲染完成。
六、获得首屏渲染时长
由于是通过采样点连续M次像素值都相同来确定首屏渲染完成的,因此为了使所计算的首屏渲染时长更为准确,页面从开始加载至停止获取像素值的时长并非真实的首屏渲染时长,因此,计算过程可以是:确定所述M与所述时间间隔的乘积,根据所述待测页面从开始加载至停止获取像素值的时长与所述乘积的差值确定所述首屏渲染时长。
由上述实施例可见,页面有可能存在背景颜色等情况,如果只设置一个采用点,很有可能在背景颜色上。若采点位置固定,那么对于某一页面,将会出现两种情况,每次都在页面内容上或者每次都在背景颜色上,所以对于某些页面可能无法获得数据。若位置是随机选择的,则选中内容的概率为:内容所占像素点/页面总像素点,而这个比率可能小于80%,所以结果并不可观。
而本说明实施例中用设置多个采样点的方式,能够很好的解决这一问题。假如一个页面内容占比为60%,假设随机选取10个点,这十个点中至少有一个为处于页面内容采用点的概率为1–0.4^10>99.9%。这样基本可以保证数据的有效性。实际应用中,技术人员期望有尽量多的采样点能够处于页面内容区域,并且页面中可能会分好几个区块渲染,因此期望能尽量覆盖所有区块,所以采样点的个数可以设置更多个,这个数量可根据具体程序的性能或页面内容的分布情况而灵活调整。
另一方面,动画等持续变化区域会对检测进行干扰,因此本说明实施例在发现多次像素值不同的情况下,可以忽略该采样点,从而避免了动画等区域的采用点对检测进行的干扰。
与前述计算页面首屏渲染时长的方法的实施例相对应,本说明书还提供了计算页面首屏渲染时长的装置及其所应用的电子设备的实施例。
本说明书计算页面首屏渲染时长的装置的实施例可以应用在电子设备上。装置实施例可以通过软件实现,也可以通过硬件或者软硬件结合的方式实现。以软件实现为例,作为一个逻辑意义上的装置,是通过其所在电子设备的处理器将非易失性存储器中对应的计算机程序指令读取到内存中运行形成的。从硬件层面而言,如图3所示,为本说明书计算页面首屏渲染时长的装置所在电子设备的一种硬件结构图,除了图3所示的处理器310、内存330、网络接口320、以及非易失性存储器340之外,实施例中装置331所在的电子设备,通常根据该电子设备的实际功能,还可以包括其他硬件,对此不再赘述。
如图4所示,图4是本说明书根据一示例性实施例示出的一种计算页面首屏渲染时长的装置的框图,所述装置包括:
设置模块41,用于:设置分布于设备屏幕上的多个采样点;
获取模块42,用于:在待测页面开始加载后,按照预设时间间隔多次获取所述采样点的像素值;
判断模块43,用于:对于多个所述采样点,根据所述采样点多次获取的像素值是否相同,判断所述设备屏幕是否完成首屏渲染;
计算模块44,用于:在确定所述设备屏幕完成首屏渲染后,根据所述采样点的像素值的获取次数及所述时间间隔,计算所述待测页面的首屏渲染时长。
可选的,所述设置模块,还用于:
将所述设备屏幕划分为多个子区域,设置分布于所述多个子区域内的一个或多个采样点。
可选的,所述多个采样点随机分布或者是均匀分布。
可选的,所述多个采样点分布在所述设备屏幕上用于展示所述待测页面的展示区域。
可选的,所述展示区域为所述设备屏幕上除导航栏和视图切换栏之外的区域。
可选的,所述判断模块,还用于:
在判断所述设备屏幕是否完成首屏渲染前,删除连续N次所获取的像素值都不同的采样点,所述N为第一预设整数。
可选的,所述获取模块,还用于:
对于连续M次所获取的像素值相同的采样点,停止获取该采样点的像素值,所述M为第二预设整数。
可选的,所述获取模块,还用于:
当所有采样点都停止获取像素值后,若所有采样点的像素值都相同,则重新执行所述按照预设时间间隔多次获取各所述采样点的像素值的步骤。
可选的,所述判断模块,还用于:在所有采样点都停止获取像素值后,确定判断所述设备屏幕完成首屏渲染。
可选的,所述计算模块,还用于:
确定所述M与所述时间间隔的乘积,根据所述待测页面从开始加载至停止获取像素值的时长与所述乘积的差值确定所述首屏渲染时长。
相应的,本说明书还提供一种电子设备,包括:
处理器;
用于存储处理器可执行指令的存储器;
其中,所述处理器被配置为:
设置分布于设备屏幕上的多个采样点;
在待测页面开始加载后,按照预设时间间隔多次获取所述采样点的像素值;
对于多个所述采样点,根据所述采样点多次获取的像素值是否相同,判断所述设备屏幕是否完成首屏渲染;
在确定所述设备屏幕完成首屏渲染后,根据所述采样点的像素值的获取次数及所述时间间隔,计算所述待测页面的首屏渲染时长。
上述计算页面首屏渲染时长的装置中各个模块的功能和作用的实现过程具体详见上述方法中对应步骤的实现过程,在此不再赘述。
对于装置实施例而言,由于其基本对应于方法实施例,所以相关之处参见方法实施例的部分说明即可。以上所描述的装置实施例仅仅是示意性的,其中所述作为分离部件说明的模块可以是或者也可以不是物理上分开的,作为模块显示的部件可以是或者也可以不是物理模块,即可以位于一个地方,或者也可以分布到多个网络模块上。可以根据实际的需要选择其中的部分或者全部模块来实现本说明书方案的目的。本领域普通 技术人员在不付出创造性劳动的情况下,即可以理解并实施。
上述对本说明书特定实施例进行了描述。其它实施例在所附权利要求书的范围内。在一些情况下,在权利要求书中记载的动作或步骤可以按照不同于实施例中的顺序来执行并且仍然可以实现期望的结果。另外,在附图中描绘的过程不一定要求示出的特定顺序或者连续顺序才能实现期望的结果。在某些实施方式中,多任务处理和并行处理也是可以的或者可能是有利的。
本领域技术人员在考虑说明书及实践这里申请的发明后,将容易想到本说明书的其它实施方案。本说明书旨在涵盖本说明书的任何变型、用途或者适应性变化,这些变型、用途或者适应性变化遵循本说明书的一般性原理并包括本说明书未申请的本技术领域中的公知常识或惯用技术手段。说明书和实施例仅被视为示例性的,本说明书的真正范围和精神由下面的权利要求指出。
应当理解的是,本说明书并不局限于上面已经描述并在附图中示出的精确结构,并且可以在不脱离其范围进行各种修改和改变。本说明书的范围仅由所附的权利要求来限制。
以上所述仅为本说明书的较佳实施例而已,并不用以限制本说明书,凡在本说明书的精神和原则之内,所做的任何修改、等同替换、改进等,均应包含在本说明书保护的范围之内。

Claims (21)

  1. 一种计算页面首屏渲染时长的方法,包括:
    设置分布于设备屏幕上的多个采样点;
    在待测页面开始加载后,按照预设时间间隔多次获取所述采样点的像素值;
    对于多个所述采样点,根据所述采样点多次获取的像素值是否相同,判断所述设备屏幕是否完成首屏渲染;
    在确定所述设备屏幕完成首屏渲染后,根据所述采样点的像素值的获取次数及所述时间间隔,计算所述待测页面的首屏渲染时长。
  2. 根据权利要求1所述的方法,所述设置分布于设备屏幕上的多个采样点,包括:
    将所述设备屏幕划分为多个子区域,设置分布于所述多个子区域内的一个或多个采样点。
  3. 根据权利要求1或2所述的方法,所述多个采样点随机分布或者是均匀分布。
  4. 根据权利要求1所述的方法,所述多个采样点分布在所述设备屏幕上用于展示所述待测页面的展示区域。
  5. 根据权利要求4所述的方法,所述展示区域为所述设备屏幕上除导航栏和视图切换栏之外的区域。
  6. 根据权利要求1所述的方法,在判断所述设备屏幕是否完成首屏渲染前,所述方法包括:
    删除连续N次所获取的像素值都不同的采样点,所述N为第一预设整数。
  7. 根据权利要求6所述的方法,所述按照预设时间间隔多次获取各所述采样点的像素值,包括:
    对于连续M次所获取的像素值相同的采样点,停止获取该采样点的像素值,所述M为第二预设整数。
  8. 根据权利要求7所述的方法,当所有采样点都停止获取像素值后,若所有采样点的像素值都相同,则重新执行所述按照预设时间间隔多次获取各所述采样点的像素值的步骤。
  9. 根据权利要求8所述的方法,所述判断所述设备屏幕是否完成首屏渲染,包括:
    在所有采样点都停止获取像素值后,确定判断所述设备屏幕完成首屏渲染。
  10. 根据权利要求8所述的方法,所述根据所述采样点的像素值的获取次数及所述时间间隔,计算所述待测页面的首屏渲染时长,包括:
    确定所述M与所述时间间隔的乘积,根据所述待测页面从开始加载至停止获取像 素值的时长与所述乘积的差值确定所述首屏渲染时长。
  11. 一种计算页面首屏渲染时长的装置,包括:
    设置模块,用于:设置分布于设备屏幕上的多个采样点;
    获取模块,用于:在待测页面开始加载后,按照预设时间间隔多次获取所述采样点的像素值;
    判断模块,用于:对于多个所述采样点,根据所述采样点多次获取的像素值是否相同,判断所述设备屏幕是否完成首屏渲染;
    计算模块,用于:在确定所述设备屏幕完成首屏渲染后,根据所述采样点的像素值的获取次数及所述时间间隔,计算所述待测页面的首屏渲染时长。
  12. 根据权利要求11所述的装置,所述设置模块,还用于:
    将所述设备屏幕划分为多个子区域,设置分布于所述多个子区域内的一个或多个采样点。
  13. 根据权利要求11或12所述的装置,所述多个采样点随机分布或者是均匀分布。
  14. 根据权利要求11所述的装置,所述多个采样点分布在所述设备屏幕上用于展示所述待测页面的展示区域。
  15. 根据权利要求14所述的装置,所述展示区域为所述设备屏幕上除导航栏和视图切换栏之外的区域。
  16. 根据权利要求11所述的装置,所述判断模块,还用于:
    在判断所述设备屏幕是否完成首屏渲染前,删除连续N次所获取的像素值都不同的采样点,所述N为第一预设整数。
  17. 根据权利要求16所述的装置,所述获取模块,还用于:
    对于连续M次所获取的像素值相同的采样点,停止获取该采样点的像素值,所述M为第二预设整数。
  18. 根据权利要求17所述的装置,所述获取模块,还用于:
    当所有采样点都停止获取像素值后,若所有采样点的像素值都相同,则重新执行所述按照预设时间间隔多次获取各所述采样点的像素值的步骤。
  19. 根据权利要求18所述的装置,所述判断模块,还用于:在所有采样点都停止获取像素值后,确定判断所述设备屏幕完成首屏渲染。
  20. 根据权利要求18所述的装置,所述计算模块,还用于:
    确定所述M与所述时间间隔的乘积,根据所述待测页面从开始加载至停止获取像素值的时长与所述乘积的差值确定所述首屏渲染时长。
  21. 一种电子设备,包括:
    处理器;
    用于存储处理器可执行指令的存储器;
    其中,所述处理器被配置为:
    设置分布于设备屏幕上的多个采样点;
    在待测页面开始加载后,按照预设时间间隔多次获取所述采样点的像素值;
    对于多个所述采样点,根据所述采样点多次获取的像素值是否相同,判断所述设备屏幕是否完成首屏渲染;
    在确定所述设备屏幕完成首屏渲染后,根据所述采样点的像素值的获取次数及所述时间间隔,计算所述待测页面的首屏渲染时长。
PCT/CN2018/101541 2017-10-31 2018-08-21 计算页面首屏渲染时长的方法、装置及电子设备 WO2019085598A1 (zh)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201711047877.6A CN107885645B (zh) 2017-10-31 2017-10-31 计算页面首屏渲染时长的方法、装置及电子设备
CN201711047877.6 2017-10-31

Publications (1)

Publication Number Publication Date
WO2019085598A1 true WO2019085598A1 (zh) 2019-05-09

Family

ID=61783250

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2018/101541 WO2019085598A1 (zh) 2017-10-31 2018-08-21 计算页面首屏渲染时长的方法、装置及电子设备

Country Status (3)

Country Link
CN (1) CN107885645B (zh)
TW (1) TWI671647B (zh)
WO (1) WO2019085598A1 (zh)

Families Citing this family (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107885645B (zh) * 2017-10-31 2020-06-23 阿里巴巴集团控股有限公司 计算页面首屏渲染时长的方法、装置及电子设备
CN108671547A (zh) * 2018-04-24 2018-10-19 腾讯科技(深圳)有限公司 一种获取应用的首屏时间的方法、装置及存储介质
CN109271600B (zh) * 2018-08-16 2022-02-22 微梦创科网络科技(中国)有限公司 一种性能数据的监测方法、系统和装置
CN109446040B (zh) * 2018-09-21 2021-01-22 网宿科技股份有限公司 一种应用界面启动时长的获取方法、装置及终端设备
CN109344044B (zh) * 2018-10-08 2022-05-31 杭州有赞科技有限公司 计算页面首屏渲染时间的方法和系统
CN110209978B (zh) * 2019-01-28 2023-05-16 腾讯科技(深圳)有限公司 一种数据处理方法和相关装置
CN110781063B (zh) * 2019-10-25 2023-12-05 北京博睿宏远数据科技股份有限公司 网页首屏时间的测量方法、装置、设备及存储介质
CN112669404B (zh) * 2020-12-28 2023-11-14 北京达佳互联信息技术有限公司 一种图像处理方法、装置、电子设备和存储介质

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102624576A (zh) * 2011-01-27 2012-08-01 腾讯科技(深圳)有限公司 一种自动测试浏览器的网页下载时间的方法和系统
CN103812713A (zh) * 2012-11-06 2014-05-21 腾讯科技(深圳)有限公司 一种网页加载时间的测试方法和装置
US20160124696A1 (en) * 2014-11-03 2016-05-05 Qualcomm Innovation Center, Inc. Downsampled rendering of web page loads to save power
CN107885645A (zh) * 2017-10-31 2018-04-06 阿里巴巴集团控股有限公司 计算页面首屏渲染时长的方法、装置及电子设备

Family Cites Families (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
ATE517500T1 (de) * 2003-06-02 2011-08-15 Qualcomm Inc Erzeugung und umsetzung eines signalprotokolls und schnittstelle für höhere datenraten
RU2006107561A (ru) * 2003-08-13 2007-09-20 Квэлкомм Инкорпорейтед (US) Сигнальный интерфейс для высоких скоростей передачи данных
MXPA06014097A (es) * 2004-06-04 2007-03-07 Qualcomm Inc Metodo y aparato de interfaz de datos de alta velocidad.
TW201239735A (en) * 2011-03-29 2012-10-01 Hon Hai Prec Ind Co Ltd System and method for protecting a display screen of an electronic device
CN103778254B (zh) * 2014-02-24 2017-08-01 北京国双科技有限公司 页面访问数据的处理方法、装置及系统
CN104899336B (zh) * 2015-07-01 2018-05-22 北京博睿宏远数据科技股份有限公司 一种测量网页首屏完全渲染时间的方法
CN105630566A (zh) * 2016-02-26 2016-06-01 北京奇虎科技有限公司 应用页面加载时长的确定方法及装置

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102624576A (zh) * 2011-01-27 2012-08-01 腾讯科技(深圳)有限公司 一种自动测试浏览器的网页下载时间的方法和系统
CN103812713A (zh) * 2012-11-06 2014-05-21 腾讯科技(深圳)有限公司 一种网页加载时间的测试方法和装置
US20160124696A1 (en) * 2014-11-03 2016-05-05 Qualcomm Innovation Center, Inc. Downsampled rendering of web page loads to save power
CN107885645A (zh) * 2017-10-31 2018-04-06 阿里巴巴集团控股有限公司 计算页面首屏渲染时长的方法、装置及电子设备

Also Published As

Publication number Publication date
TW201918911A (zh) 2019-05-16
CN107885645B (zh) 2020-06-23
TWI671647B (zh) 2019-09-11
CN107885645A (zh) 2018-04-06

Similar Documents

Publication Publication Date Title
WO2019085598A1 (zh) 计算页面首屏渲染时长的方法、装置及电子设备
EP3129871B1 (en) Generating a screenshot
CN111163345B (zh) 一种图像渲染方法及装置
JP6214547B2 (ja) ウェブページのレンダリング時間の測定
CN107515759B (zh) 截屏方法、装置、电子设备及可读存储介质
CN112770188B (zh) 一种视频播放方法及装置
CN108737739B (zh) 一种预览画面采集方法、预览画面采集装置及电子设备
CN107977137B (zh) 应用页面的对象展示方法、装置和设备
CN112947969B (zh) 一种页面离屏渲染方法、装置、设备和可读介质
CN105868420A (zh) 一种网络资源加载方式配置方法及装置
US11941728B2 (en) Previewing method and apparatus for effect application, and device, and storage medium
CN108062336B (zh) 媒体信息处理方法及装置
WO2015180448A1 (zh) 移动终端播放方式切换方法、装置、存储介质和程序
JP5635672B1 (ja) 画像処理装置及び画像処理プログラム
US20180336122A1 (en) Generating application flow entities
CN112148395A (zh) 页面显示方法、装置、设备及存储介质
CN113419649A (zh) 用于操作电子装置的方法及其装置
WO2018205392A1 (zh) 控制响应区域显示控制方法、电子装置及存储介质
CN110442499B (zh) 测试、提高页面响应性能的方法和装置、终端设备
CN110557627B (zh) 性能的监测方法、装置以及存储介质
CN108012191B (zh) 视频数据处理方法及装置、计算设备、介质
CN111083552A (zh) 一种缩略图生成方法、装置、设备和介质
CN110879738B (zh) 一种操作步骤的展示方法、装置及电子设备
US20190163762A1 (en) Reflow of user interface elements
CN112084444A (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: 18872897

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: 18872897

Country of ref document: EP

Kind code of ref document: A1