TWI671647B - Method, device and electronic device for calculating the duration of the first screen of a page - Google Patents

Method, device and electronic device for calculating the duration of the first screen of a page Download PDF

Info

Publication number
TWI671647B
TWI671647B TW107130312A TW107130312A TWI671647B TW I671647 B TWI671647 B TW I671647B TW 107130312 A TW107130312 A TW 107130312A TW 107130312 A TW107130312 A TW 107130312A TW I671647 B TWI671647 B TW I671647B
Authority
TW
Taiwan
Prior art keywords
screen
sampling points
page
pixel values
item
Prior art date
Application number
TW107130312A
Other languages
Chinese (zh)
Other versions
TW201918911A (en
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 TW201918911A publication Critical patent/TW201918911A/en
Application granted granted Critical
Publication of TWI671647B publication Critical patent/TWI671647B/en

Links

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

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • General Engineering & Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Databases & Information Systems (AREA)
  • Computer Hardware Design (AREA)
  • Quality & Reliability (AREA)
  • Data Mining & Analysis (AREA)
  • User Interface Of Digital Computer (AREA)
  • Controls And Circuits For Display Device (AREA)

Abstract

本說明書提供一種計算頁面首屏描繪時長的方法、裝置及電子設備,透過設置在設備屏幕上的多個取樣點,並透過分析多次獲取的取樣點的像素值是否相同來判斷設備屏幕是否完成首屏描繪。本說明書實施例可以應用於各類不同程式語言開發的、不同類型的頁面。本說明書實施例透過設置多個取樣點,可以降低所有取樣點都處於動畫或處於背景顏色上的概率,保證有部分取樣點可以處於頁面內容區域上;透過多次獲取的像素值是否相同,判斷所述設備屏幕是否完成首屏描繪,可以有效識別出處於動畫或處於背景顏色上的取樣點,從而提高首屏描繪時長的準確性。This manual provides a method, device, and electronic device for calculating the length of the first screen drawing of a page. The device screen is judged through the multiple sampling points set on the device screen, and by analyzing whether the pixel values of the sampling points obtained multiple times are the same. Complete the first screen drawing. The embodiments of this specification can be applied to different types of pages developed by different programming languages. In the embodiment of the present specification, by setting multiple sampling points, the probability that all sampling points are in animation or in the background color can be reduced, and some sampling points can be located on the page content area. Whether the pixel values obtained through multiple times are the same, determine Whether the device screen has completed the first screen drawing can effectively identify the sampling points in the animation or the background color, thereby improving the accuracy of the first screen drawing time.

Description

計算頁面首屏描繪時長的方法、裝置及電子設備Method, device and electronic device for calculating first page drawing time of page

本說明書涉及頁面處理技術領域,尤其涉及計算頁面首屏描繪時長的方法、裝置及電子設備。This specification relates to the technical field of page processing, and in particular, to a method, an apparatus, and an electronic device for calculating the length of the first screen drawing of a page.

在使用電子設備時常常會瀏覽頁面,例如瀏覽器接取網頁、客戶端中展示本地Native頁面、客戶端接取HTML5頁面等等。這些頁面的實現方式雖然各有不同,但是從開啓至最終展示到設備屏幕上,基本過程都是:瀏覽器或客戶端讀取頁面代碼並獲取頁面資源,根據頁面資源將部分或全部頁面描繪在設備屏幕上。   通常,頁面內容可能較多,而設備屏幕的大小有限,頁面打開後設備屏幕可能只展示部分頁面。頁面打開後,在不滾動頁面的情況下能被用戶看到的畫面稱為首屏。從頁面開啓至設備屏幕最終展示首屏的首屏描繪時長,可能受頁面代碼、伺服器響應速度、伺服器處理能力或資料庫性能等等多種因素影響。因此,不同頁面的首屏描繪時長可能不同,而首屏描繪時長的長短將會影響到用戶體驗,開發人員需要確定頁面的首屏描繪時長,以進行頁面的優化。When using an electronic device, pages are often browsed, for example, a browser accesses a web page, a client displays a native Native page, a client accesses an HTML5 page, and so on. Although the implementation of these pages are different, the basic process from opening to the final display on the device screen is: the browser or client reads the page code and obtains the page resources, and according to the page resources, some or all pages are depicted Device screen. Usually, the page content may be more, and the size of the device screen is limited. The device screen may only show part of the page after the page is opened. After the page is opened, the picture that can be seen by the user without scrolling the page is called the top screen. The length of the first screen drawing from the opening of the page to the final display of the device screen may be affected by various factors such as page code, server response speed, server processing capacity, or database performance. Therefore, the duration of the first screen drawing of different pages may be different, and the length of the first screen drawing time will affect the user experience. Developers need to determine the length of the first screen drawing of the page in order to optimize the page.

為克服相關技術中存在的問題,本說明書提供了計算頁面首屏描繪時長的方法、裝置及電子設備。   一種計算頁面首屏描繪時長的方法,包括:   設置分佈於設備屏幕上的多個取樣點;   在待測頁面開始加載後,按照預設時間間隔多次獲取所述取樣點的像素值;   對於多個所述取樣點,根據所述取樣點多次獲取的像素值是否相同,判斷所述設備屏幕是否完成首屏描繪;   在確定所述設備屏幕完成首屏描繪後,根據所述取樣點的像素值的獲取次數及所述時間間隔,計算所述待測頁面的首屏描繪時長。   可選的,所述設置分佈於設備屏幕上的多個取樣點,包括:   將所述設備屏幕劃分為多個子區域,設置分佈於所述多個子區域內的一個或多個取樣點。   可選的,所述多個取樣點隨機分佈或者是均勻分佈。   可選的,所述多個取樣點分佈在所述設備屏幕上用於展示所述待測頁面的展示區域。   可選的,所述展示區域為所述設備屏幕上除導航欄和視圖切換欄之外的區域。   可選的,在判斷所述設備屏幕是否完成首屏描繪前,所述方法包括:   删除連續N次所獲取的像素值都不同的取樣點,所述N為第一預設整數。   可選的,所述按照預設時間間隔多次獲取各所述取樣點的像素值,包括:   對於連續M次所獲取的像素值相同的取樣點,停止獲取該取樣點的像素值,所述M為第二預設整數。   可選的,當所有取樣點都停止獲取像素值後,若所有取樣點的像素值都相同,則重新執行所述按照預設時間間隔多次獲取各所述取樣點的像素值的步驟。   可選的,所述判斷所述設備屏幕是否完成首屏描繪,包括:   在所有取樣點都停止獲取像素值後,確定判斷所述設備屏幕完成首屏描繪。   可選的,所述根據所述取樣點的像素值的獲取次數及所述時間間隔,計算所述待測頁面的首屏描繪時長,包括:   確定所述M與所述時間間隔的乘積,根據所述待測頁面從開始加載至停止獲取像素值的時長與所述乘積的差值確定所述首屏描繪時長。   一種計算頁面首屏描繪時長的裝置,包括:   設置模組,用於:設置分佈於設備屏幕上的多個取樣點;   獲取模組,用於:在待測頁面開始加載後,按照預設時間間隔多次獲取所述取樣點的像素值;   判斷模組,用於:對於多個所述取樣點,根據所述取樣點多次獲取的像素值是否相同,判斷所述設備屏幕是否完成首屏描繪;   計算模組,用於:在確定所述設備屏幕完成首屏描繪後,根據所述取樣點的像素值的獲取次數及所述時間間隔,計算所述待測頁面的首屏描繪時長。   可選的,所述設置模組,還用於:   將所述設備屏幕劃分為多個子區域,設置分佈於所述多個子區域內的一個或多個取樣點。   可選的,所述多個取樣點隨機分佈或者是均勻分佈。   可選的,所述多個取樣點分佈在所述設備屏幕上用於展示所述待測頁面的展示區域。   可選的,所述展示區域為所述設備屏幕上除導航欄和視圖切換欄之外的區域。   可選的,所述判斷模組,還用於:   在判斷所述設備屏幕是否完成首屏描繪前,删除連續N次所獲取的像素值都不同的取樣點,所述N為第一預設整數。   可選的,所述獲取模組,還用於:   對於連續M次所獲取的像素值相同的取樣點,停止獲取該取樣點的像素值,所述M為第二預設整數。   可選的,所述獲取模組,還用於:   當所有取樣點都停止獲取像素值後,若所有取樣點的像素值都相同,則重新執行所述按照預設時間間隔多次獲取各所述取樣點的像素值的步驟。   可選的,所述判斷模組,還用於:在所有取樣點都停止獲取像素值後,確定判斷所述設備屏幕完成首屏描繪。   可選的,所述計算模組,還用於:   確定所述M與所述時間間隔的乘積,根據所述待測頁面從開始加載至停止獲取像素值的時長與所述乘積的差值確定所述首屏描繪時長。   一種電子設備,包括:   處理器;   用於儲存處理器可執行指令的記憶體;   其中,所述處理器被配置為:   設置分佈於設備屏幕上的多個取樣點;   在待測頁面開始加載後,按照預設時間間隔多次獲取所述取樣點的像素值;   對於多個所述取樣點,根據所述取樣點多次獲取的像素值是否相同,判斷所述設備屏幕是否完成首屏描繪;   在確定所述設備屏幕完成首屏描繪後,根據所述取樣點的像素值的獲取次數及所述時間間隔,計算所述待測頁面的首屏描繪時長。   本說明書的實施例提供的技術方案可以包括以下有益效果:   本說明書中,透過設置在設備屏幕上的多個取樣點,並透過分析多次獲取的取樣點的像素值是否相同來判斷設備屏幕是否完成首屏描繪。因此本說明書實施例可以應用於各類不同程式語言開發的、不同類型的頁面。   另一方面,頁面中可能存在會持續變化的內容,如動畫或視頻等等,也可能存在背景顏色等無變化的內容,這些內容可能會影響首屏描繪時長的準確性。而本說明書實施例透過設置多個取樣點,可以降低所有取樣點都處於動畫或處於背景顏色上的概率,保證有部分取樣點可以處於頁面內容區域上;透過多次獲取的像素值是否相同,判斷所述設備屏幕是否完成首屏描繪,可以有效識別出處於動畫或處於背景顏色上的取樣點,從而提高首屏描繪時長的準確性。   應當理解的是,以上的一般描述和後文的細節描述僅是例示性和解釋性的,並不能限制本說明書。In order to overcome the problems existing in the related technology, this specification provides a method, an apparatus, and an electronic device for calculating the duration of the first screen drawing of a page. A method for calculating the length of the first screen drawing of a page includes: setting a plurality of sampling points distributed on a device screen; 获取 obtaining the pixel values of the sampling points multiple times at a preset time interval after a page to be tested starts to load; for A plurality of the sampling points, and determine whether the device screen has completed the first screen drawing according to whether the pixel values obtained multiple times by the sampling points are the same; after determining that the device screen has completed the first screen drawing, The number of times of obtaining pixel values and the time interval are used to calculate the first screen drawing duration of the page to be tested. Optionally, the setting of the plurality of sampling points distributed on the device screen includes: 划分 dividing the device screen into a plurality of sub-regions, and setting one or more sampling points distributed within the plurality of sub-regions. Optionally, the plurality of sampling points are randomly distributed or uniformly distributed. Optionally, the plurality of sampling points are distributed on a display area of the device screen for displaying the page to be tested. Optionally, the display area is an area on the device screen other than the navigation bar and the view switching bar. Optionally, before judging whether the screen of the device has completed the first screen drawing, the method includes: deleting sampling points that have different pixel values obtained consecutive N times, where N is a first preset integer. Optionally, the obtaining the pixel value of each of the sampling points multiple times according to a preset time interval includes: for a sampling point that has the same pixel value obtained M consecutive times, stopping acquiring the pixel value of the sampling point, the M is a second preset integer. Optionally, after all the sampling points have stopped acquiring pixel values, if the pixel values of all the sampling points are the same, the step of obtaining the pixel values of each of the sampling points multiple times according to a preset time interval is performed again. Optionally, determining whether the device screen has completed the first screen drawing includes: 后 determining that the device screen has completed the first screen drawing after all the sampling points have stopped acquiring pixel values. Optionally, the calculating the first screen drawing duration of the page to be tested according to the number of times the pixel value of the sampling point is obtained and the time interval includes: determining a product of M and the time interval, Determining the first screen drawing duration according to a difference between a time period during which the page to be tested is loaded from beginning to stopping acquiring pixel values and the product. A device for calculating the length of the first screen drawing of a page includes: a setting module for: setting a plurality of sampling points distributed on a device screen; an acquisition module for: after a page to be tested starts to load, according to a preset The pixel value of the sampling point is acquired multiple times in a time interval; a judgment module is configured to: for multiple of the sampling points, determine whether the device screen has completed the first time according to whether the pixel value acquired multiple times at the sampling point is the same; Screen drawing; a computing module, configured to: after determining that the device screen has completed the first screen drawing, calculate the first screen drawing time of the page to be tested according to the number of times the pixel value of the sampling point is obtained and the time interval; long. Optionally, the setting module is further configured to: 划分 divide the device screen into a plurality of sub-areas, and set one or more sampling points distributed in the plurality of sub-areas. Optionally, the plurality of sampling points are randomly distributed or uniformly distributed. Optionally, the plurality of sampling points are distributed on a display area of the device screen for displaying the page to be tested. Optionally, the display area is an area on the device screen other than the navigation bar and the view switching bar. Optionally, the judging module is further configured to: 判断 delete the sampling points that have different pixel values obtained N consecutive times before judging whether the device screen has completed the first screen drawing, where N is the first preset Integer. Optionally, the acquisition module is further configured to: stop acquiring pixel values of the sampling points for the same sampling point obtained by M consecutive pixel values, where M is a second preset integer. Optionally, the acquisition module is further configured to: After all the sampling points stop acquiring pixel values, if the pixel values of all the sampling points are the same, then re-execute the acquiring multiple locations at a preset time interval multiple times. The steps of sampling pixel values are described. Optionally, the judging module is further configured to: after all sampling points stop acquiring pixel values, determine to judge that the device screen completes the first-screen drawing. Optionally, the calculation module is further configured to: determine a product of the M and the time interval, and determine a difference between the length of time when the page to be tested is loaded and the time when the pixel value is stopped and the product is obtained. Determining the first screen drawing duration. An electronic device includes: a processor; a memory for storing processor-executable instructions; wherein the processor is configured to: set a plurality of sampling points distributed on a device screen; 后 after a page to be tested starts to load Obtaining pixel values of the sampling point multiple times according to a preset time interval; for multiple of the sampling points, determining whether the device screen has completed the first screen drawing according to whether the pixel values obtained multiple times by the sampling point are the same; After it is determined that the first screen drawing of the device screen is completed, the first screen drawing duration of the page to be tested is calculated according to the number of times of obtaining pixel values of the sampling point and the time interval. The technical solutions provided by the embodiments of the present specification may include the following beneficial effects: 中 In this specification, whether a device screen is determined by analyzing whether the pixel values of the sampling points obtained multiple times are the same on multiple screens set on the screen of the device Complete the first screen drawing. Therefore, the embodiments of the present specification can be applied to different types of pages developed by different programming languages. On the other hand, there may be content in the page that will change continuously, such as animation or video, and there may also be content that does not change, such as the background color. These contents may affect the accuracy of the duration of the first screen drawing. In the embodiment of the present specification, by setting multiple sampling points, the probability that all the sampling points are in animation or in the background color can be reduced, and some sampling points can be located on the page content area. Whether the pixel values obtained through multiple times are the same, Judging whether the screen of the device has completed the first screen drawing can effectively identify the sampling points in the animation or the background color, thereby improving the accuracy of the first screen drawing time. It should be understood that the above general description and the following detailed description are merely exemplary and explanatory, and should not limit the present specification.

這裡將詳細地對例示性實施例進行說明,其例示表示在附圖中。下面的描述涉及附圖時,除非另有表示,不同附圖中的相同數字表示相同或相似的要素。以下例示性實施例中所描述的實施方式並不代表與本說明書相一致的所有實施方式。相反,它們僅是與如所附申請專利範圍中所詳述的、本說明書的一些方面相一致的裝置和方法的例子。   在本說明書使用的術語是僅僅出於描述特定實施例的目的,而非旨在限制本說明書。在本說明書和所附申請專利範圍中所使用的單數形式的“一種”、“所述”和“該”也旨在包括多數形式,除非上下文清楚地表示其他含義。還應當理解,本文中使用的術語“和/或”是指並包含一個或多個相關聯的列出項目的任何或所有可能組合。   應當理解,儘管在本說明書可能採用術語第一、第二、第三等來描述各種信息,但這些信息不應限於這些術語。這些術語僅用來將同一類型的信息彼此區分開。例如,在不脫離本說明書範圍的情況下,第一信息也可以被稱為第二信息,類似地,第二信息也可以被稱為第一信息。取決於語境,如在此所使用的詞語“如果”可以被解釋成為“在……時”或“當……時”或“響應於確定”。   本說明書實施例中的頁面可以包括透過瀏覽器開啓的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與所述時間間隔的乘積,根據所述待測頁面從開始加載至停止獲取像素值的時長與所述乘積的差值確定所述首屏描繪時長。   相應的,本說明書還提供一種電子設備,包括:   處理器;   用於儲存處理器可執行指令的記憶體;   其中,所述處理器被配置為:   設置分佈於設備屏幕上的多個取樣點;   在待測頁面開始加載後,按照預設時間間隔多次獲取所述取樣點的像素值;   對於多個所述取樣點,根據所述取樣點多次獲取的像素值是否相同,判斷所述設備屏幕是否完成首屏描繪;   在確定所述設備屏幕完成首屏描繪後,根據所述取樣點的像素值的獲取次數及所述時間間隔,計算所述待測頁面的首屏描繪時長。   上述計算頁面首屏描繪時長的裝置中各個模組的功能和作用的實現過程具體詳見上述方法中對應步驟的實現過程,在此不再贅述。   對於裝置實施例而言,由於其基本對應於方法實施例,所以相關之處參見方法實施例的部分說明即可。以上所描述的裝置實施例僅僅是示意性的,其中所述作為分離部件說明的模組可以是或者也可以不是物理上分開的,作為模組顯示的部件可以是或者也可以不是物理模組,即可以位於一個地方,或者也可以分佈到多個網路模組上。可以根據實際的需要選擇其中的部分或者全部模組來實現本說明書方案的目的。本領域普通技術人員在不付出創造性勞動的情況下,即可以理解並實施。   上述對本說明書特定實施例進行了描述。其它實施例在所附申請專利範圍的範圍內。在一些情況下,在申請專利範圍中記載的動作或步驟可以按照不同於實施例中的順序來執行並且仍然可以實現期望的結果。另外,在附圖中描繪的過程不一定要求示出的特定順序或者連續順序才能實現期望的結果。在某些實施方式中,多任務處理和平行處理也是可以的或者可能是有利的。   本領域技術人員在考慮說明書及實踐這裡申請的發明後,將容易想到本說明書的其它實施方案。本說明書旨在涵蓋本說明書的任何變型、用途或者適應性變化,這些變型、用途或者適應性變化遵循本說明書的一般性原理並包括本說明書未申請的本技術領域中的公知常識或慣用技術手段。說明書和實施例僅被視為例示性的,本說明書的真正範圍和精神由下面的權利要求指出。   應當理解的是,本說明書並不局限於上面已經描述並在附圖中示出的精確結構,並且可以在不脫離其範圍進行各種修改和改變。本說明書的範圍僅由所附的權利要求來限制。   以上所述僅為本說明書的較佳實施例而已,並不用以限制本說明書,凡在本說明書的精神和原則之內,所做的任何修改、等同替換、改進等,均應包含在本說明書保護的範圍之內。Exemplary embodiments will be described in detail herein, the examples of which are illustrated in the accompanying drawings. When the following description refers to the accompanying drawings, the same numbers in different drawings represent the same or similar elements unless otherwise indicated. The implementations described in the following illustrative examples do not represent all implementations consistent with this specification. Rather, they are merely examples of devices and methods consistent with some aspects of this specification as detailed in the scope of the appended patent application.的 The terminology used in this specification is for the purpose of describing particular embodiments only and is not intended to limit the specification. The singular forms "a," "the," and "the" used throughout this specification and the scope of the appended patent application are also intended to include the majority, unless the context clearly indicates otherwise. It should also be understood that the term "and / or" as used herein refers to and includes any or all possible combinations of one or more of the associated listed items. It should be understood that, although the terms first, second, third, etc. may be used in this specification to describe various information, the information should not be limited to these terms. These terms are only used to distinguish the same type of information from each other. For example, without departing from the scope of this specification, the first information may also be referred to as the second information, and similarly, the second information may also be referred to as the first information. Depending on the context, the word "if" as used herein can be interpreted as "at" or "when" or "in response to determination".的 The pages in the embodiments of the present specification may include web pages opened through a browser, local Native pages opened using a client, HTML5 pages opened using a client, and the like, which can be displayed on the screen of an electronic device. As shown in FIG. 1, it is a schematic diagram of a page according to an embodiment of the description. A full page is shown on the left side of FIG. 1, and a dotted area on the right side of FIG. 1 is an area for displaying a page on the screen of an electronic device. Due to the limited screen size of electronic devices, the size of the area on the screen used to display pages may be smaller than the page size. When the page is started, the electronic device reads the page code, obtains the page resources, and draws on the screen based on the page resources, so that the page content is displayed in the page display area set on the screen, that is, in the dashed box on the right in Figure 1. The content of this embodiment is called the first screen, that is, the page area that can be displayed by the user on the screen of the electronic device after the page is started without scrolling. The length of time from the start of the page to the completion of the first screen drawing on the screen of the electronic device is referred to as the first screen drawing time in the embodiment of this specification. It is understandable that users usually expect to see the page content faster after starting the page. Therefore, the length of the first screen drawing is an important indicator for evaluating the performance of the page. After the page development is completed, the developer can determine the first screen drawing time of the page to optimize the page based on the first screen drawing time. Based on this, the embodiment of the present specification provides a solution for calculating the duration of the first screen drawing of a page. This solution sets a plurality of sampling points distributed on the screen of the device, and obtains multiple times according to a preset time interval after the page to be tested starts to load. A pixel value of the sampling point. Then, based on whether the pixel values acquired multiple times at the sampling point are the same, it is determined whether the device screen has completed the first screen drawing, and then the first screen drawing time is calculated. Therefore, the embodiments of the present specification have at least the following advantages: First, the embodiments of the present specification determine whether the device screen has completed the first pass through multiple sampling points set on the device screen and analyzing whether the pixel values of the sampling points obtained multiple times are the same. Screen depicting. Therefore, the embodiments of the present specification can be applied to different types of pages developed by different programming languages. On the other hand, there may be content in the page that will change continuously, such as animation or video, and there may also be content that does not change, such as the background color. These contents may affect the accuracy of the duration of the first screen drawing. In the embodiment of the present specification, by setting multiple sampling points, the probability that all the sampling points are in animation or in the background color can be reduced, and some sampling points can be located on the page content area. Whether the pixel values obtained through multiple times are the same, Judging whether the screen of the device has completed the first screen drawing can effectively identify the sampling points in the animation or the background color, thereby improving the accuracy of the first screen drawing time. Next, the scheme of the embodiment of the present specification will be described in detail. As shown in FIG. 2A, it is a schematic flow chart of calculating the duration of the first screen drawing of a page according to an embodiment of the present description. The method can be applied to an electronic device and includes the following steps: In step 202, set the distribution on the device screen. Multiple sampling points; in step 204, after the page to be tested starts to load, the pixel values of the sampling points are obtained multiple times at a preset time interval; in step 206, for multiple of the sampling points, according to the If the pixel values obtained multiple times at the sampling point are the same, determine whether the device screen has completed the first screen drawing; In step 208, after determining that the device screen has completed the first screen drawing, according to the number of times the pixel values of the sampling points are obtained And the time interval, calculating the first screen drawing duration of the page to be tested.实施 The embodiments of the present specification can be applied to a scene that needs to calculate the first screen drawing time of a page. The electronic device may include a personal computer, a tablet computer, a smart phone, or a PDA (personal digital assistant) and other devices that can display the page. When the electronic device starts to start the page, the electronic device can apply the solution provided in this embodiment, so as to calculate the first screen drawing time of the page on the electronic device. Among them, the number of the above-mentioned multiple sampling points and the specific distribution manner can be flexibly set as required, which is not limited in the embodiment of the present specification. As an example, as shown in FIG. 2B, a schematic diagram of setting sampling points is shown, which includes a case of random distribution and a case of uniform distribution; and the device screen is divided into a plurality of sub-regions, and the distribution is set. In the case of one or more sampling points in the multiple sub-regions, the multiple sub-regions may be randomly distributed or evenly distributed. In practical applications, not all of the device screens are used to display pages. Therefore, in order to prevent the problem of more interference and lower data accuracy caused by setting sampling points outside the display area of the page, in this embodiment, all the The plurality of sampling points may be distributed on a display area of the device screen for displaying the page to be tested. Specifically, in some examples, the display area can be determined according to the actual device screen display requirements or page display requirements. For example, during the development of some applications or pages, the page display area may have been set in advance. In this case, the display area can be set. Determined by reading the page code.另 In other examples, a view switching bar may be set in the application where the page is located, and a navigation bar is also set on the device screen. Therefore, the display area may be an area other than the navigation bar and the view switching bar on the device screen. The position of the navigation bar on the device screen can be determined by calling the interface provided by the operating system, and the view switching bar can be determined by the specific settings of the application in which the page is located. In actual applications, it may also be determined flexibly in other ways in combination with specific application scenarios, which is not limited in this embodiment.设置 After setting the above-mentioned multiple sampling points, the user can start the page to be tested, and when the page to be tested starts to load, it can start to obtain the pixel values of the sampling points multiple times at a preset time interval. The preset time interval may be a time length of 50ms or 100ms, etc. In actual applications, it can be flexibly configured according to accuracy requirements and device performance.研究 Through research, it is found that in practical applications, the content of the page has characteristics of diversity and complexity. For example, pages may include video, dynamic pictures or flash (interactive vector graphics and Web animation standard) animations, etc. The characteristics of such page content are continuous changes. It is also possible to set the background color on the page. The characteristic of this type of page content is that after the page starts to load, the background color is first painted, and then the other page content is painted on the background color. Based on this, the embodiments of this specification can determine whether the device screen has completed the first screen drawing according to whether the pixel values obtained multiple times at the sampling point are the same. It can be understood that the first screen drawing takes a certain time to complete, and for sampling points in areas such as animated animations that are continuously changing, the pixel values obtained multiple times may be different. Therefore, in order to improve the accuracy of the data, the sampling points in this embodiment that have different pixel values obtained for N consecutive times can be considered as sampling points in areas such as animations that continuously change dynamically, so such sampling can be ignored as needed. Point to delete such sampling points. Wherein, N is a preset integer, such as 3, 5, or 7, and can be flexibly set in practical applications, which is not limited in this embodiment. For sampling points in other areas that do not change continuously, after completing the first screen drawing, the pixel values acquired by the sampling points multiple times will not change. Therefore, in the embodiment of the present specification, acquiring the pixel value of each of the sampling points multiple times according to a preset time interval may include: For sampling points having the same pixel value acquired continuously M times, stopping acquiring the sampling point A pixel value, where M is a second preset integer. For sampling points with the same pixel value obtained for M consecutive times, it can be considered that the page content corresponding to the sampling point has completed the first screen drawing, so the pixel value of the sampling point can be stopped. Wherein, M is a preset integer, such as 3, 5, or 7, and can be flexibly set in practical applications, which is not limited in this embodiment. For a page that includes a background color or a background image, after the page is loaded, the background color or background image may be drawn first, and then other page content is drawn based on the background color or background image. Assuming that the acquisition time of other page content resources is relatively long, it may take some time from the time when the background color or background picture is drawn to the other page content. At this time, it may be that the sampling point of the background color or background picture is acquired multiple times. The pixel values are all the same, so they are considered to be over. In order to solve the above problem, when all sampling points stop acquiring pixel values, it can be judged that the pixel values of all sampling points are the same. If the pixel values of all sampling points are the same, it can be considered that the sampling points are in the above background color or background image. Within the region, and no new page content has been drawn on the background color or background picture, the step of obtaining the pixel value of each of the sampling points multiple times at a preset time interval may be performed again. After completing the above process, after all the sampling points have stopped acquiring pixel values, it can be determined that the device screen completes the first screen drawing, and then calculates the first screen drawing duration. The calculation of the first screen drawing time may be based on the time between the time when the page starts to load and the time when the pixel value is finally stopped. In other examples, considering that in some embodiments, the sampling point is determined to be over after sampling points having the same pixel value obtained in consecutive M times are set, in order to further improve the accuracy of the data, it may also be: The product of M and the time interval is used to determine the first screen drawing duration according to the difference between the length of time when the page to be measured is loaded from the beginning to the end of acquiring pixel values and the product. For example, it may be based on the time between the time when the page starts to load and the time when the pixel value is finally stopped, minus the product of M and the time interval, and the finally calculated data is used as the first screen drawing time. Next through a specific example to explain the solution provided in this description. As shown in FIG. 2C, it is a schematic diagram of another method for calculating the duration of the first screen drawing of a page according to an exemplary embodiment of this specification, including the following parts: 1. The parameter configuration is mainly to set the number of sampling points, determine The position of the navigation bar on the screen of the electronic device, and the position of the view switching bar at the bottom of the page. 2. Set sampling points Set multiple sampling points on the remaining area after removing the navigation bar and view switching bar on the screen of the electronic device. The setting method of the sampling points may be a random distribution setting or a uniform distribution setting; or the page is divided into different sub-regions, and the sampling points are set in each sub-region. Third, get the pixel value of the sampling point For each sampling point, you can get the pixel value of that point. In this embodiment, a plurality of pixel values of each sampling point are acquired according to a preset time interval. Fourth, compare the previous pixel value and record For each sampling point, you can compare the current pixel value with the pixel value obtained last time after each acquisition of the pixel value. Optionally, this embodiment sets the status for each sampling point, including three types: unknown, ignored, and completed. Unknown state: The initial state, the state of each sampling point is set to the unknown state. Ignore status: If the pixel value of the sampling point is different from the last time, a change is recorded. If a sampling point has been changed more than N times (such as 5 values), it can be considered that this sampling point may be in a continuously changing area such as animation. Marking it as ignored also means that the point is deleted, which is the calculation afterwards. This sampling point is not considered in the process. Completed status: When the pixel value of a point is the same for M consecutive times (such as 5 values), the point can be marked as completed. V. Judging whether the drawing is completed When the status of all the sampling points that have not been ignored is completed, the drawing can be basically considered to be over and the collection of pixel values can be stopped. Because the page may display a background color first, wait for a period of time to obtain other page content resources, and then continue to draw other page content based on the background color. Therefore, you can test the completed sampling points. It is judged that all the sampling points are of the same color, the current picture is considered to have only the background color, and the drawing has not been completed. At this time, the status of these points is reset to unknown, and the steps of obtaining pixel values are continued. If the test does not consider it to be all the background color, the rendering is considered complete. 6. Obtaining the drawing time of the first screen Because the first screen drawing is determined by the sampling points having the same M consecutive pixel values, so in order to make the calculated first screen drawing time more accurate, the page is loaded from the beginning to the stop. The duration of the pixel value is not the actual duration of the first screen drawing. Therefore, the calculation process may be: determining the product of the M and the time interval, and according to the duration of the page to be measured from the time when the page to be tested is loaded to when the pixel value is stopped The difference with the product determines the first screen drawing duration.可见 It can be seen from the above embodiments that the page may have a background color, etc. If only one adoption point is set, it is likely to be on the background color. If the point position is fixed, then for a certain page, there will be two situations, each time on the page content or the background color each time, so for some pages, information may not be available. If the location is randomly selected, the probability of selecting the content is: the pixels occupied by the content / the total pixels of the page, and this ratio may be less than 80%, so the results are not impressive. In addition, in the embodiment of the present description, a method of setting multiple sampling points can solve this problem well. If the content of a page is 60%, suppose 10 points are randomly selected, and the probability that at least one of the ten points is a point in the page content is 1-0.4 ^ 10> 99.9%. This basically guarantees the validity of the data. In practical applications, technicians expect that as many sampling points as possible can be located in the content area of the page, and the page may be divided into several blocks to depict, so they hope to cover all 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 specific programs or the distribution of page content. On the other hand, the continuously changing areas such as animation will interfere with the detection. Therefore, in the embodiment of this description, when different pixel values are found multiple times, the sampling point can be ignored, thereby avoiding the detection of points using points in areas such as animation. interference. Corresponding to the foregoing embodiment of the method for calculating the first page drawing duration of a page, this specification also provides an embodiment of a device for calculating the first page drawing duration of a page and an electronic device to which it is applied.说明书 The embodiment of the device for calculating the duration of the first screen drawing of the page in this specification may be applied to an electronic device. The device embodiments can be implemented by software, or by a combination of hardware or software and hardware. Taking software implementation as an example, as a logical device, it is formed by reading the corresponding computer program instructions in the non-volatile memory into the memory through the processor of the electronic device where it is located. In terms of hardware, as shown in FIG. 3, it is a hardware structure diagram of the electronic device in which the device depicting the length of the first screen of the calculation page of this specification is located, except for the processor 310, the memory 330, and the network shown in FIG. In addition to the road interface 320 and the non-volatile memory 340, the electronic device in which the device 331 is located in the embodiment may generally include other hardware according to the actual function of the electronic device, and details are not described herein again. As shown in FIG. 4, FIG. 4 is a block diagram of a device for calculating the length of the first screen drawing of a page according to an exemplary embodiment of the present specification. The device includes: a setting module 41 for: setting distribution on the device Multiple sampling points on the screen; an acquisition module 42 for: acquiring the pixel values of the sampling points multiple times at a preset time interval after the page under test starts to load; a judgment module 43 for: for multiple Each of the sampling points, and determines whether the device screen has completed the first screen drawing according to whether the pixel values obtained multiple times by the sampling points are the same; a computing module 44 for: after determining that the device screen has completed the first screen drawing And calculating the first screen drawing duration of the page to be tested according to the number of times of obtaining the pixel value of the sampling point and the time interval. Optionally, the setting module is further configured to: 划分 divide the device screen into a plurality of sub-areas, and set one or more sampling points distributed in the plurality of sub-areas. Optionally, the plurality of sampling points are randomly distributed or uniformly distributed. Optionally, the plurality of sampling points are distributed on a display area of the device screen for displaying the page to be tested. Optionally, the display area is an area on the device screen other than the navigation bar and the view switching bar. Optionally, the judging module is further configured to: 判断 delete the sampling points that have different pixel values obtained N consecutive times before judging whether the device screen has completed the first screen drawing, where N is the first preset Integer. Optionally, the acquisition module is further configured to: stop acquiring pixel values of the sampling points for the same sampling point obtained by M consecutive pixel values, where M is a second preset integer. Optionally, the acquisition module is further configured to: After all the sampling points stop acquiring pixel values, if the pixel values of all the sampling points are the same, then re-execute the acquiring multiple locations at a preset time interval multiple times. The steps of sampling pixel values are described. Optionally, the judging module is further configured to: after all sampling points stop acquiring pixel values, determine to judge that the device screen completes the first-screen drawing. Optionally, the calculation module is further configured to: determine a product of the M and the time interval, and determine a difference between the length of time when the page to be tested is loaded and the time when the pixel value is stopped and the product is obtained. Determining the first screen drawing duration. Correspondingly, this specification also provides an electronic device including: a processor; a memory for storing processor-executable instructions; a processor configured to: a plurality of sampling points distributed on a device screen; After the page to be tested is loaded, the pixel values of the sampling points are obtained multiple times at preset time intervals; For multiple of the sampling points, determine whether the device is based on whether the pixel values obtained multiple times by the sampling points are the same Whether the screen has completed the first screen drawing; After determining that the device screen has completed the first screen drawing, calculate the first screen drawing duration of the page to be tested according to the number of times of obtaining pixel values of the sampling point and the time interval. For the implementation process of the functions and functions of the various modules in the device that depicts the length of the first screen of the calculation page, please refer to the implementation process of the corresponding steps in the above method for details. As for the device embodiment, since it basically corresponds to the method embodiment, the relevant parts may refer to the description of the method embodiment. The device embodiments described above are only schematic. The modules described as separate components may or may not be physically separated, and the components displayed as modules may or may not be physical modules. It can be located in one place or distributed across multiple network modules. Some or all of the modules can be selected according to actual needs to achieve the purpose of the solution in this specification. Those of ordinary skill in the art can understand and implement without creative efforts. A specific embodiment of this specification has been described above. Other embodiments are within the scope of the appended patent applications. In some cases, actions or steps described in the scope of the patent application may be performed in a different order than in the embodiments and still achieve the desired result. In addition, the processes depicted in the figures do not necessarily require the particular order shown or sequential order to achieve the desired results. In certain embodiments, multi-tasking and parallel processing are also possible or may be advantageous.技术 After considering the specification and practicing the invention applied herein, those skilled in the art will readily think of other embodiments of the specification. This description is intended to cover any variations, uses, or adaptations to this specification. These variations, uses, or adaptations follow the general principles of this specification and include the common general knowledge or conventional technical means in the technical field to which this specification has not been applied. . It is intended that the specification and examples be considered as exemplary only, with a true scope and spirit of the specification being indicated by the following claims. It should be understood that this specification is not limited to the precise structure that has been described above and shown in the accompanying drawings, and various modifications and changes can be made without departing from the scope thereof. The scope of this description is limited only by the following claims. The above is only a preferred embodiment of this specification, and is not intended to limit the specification. Any modification, equivalent replacement, or improvement made within the spirit and principles of this specification shall be included in this specification. Within the scope of protection.

310:處理器 320:網路介面 330:記憶體 331:計算頁面首屏描繪時長的裝置 340:非易失性記憶體 41:設置模組 42:獲取模組 43:判斷模組 44:計算模組310: processor 320: network interface 330: memory 331: device for calculating the length of the first screen drawing on the page 340: non-volatile memory 41: setting module 42: acquisition module 43: judgment module 44: calculation Module

此處的附圖被併入說明書中並構成本說明書的一部分,示出了符合本說明書的實施例,並與說明書一起用於解釋本說明書的原理。   圖1是本說明書根據一例示性實施例示出的一種頁面示意圖。   圖2A是本說明書根據一例示性實施例示出的一種計算頁面首屏描繪時長的流程示意圖。   圖2B是本說明書根據一例示性實施例示出的一種設置取樣點的示意圖。   圖2C是本說明書根據一例示性實施例示出的另一種計算頁面首屏描繪時長的流程示意圖。   圖3是本說明書根據一例示性實施例示出的計算頁面首屏描繪時長的裝置所在電子設備的一種硬體結構圖。   圖4是本說明書根據一例示性實施例示出的一種計算頁面首屏描繪時長的裝置的方塊圖。The drawings herein are incorporated in and constitute a part of the specification, illustrate embodiments consistent with the specification, and together with the description serve to explain the principles of the specification. FIG. 1 is a schematic diagram of a page according to an exemplary embodiment of the present specification. A FIG. 2A is a schematic flowchart of calculating a first page drawing duration of a page according to an exemplary embodiment of the present specification. FIG. 2B is a schematic diagram of setting a sampling point according to an exemplary embodiment of the present specification. C FIG. 2C is a schematic flowchart of calculating a first page drawing duration of a page according to an exemplary embodiment of the present specification. FIG. 3 is a hardware structural diagram of an electronic device in which a device for calculating a first page drawing duration of a calculation page is displayed according to an exemplary embodiment of the present specification. FIG. 4 is a block diagram of a device for calculating the length of the first screen drawing of a page according to an exemplary embodiment of the present specification.

Claims (21)

一種計算頁面首屏描繪時長的方法,包括:   設置分佈於設備屏幕上的多個取樣點;   在待測頁面開始加載後,按照預設時間間隔多次獲取所述取樣點的像素值;   對於多個所述取樣點,根據所述取樣點多次獲取的像素值是否相同,判斷所述設備屏幕是否完成首屏描繪;   在確定所述設備屏幕完成首屏描繪後,根據所述取樣點的像素值的獲取次數及所述時間間隔,計算所述待測頁面的首屏描繪時長。A method for calculating the length of the first screen drawing of a page includes: setting a plurality of sampling points distributed on a device screen; 获取 obtaining the pixel values of the sampling points multiple times at a preset time interval after a page to be tested starts to load; for A plurality of the sampling points, and determine whether the device screen has completed the first screen drawing according to whether the pixel values obtained multiple times by the sampling points are the same; after determining that the device screen has completed the first screen drawing, The number of times of obtaining pixel values and the time interval are used to calculate the first screen drawing duration of the page to be tested. 根據申請專利範圍第1項所述的方法,其中所述設置分佈於設備屏幕上的多個取樣點,包括:   將所述設備屏幕劃分為多個子區域,設置分佈於所述多個子區域內的一個或多個取樣點。The method according to item 1 of the scope of patent application, wherein the setting of the plurality of sampling points distributed on the device screen includes: 划分 dividing the device screen into a plurality of sub-areas, and setting the One or more sampling points. 根據申請專利範圍第1或2項所述的方法,其中所述多個取樣點隨機分佈或者是均勻分佈。The method according to item 1 or 2 of the patent application scope, wherein the plurality of sampling points are randomly distributed or uniformly distributed. 根據申請專利範圍第1項所述的方法,其中所述多個取樣點分佈在所述設備屏幕上用於展示所述待測頁面的展示區域。The method according to item 1 of the scope of patent application, wherein the plurality of sampling points are distributed on a display area of the device screen for displaying the page to be tested. 根據申請專利範圍第4項所述的方法,其中所述展示區域為所述設備屏幕上除導航欄和視圖切換欄之外的區域。The method according to item 4 of the scope of patent application, wherein the display area is an area other than a navigation bar and a view switching bar on the screen of the device. 根據申請專利範圍第1項所述的方法,其中在判斷所述設備屏幕是否完成首屏描繪前,所述方法包括:   删除連續N次所獲取的像素值都不同的取樣點,所述N為第一預設整數。The method according to item 1 of the scope of patent application, wherein before judging whether the screen of the device completes the first screen drawing, the method includes: deleting sampling points that have different pixel values obtained N consecutive times, where N is The first preset integer. 根據申請專利範圍第6項所述的方法,其中所述按照預設時間間隔多次獲取各所述取樣點的像素值,包括:   對於連續M次所獲取的像素值相同的取樣點,停止獲取該取樣點的像素值,所述M為第二預設整數。The method according to item 6 of the scope of patent application, wherein the obtaining the pixel value of each of the sampling points multiple times according to a preset time interval includes: 停止 stopping sampling points that have the same pixel value obtained consecutively M times The pixel value of the sampling point, where M is a second preset integer. 根據申請專利範圍第7項所述的方法,其中當所有取樣點都停止獲取像素值後,若所有取樣點的像素值都相同,則重新執行所述按照預設時間間隔多次獲取各所述取樣點的像素值的步驟。The method according to item 7 of the scope of patent application, wherein after all the sampling points have stopped acquiring pixel values, if the pixel values of all the sampling points are the same, then re-executing the acquiring multiple times according to a preset time interval Steps to sample the pixel values of a point. 根據申請專利範圍第8項所述的方法,其中所述判斷所述設備屏幕是否完成首屏描繪,包括:   在所有取樣點都停止獲取像素值後,確定判斷所述設備屏幕完成首屏描繪。The method according to item 8 of the scope of patent application, wherein said determining whether the device screen has completed the first screen drawing includes: 确定 determining that the device screen has completed the first screen drawing after all sampling points have stopped acquiring pixel values. 根據申請專利範圍第8項所述的方法,其中所述根據所述取樣點的像素值的獲取次數及所述時間間隔,計算所述待測頁面的首屏描繪時長,包括:   確定所述M與所述時間間隔的乘積,根據所述待測頁面從開始加載至停止獲取像素值的時長與所述乘積的差值確定所述首屏描繪時長。The method according to item 8 of the scope of patent application, wherein the calculating the first screen drawing duration of the page to be tested according to the number of times of obtaining pixel values of the sampling point and the time interval includes: determining the The product of M and the time interval is used to determine the first screen drawing duration according to the difference between the length of time when the page to be measured is loaded from the beginning to the end of acquiring pixel values and the product. 一種計算頁面首屏描繪時長的裝置,包括:   設置模組,用於:設置分佈於設備屏幕上的多個取樣點;   獲取模組,用於:在待測頁面開始加載後,按照預設時間間隔多次獲取所述取樣點的像素值;   判斷模組,用於:對於多個所述取樣點,根據所述取樣點多次獲取的像素值是否相同,判斷所述設備屏幕是否完成首屏描繪;   計算模組,用於:在確定所述設備屏幕完成首屏描繪後,根據所述取樣點的像素值的獲取次數及所述時間間隔,計算所述待測頁面的首屏描繪時長。A device for calculating the length of the first screen drawing of a page includes: a setting module for: setting a plurality of sampling points distributed on a device screen; an acquisition module for: after a page to be tested starts to load, according to a preset The pixel value of the sampling point is acquired multiple times in a time interval; a judgment module is configured to: for multiple of the sampling points, determine whether the device screen has completed the first time according to whether the pixel value acquired multiple times at the sampling point is the same; Screen drawing; a computing module, configured to: after determining that the device screen has completed the first screen drawing, calculate the first screen drawing time of the page to be tested according to the number of times the pixel value of the sampling point is obtained and the time interval; long. 根據申請專利範圍第11項所述的裝置,其中所述設置模組,還用於:   將所述設備屏幕劃分為多個子區域,設置分佈於所述多個子區域內的一個或多個取樣點。The device according to item 11 of the scope of patent application, wherein the setting module is further configured to: 划分 divide the device screen into a plurality of sub-regions, and set one or more sampling points distributed in the plurality of sub-regions . 根據申請專利範圍第11或12項所述的裝置,其中所述多個取樣點隨機分佈或者是均勻分佈。The device according to item 11 or 12 of the scope of the patent application, wherein the plurality of sampling points are randomly distributed or uniformly distributed. 根據申請專利範圍第11項所述的裝置,其中所述多個取樣點分佈在所述設備屏幕上用於展示所述待測頁面的展示區域。The device according to item 11 of the scope of patent application, wherein the plurality of sampling points are distributed on a display area of the device screen for displaying the page to be tested. 根據申請專利範圍第14項所述的裝置,其中所述展示區域為所述設備屏幕上除導航欄和視圖切換欄之外的區域。The device according to item 14 of the scope of patent application, wherein the display area is an area other than a navigation bar and a view switching bar on the screen of the device. 根據申請專利範圍第11項所述的裝置,其中所述判斷模組,還用於:   在判斷所述設備屏幕是否完成首屏描繪前,删除連續N次所獲取的像素值都不同的取樣點,所述N為第一預設整數。The device according to item 11 of the scope of patent application, wherein the judgment module is further configured to: 判断 delete the sampling points that have different pixel values obtained N consecutive times before judging whether the device screen has completed the first screen drawing , Where N is a first preset integer. 根據申請專利範圍第16項所述的裝置,其中所述獲取模組,還用於:   對於連續M次所獲取的像素值相同的取樣點,停止獲取該取樣點的像素值,所述M為第二預設整數。The device according to item 16 of the scope of the patent application, wherein the acquisition module is further configured to: 停止 stop acquiring pixel values of the sampling points for the same pixel values obtained in consecutive M times, where M is The second preset integer. 根據申請專利範圍第17項所述的裝置,其中所述獲取模組,還用於:   當所有取樣點都停止獲取像素值後,若所有取樣點的像素值都相同,則重新執行所述按照預設時間間隔多次獲取各所述取樣點的像素值的步驟。The device according to item 17 of the scope of patent application, wherein the acquisition module is further configured to: After all sampling points stop acquiring pixel values, if the pixel values of all sampling points are the same, re-execute the The step of obtaining the pixel value of each of the sampling points multiple times at a preset time interval. 根據申請專利範圍第18項所述的裝置,其中所述判斷模組,還用於:在所有取樣點都停止獲取像素值後,確定判斷所述設備屏幕完成首屏描繪。The device according to item 18 of the scope of the patent application, wherein the determination module is further configured to: after all sampling points stop acquiring pixel values, determine to determine that the screen of the device completes the first-screen drawing. 根據申請專利範圍第18項所述的裝置,其中所述計算模組,還用於:   確定所述M與所述時間間隔的乘積,根據所述待測頁面從開始加載至停止獲取像素值的時長與所述乘積的差值確定所述首屏描繪時長。The device according to item 18 of the scope of patent application, wherein the calculation module is further configured to: determine a product of the M and the time interval, and calculate a pixel value from the start of loading the page to be tested to the stop of obtaining the pixel value The difference between the duration and the product determines the duration of the first screen drawing. 一種電子設備,包括:   處理器;   用於儲存處理器可執行指令的記憶體;   其中,所述處理器被配置為:   設置分佈於設備屏幕上的多個取樣點;   在待測頁面開始加載後,按照預設時間間隔多次獲取所述取樣點的像素值;   對於多個所述取樣點,根據所述取樣點多次獲取的像素值是否相同,判斷所述設備屏幕是否完成首屏描繪;   在確定所述設備屏幕完成首屏描繪後,根據所述取樣點的像素值的獲取次數及所述時間間隔,計算所述待測頁面的首屏描繪時長。An electronic device includes: a processor; a memory for storing processor-executable instructions; wherein the processor is configured to: set a plurality of sampling points distributed on a device screen; 后 after a page to be tested starts to load Obtaining pixel values of the sampling point multiple times according to a preset time interval; for multiple of the sampling points, determining whether the device screen has completed the first screen drawing according to whether the pixel values obtained multiple times by the sampling point are the same; After it is determined that the first screen drawing of the device screen is completed, the first screen drawing duration of the page to be tested is calculated according to the number of times of obtaining pixel values of the sampling point and the time interval.
TW107130312A 2017-10-31 2018-08-30 Method, device and electronic device for calculating the duration of the first screen of a page TWI671647B (en)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
??201711047877.6 2017-10-31
CN201711047877.6A CN107885645B (en) 2017-10-31 2017-10-31 Method and device for calculating rendering duration of first screen of page and electronic equipment

Publications (2)

Publication Number Publication Date
TW201918911A TW201918911A (en) 2019-05-16
TWI671647B true TWI671647B (en) 2019-09-11

Family

ID=61783250

Family Applications (1)

Application Number Title Priority Date Filing Date
TW107130312A TWI671647B (en) 2017-10-31 2018-08-30 Method, device and electronic device for calculating the duration of the first screen of a page

Country Status (3)

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

Families Citing this family (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107885645B (en) * 2017-10-31 2020-06-23 阿里巴巴集团控股有限公司 Method and device for calculating rendering duration of first screen of page and electronic equipment
CN108671547A (en) * 2018-04-24 2018-10-19 腾讯科技(深圳)有限公司 A kind of method, apparatus and storage medium of the initial screen time obtaining application
CN109271600B (en) * 2018-08-16 2022-02-22 微梦创科网络科技(中国)有限公司 Method, system and device for monitoring performance data
CN109446040B (en) * 2018-09-21 2021-01-22 网宿科技股份有限公司 Method and device for acquiring starting duration of application interface and terminal equipment
CN109344044B (en) * 2018-10-08 2022-05-31 杭州有赞科技有限公司 Method and system for calculating rendering time of first screen of page
CN110209978B (en) * 2019-01-28 2023-05-16 腾讯科技(深圳)有限公司 Data processing method and related device
CN110781063B (en) * 2019-10-25 2023-12-05 北京博睿宏远数据科技股份有限公司 Method, device, equipment and storage medium for measuring first screen time of web page
CN112669404B (en) * 2020-12-28 2023-11-14 北京达佳互联信息技术有限公司 Image processing method, device, electronic equipment and storage medium

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
TW200511775A (en) * 2003-06-02 2005-03-16 Qualcomm Inc Generating and implementing a signal protocol and interface for higher data rates
TW200525964A (en) * 2003-08-13 2005-08-01 Qualcomm Inc A signal interface for higher data rates
TW200623765A (en) * 2004-06-04 2006-07-01 Qualcomm Inc High data rate interface apparatus and method
US20120249411A1 (en) * 2011-03-29 2012-10-04 Hon Hai Precision Industry Co., Ltd. Screen protection system and method of an electronic device

Family Cites Families (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102624576B (en) * 2011-01-27 2016-04-20 腾讯科技(深圳)有限公司 A kind of method and system of web page download time of automatic test browser
CN103812713A (en) * 2012-11-06 2014-05-21 腾讯科技(深圳)有限公司 Method and apparatus for testing webpage loading time
CN103778254B (en) * 2014-02-24 2017-08-01 北京国双科技有限公司 The processing method of page access data, apparatus and system
US20160124696A1 (en) * 2014-11-03 2016-05-05 Qualcomm Innovation Center, Inc. Downsampled rendering of web page loads to save power
CN104899336B (en) * 2015-07-01 2018-05-22 北京博睿宏远数据科技股份有限公司 It is a kind of to measure the first method for shielding complete render time of webpage
CN105630566A (en) * 2016-02-26 2016-06-01 北京奇虎科技有限公司 Application page loading duration determining method and application page loading duration determining device
CN107885645B (en) * 2017-10-31 2020-06-23 阿里巴巴集团控股有限公司 Method and device for calculating rendering duration of first screen of page and electronic equipment

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
TW200511775A (en) * 2003-06-02 2005-03-16 Qualcomm Inc Generating and implementing a signal protocol and interface for higher data rates
TW200525964A (en) * 2003-08-13 2005-08-01 Qualcomm Inc A signal interface for higher data rates
TW200623765A (en) * 2004-06-04 2006-07-01 Qualcomm Inc High data rate interface apparatus and method
US20120249411A1 (en) * 2011-03-29 2012-10-04 Hon Hai Precision Industry Co., Ltd. Screen protection system and method of an electronic device

Also Published As

Publication number Publication date
CN107885645B (en) 2020-06-23
CN107885645A (en) 2018-04-06
TW201918911A (en) 2019-05-16
WO2019085598A1 (en) 2019-05-09

Similar Documents

Publication Publication Date Title
TWI671647B (en) Method, device and electronic device for calculating the duration of the first screen of a page
JP6214547B2 (en) Measuring the rendering time of a web page
CN110297996B (en) Animation display method, device, equipment and storage medium based on H5 page
CN109034115A (en) Video knows drawing method, device, terminal and storage medium
WO2017124811A1 (en) Data drawing method and apparatus, terminal and storage medium
CN111752557A (en) Display method and device
US20190200008A1 (en) Method and device for testing screen fluency of terminal, and terminal device
CN112947969B (en) Page off-screen rendering method, device, equipment and readable medium
CN107977137B (en) Object display method, device and equipment of application page
CN109388317B (en) Picture loading method, terminal device and storage medium
JP2015531918A (en) Hit test method and apparatus
US11941728B2 (en) Previewing method and apparatus for effect application, and device, and storage medium
WO2015180448A1 (en) Method and device for switching playing mode of mobile terminal, storage medium and program
CN108255546A (en) A kind of implementation method and device of data loading animation
CN110471700B (en) Graphic processing method, apparatus, storage medium and electronic device
CN107943805B (en) Animation rendering and publishing method and device
Kelly et al. Basic introduction to pygame
CN112148395A (en) Page display method, device, equipment and storage medium
US20180336122A1 (en) Generating application flow entities
CN114003160A (en) Data visualization display method and device, computer equipment and storage medium
CN110858154A (en) Switching display method and device of carousel pictures, electronic equipment and storage medium
CN101996390B (en) Image copying method and device
CN114913277A (en) Method, device, equipment and medium for three-dimensional interactive display of object
CN113763552A (en) Three-dimensional geographic model display method and device, computer equipment and storage medium
CN110557627B (en) Performance monitoring method and device and storage medium