A kind of timestamp generation system and method based on token
Technical field
The present invention relates to Ethernet communication technology fields, and in particular to a kind of timestamp generation system and side based on token
Method.
Background technology
Requirement of the network equipment to time net synchronization capability at present is higher and higher, using 1588v2 agreements as the time synchronization of representative
Scheme is obtained for extensive use in many scenes, and the accuracy of generation time stamp directly determines the synchronousness of equipment
Energy.Way generally used now is the function of PTP data packets addition time stamp to be placed on hardware view to do, and be placed on distance as far as possible
The serial closer position of interface (SerDes) of unstringing, to reduce " timestamp reference point " in PTP data packets across serial
The total delay passed through when unstringing " reference planes " and " timestamp record point " in interface improves time stamp accuracy.Although can be with
It is close, but can not infinite approach, therefore the problem of certainly exist compensation delay, and how effectively to calculate and compensate this section and prolong
When, become the key for improving timestamp precision.
Shown in FIG. 1 is a kind of basic structure of the network equipment (Dev001) processing time stamp, it is unstringed by serial mode
The basic units such as module (SerDes), physical layer coding module (Pcs) and timestamp processing module (Tpu) form, specifically again can
It sends (Tx is sent to serial module of unstringing by timestamp processing module) and reception to be divided into (Rx, timestamp processing module connects
Receive the data for module transmission of serially unstringing) two paths:Wherein, T1 and T2 is respectively represented in PTP messages " timestamp reference point "
The actual time of (Timestamp Point) input and output SerDes pins (namely " reference planes " Reference Plane);
" timestamp reference point " can be the SOP (the first bit of data packet first byte) in PTP data packets, can also be SOF (leading
First bit after code), it can also be other reference positions;T1 ' and T2 ' respectively represents " timestamp on the directions Rx and Tx
Reference point " by when timestamp processing module by local high precision clock (Chronometer) record precise time;Rx_
Latency and Tx_Latency respectively represents " timestamp reference point " input, exports the delay passed through to timestamp processing module;
Rx_Timestamp and Tx_Timestamp respectively represents the timestamp that the directions Rx and the directions Tx ultimately generate, and has following relationship:
The directions Tx:Tx_Timestamp=T2 '+Tx_Latency ≈ T2
The directions Rx:Rx_Timestamp=T1 '-Rx_Latency ≈ T1
The delay that " timestamp reference point " input, output to timestamp processing module are passed through includes mainly three kinds of situations:
1) path delay
It is shown in Fig. 2 be one kind after the comprehensive directions Tx and the directions Rx serially unstring module and timestamp processing module it
Between path delay calculate structure, wherein Latency correspond to Fig. 1 in Rx_Latency and Tx_Latency, its practical packet
Include constant time lag and Variable delay two parts.For example, delay fluctuation that FIFO buffer structures are brought and Gearbox (gearbox) etc.
The delay fluctuation brought, they belong to Variable delay part.A kind of FIFO (First Input FirstOutput) advanced elder generation
The data buffer gone out, the data being introduced into first are read from FIFO buffers, do not have exterior read-write address wire compared with RAM,
Using fairly simple, but data can only be sequentially written in, the reading data of sequence cannot can be by address as normal memory
Line determines to read or be written some specified address.
2) timestamp reference point locations are delayed
Shown in Fig. 3 is a kind of typical multiplexing structure that can bring Variable delay, and the channel of M physical layer coding module is multiple
Use the channel of N number of serial module of unstringing, the value of M and N equal may may not also wait, and specific multiplexing relationship is with the mould that serially unstrings
Block operating mode is related.Since the position of " timestamp reference point " in the channel for serially unstringing module is uncertain, so
Variable multiplexing can be brought to be delayed.
Therefore, it can accurately be compensated by the data transmission between serial interface string module and timestamp processing module there is an urgent need for a kind of
The delay in path generates the technical solution that " timestamp reference point " inputted, exported the High Precision Time Stamps of serial interface string module.
Invention content
In view of the deficiencies in the prior art, the purpose of the present invention is to provide a kind of, and the timestamp based on token generates
System and method can accurately compensate prolonging by the data transfer path between serial interface string module and timestamp processing module
When, improve timestamp precision.
To achieve the above objectives, the technical solution adopted by the present invention is that:A kind of timestamp generation system based on token, should
System includes serial unstring module, physical layer coding module and timestamp processing module, and module of serially unstringing is handled with timestamp
Module is communicated by physical layer coding module:
The serial module of unstringing is used for:The bit flow amount for having sent He having received is real-time in the form of the first token
Feed back to timestamp processing module;
The timestamp processing module is used for:In the form of the second token Real-time Feedback timestamp processing module sent and
The bit flow amount received calculates serial module of unstringing according to the difference of the first token and the second token and handles mould with timestamp
The bit flow amount of delay between block;String is calculated according to the interface rate of the bit flow amount of delay and module of serially unstringing
The delay for the data transfer path that row unstrings between module and timestamp processing module.
Based on the above technical solution, according to the difference of the first token and the second token calculate it is serial unstring module with
The detailed process of the bit flow amount of delay between timestamp processing module includes:
Create a token bucket;
Timestamp processing module serially unstring module transmission data when, timestamp processing module is filled out into the token bucket
The second token is filled, the first token is taken out from the token bucket;
When timestamp processing module receives the data for module transmission of serially unstringing, timestamp processing module is to the token bucket
The first token of middle filling, and the second token is taken out from the token bucket;
The bit for the delay that token number in the token bucket as serially unstrings between module and timestamp processing module
Flow amount.
Based on the above technical solution, the timestamp processing module further includes smothing filtering submodule, is used for
Control the token uniform amount filled every time into the token bucket;Control the token quantity by being taken out in the token bucket every time
Uniformly.
Based on the above technical solution, the timestamp processing module detects that the timestamp in PTP messages refers to
When point, also according to the interface rate of module of serially unstringing, the position of the timestamp reference point detected, timestamp reference is calculated
The offset of point.
Based on the above technical solution, the serial data transmission unstringed between module and timestamp processing module
The calculation formula of the delay in path is:
The directions Tx:Tx_Latency=(Level+Offset)/Speed;
The directions Rx:Rx_Latency=(Level-Offset)/Speed;
Wherein, the directions Tx are that timestamp processing module is serially unstringed the direction of module transmission data, and the directions Rx are the time
Stamp processing module receives the direction for module transmission data of serially unstringing;Latency is that serial module of unstringing handles mould with timestamp
Delay between block, Level are the token number in the token bucket, and Speed is the operating rate of module of serially unstringing, Offset
For the offset of timestamp reference point.
The timestamp generation method based on token that the invention also discloses a kind of, includes the following steps:
It is serial unstring module by the bit flow amount for having sent and having received in the form of the first token Real-time Feedback to when
Between stab processing module;
What timestamp processing module Real-time Feedback timestamp processing module in the form of the second token had sent and had received
Bit flow amount is calculated according to the difference of the first token and the second token and is serially unstringed between module and timestamp processing module
The bit flow amount of delay;
Timestamp processing module calculates serially according to the bit flow amount of delay and the interface rate for module of serially unstringing
The delay of data transfer path between module of unstringing and timestamp processing module.
Based on the above technical solution, according to the difference of the first token and the second token calculate it is serial unstring module with
The detailed process of the bit flow amount of delay between timestamp processing module includes:
Create a token bucket;
Timestamp processing module serially unstring module transmission data when, timestamp processing module is filled out into the token bucket
The second token is filled, the first token is taken out from the token bucket;
When timestamp processing module receives the data for module transmission of serially unstringing, timestamp processing module is to the token bucket
The first token of middle filling, and the second token is taken out from the token bucket;
The bit for the delay that token number in the token bucket as serially unstrings between module and timestamp processing module
Flow amount.
Based on the above technical solution, the token that the timestamp processing module is filled into the token bucket every time
Uniform amount;Token uniform amount by being taken out in the token bucket every time.
Based on the above technical solution, the timestamp processing module detects that the timestamp in PTP messages refers to
When point, also according to the interface rate of module of serially unstringing, the position of the timestamp reference point detected, timestamp reference is calculated
The offset of point.
Based on the above technical solution, the serial data transmission unstringed between module and timestamp processing module
The calculation formula of the delay in path is:
The directions Tx:Tx_Latency=(Level+Offset)/Speed;
The directions Rx:Rx_Latency=(Level-Offset)/Speed;
Wherein, the directions Tx are that timestamp processing module is serially unstringed the direction of module transmission data, and the directions Rx are the time
Stamp processing module receives the direction for module transmission data of serially unstringing;Latency is that serial module of unstringing handles mould with timestamp
Delay between block, Level are the token number in the token bucket, and Speed is the operating rate of module of serially unstringing, Offset
For the offset of timestamp reference point.
Compared with the prior art, the advantages of the present invention are as follows:
Serial module of unstringing in the present invention is by the serial bit stream data amount sent and received in the form of the first token
Real-time Feedback is to timestamp processing module, timestamp processing module Real-time Feedback timestamp processing module in the form of the second token
The bit flow amount for having sent and having received is calculated according to the difference of the first token and the second token and is serially unstringed module and time
Stab the bit flow amount of the delay between processing module;According to the interface rate of the bit flow amount of delay and module of serially unstringing
Calculate the delay of the serial data transfer path to unstring between module and timestamp processing module.This programme is accurately compensated by going here and there
Row connects the delay of the data transfer path between string module and timestamp processing module, to improve timestamp precision.
The present invention calculates the time according to the interface rate for module of serially unstringing, the position of the timestamp reference point detected
The offset for stabbing reference point effectively overcomes since " timestamp reference point " can in serial uncertain bring in mould position in the block of unstringing
The multiplexing of change is delayed.
Description of the drawings
Fig. 1 is the basic structure schematic diagram that the network equipment (Dev001) processing time stabs in background technology;
Fig. 2 is timestamp delay computing structure model in background technology;
Fig. 3 is channel multiplexing structural model in background technology;
Fig. 4 is the structural schematic diagram of timestamp processing system in the embodiment of the present invention;
Fig. 5 is token bucket filling and extraction principle schematic in the embodiment of the present invention;
Fig. 6 is timestamp detection, compensation and the typical structure generated in the embodiment of the present invention;
Fig. 7 is the offset computational methods under the conditions of timestamp reference point a in the embodiment of the present invention;
Fig. 8 is the offset computational methods under the conditions of timestamp reference point b in the embodiment of the present invention;
Fig. 9 is the offset computational methods under the conditions of timestamp reference point c in the embodiment of the present invention;
Figure 10 is the principle schematic of smothing filtering submodule in the embodiment of the present invention;
Figure 11 is the flow diagram of timestamp processing method in the embodiment of the present invention.
Specific implementation mode
Invention is further described in detail with reference to the accompanying drawings and embodiments.
Embodiment 1:Timestamp based on token generates system
Shown in Figure 4, the embodiment of the invention discloses a kind of, and the timestamp based on token generates system, which includes
Serial unstring module (SerDes), physical layer coding module (Pcs) and timestamp processing module (Tpu), module of serially unstringing and
Timestamp processing module is communicated by physical layer coding module:
The serial module of unstringing is used for:The bit flow amount for having sent He having received is real-time in the form of the first token
Feed back to timestamp processing module;
The timestamp processing module is used for:In the form of the second token Real-time Feedback timestamp processing module sent and
The bit flow amount received calculates serial module of unstringing according to the difference of the first token and the second token and handles mould with timestamp
The bit flow amount of delay between block;String is calculated according to the interface rate of the bit flow amount of delay and module of serially unstringing
The delay for the data transfer path that row unstrings between module and timestamp processing module.
When detecting the timestamp reference point in PTP messages, this is recorded by local high precision clock (Chronometer)
When time, base timestamp when module of serially unstringing as the timestamp reference point corresponding data input and output uses this
Compensation of delay base timestamp, generated time stamp the input and output of reference point corresponding data serially unstring module when the final time
Stamp.
It is shown in Figure 5, serial module of unstringing is calculated according to the difference of the first token and the second token and is handled with timestamp
The detailed process of the bit flow amount of delay between module includes:
Create a token bucket;
Timestamp processing module serially unstring module transmission data when, timestamp processing module is filled out into the token bucket
The second token Tokens2 is filled, the first token Tokens1 is taken out from the token bucket;
When timestamp processing module receives the data for module transmission of serially unstringing, timestamp processing module is to the token bucket
The first token Tokens1 of middle filling, and the second token Tokens2 is taken out from the token bucket;
The bit for the delay that token number in the token bucket as serially unstrings between module and timestamp processing module
Flow amount.
It is calculated according to the interface rate of the bit flow amount of delay and module of serially unstringing and is serially unstringed module and time
The calculation formula of delay of data transfer path between stamp processing module is:
Latency=Level/Speed;
Wherein, Latency is the delay serially unstringed between module and timestamp processing module, and Level is the token
Token number in bucket, Speed are the operating rate of module of serially unstringing.
The operating rate of serial module of unstringing determines the time that each token represents, such as:Under 1Gbps rates, 1bit
Token just represents the 1ns times;Under 10Gbps rates, 1bit tokens just represent 0.1ns.Therefore, knowing serial module work of unstringing
Under conditions of making rate, the token number in token bucket can be converted to specific delay time.
Embodiment 2:Consider the offset of timestamp reference point
On the basis of embodiment 1, the offset of timestamp reference point is considered, in the timestamp generation system based on token
Timestamp processing module when detecting the timestamp reference point in PTP messages, also according to module of serially unstringing interface rate,
The position of the timestamp reference point detected calculates the offset of timestamp reference point.
Shown in fig. 6 is a kind of reality of the timestamp processing module in the present invention in the timestamp generation system based on token
Existing structure:Wherein, Timestamp Point Detect are " timestamp reference point " detection units, are handled for detection time stamp
Whether contain " timestamp reference point " in the Brick blocks of the interface of module.Here " timestamp reference point " can be PTP data
SOP (the first bit of data packet first byte) in packet, can also be SOF (the first bit after lead code), can also be
Other reference positions;Assuming that select SOF as " timestamp reference point ", then the subelement is after detecting SOF, it will
Offset Offset is calculated according to operating mode.Mode in Fig. 6 is a register, it saves channel multiplexing rule etc.
Information, offset Offset are calculated by migration algorithm combination configuration information by offset computation unit.Delay in Fig. 6 is mended
Repay subelement Compensation) for computing and compensating for final Delay Estima-tion value, Term is a register in Fig. 6, it
Save the information such as the operating rate (Speed) of serial module of unstringing.
The computational methods of the offset of timestamp reference point shown in Fig. 7.Bricks represents physical layer coding module in figure
(Pcs) data bus interface between timestamp processing module (Tpu), it is assumed that contain p Brick block, each Brick blocks
Data bit width is w, and bx indicates the position where time stamp reference point;
PcsLane in Fig. 7 shares L, and the specific size of L is related to agreement, such as:
100G Ethernet require to use 20 PcsLane,
40G Ethernet require to use 4 PcsLane,
10G Ethernet require to use 1 PcsLane,
The relationship of L and p can be summarized as follows three kinds:
A conditions:L=n*p, (n >=1, L ≠ 1) is shown in Figure 7;
B conditions:P=n*L, (n >=1, L=1) is shown in Figure 8;
C conditions:P=n*L, (n >=1, L ≠ 1) is shown in Figure 9;
Fig. 7 is suitable for a conditions, and coordinate system here has divided tetra- regions A/B/C/D, and Offset calculations of offset is as follows:
Offset=A-C=(A+D)-(C+D)=x*L-w*i;
As L=p, C=0, D=0, special circumstances in Offset=A=x*L, that is, Fig. 7 at this time.
The region interpretation of Fig. 7:
A:It indicates that determination exports before bx, but is not yet added to total data volume in token bucket;
C:It indicates in token bucket, but due to than being exported after bx, needing the data volume therefrom deducted;
Fig. 8 is suitable for b conditions, and coordinate system here has also divided tetra- regions A/B/C/D, and bx indicates time stamp reference point institute
The positions bit, Offset calculate it is as follows:
Offset=x+C+D=x+w*i
Due to L=1, so all data before bx should all be added in token bucket, one as link delay
Point.
The region interpretation of Fig. 8:
A:It is different with the region A meanings in condition a because in A here only some data determine it is defeated before bx
Go out, it is assumed that time stamp reference point bx is in the position of Bricks [i], then just there was only x bit number before bx in Bricks [i]
It is counted according to needs;
C+D:It indicates that determination exports before bx, but is not yet added to total data volume in token bucket;
Fig. 9 is suitable for c conditions, and coordinate system here has divided six regions A/B/C/D/E/F, and bx still indicates that time stamp is joined
The positions bit where examination point, since p is the integral multiple of L, so p can be cut into multiple L blocks;Offset calculates as follows:
Offset=A+C+D,
Wherein the calculating of A can be with reference chart 7;
C+D=w*i;
So Offset=x*L+w*i;
The region interpretation of Fig. 9:
A:It indicates that determination exports before bx, but is not yet added to total data volume in token bucket;
C+D:It indicates that determination exports before bx, but is not yet added to the data volume of token bucket;
B,E,F:It indicates to determine the data exported after bx, cannot count in token bucket.
In the case of the offset for considering timestamp reference point, the number between module of serially unstringing and timestamp processing module
Calculation formula according to the delay of transmission path is:
The directions Tx:Tx_Latency=(Level+Offset)/Speed;
The directions Rx:Rx_Latency=(Level-Offset)/Speed;
Wherein, the directions Tx are that timestamp processing module is serially unstringed the direction of module transmission data, and the directions Rx are the time
Stamp processing module receives the direction for module transmission data of serially unstringing;Latency is that serial module of unstringing handles mould with timestamp
Delay between block, Level are the token number in the token bucket, and Speed is the operating rate of module of serially unstringing, Offset
For the offset of timestamp reference point.
Embodiment 3:Consider smothing filtering
On the basis of embodiment 1, smothing filtering is considered, the timestamp processing in the timestamp generation system based on token
Module further includes smothing filtering submodule (Smooth in Fig. 4), is used to control the token filled every time into the token bucket
Uniform amount;Control the token uniform amount by being taken out in the token bucket every time.
The specific method is as follows:
It is shown in Figure 10, using the thought of arithmetic average;Window is smothing filtering length of window, is counted for convenience
It calculates, length L is typically 2 integral number power, such as 32;ACC is accumulator, save in window the statistics of L nodal value and,
New and Old is the first order and afterbody node respectively;TokenIn is output, and TokenOut is output, and TokenOut is exactly L
The mean value of a node:
TokenOut=[Acc+ (New-Old)]/L
Loss of significance caused by order to reduce computation complexity and displacement, output result can only not exist temporarily divided by L
Take into account relationship L is multiplied again when final token bucket statistics, i.e.,:
TokenOut=[Acc+ (New-Old)].
Embodiment 4:Timestamp generation method based on token
Shown in Figure 11, the timestamp generation method based on token that the embodiment of the invention discloses a kind of is used to go here and there
When capable module of unstringing is communicated with timestamp processing module by physical layer coding module, the timestamp reference in PTP messages is generated
Point corresponding data input and output serially unstring module when timestamp, this approach includes the following steps:
It is serial unstring module by the bit flow amount for having sent and having received in the form of the first token Real-time Feedback to when
Between stab processing module;
What timestamp processing module Real-time Feedback timestamp processing module in the form of the second token had sent and had received
Bit flow amount is calculated according to the difference of the first token and the second token and is serially unstringed between module and timestamp processing module
The bit flow amount of delay;
Timestamp processing module calculates serially according to the bit flow amount of delay and the interface rate for module of serially unstringing
The delay of data transfer path between module of unstringing and timestamp processing module.
When detecting the timestamp reference point in PTP messages, this is recorded by local high precision clock (Chronometer)
When time, base timestamp when module of serially unstringing as the timestamp reference point corresponding data input and output uses this
Compensation of delay base timestamp, generated time stamp the input and output of reference point corresponding data serially unstring module when the final time
Stamp.
It is shown in Figure 5, serial module of unstringing is calculated according to the difference of the first token and the second token and is handled with timestamp
The detailed process of the bit flow amount of delay between module includes:
Create a token bucket;
Timestamp processing module serially unstring module transmission data when, timestamp processing module is filled out into the token bucket
The second token Tokens2 is filled, the first token Tokens1 is taken out from the token bucket;
When timestamp processing module receives the data for module transmission of serially unstringing, timestamp processing module is to the token bucket
The first token Tokens1 of middle filling, and the second token Tokens2 is taken out from the token bucket;
The bit for the delay that token number in the token bucket as serially unstrings between module and timestamp processing module
Flow amount.
It is calculated according to the interface rate of the bit flow amount of delay and module of serially unstringing and is serially unstringed module and time
The calculation formula of delay of data transfer path between stamp processing module is:
Latency=Level/Speed;
Wherein, Latency is the delay serially unstringed between module and timestamp processing module, and Level is the token
Token number in bucket, Speed are the operating rate of module of serially unstringing.
Embodiment 5:Consider the offset of timestamp reference point
On the basis of embodiment 4, the offset of timestamp reference point, the timestamp generation method based on token are considered
In, when timestamp processing module detects the timestamp reference point in PTP messages, also according to the interface speed for module of serially unstringing
The position of rate, the timestamp reference point detected, calculates the offset of timestamp reference point.
The computational methods of the offset of timestamp reference point shown in Fig. 7.Bricks represents Bricks and represents physical layer in figure
Data bus interface between coding module (Pcs) and timestamp processing module (Tpu), it is assumed that contain p Brick block, often
A Brick blocks data bit width is w, and bx indicates the position where time stamp reference point;
PcsLane in Fig. 7 shares L, and the specific size of L is related to agreement, such as:
100G Ethernet require to use 20 PcsLane,
40G Ethernet require to use 4 PcsLane,
10G Ethernet require to use 1 PcsLane,
The relationship of L and p can be summarized as follows:
a>L=n*p, (n >=1, L ≠ 1) is shown in Figure 7;
b>P=n*L, (n >=1, L=1) is shown in Figure 8;
c>P=n*L, (n >=1, L ≠ 1) is shown in Figure 9;
Fig. 7 is suitable for a conditions, and coordinate system here has divided tetra- regions A/B/C/D, and Offset calculations of offset is as follows:
Offset=A-C=(A+D)-(C+D)=x*L-w*i;
As L=p, C=0, D=0, special circumstances in Offset=A=x*L, that is, Fig. 7 at this time.
The region interpretation of Fig. 7:
A:It indicates that determination exports before bx, but is not yet added to total data volume in token bucket;
C:It indicates in token bucket, but due to than being exported after bx, needing the data volume therefrom deducted;
Fig. 8 is suitable for b conditions, and coordinate system here has also divided tetra- regions A/B/C/D, and bx indicates time stamp reference point institute
The positions bit, Offset calculate it is as follows:
Offset=x+C+D=x+w*i
Due to L=1, so all data before bx should all be added in token bucket, one as link delay
Point.
The region interpretation of Fig. 8:
A:It is different with the region A meanings in condition a because in A here only some data determine it is defeated before bx
Go out, it is assumed that time stamp reference point bx is in the position of Bricks [i], then just there was only x bit number before bx in Bricks [i]
It is counted according to needs;
C+D:It indicates that determination exports before bx, but is not yet added to total data volume in token bucket;
Fig. 9 is suitable for c conditions, and coordinate system here has divided six regions A/B/C/D/E/F, and bx still indicates that time stamp is joined
The positions bit where examination point, since p is the integral multiple of L, so p can be cut into multiple L blocks;Offset calculates as follows:
Offset=A+C+D,
Wherein the calculating of A can be with reference chart 7;
C+D=w*i;
So Offset=x*L+w*i;
The region interpretation of Fig. 9:
A:It indicates that determination exports before bx, but is not yet added to total data volume in token bucket;
C+D:It indicates that determination exports before bx, but is not yet added to the data volume of token bucket;
B,E,F:It indicates that determination exports after bx, the data volume in token bucket cannot be counted on.
In the case of the offset for considering timestamp reference point, the number between module of serially unstringing and timestamp processing module
Calculation formula according to the delay of transmission path is:
The directions Tx:Tx_Latency=(Level+Offset)/Speed;
The directions Rx:Rx_Latency=(Level-Offset)/Speed;
Wherein, the directions Tx are that timestamp processing module is serially unstringed the direction of module transmission data, and the directions Rx are the time
Stamp processing module receives the direction for module transmission data of serially unstringing;Latency is that serial module of unstringing handles mould with timestamp
Delay between block, Level are the token number in the token bucket, and Speed is the operating rate of module of serially unstringing, Offset
For the offset of timestamp reference point.
Embodiment 6:Consider smothing filtering
On the basis of embodiment 5, smothing filtering is considered, in the timestamp generation method based on token, timestamp processing
The token uniform amount that module is filled into the token bucket every time;It is equal by the token quantity taken out in the token bucket every time
It is even.
The specific method is as follows:
It is shown in Figure 10, using the thought of arithmetic average;Window is smothing filtering length of window, is counted for convenience
It calculates, length L is typically 2 integral number power, such as 32;ACC is accumulator, save in window the statistics of L nodal value and,
New and Old is the first order and afterbody node respectively;TokenIn is input, and TokenOut is output, and TokenOut is exactly L
The mean value of a node:
TokenOut=[Acc+ (New-Old)]/L
Loss of significance caused by order to reduce computation complexity and displacement, output result can only not exist temporarily divided by L
Take into account relationship L is multiplied again when final token bucket statistics, i.e.,:
TokenOut=[Acc+ (New-Old)].
The present invention is not limited to the above-described embodiments, for those skilled in the art, is not departing from
Under the premise of the principle of the invention, several improvements and modifications can also be made, these improvements and modifications are also considered as the protection of the present invention
Within the scope of.The content not being described in detail in this specification belongs to the prior art well known to professional and technical personnel in the field.