Disclosure of Invention
The application aims to provide a browser timing method and a browser timing system so as to improve the timing accuracy of a client browser.
A browser timing method, comprising:
a client browser reads a webpage code sent by a server;
the client browser executes the webpage code to trigger an initialization timing event and display timing time on a page;
after the current timing event, the client browser calculates the time interval for triggering the next timing event according to the total times for triggering the timing event, the minimum timing interval and the actual elapsed total time since the webpage code is executed;
and triggering the next timing event when the client browser passes the calculated time interval.
In a preferred embodiment, the total time actually elapsed since the start of executing the web code is calculated according to the actual time of the client when the current timing event is ended and the actual time of the client when the execution of the web code is started.
In a preferred scheme, the total times of the triggering timing events are recorded by a client; and recording the actual time of the client when the current timing event is ended and the actual time of the client when the webpage code starts to be executed by the client.
A browser timing method, comprising:
a client browser reads a webpage code sent by a server;
the client browser executes the webpage code to trigger an initialization timing event and display timing time on a page;
after the current timing event, the client browser calculates the time interval of the next triggering timing event according to the total times of triggering the timing event, the minimum timing interval and the actual elapsed total time since reading the webpage code;
and triggering the next timing event when the client browser passes the calculated time interval.
In a preferred embodiment, the total time actually elapsed since the reading of the web page code is calculated according to the actual time of the client when the web page code is read by the client browser and the actual time of the client when the current timing event is ended.
In a preferred embodiment, when using AJAX technology, the actual time of the client when the client browser reads the web page code includes: the client acquires and uses the actual time of the client when the server responds; or the actual time of the client when the server is processing the client's request.
In a preferred embodiment, the web page code includes the minimum timing interval and the time of the server when the client reads the web page code.
In a preferred scheme, the total times of the triggering timing events are recorded by a client; the actual time of the client when the client browser reads the webpage code and the actual time of the client when the current timing event is finished are recorded by the client.
In a preferred embodiment, the client browser executes the web page code to trigger an initialization timing event and display timing time on a page, and specifically includes: the client browser executes the webpage code to display timing display time in a timing mode on a page; or the client browser executes the webpage code to display the timing display time in a countdown mode on the page.
In a preferred embodiment of the present invention,
the method for determining the timing display time in the positive timing mode comprises the following steps: setting the time of a server when the client reads the webpage code as the reference time for timing the webpage of the browser of the client, calculating the time difference between the timing starting time on the server and the reference time, and setting the time difference as the timing display time in a positive timing mode;
the method for determining the timing display time in the countdown mode comprises the following steps: setting the time of a server when the client reads the webpage codes as the reference time for timing the webpage of the browser of the client, calculating the time difference between the deadline timing time on the server and the reference time, and setting the time difference as the timing display time in a countdown mode.
In a preferred embodiment, the current timing event includes: a timing event executed after the last timing event is finished and a minimum timing interval is elapsed; or, the previous timing event ends the timing event executed after the calculated time interval triggering the next timing event.
A browser timing system, comprising: the system comprises a webpage code reading unit, a starting execution unit, a time interval calculation unit, a timing execution unit and a recording unit; wherein,
the webpage code reading unit is used for reading a webpage code sent by a server; the webpage codes comprise timing codes, the time and the minimum timing interval of the server when the client reads the webpage codes, and the timing starting time on the server or the timing ending time on the server;
the starting execution unit is used for starting to execute the webpage codes read by the webpage code reading unit so as to trigger the initialization timing event and display the timing time on the page;
the time interval calculating unit is used for calculating the time interval for triggering the next timing event according to the total times of triggering the timing event, the minimum timing interval and the total time actually elapsed since the webpage code is executed;
the timing execution unit is used for triggering the next timing event of the page after the calculated time interval;
and the recording unit is used for recording the total times of triggering the timing events, the actual time of the client when the webpage codes begin to be executed and the actual time of the client when the current timing events end, and returning the recorded data to the time interval calculation unit.
In a preferred embodiment, the time interval calculating unit includes: a total time calculating unit and an interval calculating unit; wherein,
the total time timing unit is used for calculating the total time from the start of executing the code to the end of the current timing event according to the actual time of the client when the webpage code is started and the actual time of the client when the current timing event is ended, which are returned by the recording unit;
and the interval calculation unit is used for calculating the time interval for triggering the next timing event according to the minimum timing interval, the total times of triggering the timing event recorded by the recording unit and the total time actually elapsed since the webpage code is executed by the total time timing unit.
In a preferred embodiment, the time recording unit includes: the data recording unit and the data returning unit; wherein,
the data recording unit is used for recording the total times of triggering the timing event, the actual time of the client when the webpage code starts to be executed and the actual time of the client when the current timing event is finished;
and the data returning unit is used for returning the data recorded by the data recording unit to the time interval calculating unit.
A browser timing system, comprising: the system comprises a webpage code reading unit, a starting execution unit, a second time interval calculation unit, a timing execution unit and a second recording unit; wherein,
the webpage code reading unit is used for reading a webpage code sent by a server; the webpage codes comprise timing codes, the time and the minimum timing interval of the server when the client reads the webpage codes, and the timing starting time on the server or the timing ending time on the server;
the starting execution unit is used for starting to execute the webpage codes read by the webpage code reading unit so as to trigger the initialization timing event and display the timing time on the page;
the second time interval calculating unit is used for calculating the time interval for triggering the next timing event according to the total times of triggering the timing event, the minimum timing interval and the total time actually elapsed from the time when the webpage code is read by the client browser after the current timing event;
the timing execution unit is used for triggering the next timing event of the page after the calculated time interval;
and the second recording unit is used for recording the total times of triggering the timing events, the actual time of the client when the client browser reads the webpage codes and the actual time of the client when the current timing event is ended, and returning the recorded data to the second time interval calculating unit.
In a preferred embodiment, the second time interval calculating unit includes: a second total time calculating unit and a second interval calculating unit; wherein,
the second total time timing unit is used for calculating the total time from reading the webpage codes to the end of the current timing event according to the actual time of the client when the webpage codes are read and the actual time of the client when the current timing event is ended, which are returned by the second recording unit;
and the second interval calculating unit is used for calculating the time interval for triggering the next timing event according to the minimum timing interval, the total times of triggering the timing event recorded by the second recording unit and the total time actually passed from the reading of the webpage code and obtained by timing by the second total time timing unit.
In a preferred embodiment, the second time recording unit includes: the second data recording unit and the second data returning unit; wherein,
the second data recording unit is used for recording the total times of triggering the timing event, the actual time of the client when the client browser reads the webpage code and the actual time of the client when the current timing event is finished; the actual time of the client when the client browser reads the webpage code is obtained by the client and used for responding by the server, or the actual time of the client when the server is processing the request of the client;
and the second data returning unit is used for returning the data recorded by the second data recording unit to the second time interval calculating unit.
According to the browser timing method and system, after the client browser and the server conduct one-time timing through the Internet, the time interval from the end of the current trigger timing event to the next trigger timing event can be calculated according to the total times of trigger timing, the first time interval and the actual elapsed total time, the timing error existing in the client browser after the current execution timing event is eliminated by changing the time interval of the next trigger timing event, the browser timing method can prevent the error generated by execution codes from accumulating, and after the client browser conducts one-time timing with the server, the client browser can achieve high-precision timing without depending on the Internet.
In addition, when the AJAX technology is adopted, if the actual time of the client when the client acquires and uses the response of the server is used as the actual time of the client when the client browser reads the webpage code, the time difference between the reading of the webpage code and the start of the execution of the webpage code can be eliminated. If the actual time of the client when the server is processing the request of the client is taken as the actual time of the client when the browser of the client reads the webpage code, the network error can be further eliminated, so that the value of the actual elapsed total time for calculating the next trigger timing interval is more accurate, and the timing accuracy of the browser timing page is ensured.
Detailed Description
In order to make those skilled in the art better understand the technical solutions in the present application, the technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the drawings in the embodiments of the present application, and it is obvious that the described embodiments are only a part of the embodiments of the present application, and not all of the embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present application.
Fig. 1 is a flowchart illustrating a browser timing method according to an embodiment of the present application. As shown in fig. 1, the browser timing method includes:
s101: the client browser reads the webpage code sent by the server.
The client browser communicates with the server through the Internet and reads the webpage codes sent by the server. The webpage code can comprise a timing code, the time and the minimum timing interval of the server when the client reads the webpage code, and the starting timing time on the server or the ending timing time on the server.
Executing the timing code may display a dynamic timing effect. The timing code can be written by adopting Javascript language, and also can adopt other script languages capable of realizing dynamic webpage functions.
The minimum timing interval is a unit change amount of time displayed on the timing page.
For example, if the minimum timing interval included in the web page code is 1 second, the unit change amount of the time displayed on the timing page is 1 second, that is, each time the timing event is triggered, the length of the time displayed on the timing page changes by 1 second. If the time is positive, the time length displayed on the timing page is increased by 1 second. If the counting is down, the time length displayed on the timing page is reduced by 1 second.
The time of the server when the client reads the webpage code, and the starting timing time on the server or the ending timing time on the server can be used for calculating the display time of the timing page of the browser of the client.
S102: the client browser executes the web page code to trigger an initialization timing event and display the timing time on the page.
And after the client browser reads the webpage code, executing the webpage code. The web page code contains timing code, and execution of the web page code triggers initiation of a timing event and display of a timing time on the page. The initialization timing event does not count the total number of times the timing is triggered.
The displayed timing time is calculated according to the time of the server contained in the webpage code. The displayed timing time may be a timing display time in a count-up mode or a timing display time in a count-down mode.
The timing display time of the positive timing mode is calculated according to the starting timing time on the server and the time of the server contained in the webpage code. The method specifically comprises the following steps: and taking the time of the server contained in the webpage code as the reference time for the page timing of the client browser, and calculating the time difference between the timing starting time on the server and the reference time, wherein the time difference is the timing display time in a positive timing mode.
The timing display time of the countdown mode is calculated according to the expiration timing time on the server and the time of the server contained in the webpage code. The method specifically comprises the following steps: and taking the time of the server contained in the webpage code as the reference time for the page timing of the client browser, and calculating the time difference between the deadline timing time on the server and the reference time, wherein the time difference is the timing display time in a countdown mode.
And displaying the calculated timing display time and triggering a timing event. By executing the timing code, the display time on the timing page may be changed, the length of the display time change being the minimum timing interval.
For example, in the positive timing mode, if the minimum timing interval included in the web page code is 1 second, the server time is 5 hours, 30 minutes and 45 seconds, and the timing start time on the server is 5 hours, 0 minutes and 0 seconds, the display time of the browser timing page is 30 minutes and 45 seconds, and after the timing event is triggered, the display time of the timing page is changed to 30 minutes and 46 seconds. If the browser timing page is in a countdown mode, the minimum timing interval contained in the webpage code is 1 second, the server time is 5 hours, 30 minutes and 45 seconds, the countdown deadline on the server is 6 hours, 0 minutes and 0 seconds, the display time of the browser timing page is 29 minutes and 15 seconds, and after a timing event is triggered, the display time of the timing page is changed into 29 minutes and 14 seconds.
S103: after the current timing event is finished, the client browser calculates the time interval for triggering the next timing event according to the total times for triggering the timing event, the minimum timing interval and the actual elapsed total time since the webpage code is executed.
As described in the background, errors occur each time the timing code is executed. After the timing code is executed for multiple times, errors generated by the execution of the timing code can be accumulated, and the errors can reach hundreds of milliseconds or even seconds. The process of the client browser reading the web page code sent by the server generates a network error due to network data transmission, which is generally several milliseconds. The network error may be ignored with respect to accumulated error generated by executing the timing code. After the client browser receives the web page code sent by the server, the client browser generally starts to execute the web page code immediately, and the time difference between the time when the client browser receives the web page code and the time when the client browser starts to execute the web page code can be ignored. Therefore, the present embodiment only considers how to eliminate the error generated by executing the timing code.
In order to eliminate the error generated by the execution of the timing code, the time interval for triggering the next timing event can be calculated by using the principle that the actual time elapsed by the client from the beginning of the execution of the web page code to the end of the current timing event is accurate. By adjusting the time interval for triggering the next timing event, timing errors due to execution of the timing code at the end of the current timing event can be eliminated. The total number of times the timing event is triggered and the total time actually elapsed since the start of execution of the web page code may be recorded by the client.
The time interval for triggering the next timing event can be calculated by the following formula:
Tn+1=(n+1)*Δt-(newtime-basetime) (1)
in the above formula, n represents the total number of times of the current trigger timing event; Δ t represents the minimum timing interval, i.e., the length of time that the timing page displays changes after each triggering of a timing event; basetime represents the actual time of the client when the web code begins to be executed; newtime represents the actual time of the client at the end of the current timed event; (newtime-basetime) represents the total time that actually elapses since the start of execution of the web code until the end of the current timed event. T isn+1The time interval from the end of the current timing event to the (n + 1) th triggering timing event, i.e., the time interval for triggering the next timing event. The value of basetime and the value of newtime may be recorded by the client. When n =0, T1=Δt-(newtime-basetime),T1Indicating the time interval after the page display time is initialized until the timing event is triggered for the first time.
For example: the minimum time interval in the web page code is 1 second.
At the end of the 100 th timed event, the actual elapsed time since the start of the execution of the web page code by the clientThe time is 100800 ms, which indicates that an error of 800 ms is generated from the beginning of the execution of the web page code to the end of the 100 th timing event. Calculating the time interval from the completion of the 100 th timing event to the triggering of the 11 th timing event according to the formula (1), wherein the calculation result is as follows: t is101And =101 × 1000-.
The current timing event may be a timing event executed after a minimum timing interval elapses from the end of the previous timing event. The current timing time may also be a timing event executed after the previous timing event ends and triggers the next timing event interval.
S104: and when the client browser passes the calculated time interval, triggering the next timing event and changing the time displayed on the timing page.
When the calculated time interval passes, the client browser can trigger the next timing event of the page, execute the timing code and change the time displayed on the timing page. Completion of the time change displayed on the page indicates the end of the current timed event
For example: the minimum time interval in the web page code is 1 second.
When the 1 st timing event is finished, if the client end triggers the timing event to be finished from the beginning of executing the web page code to the first time, the actual elapsed total time of the client end is 1010 milliseconds, which indicates that there is an error of 10 milliseconds at present. Calculating the time interval from the completion of the 1 st timing event to the triggering of the 2 nd timing event according to the formula (1), wherein the calculation result is as follows: t is2The term "= 2 × 1000-. Then, the 2 nd time counting event is triggered 990 milliseconds after the 1 st time counting event is finished, the time counting code is executed, and the time displayed on the time counting page is changed.
After the 2 nd trigger timing event is finished, if the guest hasThe actual total time of the user end after reading the webpage code is 2080 milliseconds, which indicates that there is an error of 80 milliseconds at present. Calculating the time interval from the completion of the 2 nd timing event to the 3 rd triggering timing event according to the formula (1), wherein the calculation result is as follows: t is3=3 × 1000-. Then, the timing event is triggered 3 rd time 920 milliseconds after the 2 nd timing event, the timing code is executed, and the time displayed on the timing page is changed.
By analogy … …
After the 10 th trigger timing event is finished, if the total time actually elapsed since the client reads the web page code is 10200 milliseconds, it indicates that there is an error of 200 milliseconds at present. Calculating the time interval from the completion of the 10 th timing event to the 11 th triggering timing event according to the formula (1), wherein the calculation result is as follows: t is11The expression of 11 × 1000-. Then, the timing event is triggered 11 th time 800 milliseconds after the 10 th timing event, the timing code is executed, and the time displayed on the timing page is changed.
According to the browser timing method embodiment, after a client browser and a server perform time synchronization once through the Internet, the time interval from the end of a current trigger timing event to the next trigger timing event can be calculated according to the total times of trigger timing, a first time interval and the actual elapsed total time, the time interval from the end of the current trigger timing event to the next trigger timing event is changed to eliminate the timing error of the client browser after the current execution of the timing event, the browser timing method can prevent the error generated by an execution code from accumulating, and after the client browser and the server perform time synchronization once, the client browser can achieve high-precision timing without depending on the Internet.
Fig. 2 is a block diagram of a browser timing system according to an embodiment of the present application. As shown in fig. 2, the browser timing system includes: the webpage code reading unit 100, the starting execution unit 200, the time interval calculation unit 300, the timing execution unit 400 and the recording unit 500. Wherein,
the web page code reading unit 100 is configured to read a web page code sent by a server; the webpage code can comprise a timing code, the time and the minimum timing interval of the server when the client reads the webpage code, and the starting timing time on the server or the ending timing time on the server.
The start execution unit 200 is configured to start executing the webpage code read by the webpage code reading unit 100, so as to trigger an initialization timing event and display a timing time on a page.
The time interval calculating unit 300 is configured to calculate, after the current timing event, a time interval for triggering a next timing event according to the total number of times of triggering the timing event, the minimum timing interval, and the total time actually elapsed since the start of executing the web page code.
The timing execution unit 400 is configured to trigger a next timing event of the page after the calculated time interval.
The recording unit 500 is configured to record the total number of times of triggering the timing event when the current timing event is ended, the actual time of the client when the web code starts to be executed, and the actual time of the client when the current timing event is ended, and return the recorded data to the time interval calculating unit 300.
Fig. 3 is a block diagram of a time interval calculating unit in an embodiment of a browser timing system according to the present application. As shown in fig. 3, the time interval calculating unit 300 includes: total time calculation unit 310, interval calculation unit 320. Wherein,
the total time counting unit 310 is configured to calculate a total time elapsed from the start of executing the code to the end of the current timing event by the client according to the actual time of the client when the web page code starts to be executed and the actual time of the client when the current timing event ends, which are returned by the recording unit 500.
The interval calculating unit 320 is configured to calculate a time interval for triggering a next timing event according to the minimum timing interval, the total number of times of triggering the timing event recorded by the recording unit 500, and the total time actually elapsed since the web page code is started to be executed and obtained by timing by the total time timing unit 310.
Fig. 4 is a structural diagram of a recording unit in an embodiment of a browser timing system according to the present application. As shown in fig. 4, the time recording unit 500 includes: a data recording unit 510 and a data returning unit 520. Wherein,
the data recording unit 510 is configured to record the total number of times of triggering the timing event, the actual time of the client when the web code starts to be executed, and the actual time of the client when the current timing event ends.
The data returning unit 520 is configured to return the data recorded by the data recording unit 510 to the time interval calculating unit 300.
The embodiment of the browser timing system corresponds to the embodiment of the browser timing method, the browser timing method can be realized, and the client browser can realize high-precision timing without depending on the Internet after the client browser and the server perform one-time timing.
The following describes a second embodiment of the browser timing method of the present application:
as known to those skilled in the art, a general process of a client requesting data from a server via the internet may include: blocking (request is blocked), Sending (request is sent), Waiting (response Waiting), and Receiving (response Receiving), where the execution contents corresponding to the four processes are shown in table 1;
TABLE 1 procedure for network request
Process for producing a metal oxide |
Corresponding executed content |
Blocking |
Resolving DNS, establishing HTTP requests |
Sending |
Requesting data transmission |
Waiting |
The server receives the request and starts to process the request |
Receiving |
The server sends data to the client |
The process of the client reading the webpage code of the server can be represented by the request state of AJAX (asynchronous JavaScript And XML)). The AJAX performs a small amount of data exchange with the server in the background, so that the asynchronous updating of the webpage can be realized, namely, a certain part of the webpage can be updated under the condition of not reloading the whole webpage.
The request State of the AJAX is typically represented by the variable Ready State, which is an integer number of length 4. The request states of AJAX include 5 states, and the state interpretation of the 5 states is specifically shown in table 2.
TABLE 2AJAX request State and State interpretation
With reference to the embodiment shown in fig. 1, in an example that the AJAX technology is adopted, when the client reads a webpage code of the server, the actual time of the client when the Ready State is 4 may be recorded, and the actual time of the client when the Ready State is 4 is taken as the value of basetime in formula (1). The next timing event is triggered after the calculated time interval, so that not only can errors generated by executing timing codes be eliminated, but also the time difference between the time when the webpage codes are read and the time when the webpage codes begin to be executed can be eliminated.
The time required by the waiting process in table 1 refers to the time for the server to respond to the client request, and may correspond to the time when the Ready State in the AJAX request State in table 2 is 2, and in the process of reading the web page code of the server by the client, the time required by the waiting process is generally short, and is usually less than 5 milliseconds. The time required by the recovering process can correspond to the time when the Ready State is 3-4 in the AJAX request State, the time required by the recovering process or the time when the Ready State is 3-4 in the AJAX request State is determined depending on the network speed, if the network speed is high, the time required by the process is short, and if the network speed is low, the time required by the process is long.
FIG. 5 is a diagram illustrating the relationship between the client timeline, the server timeline, and the Ready State status according to the present application. As shown in fig. 5, the server time included in the webpage code sent by the server to the client is the time when the Ready State is 2, but when the client browser reads the webpage code of the server, the actual time of the client is the time when the Ready State is 4, so that when the total time elapsed by the client in formula (1) is calculated, an error when the Ready State is 3-4 is generated, and the error is called a network error. If the actual time of the client is recorded when the Ready State is 2, the actual time of the client is set to be the value of the basetime in the formula (1) when the Ready State is 2, so that the network error can be further eliminated.
Therefore, in an example of using the AJAX technology, in combination with the embodiment shown in fig. 1, when the client reads the web page code of the server, the actual time of the client when the Ready State is 2 may also be recorded, and the actual time of the client when the Ready State is 2 is taken as the value of basetime in formula (1). The next timing event is triggered after the calculated time interval, so that the error generated by executing the timing code and the time difference between the reading of the webpage code and the start of executing the webpage code can be eliminated, and the network error can be eliminated.
FIG. 6 is a flowchart of a second embodiment of a browser timing method according to the present application. As shown in fig. 6, a second implementation of the browser timing method may include:
s601: a client browser reads a webpage code sent by a server;
s602: the client browser executes the webpage code to trigger an initialization timing event and display timing time on a page;
s603: after the current timing event, the client browser calculates the time interval of the next triggering timing event according to the total times of triggering the timing event, the minimum timing interval and the actual elapsed total time since reading the webpage code;
s604: and triggering the next timing event when the client browser passes the calculated time interval.
Wherein,
s603 is obtained by calculation according to the following formula:
Tn+1=(n+1)*Δt-(newtime-basetime1) (2)
in the above formula, n represents the total number of times of the current trigger timing event; Δ t represents the minimum timing interval, i.e., the length of time that the timing page displays changes after each triggering of a timing event; basetime1 represents the time when a client browser reads a web pageActual time of the client when the code is coded; newtime represents the actual time of the client at the end of the current timed event; (newtime-basetime 1) represents the total time actually elapsed since the web page code was read by the client browser. T isn+1The time interval from the end of the current timing event to the (n + 1) th triggering timing event, i.e., the time interval for triggering the next timing event. When n =0, T1=Δt-(newtime-basetime),T1Indicating the time interval after the page display time is initialized until the timing event is triggered for the first time. The value of basetime1 and the value of newtime may be recorded by the client.
When the AJAX technology is adopted, the actual time of the client when the client browser reads the webpage code may be the actual time of the client when the Ready State is 4, that is, the actual time of the client when the client can obtain and use the response of the server. The actual time of the client when the client browser reads the webpage code may also be the actual time of the client when the Ready State is 2, that is, the actual time of the client when the server is processing the request of the client.
Other parts of this embodiment are identical to those of the first embodiment of the browser timing method, and reference may be made to the first embodiment of the first browser timing method, and a description thereof will not be repeated.
In the second embodiment of the browser timing method, when the AJAX technology is used, if the actual time of the client when the ReadyState state is 4 is used as the actual time of the client when the client browser reads the webpage code, the time difference between the reading of the webpage code and the start of executing the webpage code can be eliminated. If the actual time of the client when the Ready State is 2 is taken as the actual time of the client when the browser of the client reads the webpage code, the network error can be further eliminated, so that the value of the actual elapsed total time for calculating the next trigger timing interval is more accurate, and the timing accuracy of the browser timing page is ensured.
A second embodiment of the browser timing system of the present application is described below. Fig. 7 is a block diagram showing the components of a second embodiment of the browser timer system according to the present application. As shown in fig. 7, the browser timing system includes: the webpage code reading unit 100, the starting execution unit 200, the second time interval calculation unit 600, the timing execution unit 400 and the second recording unit 700. Wherein,
the web page code reading unit 100 is configured to read a web page code sent by a server. The webpage code can comprise a timing code, the time and the minimum timing interval of the server when the client reads the webpage code, and the starting timing time on the server or the ending timing time on the server.
The start execution unit 200 is configured to start executing the webpage code read by the webpage code reading unit 100, so as to trigger an initialization timing event and display a timing time on a page.
The second time interval calculating unit 600 is configured to calculate, after the current timing event, a time interval for triggering a next timing event according to the total number of times of triggering the timing event, the minimum timing interval, and the total time actually elapsed since the client browser reads the web page code.
The timing execution unit 400 is configured to trigger a next timing event of the page after the calculated time interval.
The second recording unit 700 is configured to record the total number of times of triggering the timing event, the actual time of the client when the client browser reads the web code, and the actual time of the client when the current timing event ends, and return the recorded data to the second time interval calculating unit 600.
Fig. 8 is a block diagram of a second time interval calculating unit in the second embodiment of the browser timer system according to the present application. As shown in fig. 8, the second time interval calculation unit 600 includes: a second total time calculating unit 610 and a second interval calculating unit 620. Wherein,
the second total time timing unit 610 is configured to calculate total time elapsed from reading the web page code to the end of the current timing event by the client according to the actual time of the client when reading the web page code and the actual time of the client when the current timing event ends, which are returned by the second recording unit 700.
The second interval calculating unit 620 is configured to calculate a time interval for triggering a next timing event according to the minimum timing interval, the total number of times of triggering the timing event recorded by the second recording unit 700, and the total time actually elapsed since the web page was read and obtained by timing by the second total time timing unit 610.
Fig. 9 is a structural diagram of a second recording unit in the second embodiment of the browser timing system of the present application. As shown in fig. 9, the second time recording unit 700 includes: a second data recording unit 710 and a second data returning unit 720. Wherein,
the second data recording unit 710 is configured to record the total number of times of triggering the timing event, the actual time of the client when the client browser reads the web page code, and the actual time of the client when the current timing event is ended. The actual time of the client when the client browser reads the webpage code can be the actual time of the client when the client acquires and uses the response of the server, or the actual time of the client when the server processes the request of the client.
The second data returning unit 720 is configured to return the data recorded by the second data recording unit 710 to the second time interval calculating unit 600.
The second embodiment of the browser timing system corresponds to the second embodiment of the browser timing method, and the corresponding effects of the second embodiment of the browser timing method can be achieved.
In the 90 s of the 20 th century, improvements in a technology could clearly distinguish between improvements in hardware (e.g., improvements in circuit structures such as diodes, transistors, switches, etc.) and improvements in software (improvements in process flow). However, as technology advances, many of today's process flow improvements have been seen as direct improvements in hardware circuit architecture. Designers almost always obtain the corresponding hardware circuit structure by programming an improved method flow into the hardware circuit. Thus, it cannot be said that an improvement in the process flow cannot be realized by hardware physical modules. For example, a Programmable Logic Device (PLD), such as a Field Programmable Gate Array (FPGA), is an integrated circuit whose Logic functions are determined by programming the Device by a user. A digital system is "integrated" on a PLD by the designer's own programming without requiring the chip manufacturer to design and fabricate a dedicated integrated circuit chip 2. Furthermore, nowadays, instead of manually making an integrated Circuit chip, such Programming is often implemented by "logic compiler" software, which is similar to a software compiler used in program development and writing, but the original code before compiling is also written by a specific Programming Language, which is called Hardware Description Language (HDL), and HDL is not only one but many, such as abel (advanced Boolean Expression Language), ahdl (alternate Language Description Language), traffic, pl (core unified Programming Language), HDCal, JHDL (Java Hardware Description Language), langue, Lola, HDL, laspam, hardsradware (Hardware Description Language), vhjhd (Hardware Description Language), and vhigh-Language, which are currently used in most popular applications. It will also be apparent to those skilled in the art that hardware circuitry that implements the logical method flows can be readily obtained by merely slightly programming the method flows into an integrated circuit using the hardware description languages described above.
The controller may be implemented in any suitable manner, for example, the controller may take the form of, for example, a microprocessor or processor and a computer-readable medium storing computer-readable program code (e.g., software or firmware) executable by the (micro) processor, logic gates, switches, an Application Specific Integrated Circuit (ASIC), a programmable logic controller, and an embedded microcontroller, examples of which include, but are not limited to, the following microcontrollers: the ARC625D, Atmel AT91SAM, Microchip PIC18F26K20, and Silicone Labs C8051F320, the memory controller may also be implemented as part of the control logic for the memory.
Those skilled in the art will also appreciate that, in addition to implementing the controller as pure computer readable program code, the same functionality can be implemented by logically programming method steps such that the controller is in the form of logic gates, switches, application specific integrated circuits, programmable logic controllers, embedded microcontrollers and the like. Such a controller may thus be considered a hardware component, and the means included therein for performing the various functions may also be considered as a structure within the hardware component. Or even means for performing the functions may be regarded as being both a software module for performing the method and a structure within a hardware component.
The systems, devices, modules or units illustrated in the above embodiments may be implemented by a computer chip or an entity, or by a product with certain functions.
For convenience of description, the above devices are described as being divided into various units by function, and are described separately. Of course, the functionality of the units may be implemented in one or more software and/or hardware when implementing the present application.
From the above description of the embodiments, it is clear to those skilled in the art that the present application can be implemented by software plus necessary general hardware platform. With this understanding in mind, the present solution, or portions thereof that contribute to the prior art, may be embodied in the form of a software product, which in a typical configuration includes one or more processors (CPUs), input/output interfaces, network interfaces, and memory. The computer software product may include instructions for causing a computing device (which may be a personal computer, a server, or a network device, etc.) to perform the methods described in the various embodiments or portions of embodiments of the present application. The computer software product may be stored in a memory, which may include forms of volatile memory in a computer readable medium, Random Access Memory (RAM) and/or non-volatile memory, such as Read Only Memory (ROM) or flash memory (flash RAM). Memory is an example of a computer-readable medium. Computer-readable media, including both non-transitory and non-transitory, removable and non-removable media, may implement information storage by any method or technology. The information may be computer readable instructions, data structures, modules of a program, or other data. Examples of computer storage media include, but are not limited to, phase change memory (PRAM), Static Random Access Memory (SRAM), Dynamic Random Access Memory (DRAM), other types of Random Access Memory (RAM), Read Only Memory (ROM), Electrically Erasable Programmable Read Only Memory (EEPROM), flash memory or other memory technology, compact disc read only memory (CD-ROM), Digital Versatile Discs (DVD) or other optical storage, magnetic cassettes, magnetic tape magnetic disk storage or other magnetic storage devices, or any other non-transmission medium that can be used to store information that can be accessed by a computing device. As defined herein, computer readable media does not include transitory computer readable media (transient media), such as modulated data signals and carrier waves.
The embodiments in the present specification are described in a progressive manner, and the same and similar parts among the embodiments are referred to each other, and each embodiment focuses on the differences from the other embodiments. In particular, for the system embodiment, since it is substantially similar to the method embodiment, the description is simple, and for the relevant points, reference may be made to the partial description of the method embodiment.
The application is operational with numerous general purpose or special purpose computing system environments or configurations. For example: personal computers, server computers, hand-held or portable devices, tablet-type devices, multiprocessor systems, microprocessor-based systems, set top boxes, programmable consumer electronics, network PCs, minicomputers, mainframe computers, distributed computing environments that include any of the above systems or devices, and the like.
The application may be described in the general context of computer-executable instructions, such as program modules, being executed by a computer. Generally, program modules include routines, programs, objects, components, data structures, etc. that perform particular tasks or implement particular abstract data types. The application may also be practiced in distributed computing environments where tasks are performed by remote processing devices that are linked through a communications network. In a distributed computing environment, program modules may be located in both local and remote computer storage media including memory storage devices.
While the present application has been described with examples, those of ordinary skill in the art will appreciate that there are numerous variations and permutations of the present application without departing from the spirit of the application, and it is intended that the appended claims encompass such variations and permutations without departing from the spirit of the application.