Summary of the invention
Test method, device and the electronic equipment for being designed to provide a kind of page presentation speed of the embodiment of the present invention,Test result is obtained in time after a page presentation to realize.Specific technical solution is as follows:
In a first aspect, a kind of test method of page presentation speed is provided, this method comprises:
At the time of by the invocation target page, it is determined as page presentation start time;
Since the page presentation start time, a screen interception operation is executed at interval of preset duration, is obtained pre-If quantity screenshot and the screenshot corresponding interception moment;The product of the preset duration and the preset quantity is greater than defaultMaximum duration consumed by displayed page;
From the screenshot obtained, target screenshot is obtained;The target screenshot with intercept it is obtained before the target screenshotThe similarity of any screenshot is respectively less than similarity threshold, and the target screenshot with intercept it is obtained after the target screenshotThe similarity of all screenshots is all larger than or is equal to the similarity threshold;
By the target screenshot corresponding interception moment, it is determined as page presentation finish time;
The time difference between the page presentation finish time and the page presentation start time is calculated, target is determined asPage presentation speed.
Optionally, described since the page presentation start time, a screen interception is executed at interval of preset durationOperation, the step of obtaining preset quantity screenshot and the screenshot corresponding interception moment, comprising:
Start the timer of preset duration;
When the timer reaches the preset duration, screen interception operation is executed, obtains cutting for current display pageFigure and the screenshot corresponding interception moment;
If the quantity of the screenshot obtained is less than preset quantity, return described when the timer reaches described defaultWhen duration, the step of screen interception operates is executed.
Optionally, described from the screenshot obtained, obtain target screenshot the step of, comprising:
According to interception time sequence, select the corresponding screenshot of previous interception moment at the last one interception moment as currentScreenshot;
Determine the similarity of current screenshot screenshot corresponding with the last one interception moment;
If two screenshot similarities are greater than or equal to the similarity threshold, according to interception time sequence, when by interceptingBefore being engraved in the current screenshot interception moment and the screenshot of the interception moment apart from current screenshot recently is determined as current screenshot,Return to described the step of comparing current screenshot screenshot corresponding with the last one interception moment;
If two screenshot similarities are less than the similarity threshold, according to interception time sequence, the interception moment is being worked asAfter the preceding screenshot interception moment and the screenshot of the interception moment apart from current screenshot recently is determined as target screenshot.
Optionally, in the step of the similarity of the determination current screenshot screenshot corresponding with the last one interception momentBefore rapid, further includes:
Obtain the binary data of the current screenshot and the binary system of the last one interception moment corresponding screenshotData;
The step of similarity of determination current screenshot screenshot corresponding with the last one interception moment, comprising:
By the bits per inch evidence of the binary data of the current screenshot, screenshot corresponding with the last one described interception momentBinary data in compared with the bits per inch carries out numerical value according to the identical data of digit;
According to the comparison result of the bits per inch evidence of the binary data of the current screenshot, determining has the number of identical numerical valueAccording to pair quantity;
According to the quantity of the data pair with identical numerical value, the current screenshot and the last one described interception are determinedThe similarity of moment corresponding screenshot.
Optionally, in the step of the similarity of the determination current screenshot screenshot corresponding with the last one interception momentBefore rapid, further includes:
According to the gray value of each pixel in the current screenshot, binary conversion treatment is carried out to the current screenshot, is obtainedObtain the binary image of the current screenshot;
According to the gray value of each pixel in the last one described interception moment corresponding screenshot, to it is described the last oneIt intercepts moment corresponding screenshot and carries out binary conversion treatment, obtain the binary picture of the last one interception moment corresponding screenshotPicture;
The step of similarity of determination current screenshot screenshot corresponding with the last one interception moment, comprising:
By each pixel of the binary image of the current screenshot, with the last one described corresponding section of the moment of interceptionCompared with each pixel position, identical pixel carries out gray value in the binary image of figure;
According to the comparison result of each pixel of the binary image of the current screenshot, determining has same grayscale valuePixel pair quantity;
According to the quantity of the pixel pair with same grayscale value, determine the current screenshot and it is described the last oneIntercept the similarity of moment corresponding screenshot.
Optionally, described since the page presentation start time, a secondary screen is executed at interval of preset duration and is cutBefore the step of extract operation, further includes:
Judge the target pages whether complete call initialization logic;
After the target pages complete call initialization logic, execution is described to open from the page presentation start timeBegin, executes a screen interception operation at interval of preset duration.
Optionally, the time between the calculating page presentation finish time and the page presentation start timeDifference is determined as after the step of target pages show speed, further includes:
It stores the target pages and shows speed;
Calculate the average value that the target pages show speed and stored all page presentation speed;
Speed, the stored page presentation speed and the average value are shown according to the target pages, are generatedStatistical documents.
Second aspect, provides a kind of test device of page presentation speed, which includes:
Start time determining module is determined as page presentation start time at the time of for by the invocation target page;
Interception module, for executing a secondary screen at interval of preset duration and cutting since the page presentation start timeExtract operation obtains preset quantity screenshot and the screenshot corresponding interception moment;The preset duration and the preset quantityProduct be greater than maximum duration consumed by default displayed page;
Target screenshot obtains module, for obtaining target screenshot from the screenshot obtained;The target screenshot and interception instituteThe similarity for stating any screenshot obtained before target screenshot is respectively less than similarity threshold, and the target screenshot and interception instituteThe similarity for stating all screenshots obtained after target screenshot is all larger than or is equal to the similarity threshold;
Finish time determining module, for by the target screenshot corresponding interception moment, being determined as page presentation to terminateMoment;
Show speed determination module, for calculate the page presentation finish time and the page presentation start time itBetween time difference, be determined as target pages show speed.
Optionally, the interception module, is specifically used for:
Start the timer of preset duration;When the timer reaches the preset duration, screen interception operation is executed,Obtain screenshot and the screenshot corresponding interception moment of current display page;If the quantity of the screenshot obtained is less than defaultThe step of quantity, then return is described when the timer reaches the preset duration, executes screen interception operation.
Optionally, the target screenshot obtains module, comprising: selecting unit, similarity determining unit, return unit and meshMark screenshot determination unit;
The selecting unit, for according to interception time sequence, selecting the previous interception moment at the last one interception momentCorresponding screenshot is as current screenshot;
The similarity determining unit, for determining current screenshot screenshot corresponding with the last one interception momentSimilarity;
The return unit, if being greater than or equal to the similarity threshold for two screenshot similarities, according to interceptionTime sequencing cuts one of the interception moment for intercepting the moment before current screenshot intercepts the moment and apart from current screenshot recentlyFigure is determined as current screenshot, returns to described the step of comparing current screenshot screenshot corresponding with the last one interception moment;
The target screenshot determination unit, if being less than the similarity threshold for two screenshot similarities, according to cuttingTime sequencing is taken, one of interception moment of the moment after current screenshot intercepts the moment and apart from current screenshot recently will be interceptedScreenshot is determined as target screenshot.
Optionally, device further include: binary data obtains module;
The binary data obtains module, for obtain the current screenshot binary data and it is described the last oneIntercept the binary data of moment corresponding screenshot;
The similarity determining unit, specifically for by the bits per inch evidence of the binary data of the current screenshot, with instituteIt states in the binary data of the last one interception moment corresponding screenshot and carries out numerical value according to the identical data of digit with the bits per inchCompare;According to the comparison result of the bits per inch evidence of the binary data of the current screenshot, determining has the data of identical numerical valuePair quantity;According to the quantity of the data pair with identical numerical value, the current screenshot and the last one described section are determinedTake the similarity of moment corresponding screenshot.
Optionally, device further include: binarization block;
The binarization block, for the gray value according to each pixel in the current screenshot, to described current sectionFigure carries out binary conversion treatment, obtains the binary image of the current screenshot;It is corresponding according to the last one described interception momentThe gray value of each pixel in screenshot carries out binary conversion treatment to the last one described interception moment corresponding screenshot, obtainsThe binary image of the last one interception moment corresponding screenshot;
The similarity determining unit, specifically for by each pixel of the binary image of the current screenshot, withPixel identical with each pixel position clicks through in the binary image of the last one interception moment corresponding screenshotRow gray value compares;According to the comparison result of each pixel of the binary image of the current screenshot, determine with identicalThe quantity of the pixel pair of gray value;According to the quantity of the pixel pair with same grayscale value, described current section is determinedScheme the similarity of screenshot corresponding with the last one described interception moment.
Optionally, device further include: initialization judgment module;
The initialization judgment module, for judge the target pages whether complete call initialization logic;When describedAfter target pages complete call initialization logic, execute it is described since the page presentation start time, at interval of it is default whenIt is long to execute a screen interception operation.
Optionally, device further include: memory module, computing module and generation module;
The memory module, for depositing after the displaying speed determination module has determined that target pages show speedIt stores up the target pages and shows speed;
The computing module shows speed and stored all page presentation speed for calculating the target pagesAverage value;
The generation module, for showing speed, the stored page presentation speed according to the target pagesWith the average value, statistical documents is generated.
The third aspect, provides a kind of electronic equipment, the electronic equipment include processor, communication interface, memory andCommunication bus, wherein processor, communication interface, memory complete mutual communication by communication bus;
Memory, for storing computer program;
Processor when for executing the program stored on memory, realizes any of the above-described page presentation speedTest method the step of.
Present invention implementation additionally provides a kind of computer readable storage medium, storage in the computer readable storage mediumThere is computer program, the computer program realizes the test of any of the above-described page presentation speed when being executed by processorThe step of method.
The embodiment of the invention also provides a kind of computer program products comprising instruction, when it runs on computersWhen, so that computer executes the test method of any of the above-described page presentation speed.
Test method, device and the electronic equipment of a kind of page presentation speed provided in an embodiment of the present invention, with existing skillArt first records screen, then analyzes the start frame and end frame of page presentation frame by frame, finally obtains the mode phase of page presentation speedThan the invoking page moment can be determined as page presentation start time by the embodiment of the present invention, and execute screen from this momentCurtain interception, by comparing the similarity of screenshot, from the screenshot obtained, obtains target after the completion of end objectives page presentationThen screenshot calculates the time difference between the interception moment corresponding with target screenshot page presentation start time, by calculated resultThe time required to being determined as page presentation.As it can be seen that the embodiment of the present invention only needs that page can be obtained by simply comparing and calculatingThe time required to face is shown, therefore time-consuming easy to operate is short, can obtain in time test result after page presentation.
Certainly, implement any of the products of the present invention or method it is not absolutely required at the same reach all the above excellentPoint.
Specific embodiment
Following will be combined with the drawings in the embodiments of the present invention, and technical solution in the embodiment of the present invention is described.
Test result is obtained in time after a page presentation in order to realize, the embodiment of the invention provides a kind of pagesTest method, device and the electronic equipment of face displaying speed.
Referring to Fig. 1, Fig. 1 is a kind of test method flow chart of page presentation speed of the embodiment of the present invention, including as followsStep:
Step 101, at the time of by the invocation target page, it is determined as page presentation start time.
In a kind of implementation, the method that system is shown by invoking page carrys out displayed page.Acquisition system invocation targetCurrent system moment TB when the page, that is, at the time of the invocation target page, and TB is saved and is used as target in memoryPage presentation start time.
In embodiments of the present invention, target pages can be the application program page in terminal.Such as: target pages can be withFor the homepage of the photograph album in terminal.
Step 102, since page presentation start time, a screen interception operation is executed at interval of preset duration, is obtainedObtain preset quantity screenshot and the screenshot corresponding interception moment.
Specifically, can star the timer that timing length is preset duration t;When reaching timer timing length,A screen interception operation is executed, the screenshot and the corresponding interception time of the screenshot of current display page are obtained;Then judgeWhether the quantity of the screenshot obtained is equal to preset quantity n, if it is, stopping executing screen interception operation;If it is not, thenReturn to the step of starting timing length is the timer of preset duration t.
In this hair embodiment, in order to guarantee corresponding section of finish time in the screenshot got comprising page presentationFigure, the time for executing screen interception operation need to be greater than maximum duration consumed by default displayed page.So needing to be arranged, in advanceIf the product of duration and preset quantity is greater than maximum duration consumed by default displayed page.
For example, maximum duration consumed by default displayed page can be 500 milliseconds, then preset duration t can be setIt is 10 milliseconds, n is set as 100, the product of such t and n are greater than maximum duration consumed by default displayed page.
In embodiments of the present invention, time interval t can be reduced under the premise of the product of t and n is constant, so that obtainingThe target screenshot corresponding interception moment closer to page presentation finish time, allow to obtain page presentation speed more accurate.
In embodiments of the present invention, a screen interception operation can have been executed with every, has recorded the current screen interception that executes and graspsThe number w of work continues to execute screen interception operation if w < n;If w=n, stop timing device.
Specifically, executing a screen interception operation at interval of preset duration since page presentation start timeBefore step, can also include:
Judge target pages whether complete call initialization logic;After target pages complete call initialization logic, holdRow executes a screen interception operation since page presentation start time, at interval of preset duration.
Wherein, initialization logic includes: creation page view, loads local data and request network from local data baseData.
Before executing screen interception operation, judge whether to complete initialization logic, it is ensured that the screenshot being truncated to isScreenshot during target pages displaying, so that the target pages obtained show that speed is more accurate.If executing screen interceptionBefore, do not judge whether to complete initialization logic, then target pages may be without calling initialization logic, so that target pagesIt can not show, the screenshot being truncated at this time is not the screenshot during target pages are shown;Alternatively, starting to execute screen interception behaviourWhen making, target pages do not complete also and call initialization logic, so that having part screenshot in the screenshot being truncated to is not target pagesScreenshot during displaying.
Optionally, judge that method that whether initialization logic is called may is that and first enumerate whole processes, then again pieceThe object handle for enumerating each process is judging object handle name with the presence or absence of the file path judged in needs.
Specifically, screen interception operates, it may include: that the current full page screenshot of interception or the interception current portions page are cutFigure.If can choose part of screen interception constant in target pages containing the part changed in target pages.
In embodiments of the present invention, interception moment of the current system moment as screenshot is obtained, by section of screenshot and screenshotIt takes the time to correspond, saves in memory.
Step 103, from the screenshot obtained, target screenshot is obtained.
Wherein, target screenshot and the similarity of any screenshot obtained before interception target screenshot are respectively less than similarity thresholdValue, and target screenshot and the similarity of all screenshots obtained after interception target screenshot are all larger than or are equal to similarity threshold.
Step 104, by the target screenshot corresponding interception moment, it is determined as page presentation finish time.
In a kind of implementation, target can be obtained from each screenshot corresponding interception moment that memory has been savedThe target screenshot of the acquisition corresponding interception moment is determined as page presentation finish time by the screenshot corresponding interception moment.
Step 105, the time difference between page presentation finish time and page presentation start time is calculated, target is determined asPage presentation speed.In a kind of implementation, target pages show that speed can be and calculate page presentation finish time TE and pageFace shows the difference of start time TB, i.e. TE-TB.
A kind of test method of page presentation speed provided in an embodiment of the present invention records screen with prior art, thenThe start frame and end frame of page presentation are analyzed frame by frame, and the mode for finally obtaining page presentation speed is compared, the embodiment of the present inventionThe invoking page moment can be determined as page presentation start time, and execute screen interception from this moment, in terminal meshAfter the completion of marking page presentation, by comparing the similarity of screenshot, from the screenshot obtained, target screenshot is obtained, page is then calculatedFace shows the time difference between the interception moment corresponding with target screenshot start time, and calculated result is determined as page presentation instituteIt takes time.As it can be seen that the embodiment of the present invention is only needed by simply comparing and calculating, the time required to page presentation can be obtained,Therefore time-consuming easy to operate is short, can obtain in time test result after page presentation.
Referring to fig. 2, Fig. 2 is the acquisition target screenshot in a kind of test method of page presentation speed of the embodiment of the present inventionMethod flow diagram, include the following steps:
Step 201, according to interception time sequence, the corresponding screenshot of previous interception moment at the last one interception moment is selectedAs current screenshot.
In a kind of implementation, it can be selected from back to front since second from the bottom screenshot according to interception time sequenceOne screenshot is as current screenshot.
Step 202, the similarity of current screenshot screenshot corresponding with the last one interception moment is determined.
In a kind of implementation, the binary data of current screenshot and the last one corresponding section of the moment of interception can be obtainedThe binary data of figure;Then corresponding with the last one interception moment by the bits per inch evidence of the binary data of current screenshotIn the binary data of screenshot compared with the bits per inch carries out numerical value according to the identical data of digit;Further according to current screenshot two intoThe comparison result of the bits per inch evidence of data processed, determining has the quantity of the data pair of identical numerical value;According to identical numerical valueThe quantity of data pair determines the similarity of current screenshot screenshot corresponding with the last one interception moment.
For example, by each data bit of the binary data of two pictures, it is corresponding to compare, if the binary number of two picturesHave in more than or equal to 95% data to numerical value all having the same, it is determined that the similarity of this two picture is greater than or waitsIn similarity threshold.
In another implementation, can according to the gray value of pixel each in current screenshot, to current screenshot intoRow binary conversion treatment obtains the binary image of current screenshot;According to each picture in the last one interception moment corresponding screenshotThe gray value of vegetarian refreshments carries out binary conversion treatment to the last one interception moment corresponding screenshot, obtains the last one interception momentThe binary image of corresponding screenshot;Then by each pixel of the binary image of current screenshot, with the last one interceptionCompared with each pixel position, identical pixel carries out gray value in the binary image of moment corresponding screenshot;Root againAccording to the comparison result of each pixel of the binary image of current screenshot, determining has the number of the pixel pair of same grayscale valueAmount;Further according to the quantity of the pixel pair with same grayscale value, determine that current screenshot is corresponding with the last one interception momentThe similarity of screenshot.
For example, by two picture binaryzations, it is corresponding to compare by each pixel of two binaryzation pictures, if two figuresPiece has more than or equal to 98% pixel to gray value all having the same, it is determined that the similarity of this two picture is greater than or waitsIn similarity threshold.
Step 203, it if two screenshot similarities are greater than or equal to similarity threshold, according to interception time sequence, will cutA screenshot for taking interception moment of the moment before current screenshot intercepts the moment and apart from current screenshot nearest is determined as currentlyScreenshot returns to the step of comparing current screenshot screenshot corresponding with the last one interception moment.
In a kind of implementation, if current screenshot is greater than or waits with the similarity that the last one intercepts moment corresponding screenshotIn similarity threshold, then it represents that current screenshot is the screenshot being truncated to after page presentation, then according still further to interception time sequence,Selection intercepts the screenshot of current screenshot previous moment interception, is determined as current screenshot, judges current screenshot and the last one againIntercept the similarity of moment corresponding screenshot.
Step 204, if two screenshot similarities, which are less than similarity threshold, will intercept the moment according to interception time sequenceThe screenshot of interception moment recently after current screenshot intercepts the moment and apart from current screenshot is determined as target screenshot.
In a kind of implementation, if the similarity of current screenshot screenshot corresponding with the last one interception moment is less than similarSpend threshold value, then it represents that current screenshot is the screenshot being truncated to before page presentation terminates, so according to interception time sequence, it is current to cutAfter latter screenshot of figure is then page presentation, first screenshot being truncated to, that is, by latter of current screenshot IMGiScreenshot IMG (i+1) is determined as target screenshot, wherein IMGi indicates that i-th screenshot, IMG (i+1) indicate (i+1) screenshot.
As it can be seen that using the embodiment of the present invention, it can be after page presentation, from back to front by each screenshot and finallyOne screenshot comparison, more quickly finds target screenshot, so that page presentation speed is calculated, it is complete in page presentation in this wayBi Hou can calculate page presentation speed in time, and speed is fast, can be adapted for a large amount of statistical conditions.
Referring to Fig. 3, Fig. 3 is the statistical documents in a kind of test method of page presentation speed provided in an embodiment of the present inventionOutput method flow chart, includes the following steps:
Step 301, storage target pages show speed.
In a kind of implementation, after the displaying speed for calculating this target pages, by this page presentation speed recordIn disk.
Step 302, the average value that target pages show speed and stored all page presentation speed is calculated.
In a kind of implementation, by all page presentations speed stored in this page presentation speed T and databaseDegree Ti~Tn averages, it may be assumed that
Wherein, Tn is n-th of page presentation speed in database, and N is pre-stored page presentation speed in databaseQuantity.
In embodiments of the present invention, calculated average value can be stored in disk.
Step 303, speed, stored page presentation speed and average value are shown according to target pages, generates statisticsDocument.
In a kind of implementation, statistical documents can be the readable formats such as table, text or database.For example, statisticsIt, specifically can be as shown in table 1 when document is table:
| Serial number | Speed (unit: millisecond/page) |
| 1 | 500 |
| 2 | 400 |
| 3 | 600 |
| This | 500 |
| Average value | 500 |
Table 1
In embodiments of the present invention, after generating statistical documents, a dialog box can be popped up and show statistical documents, orThe file comprising statistical documents is generated, for statistical documents to be showed user.
As it can be seen that using the embodiment of the present invention page presentation duration can be calculated and generate after page presentationStatistical documents, and statistical documents is showed into user, such user can obtain page presentation after page presentation in timeAs a result, easy to use.
Based on the same technical idea, corresponding to embodiment of the method shown in Fig. 1, the embodiment of the invention also provides a kind of pagesFace shows the test device of speed, as shown in figure 4, the device includes:
Start time determining module 401 is determined as page presentation start time at the time of for by the invocation target page;
Interception module 402, for executing a screen interception at interval of preset duration since page presentation start timeOperation obtains preset quantity screenshot and the screenshot corresponding interception moment;The product of preset duration and preset quantity is greater thanMaximum duration consumed by default displayed page;
Target screenshot obtains module 403, for obtaining target screenshot in the screenshot of acquisition;Target screenshot and interception targetThe similarity of any screenshot obtained is respectively less than similarity threshold, and institute after target screenshot and interception target screenshot before screenshotThe similarity of all screenshots obtained is all larger than or is equal to similarity threshold;
Finish time determining module 404 is used for by the target screenshot corresponding interception moment, at the end of being determined as page presentationIt carves;
Speed determination module 405 is shown, for calculating between page presentation finish time and page presentation start timeTime difference is determined as target pages and shows speed.
Optionally, interception module 402 can be specifically used for:
Start the timer of preset duration;When timer reaches preset duration, screen interception operation is executed, is obtained currentShow screenshot and the screenshot corresponding interception moment of the page;If the quantity of the screenshot obtained is less than preset quantity,The step of returning when timer reaches preset duration, executing screen interception operation.
Optionally, target screenshot obtains module 403, may include: selecting unit, similarity determining unit, return unitWith target screenshot determination unit;
Selecting unit, for according to interception time sequence, selecting the previous interception moment at the last one interception moment correspondingScreenshot as current screenshot;
Similarity determining unit, for determining the similarity of current screenshot screenshot corresponding with the last one interception moment;
Return unit, if being greater than or equal to similarity threshold for two screenshot similarities, according to interception time sequence,The screenshot of interception moment of the moment before current screenshot intercepts the moment and apart from current screenshot recently will be intercepted to be determined asCurrent screenshot returns to the step of comparing current screenshot screenshot corresponding with the last one interception moment;
Target screenshot determination unit, it is suitable according to interception time if being less than similarity threshold for two screenshot similaritiesSequence will intercept the moment after current screenshot intercepts the moment and determine apart from a nearest screenshot of the interception moment of current screenshotFor target screenshot.
Optionally, which can also include: that binary data obtains module;
Binary data obtains module, and the binary data for obtaining current screenshot is corresponding with the last one interception momentScreenshot binary data;
Similarity determining unit, specifically for by the bits per inch evidence of the binary data of current screenshot, with the last one sectionIt takes in the binary data of moment corresponding screenshot compared with the bits per inch carries out numerical value according to the identical data of digit;According to currentThe comparison result of the bits per inch evidence of the binary data of screenshot, determining has the quantity of the data pair of identical numerical value;According to havingThe quantity of the data pair of identical numerical value determines the similarity of current screenshot screenshot corresponding with the last one interception moment.
Optionally, which can also include: binarization block;
Binarization block carries out binaryzation to current screenshot for the gray value according to pixel each in current screenshotProcessing, obtains the binary image of current screenshot;According to the ash of each pixel in the last one interception moment corresponding screenshotAngle value carries out binary conversion treatment to the last one interception moment corresponding screenshot, obtains the last one corresponding section of the moment of interceptionThe binary image of figure;
Similarity determining unit, specifically for by each pixel of the binary image of current screenshot, with the last oneIt intercepts compared with each pixel position, identical pixel carries out gray value in the binary image of moment corresponding screenshot;According to the comparison result of each pixel of the binary image of current screenshot, the pixel pair with same grayscale value is determinedQuantity;According to the quantity of the pixel pair with same grayscale value, determine that current screenshot is corresponding with the last one interception momentThe similarity of screenshot.
Optionally, which can also include: initialization judgment module;
Initialize judgment module, for judge target pages whether complete call initialization logic;When target pages are completedIt after calling initialization logic, executes since page presentation start time, executes a screen interception behaviour at interval of preset durationMake.
Optionally, which can also include: memory module, computing module and generation module;
Memory module, for storing page object after showing that speed determination module has determined that target pages show speedFace shows speed;
Computing module shows being averaged for speed and stored all page presentation speed for calculating target pagesValue;
Generation module is generated for showing speed, stored page presentation speed and average value according to target pagesStatistical documents.
A kind of test device of page presentation speed provided in an embodiment of the present invention records screen with prior art, thenThe start frame and end frame of page presentation are analyzed frame by frame, and the mode for finally obtaining page presentation speed is compared, the embodiment of the present inventionThe invoking page moment can be determined as page presentation start time, and execute screen interception from this moment, in terminal meshAfter the completion of marking page presentation, by comparing the similarity of screenshot, from the screenshot obtained, target screenshot is obtained, page is then calculatedFace shows the time difference between the interception moment corresponding with target screenshot start time, and calculated result is determined as page presentation instituteIt takes time.As it can be seen that the embodiment of the present invention is only needed by simply comparing and calculating, the time required to page presentation can be obtained,Therefore time-consuming easy to operate is short, can obtain in time test result after page presentation.
The embodiment of the invention also provides a kind of electronic equipment, as shown in figure 5, include processor 501, communication interface 502,Memory 503 and communication bus 504, wherein processor 501, communication interface 502, memory 503 are complete by communication bus 504At mutual communication,
Memory 503, for storing computer program;
Processor 501 when for executing the program stored on memory 503, realizes following steps:
At the time of by the invocation target page, it is determined as page presentation start time;
Since page presentation start time, a screen interception operation is executed at interval of preset duration, obtains present countAmount screenshot and the screenshot corresponding interception moment;The product of preset duration and preset quantity is greater than default displayed page and is disappearedThe maximum duration of consumption;
From the screenshot obtained, target screenshot is obtained;Any obtained is cut before target screenshot and interception target screenshotThe similarity of figure is respectively less than similarity threshold, and the similarity of target screenshot and all screenshots obtained after interception target screenshotIt is all larger than or is equal to similarity threshold;
By the target screenshot corresponding interception moment, it is determined as page presentation finish time;
The time difference between page presentation finish time and page presentation start time is calculated, target pages displaying is determined asSpeed.
The communication bus that above-mentioned electronic equipment is mentioned can be Peripheral Component Interconnect standard (Peripheral ComponentInterconnect, PCI) bus or expanding the industrial standard structure (Extended Industry StandardArchitecture, EISA) bus etc..The communication bus can be divided into address bus, data/address bus, control bus etc..For justIt is only indicated with a thick line in expression, figure, it is not intended that an only bus or a type of bus.
Communication interface is for the communication between above-mentioned electronic equipment and other equipment.
Memory may include random access memory (Random Access Memory, RAM), also may include non-easyThe property lost memory (Non-Volatile Memory, NVM), for example, at least a magnetic disk storage.Optionally, memory may be used alsoTo be storage device that at least one is located remotely from aforementioned processor.
Above-mentioned processor can be general processor, including central processing unit (Central Processing Unit,CPU), network processing unit (Network Processor, NP) etc.;It can also be digital signal processor (Digital SignalProcessing, DSP), it is specific integrated circuit (Application Specific Integrated Circuit, ASIC), existingIt is field programmable gate array (Field-Programmable Gate Array, FPGA) or other programmable logic device, discreteDoor or transistor logic, discrete hardware components.
In another embodiment provided by the invention, a kind of computer readable storage medium is additionally provided, which canIt reads to be stored with computer program in storage medium, the computer program realizes any of the above-described page presentation when being executed by processorThe step of test method of speed.
In another embodiment provided by the invention, a kind of computer program product comprising instruction is additionally provided, when itWhen running on computers, so that computer executes the test method of any page presentation speed in above-described embodiment.
In the above-described embodiments, can come wholly or partly by software, hardware, firmware or any combination thereof realIt is existing.When implemented in software, it can entirely or partly realize in the form of a computer program product.The computer programProduct includes one or more computer instructions.When loading on computers and executing the computer program instructions, all orIt partly generates according to process or function described in the embodiment of the present invention.The computer can be general purpose computer, dedicated meterCalculation machine, computer network or other programmable devices.The computer instruction can store in computer readable storage mediumIn, or from a computer readable storage medium to the transmission of another computer readable storage medium, for example, the computerInstruction can pass through wired (such as coaxial cable, optical fiber, number from a web-site, computer, server or data centerUser's line (DSL)) or wireless (such as infrared, wireless, microwave etc.) mode to another web-site, computer, server orData center is transmitted.The computer readable storage medium can be any usable medium that computer can access orIt is comprising data storage devices such as one or more usable mediums integrated server, data centers.The usable medium can be withIt is magnetic medium, (for example, floppy disk, hard disk, tape), optical medium (for example, DVD) or semiconductor medium (such as solid state hard diskSolid State Disk (SSD)) etc..
It should be noted that, in this document, relational terms such as first and second and the like are used merely to a realityBody or operation are distinguished with another entity or operation, are deposited without necessarily requiring or implying between these entities or operationIn any actual relationship or order or sequence.Moreover, the terms "include", "comprise" or its any other variant are intended toNon-exclusive inclusion, so that the process, method, article or equipment including a series of elements is not only wanted including thoseElement, but also including other elements that are not explicitly listed, or further include for this process, method, article or equipmentIntrinsic element.In the absence of more restrictions, the element limited by sentence "including a ...", it is not excluded thatThere is also other identical elements in process, method, article or equipment including the element.
Each embodiment in this specification is all made of relevant mode and describes, same and similar portion between each embodimentDividing may refer to each other, and each embodiment focuses on the differences from other embodiments.Especially for device,For the embodiments such as electronic equipment, since it is substantially similar to the method embodiment, so being described relatively simple, related place ginsengSee the part explanation of embodiment of the method.
The foregoing is merely illustrative of the preferred embodiments of the present invention, is not intended to limit the scope of the present invention.It is allAny modification, equivalent replacement, improvement and so within the spirit and principles in the present invention, are all contained in protection scope of the present inventionIt is interior.