CN109818826B - Network path delay measuring method and device and time synchronization system - Google Patents

Network path delay measuring method and device and time synchronization system Download PDF

Info

Publication number
CN109818826B
CN109818826B CN201910027368.XA CN201910027368A CN109818826B CN 109818826 B CN109818826 B CN 109818826B CN 201910027368 A CN201910027368 A CN 201910027368A CN 109818826 B CN109818826 B CN 109818826B
Authority
CN
China
Prior art keywords
state
timestamp
state machine
time
sub
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN201910027368.XA
Other languages
Chinese (zh)
Other versions
CN109818826A (en
Inventor
王华林
赵玉娟
郭栋
吕宁
殷廷瑞
陈晨
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Xidian University Engineering Technology Research Institute Co ltd
Original Assignee
Xidian University Engineering Technology Research Institute Co ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Xidian University Engineering Technology Research Institute Co ltd filed Critical Xidian University Engineering Technology Research Institute Co ltd
Priority to CN201910027368.XA priority Critical patent/CN109818826B/en
Publication of CN109818826A publication Critical patent/CN109818826A/en
Application granted granted Critical
Publication of CN109818826B publication Critical patent/CN109818826B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Landscapes

  • Data Exchanges In Wide-Area Networks (AREA)

Abstract

The invention relates to a network path delay measuring method and device and time synchronization system, including obtaining the trigger data; acquiring a preset state machine information table; acquiring a state machine from the preset state machine information table according to the trigger data, and generating feedback information according to the state machine; queuing the feedback information in a task queue to obtain a queuing result, and detecting the queuing result according to preset time to obtain a detection result; and performing state processing on the state machine according to the detection result to obtain a time stamp, and calculating path delay measurement data according to the time stamp. The invention uniformly skips the interfaces of all state machines in the delay measurement through the scheduling of the task timing queue and starts the timing processing of the task timer in the task timing queue, thereby reducing the uncertainty of the system call delay, finally improving the execution efficiency of the system and improving the time precision of the path delay measurement and the time synchronization.

Description

Network path delay measuring method and device and time synchronization system
Technical Field
The invention belongs to the field of electronics and communication, and particularly relates to a network path delay measuring method and device and a time synchronization system.
Background
With the application of multimedia entertainment systems and auxiliary driving systems, a large amount of time-sensitive message data such as audio and video and the like need to be transmitted through the Ethernet, which puts higher requirements on the time synchronization of a time-sensitive network.
The time synchronization technology calibrates the time of each transmission node to a smaller range, reduces the influence caused by clock jitter and transmission delay, thereby improving the transmission quality of the network, and is a key technology for realizing high-definition audio and video and real-time data transmission. The IEEE802.1as time synchronization protocol established by the IEEE802.1 working group defines a generalized precise clock synchronization protocol (gPTP), and synchronizes the time of each transmission node of the network to a common optimal master clock, thereby ensuring low delay and time synchronization of time-sensitive network message data transmission.
However, this protocol generally suffers from a serious problem in its implementation: the path delay measurement is easily affected by uncertain calling delay of an operating system, and a large measurement error is generated, so that the precision of time synchronization is affected.
Disclosure of Invention
In order to solve the above problems in the prior art, the present invention provides a network path delay measurement method, a device thereof and a time synchronization system.
The embodiment of the invention provides a network path delay measuring method, which comprises the following steps:
acquiring trigger data;
acquiring a preset state machine information table;
acquiring a state machine from the preset state machine information table according to the trigger data, and generating feedback information according to the state machine;
queuing the feedback information in a task queue to obtain a queuing result, and detecting the queuing result according to preset time to obtain a detection result;
and performing state processing on the state machine according to the detection result to obtain a time stamp, and calculating path delay measurement data according to the time stamp.
In an embodiment of the present invention, detecting the queuing result according to the preset time to obtain a detection result includes:
acquiring a current state jump mark;
acquiring a next state jump mark;
and detecting the state jump result of the state machine in the queuing result according to the preset time, if the state jump result is that the current state jump mark is not updated to the next state jump mark, continuously detecting the state jump result of the state machine, and if the state jump result is that the current state jump mark is updated to the next state jump mark, outputting the detection result.
In one embodiment of the invention, the state machine is state-processed according to the detection result to obtain a timestamp, including,
performing first state processing on a first state machine of the state machines according to the detection result to obtain a first timestamp;
and performing second state processing on a second state machine of the state machines according to the detection result to acquire a second timestamp.
In one embodiment of the invention, performing a first state process on a first state machine of the state machines according to the detection result to obtain a first timestamp comprises,
according to the port enabling mark, when the time delay request sends the time delay request message data in the initial state, reading a first sub-timestamp, and updating a state jump mark to be a timestamp reading success mark after reading the first sub-timestamp;
reading a success mark according to the timestamp, reading a fourth sub-timestamp when receiving the delay response message data in a delay response waiting state, analyzing a second sub-timestamp from the delay response message data after reading the fourth sub-timestamp, and updating the state jump mark delay response receiving mark after analyzing the second sub-timestamp;
according to the delay response receiving mark, when the delay response following message data is received in a delay response following waiting state, a third sub-timestamp is analyzed from the delay response following message data, and the state jump mark is updated to be the delay response following receiving mark after the third sub-timestamp is analyzed;
receiving a delay request waiting timing information in a delay request interval waiting state according to the delay response following receiving mark, and updating the state jump mark into a delay request sending interval mark;
according to the time delay request sending interval mark, when the time delay request message data is sent in a time delay request waiting state, reading the first sub-timestamp, and updating the state jump mark after reading the first sub-timestamp until the first timestamp meets the requirement of a preset threshold value;
and obtaining a first time stamp according to the first sub-time stamp and the fourth sub-time stamp.
In one embodiment of the invention, performing a second state processing on a second state machine of the state machines according to the detection result to obtain a second timestamp includes,
according to the port enabling mark, receiving the delay request message data in the initial waiting state of the delay request, and updating the state jump mark into a delay request receiving mark;
according to the time delay request receiving mark, reading a second sub-timestamp in a waiting state of a time delay response timestamp, filling the second sub-timestamp in the time delay response message data, sending the time delay response message data after filling the second timestamp, reading a third sub-timestamp, and updating the state jump mark into a timestamp reading success mark after reading the third sub-timestamp;
according to the timestamp reading success mark, filling the third sub-timestamp in the delay response following message data in a delay request waiting state, sending the delay response following message data, and updating the state jump mark until the second timestamp meets the requirement of a preset threshold value after the delay response following message data is sent and then the delay request message data is received;
and acquiring a second timestamp according to the second sub-timestamp and the third sub-timestamp.
In one embodiment of the invention, path delay measurement data is calculated from the time stamps, including,
calculating the path delay measurement data from the first sub-timestamp, the second sub-timestamp, the third sub-timestamp, and the fourth sub-timestamp.
The embodiment of the invention provides a network path delay measuring device, which comprises a triggering module, a state storage module, a state acquisition module, a task timing queue module and a state processing module, wherein,
the trigger module is used for acquiring the trigger data;
the state storage module is used for storing the preset state machine information table;
the state obtaining module is used for obtaining the state machine from the preset state machine information table according to the trigger data and generating the feedback information according to the state machine;
the task timing queue module is used for queuing the feedback information in a task queue to obtain a queuing result, and detecting the queuing result according to the preset time to obtain the detection result;
and the state processing module is used for carrying out state processing on the state machine according to the detection result so as to obtain the timestamp and calculating the path delay measurement data according to the timestamp.
The embodiment of the invention provides a network path delay measurement time synchronization system, which comprises the network path delay measurement device.
Compared with the prior art, the invention has the beneficial effects that:
1. the invention uniformly skips the interfaces of all state machines in the delay measurement through the scheduling of the task timing queue and starts the timing processing of the task timer in the task timing queue, thereby reducing the uncertainty of the system call delay, finally improving the execution efficiency of the system and improving the time precision of the path delay measurement and the time synchronization.
2. The path delay measurement method can be used in an end-to-end time synchronization system, can also be suitable for complex environments such as multi-point networking and the like, can improve the time synchronization performance in the whole networking environment, and is more widely applied.
Drawings
Fig. 1 is a schematic flowchart of a method for measuring network path delay according to an embodiment of the present invention;
fig. 2 is a schematic structural diagram of a first state machine and a second state machine in a network path delay measurement method according to an embodiment of the present invention;
fig. 3 is a schematic diagram of state transition of a first state machine in a network path delay measurement method according to an embodiment of the present invention;
fig. 4 is a schematic diagram of state transition of another first state machine in a network path delay measurement method according to an embodiment of the present invention;
fig. 5 is a schematic diagram of state transition of a second state machine in the network path delay measurement method according to the embodiment of the present invention;
fig. 6 is a schematic diagram of state transition of another second state machine in a network path delay measurement method according to an embodiment of the present invention;
fig. 7 is a schematic diagram of a timestamp generation position in a network path delay measurement method according to an embodiment of the present invention;
fig. 8 is a schematic structural diagram of a network path delay measurement apparatus according to an embodiment of the present invention;
fig. 9 is a schematic operation flow diagram of a network path delay measurement time synchronization system according to an embodiment of the present invention;
fig. 10a to 10b are schematic diagrams illustrating comparison of path delay measurement results of three path delay measurement methods of gPTP, penAVB and PTP-1.8 under no-load and 256kps load according to an embodiment of the present invention.
Detailed Description
The present invention will be described in further detail with reference to specific examples, but the embodiments of the present invention are not limited thereto.
Example one
Referring to fig. 1, fig. 2, fig. 3, fig. 4, fig. 5, and fig. 6, fig. 1 is a schematic flow chart illustrating a method for measuring network path delay according to an embodiment of the present invention; fig. 2 is a schematic structural diagram of a first state machine and a second state machine in a network path delay measurement method according to an embodiment of the present invention; fig. 3 is a schematic diagram of state transition of a first state machine in a network path delay measurement method according to an embodiment of the present invention; fig. 4 is a schematic diagram of state transition of another first state machine in a network path delay measurement method according to an embodiment of the present invention; fig. 5 is a schematic diagram of state transition of a second state machine in the network path delay measurement method according to the embodiment of the present invention; fig. 6 is a schematic diagram of state transition of another second state machine in a network path delay measurement method according to an embodiment of the present invention. The embodiment of the invention provides a network path delay measurement method, which comprises the following steps:
acquiring trigger data;
acquiring a preset state machine information table;
acquiring a state machine from a preset state machine information table according to the trigger data, and generating feedback information according to the state machine;
queuing the feedback information in the task queue to obtain a queuing result, and detecting the queuing result according to preset time to obtain a detection result;
and performing state processing on the state machine according to the detection result to acquire a time stamp, and calculating path delay measurement data according to the time stamp.
Further, the acquiring of the trigger data is to acquire a state jump flag of the state machine in the path delay measurement.
Further, a preset state machine information table is obtained, all state machines of the whole time synchronization system are stored in the preset state information table, no matter whether a certain current state machine operates or not or whether a certain state of the state machine is executed or not, as long as the time synchronization system starts to operate, information of all the state machines can be stored in the preset state information table in advance, and the preset state information table comprises types of the state machines and states of the state machines.
And further, acquiring the state machine from a preset state machine information table according to the trigger data, and generating feedback information according to the state machine.
Specifically, after receiving trigger data, firstly, determining whether a state machine corresponding to the trigger data exists in a state information table according to the trigger data, if the state machine corresponding to the trigger data does not exist in a preset state information table, registering the state machine in the preset state information table, then marking the registered state machine, and generating feedback information by the marked state machines; and if the state machines corresponding to the trigger data exist in the preset state information table, marking the state machines corresponding to the trigger data, and generating feedback information by the marked state machines. Meanwhile, the time required by all the marked state machines to process each state is counted, the longest time Tmax spent by the state processing is selected from the time required by the state processing, and the state processing is packed into the feedback information. Wherein the feedback information comprises a marked state machine type, a marked state machine state and a time Tmax.
Further, queuing the feedback information in the task queue to obtain a queuing result, and detecting the queuing result according to preset time to obtain a detection result.
Specifically, the task timing queue performs queue sequencing on the states of the state machines in the feedback information according to the sequence received by the state machines to obtain a queuing result;
meanwhile, according to the time Tmax fed back by the feedback information, setting preset time, starting a task timer according to the preset time, periodically detecting the state of a state machine in a queuing result of the task timing queue by the task timer, and outputting a detection result. And the detection period of the task timer is less than the time Tmax. For example, the longest state processing time of all state processing in the current task timing queue is 5ms, that is, it is necessary to wait for 5ms at most from a certain state to the next state, then the detection period of the task timer is set to 1ms, it is detected every 1ms (or less time interval) whether the state of the state machine jumps to the next state, if not, the detection is continued, and if the state jumps to the next state, the detection result is output.
Further, detecting the queuing result according to the preset time to obtain a detection result, including:
acquiring a current state jump mark;
acquiring a next state jump mark;
and detecting a state jump result of the state machine in the queuing result according to the preset time, if the state jump result is that the current state jump mark is not updated to a next state jump mark, continuously detecting the state jump result of the state machine, and if the state jump result is that the current state jump mark is updated to the next state jump mark, outputting the detection result.
Further, the state machine is subjected to state processing according to the detection result to obtain a time stamp, and path delay measurement data is calculated according to the time stamp.
Wherein, the state machine is processed according to the detection result to obtain the time stamp, comprising,
performing first state processing on a first state machine MDPdielAyReq of the state machine according to the detection result to obtain a first timestamp;
and performing second state processing on a second state machine MDPdielAyReq of the state machine according to the detection result to acquire a second timestamp.
Specifically, referring to fig. 2 again, in the present embodiment, the path delay measurement data is mainly implemented by two state machines, namely, a first state machine MDPdelayReq and a second state machine MDPdelayResp, where the first state machine MDPdelayReq and the second state machine MDPdelayResp are located in a Media-dependent layer (MD). The node where the first state machine MDPdielAyReq is located serves as an initiator, the node where the second state machine MDPdielAyResp is located serves as a responder, the first state machine processing is carried out in the state of the first state machine MDPdielAyReq through triggering of triggering data, the first timestamp is obtained, message data receiving and second state machine processing are carried out in the state of the second state machine MDPdielAyResp, the second timestamp is obtained, and path delay measurement data are obtained through calculation of the first timestamp and the second timestamp.
In this embodiment, a path delay measurement first state machine MDPdelayReq and a second state machine MDPdelayResp designed based on a gPTP protocol defined by an ieee 802.11 as protocol, where the ieee 802.11 as protocol includes a Media-dependent layer MD and a Media-independent layer (MI for short), where the Media-dependent layer MD is responsible for transmission of packet data, and the Media-independent layer MI is responsible for scheduling of a time synchronization system. Specifically, the media related layer MD implements sending and receiving of message data with a time synchronization system, and reading and writing of a timestamp; and the media independent layer MI realizes the scheduling of the time synchronization system and the processing of message data according to the first state machine MDPdeleyReq and the second state machine MDPdeleyResp. The first state machine MDPdelayReq and the second state machine MDPdelayResp cooperate to perform path delay measurements.
Further, a first state process is performed on a first state machine MDPdelayReq of the state machine according to the detection result to obtain a first timestamp, including,
according to the port enabling mark, when the delay request is sent in the initial state to send the delay request message data, reading a first sub-timestamp t1, and updating a state jump mark to be a timestamp reading success mark after reading the first sub-timestamp t 1;
reading a success mark according to the timestamp, reading a fourth sub-timestamp t4 when the delay response message data is received in a delay response waiting state, analyzing a second sub-timestamp t2 from the delay response message data after reading the fourth sub-timestamp t4, and updating a state jump mark delay response receiving mark after analyzing the second sub-timestamp t 2;
according to the delay response receiving mark, when the delay response following message data is received in a delay response following waiting state, a third sub-timestamp t3 is analyzed from the delay response following message data, and after the third sub-timestamp t3 is analyzed, the state jump mark is updated to be a delay response following receiving mark;
receiving a delay request waiting timing information in a delay request interval waiting state according to the delay response following receiving mark, and updating a state skip mark into a delay request sending interval mark;
according to the time delay request sending interval mark, sending time delay request message data in a time delay request waiting state, reading a first sub-timestamp t1, and updating a state jump mark after reading a first sub-timestamp t1 until the first timestamp meets the requirement of a preset threshold value;
the first timestamp is derived from the first sub-timestamp t1 and the fourth sub-timestamp t 4.
Referring to fig. 3 and 4 again, it can be seen that the states of the first state machine MDPdelayReq in this embodiment include a port NOT ENABLED state NOT _ enable, a delay request sending INITIAL state INITIAL _ SEND _ pdelayreq, a delay response WAITING state wait _ FOR _ pdelayresp, a delay response following WAITING state wait _ FOR _ pdelayjresp _ close _ Up, a delay request sending INTERVAL WAITING state wait _ FOR _ pdelayjinterrupt _ TIMER, a delay request sending state SEND _ pdelayreq, and a timeout RESET state RESET, and all the states constitute the first state machine MDPdelayReq.
Specifically, the state machine jump flow of the first state machine MDPdelayReq and its operation in the corresponding state processing include: when the time synchronization system detects that the port of the node where the first state machine mdpdeliyreq is located is ENABLED and the node where the first state machine mdpdeliyreq is located supports message data receiving and sending, the state jump flag of the first state machine mdpdeliyreq is updated to the port enabling flag, and the state jump flag received by the first state machine mdpdeliyreq is updated to the port enabling flag, so that the first state machine mdpdeliyreq requests sending of the INITIAL state INITIAL _ SEND _ pdeliay _ REQ from the time delay of the state machine port NOT enabling state NOT _ enable to the port enabling flag;
sending delay request message data Pdelay _ REQ under a delay request sending INITIAL state INITIAL _ SEND _ PDELAY _ REQ, reading a first sub-timestamp t1 after sending the delay request message data Pdelay _ REQ, updating a state jump flag of the first state machine MDPdelay _ Req to a timestamp reading success flag after reading the first sub-timestamp t1, and jumping to a delay response WAITING state WAITING _ FOR _ PDELAY _ RESP by the first state machine MDPdelay Req through the delay request sending INITIAL state INITIAL _ SEND _ PDELAY _ REQ;
receiving delay response message data PDELAY _ RESP sent by a second state machine MDPdelayResp under a delay response WAITING state wait _ FOR _ PDELAY _ RESP, reading a fourth sub-timestamp t4 after receiving the delay response message data PDELAY _ RESP, resolving a second sub-timestamp t2 from the delay response message data PDELAY _ RESP, updating a state jump flag of the first state machine MDPdelayReq into a delay response receiving flag, and jumping the first state machine MDPdelayReq from the delay response WAITING state wait _ FOR _ PDELAY _ RESP to a delay response following WAITING state wait _ FOR _ PDELAY _ RESP _ top;
receiving delay response following message data PDELAY _ RESP _ FOLLOW _ UP sent by the second state machine MDPdelayResp at the delay response following WAITING state wait _ FOR _ PDELAY _ RESP _ FOLLOW _ UP, parsing a third sub-timestamp t3 from the delay response following message data PDELAY _ RESP _ FOLLOW _ UP so that the first state machine MDPdelayReq obtains four timestamp information of the calculated path delay measurement data, updating a state jump flag of the first state machine MDPdelayReq to a delay response following receiving flag, and updating the first state machine MDPdelayReq to a delay request INTERVAL WAITING state wait _ FOR _ PDELAY _ temporal _ TIMER by the delay response following WAITING state wait _ FOR _ PDELAY _ RESP _ prop _ FOLLOW _ UP _ jump to the delay request INTERVAL WAITING state wait;
WAITING FOR TIMER information of time delay request message data Pdelay _ Req at a WAITING state of a time delay INTERVAL TIMER, updating a state jump flag of a first state machine MDPdelay Req to a time delay request sending INTERVAL flag after the TIMER information of the time delay request message data Pdelay _ Req arrives, and jumping to a time delay request sending state SEND _ PDELAY _ REq by the WAITING state of the time delay INTERVAL TIMER WAITING _ FOR _ PDELAY _ INTERVAL _ TIMER of the first state machine MDPdelay Req;
and sending time delay request message data Pdelay _ REQ in a time delay request sending state SEND _ PDELAY _ REQ, and starting a new round of path delay measurement until the first timestamp meets the requirement of a preset threshold value. Wherein the first timestamp is derived from the first sub-timestamp t1 and the fourth sub-timestamp t 4.
If the first state machine MDPdelayReq waits FOR the delay response message data PDELAY _ RESP in the delay response WAITING state wait _ FOR _ PDELAY _ RESP or the delay response following WAITING state wait _ FOR _ PDELAY _ RESP _ folow _ UP and waits FOR the delay response following message data PDELAY _ RESP _ FOLLOW _ UP, a wait timeout occurs, the state jump flag of the first state machine MDPdelayReq is updated to a delay response wait timeout flag or a delay response following wait timeout flag, and the first state machine MDPdelayReq is transitioned to a wait timeout RESET state RESET from the delay response WAITING state wait _ FOR _ PDELAY _ RESP or the delay response following wait state wait _ FOR _ PDELAY _ RESP _ full _ req; initializing path delay measurement parameters in a waiting overtime RESET state, then unconditionally jumping from the waiting overtime RESET state to a delay request sending state SEND _ PDELAY _ REQ, and continuously sending delay request message data Pdelay _ Req to start next path delay measurement.
TABLE 1 State jump flag description in the first state machine MDPdielAyReq
Status jump flag Description of the invention
portEnabled Indicating port enable flag
pdelayIntervalTimer Indication of delay request transmission interval flag
rcvdPdelayResp Indication of delay response reception
rcvdPdelayRespFollowUp Indicating that the delay response follows the received flag
rcvdMDTimestampReceive Indication of timestamp read success flag
pdelayRespTimeout Indicating delay response wait timeout flag
pdelayRespFollowUpTimeout Indication of delay response following wait timeout flag
In table 1, the state jump flags of the first state machine MDPdelayReq control the jump of the states of the first state machine MDPdelayReq. The initial state of each state jump mark is 0. Referring to fig. 3 and 4 again, FOR example, the condition of the delay response wait state wait _ FOR _ PDELAY _ RESP jumping to the delay response FOLLOW wait state wait _ FOR _ PDELAY _ RESP _ down _ UP is that the delay response wait state wait _ FOR _ PDELAY _ RESP state jump flag is updated to the delay response receive flag, otherwise the first state process of the delay response wait state wait _ FOR _ PDELAY _ RESP is not completed yet, the state jump flag needs to be updated to the delay response receive flag until the first state process of the state is completed, and the first state machine MDPdelayReq jumps from the delay response wait state wait _ state wait _ state wait _ FOR _ PDELAY _ RESP _ down to the delay response FOLLOW wait state wait _ state wait _ FOR _ PDELAY _ RESP _ FOR _ delay _ response _ FOR _ response _ state. Other states are analogized.
As can be seen from the above, the main functions of the first state machine MDPdelayReq in this embodiment are:
(a) the delay request message data Pdelay _ Req is sent, and the first word timestamp t1 is read, and the first sub-timestamp t1 is read after the delay request message data Pdelay _ Req is sent.
(b) Receiving the delay response message data Pdelay _ Resp, and reading a fourth sub-timestamp t4, where the fourth sub-timestamp t4 is read after the delay response message data Pdelay _ Resp is received; after the fourth sub-timestamp t4 is read, the second sub-timestamp t2 is parsed from the delayed response message data Pdelay _ Resp.
(c) And receiving the delay response following message data Pdelay _ Resp _ Follow _ Up, and then resolving a third sub-timestamp t3 from the delay response following message data Pdelay _ Resp _ Follow _ Up.
(d) And performing timeout processing on the time delay response message data Pdelay _ Resp and the time delay response following message data Pdelay _ Resp _ Follow _ Up.
Further, second state processing is performed on a second state machine MDPdelayResp of the state machine according to the detection result to obtain a second timestamp, including,
according to the port enabling mark, receiving the delay request message data in the initial waiting state of the delay request, and updating the state jump mark into a delay request receiving mark;
according to the time delay request receiving mark, when the second sub-timestamp t2 is read in the waiting state of the time delay response timestamp, the second timestamp is filled in the time delay response message data, the time delay response message data is sent after the second sub-timestamp t2 is filled, the third sub-timestamp t3 is read, and after the third sub-timestamp t3 is read, the state skip mark is updated to be the timestamp reading success mark;
according to the timestamp reading success mark, filling a third sub-timestamp t3 in the delay response following message data in a delay request waiting state, sending the delay response following message data, and updating the state jump mark until the second timestamp meets the preset threshold value requirement after the delay response following message data is sent and then the delay request message data is received;
the second time stamp is acquired according to the second sub time stamp t2 and the third sub time stamp t 3.
Referring to fig. 5 and 6 again, it can be seen that the states of the second state machine MDPdelayResp in this embodiment include a port NOT _ ENABLED state, a delay request wait INITIAL state INITIAL _ wait _ FOR _ PDELAY _ REQ, a delay request wait state wait _ FOR _ PDELAY _ REQ, and a delay response timestamp wait state send _ PDELAY _ RESP _ wait _ FOR _ TIMESTAMP, and all the states constitute the second state machine MDPdelayResp.
Specifically, the state machine jump flow of the second state machine MDPdelayResp and the operation thereof in the corresponding state processing include: when the port of the node where the second state machine MDPdelayResp is located meets the port enable and the node where the second state machine MDPdelayResp is located supports message data receiving and sending, the state jump flag of the second state machine MDPdelayResp is updated to the port enable flag, and after the state jump flag received by the second state machine MDPdelayResp is updated to the port enable flag, the state of the second state machine MDPdelayResp jumps from the port disable state NOT _ enable block to the delay request WAITING FOR the INITIAL state INITIAL _ wait _ FOR _ PDELAY _ REQ;
setting a state jump rcvdPdelayReq flag to false under a delay request WAITING INITIAL state INITIAL _ wait _ FOR _ PDELAY _ REQ, then WAITING FOR a first state machine MDPdelayReq to send delay request message data PDELAY _ REQ, updating the state jump flag of a second state machine MDPdelayResp to a delay request receiving flag when the delay request WAITING INITIAL state INITIAL _ wait _ FOR _ PDELAY _ REQ receives the delay request message data PDELAY _ REQ, and jumping the state of the second state machine MDPdelayResp from the delay request WAITING INITIAL state INITIAL _ wait _ state _ FOR _ PDELAY _ REQ to a delay response timestamp WAITING state send _ PDELAY _ rest _ wait _ FOR _ TIMESTAMP;
under the delayed response timestamp WAITING state SENT _ PDELAY _ RESP _ WAITING _ FOR _ TIMESTAMP, first reading a second sub-timestamp t2, then filling a second sub-timestamp t2 into delayed response message data Pdelay _ Resp and sending the second sub-timestamp to a first state machine MDPdelayReq, reading a third sub-timestamp t3 after sending the delayed response message data Pdelay _ Resp, updating a state jump flag of the second state machine MDPdelayResp to a timestamp reading success flag, and jumping the state of the second state machine MDPdelayResp from the delayed response timestamp WAITING state SENT _ PDELAY _ RESP _ WAITING _ FOR _ TIMESTAMP to a delayed response timestamp WAITING state WAITING _ FOR _ REQ;
under the delay request WAITING state wait _ FOR _ PDELAY _ REQ, the third sub-timestamp t3 is first filled into the delay response following message data PDELAY _ Resp _ Follow _ Up and sent to the first state machine MDPdelayReq, after the delay response following message data PDELAY _ Resp _ Follow _ Up is sent, the delay request message data PDELAY _ REQ sent by the first state machine MDPdelayReq is continuously waited FOR receiving, and the second state processing flow is continued until the second timestamp meets the preset threshold requirement. Wherein the second timestamp is obtained according to the second sub-timestamp t2 and the third sub-timestamp t 3.
TABLE 2 State jump flag description in the second state machine MDPdielayResp
Status jump flag Description of the invention
portEnabled Indicating port enable flag
rcvdPdelayReq Indication of delay request receipt
rcvdMDTimestampReceive Indication of timestamp read success flag
In table 2, each state jump flag of the second state machine MDPdelayResp controls the jump of each state in the second state machine MDPdelayResp, and the initial value of each state jump flag is 0. Referring to fig. 5 and fig. 6 again, FOR example, when the delayed response timestamp wait state send _ PDELAY _ RESP _ WAITING _ FOR _ TIMESTAMP jumps to the delayed response timestamp wait state wait _ FOR _ PDELAY _ REQ, the condition is that the state jump flag after the delayed response timestamp wait state send _ PDELAY _ RESP _ WAITING _ FOR _ TIMESTAMP state processing is updated to the timestamp reading success flag, otherwise, the delayed response timestamp wait state send _ PDELAY _ RESP _ WAITING _ FOR _ TIMESTAMP continues the second state processing procedure of the state until the state processing is finished, the state jump flag is updated to the timestamp reading success flag, and the delayed response timestamp wait state wait _ FOR _ PDELAY _ REQ jumps to the delayed response timestamp wait state wait _ FOR _ PDELAY _ REQ, and then the second state processing of the state is performed. Other states are analogized.
As can be seen from the above, the main functions of the second state machine MDPdelayResp in this embodiment are:
(a) and receiving the delay request message data Pdelay _ Req sent by the first state machine MDPdelayReq, and reading a second sub-timestamp t2, where the second sub-timestamp t2 is read after the second state machine MDPdelayResp receives the delay request message data Pdelay _ Req.
(b) And filling the second sub-timestamp t2 in the delay response message data Pdelay _ Resp, and sending the second sub-timestamp t2 to the first state machine MDPdelayReq.
(c) And reading a third sub-timestamp t3 after sending the delay response message data Pdelay _ Resp, filling the third sub-timestamp t3 into the delay response following message data Pdelay _ Resp _ Follow _ Up, and sending the delay response following message data Pdelay _ Resp _ Follow _ Up to the first state machine MDPdelayReq.
Referring to fig. 3, 4, 5 and 6 again, it can be seen that the overall workflow of the first state machine MDPdelayReq and the second state machine MDPdelayResp is as follows: the time synchronization system is initially started, firstly, an INITIAL state INITIAL _ SEND _ PDELAY _ REQ is sent in a time delay request of a first state machine MDPdelayReq to SEND time delay request message data PDELAY _ REQ, a first sub-timestamp t1 is read, a state skip flag is updated to be a timestamp reading success flag after the first sub-timestamp t1 is read, and the state of the first state machine MDPdelayReq is skipped from the time delay request sending INITIAL state INITIAL _ SEND _ PDELAY _ REQ to a time delay response WAITING state wait _ FOR _ PDELAY _ RESP; when the second state machine MDPdelayResp receives the delay request message data PDELAY _ REQ at the delay request INITIAL WAITING state INITIAL _ WAITING _ state _ FOR _ PDELAY _ REQ, the state jump flag of the second state machine MDPdelayResp is updated to a delay request receiving flag, and the state of the second state machine MDPdelayResp jumps from the delay request INITIAL WAITING state INITIAL _ WAITING _ FOR _ PDELAY _ REQ to the delay response timestamp WAITING state send _ PDELAY _ rest _ WAITING _ FOR _ TIMESTAMP; in a latency response timestamp WAITING state send _ PDELAY _ RESP _ WAITING _ FOR _ TIMESTAMP, first reading a second sub-timestamp t2, after reading a second sub-timestamp t2, filling a second sub-timestamp t2 into latency response message data PDELAY _ RESP, then sending the latency response message data PDELAY _ RESP, and after sending the latency response message data PDELAY _ RESP, reading a third sub-timestamp t3, then updating a status jump flag of the second state machine MDPdelayResp to a timestamp reading success flag, and jumping a status of the second state machine MDPdelayResp from a latency response timestamp WAITING state send _ PDELAY _ RESP _ WAITING _ FOR _ REQ; in the WAITING-state wait _ FOR _ PDELAY _ REQ of the delay request, firstly filling a third sub-timestamp t3 into the delay response following message data PDELAY _ Resp _ Follow _ Up, and then sending the delay response following message data PDELAY _ Resp _ Follow _ Up; when the delay response WAITING state wait _ FOR _ PDELAY _ RESP of the first state machine MDPdelayReq receives the delay response message data PDELAY _ RESP, the fourth sub-timestamp t4 is read, the second sub-timestamp t2 is parsed from the delay response message data PDELAY _ RESP after the fourth sub-timestamp t4 is read, the state jump flag of the first state machine MDPdelayReq is updated to the delay response receiving flag, and the state of the first state machine MDPdelayReq jumps from the delay response WAITING state wait _ FOR _ PDELAY _ RESP to the delay response following WAITING state wait _ FOR _ PDELAY _ RESP _ top; receiving the delay response following message data PDELAY _ RESP _ below _ UP in the delay response following WAITING state, parsing a fourth sub-timestamp t4 from the delay response following message data PDELAY _ RESP _ below _ UP until four timestamp data required FOR calculating the path delay measurement data are acquired at the node where the first state machine MDPdelayReq is located, calculating the path delay measurement data at the node where the first state machine MDPdelayReq is located, and storing the path delay measurement data to the node where the first state machine MDPdelayReq is located. And starting the working processes of the first state machine MDPdelayReq and the second state machine MDPdelayResp by time delay request timing information, sending a time delay request data message Pdelay _ Req after receiving the time delay request timer information, and starting a new round of flow for acquiring path delay measurement data until the first time stamp and the second time stamp meet the preset threshold requirement.
Further, the first sub-timestamp, the second sub-timestamp, the third sub-timestamp, and the fourth sub-timestamp are all read at a physical layer of the gPTP protocol.
Specifically, referring to fig. 7, fig. 7 is a schematic diagram of a timestamp generation position in a network path delay measurement method according to an embodiment of the present invention, and it can be seen that a position of a data packet generation timestamp in a gPTP protocol may be in a user layer, an MAC layer, and a physical layer. The timestamp is not directly packed into the message data after being generated, but is read by calling a timestamp interface after the message data is sent or received. In this embodiment, the timestamps specifically refer to a first sub-timestamp t1, a second sub-timestamp t2, a third sub-timestamp t3, and a fourth sub-timestamp t4, and the first sub-timestamp t1, the second sub-timestamp t2, the third sub-timestamp t3, and the fourth sub-timestamp t4 are all read in the gPTP protocol physical layer.
The time stamp represents the time when the message data enters or leaves the time synchronization system, and the gPTP takes the difference between the time stamp and the time when the message data actually enters or leaves the time synchronization system as the time stamp accuracy measurement standard. The timestamp accuracy at the user layer, MAC layer and physical layer three timestamp generation locations is different: because the Linux system is a non-real-time operating system, the time synchronization system cannot be determined due to the fact that a processor is occupied by other processes on a user layer, and the accuracy of the timestamp is low; the timestamp is generated on the MAC layer through the network card drive, so that the interference of a user process is avoided, the accuracy of the timestamp is higher than that of the user layer timestamp, but the processing time of the timestamp in the MAC layer is difficult to determine, and the accuracy of the timestamp is still influenced; the timestamp generation mode with the highest accuracy is the timestamp generated when the first byte reaches the physical layer during message data receiving, and the timestamp is generated when the last byte leaves the physical layer during message data sending, so that the mode completely avoids the interference of time synchronization system delay. However, this method of generating the time stamp requires precise hardware. In this embodiment, the time stamp is implemented at the physical layer.
Further, path delay measurement data is calculated from the time stamps.
Specifically, the present embodiment calculates the path delay measurement data from the first sub-timestamp, the second sub-timestamp, the third sub-timestamp, and the fourth sub-timestamp. The path delay measurement data is calculated and saved in a first state machine MDPdelayReq.
In this embodiment, each time the path delay measurement data is calculated as:
Figure BDA0001942983960000181
where D denotes path delay measurement data, t1 denotes a first sub-timestamp, t2 denotes a second sub-timestamp, t3 denotes a third sub-timestamp, and t4 denotes a fourth sub-timestamp.
Specifically, the first state machine MDPdelayReq and the second state machine MDPdelayResp acquire the first sub-timestamp t1, the second sub-timestamp t2, the third sub-timestamp t3, and the fourth sub-timestamp t4 through the first state process and the second state process, and finally calculate the acquisition path delay measurement data D by the equation (1) for the first sub-timestamp t1, the second sub-timestamp t2, the third sub-timestamp t3, and the fourth sub-timestamp t4 acquired in the first state machine MDPdelayReq pair.
Further, according to the path delay measurement data of each time, an average value of the k times of path delay measurement data is obtained as final path delay measurement data, and the final path delay measurement data is calculated and expressed as:
Figure BDA0001942983960000191
wherein k represents the number of times, Davg,kRepresents the mean value of k path delay measurements, Davg,k-1The average of the k-1 path delay measurement data is shown.
Preferably, the value of k ranges from 10 to 20.
Specifically, the path delay measurement is initiated between the node where the first state machine MDPdelayReq is located and the node where the second state machine MDPdelayResp is located. Because the delay of the message data in the time synchronization system may be affected by network congestion or fluctuation, a single path delay measurement result cannot accurately measure the path delay measurement data between the node where the first state machine MDPdelayReq is located and the node where the second state machine MDPdelayResp is located within a period of time. Therefore, the path delay measurement data is often required to be performed multiple times, and the time synchronization system averages the k times of path delay measurement data stored in the node where the first state machine MDPdelayReq is located to obtain the final path delay measurement data of the time synchronization system. In this embodiment, the first timestamp and the second timestamp are obtained to meet the requirement of the preset threshold, that is, the present embodiment obtains k times of path delay measurement data, that is, obtains k times of the first timestamp and the second timestamp, calculates path delay measurement data each time through the first timestamp and the second timestamp obtained each time, and averages the obtained k times of the path delay measurement data to obtain final path delay measurement data. The message data includes delay request message data Pdelay _ Req, delay response message data Pdelay _ Resp, and delay response following message data Pdelay _ Resp _ Follow _ Up.
Further, after traversing the state of the first state machine MDPdelayReq and the state of the second state machine MDPdelayResp in the feedback information, the task timer periodically clears the skipped state in the feedback information in the task queue.
Specifically, the timed task queue marks all state machines required in a preset state machine information table according to trigger data in a time synchronization system, designs task timed queue scheduling according to the marked state machine type and the state of the state machine, sets preset time according to the time Tmax, starts a task timer according to the preset time, and regularly detects the state of the state machine reaching the execution time according to the state machine state in the task timed queue scheduling by the task timer and performs corresponding state processing. And after traversing the state of the first state machine MDPdielAyReq and the state of the second state machine MDPdielAyResp in the feedback information, the task timer regularly clears the skipped state in the feedback information in the task queue, and reserves enough space for the next state machine state queue. And marking the state machine from the preset state information table again according to the trigger data, confirming the type, the state and the time Tmax of the state machine entering the task timing queue next time, and carrying out subsequent flow processing.
The task timing queue has the function that on the basis that the path delay time called by each state in the first state machine MDPdielAyReq and the second state machine MDPdielAyResp is determined by the formula (1) and the formula (2), the state machine type, the state machine state and the time Tmax in the preset state information table are written into the task timing queue, and the task timer is adopted to poll and detect the state of the state machine at regular time, so that the uncertainty of the message data sending interval can be reduced, and the accuracy of path delay measurement and time synchronization is improved.
The embodiment provides a path delay measurement method, which adopts task timing queue scheduling to unify the state of a first state machine MDPdielAyReq and the state of a second state machine MDPdielAyResp into a state jump interface, and starts the timing of a task timer in a task timing queue, so that the time for processing each state in the first state machine MDPdielAyReq and the second state machine MDPdielAyResp is determined, the uncertainty of the call delay of a time synchronization system is reduced, the execution efficiency of the time synchronization system is finally improved, and the time precision of delay measurement and time synchronization is improved.
Referring to fig. 8, fig. 8 is a schematic structural diagram of a network path delay measurement apparatus according to an embodiment of the present invention. In this embodiment, the path delay measuring apparatus specifically includes a trigger module, a state storage module, a state acquisition module, a task timing queue module, and a state processing module,
and the trigger module is used for acquiring trigger data.
Specifically, the trigger module obtains trigger data, and the trigger data in this embodiment is mainly a state jump flag.
And the state storage module is used for storing a preset state machine information table.
Specifically, the preset state machine information table stored in the state storage module stores the related state machine in the preset state information table in advance according to the requirement of the time synchronization system, so that the use of subsequent path delay measurement is facilitated, and the time for generating the state machine information table in the path delay measurement process and the cost of a memory can be reduced.
And the state acquisition module is used for acquiring the state machine from the preset state machine information table according to the trigger data and generating feedback information according to the state machine.
Specifically, in the state acquisition module, the state machine required for calculating the path delay data is marked from the preset state machine information table according to the trigger data, and the type of the state machine, the state machine state and the state processing time Tmax in all state processing of the state machine are used for generating the feedback information, so that the processing of all state machines in the preset state machine information table in the subsequent process is avoided.
And the task timing queue module is used for queuing the feedback information in the task queue to obtain a queuing result, and detecting the queuing result according to preset time to obtain a detection result.
Specifically, the task timing queue module queues the state machine state in the feedback information to obtain a queuing result; and secondly, setting preset time according to the time Tmax in the feedback information, starting a task timer according to the preset time, detecting a queuing result of the task timing queue at regular time, and outputting a detection result.
In the embodiment, the task timing queue is used for scheduling the state of the state machine, so that the delay of a part of time synchronization system call is determined and counteracted, meanwhile, the path delay data is prevented from being directly processed in the message data receiving and sending threads, and the uncertainty of the time synchronization system call path delay measurement is greatly reduced.
And the state processing module is used for carrying out state processing on the state machine according to the detection result so as to obtain the time stamp and calculating the path delay measurement data according to the time stamp.
Specifically, the state processing module performs state processing on the state of the state machine according to the detection result of the task timer, acquires timestamp information required for calculating the path delay measurement data in the embodiment from each state processing of the state machine continuously according to the detection result of the timer, and calculates the path delay measurement data according to the timestamp information.
The state processing in this embodiment is to perform corresponding state processing operation in the state according to the state jump flag, and immediately exit the state after completing the state processing operation of one state, and meanwhile, prompt the currently executed state and the state that needs to be jumped next time. Due to the design, each state of the state machine is executed only when the jump condition is met, the jump condition of the state is not required to be polled and detected constantly, and a large amount of time consumption of a time synchronization system is saved. Meanwhile, the unified state machine entry design greatly facilitates the calling of the task timing queue of the time synchronization system to various state machines, and the task timer of the task timing queue is combined to separate the operations of receiving and sending the message data and the processing of the message data, so that the mutual influence of the message data processing, the message data receiving and sending on time is eliminated.
Referring to fig. 9, fig. 9 is a schematic diagram illustrating an operation flow of a time synchronization system for measuring network path delay according to an embodiment of the present invention. The design of this embodiment is based on the ieee 802.11 as protocol, after the time synchronization system is started, firstly, parameter initialization is performed, then it is determined whether the connected device supports the ieee 802.11 as protocol by receiving and sending message data, if not, the procedure is ended, if supported, an optimal Master Clock Algorithm (Best Master Clock Algorithm, abbreviated as BMCA) is run, whether an optimal Master Clock, that is, a GrandMaster (GM) exists is determined according to the running result of the BMCA, and if not, the BMCA is continuously run to select the optimal Master Clock. If the BMCA selects the optimal master clock, the time synchronization system continues to execute the path delay measurement method of the embodiment downwards, and stores the path delay measurement data in the node position of the first state machine; in this embodiment, the time synchronization process of the time synchronization system is performed after the path delay measurement, the GM sends time synchronization packet data, and after the node where the first state machine is located and the node where the second state machine is located receive the time synchronization packet data, a clock offset value is calculated according to the time synchronization packet data and the path delay measurement data; and the time synchronization system calls a clock source interface according to the clock offset value to calibrate the time of the local clock source, namely calibrating the time of the time synchronization system. Since the delay is necessarily present, time synchronization without a path delay measurement results in a large clock skew. When the path delay measurement of the node where the first state machine is located and the node where the second state machine is located is unsuccessful, time synchronization is not performed between the node where the first state machine is located and the node where the second state machine is located.
The BMCA, the path delay measurement and the time synchronization of the time synchronization system are always performed circularly, the ieee 802.11 as protocol does not specify the sequence of the three, but the time synchronization cannot be performed under the condition that the BMCA does not select the super master according to the actual situation, and the path delay measurement alone without the time synchronization is meaningless. Therefore, the time synchronization system designed in this embodiment first runs BMCA, and performs path delay measurement and time synchronization after the optimal master clock is determined by the entire ieee 802.11 as protocol. In this embodiment, the path delay measurement period depends on the transmission period of the Pdelay _ Req packet data.
The time synchronization system designed by the embodiment can be directly applied to scenes needing time sensitive data transmission through a network, such as the fields of audio and video transmission, an Internet of vehicles auxiliary driving system, an unmanned driving system and the like, the accuracy of real-time data transmission of the time synchronization system can be obviously enhanced, and the system performance is improved.
For example, in the unmanned system, the vehicle needs to accurately locate and transmit data in real time by means of a communication network, and a large amount of real-time data is transmitted through the ethernet. Because the jitter of the clock and the data transmission path delay existing between the network transmission devices seriously affect the transmission quality of the real-time data, the requirements on the time synchronization system between the network transmission devices are higher as the requirements on the data transmission bandwidth and the real-time performance increase.
The path delay measurement method provided in this embodiment calibrates the time of each transmission node to a smaller range, and reduces the influence caused by clock jitter and transmission delay, thereby improving the transmission quality of the network and implementing real-time data transmission of the network.
To illustrate the advantages of the path delay measurement method of this embodiment, this embodiment compares the gPTP path delay measurement method of the present invention with an OpenAVB (Open Audio Video multiplexing, abbreviated as OpenAVB) path delay measurement method and a PTP-1.8 path delay measurement method in an Open source project, where three path delay measurement methods respectively perform 200 times of path delay measurement data acquisition under different network loads, and average the 200 times of path delay measurement data, and perform average value calculation on the 200 times of path delay measurement data
Figure BDA0001942983960000241
See table 3 for data specific to the standard deviation σ.
TABLE 3 mean and standard deviation (ns) of the path delay measurement data under three path delay measurement methods
Figure BDA0001942983960000242
As can be found from the data in table 3, compared with the OpenAVB path delay measurement method and the PTP-1.8 path delay measurement method for the open source project, the gPTP path delay measurement method designed and implemented in this embodiment has the path delay measurement result most similar to the theoretical value, and the fluctuation of the path delay measurement data is small. Wherein the appearance of "-" in the theoretical value means that the official authority does not give the theoretical value under the condition.
Referring to fig. 10a to 10b, fig. 10a to 10b are schematic diagrams illustrating comparison of path delay measurement results of three path delay measurement methods of gPTP, penAVB and PTP-1.8 under no load and 256kps load according to an embodiment of the present invention. Fig. 10a is a graph comparing the results of the path delay measurements under no load, and fig. 10b is a graph comparing the results of the path delay measurements under 256kps load. It can be seen that, under the condition of no load, the difference between the PTP-1.8 path delay measurement value and the theoretical value is large, and the path delay measurement result has large fluctuation, because PTP-1.8 is a four-layer protocol based on UDP and generates a timestamp in the user layer, the path delay generated by the timestamp is difficult to determine, and the difference between the path delay measurement value and the theoretical value is large and the fluctuation is large; the reason why the fluctuation of the gPTP path delay measurement method designed in this embodiment is smaller than that of the OpenAVB path delay measurement value is that the gPTP path delay measurement method uses scheduling of a task timing queue to determine and cancel out delay of a part of time synchronization system calls, so that the gPTP path delay measurement value is closest to the theoretical value and fluctuates less.
Referring to fig. 10b again, with the increase of the load, the fluctuation of the OpenAVB path delay measurement value and the PTP-1.8 path delay measurement value is more obvious, because both OpenAVB and PTP-1.8 do not have a task timing queue scheduling processing flow, but directly perform the processing of the path delay data in the message data receiving and sending threads, and the increase of the load aggravates the uncertainty of the time synchronization system invoking the path delay measurement.
The gPTP path delay measurement method provided by the embodiment can be used in an end-to-end time synchronization system and can also be applied to complex environments such as multi-point networking, so that the time synchronization performance in the whole networking environment is improved, and the application scene is wider.
The foregoing is a more detailed description of the invention in connection with specific preferred embodiments and it is not intended that the invention be limited to these specific details. For those skilled in the art to which the invention pertains, several simple deductions or substitutions can be made without departing from the spirit of the invention, and all shall be considered as belonging to the protection scope of the invention.

Claims (6)

1. A method for network path delay measurement, comprising:
acquiring trigger data;
acquiring a preset state machine information table;
acquiring a state machine from the preset state machine information table according to the trigger data, and generating feedback information according to the state machine;
queuing the feedback information in a task queue to obtain a queuing result, and detecting the queuing result according to preset time to obtain a detection result;
performing state processing on the state machine according to the detection result to obtain a timestamp, and calculating path delay measurement data according to the timestamp;
acquiring a state machine from the preset state machine information table according to the trigger data, and generating feedback information according to the state machine, wherein the method comprises the following steps:
after receiving the trigger data, confirming whether a state machine corresponding to the trigger data exists in a preset state information table according to the trigger data, if the state machine corresponding to the trigger data does not exist in the preset state information table, registering the state machine corresponding to the trigger data in the preset state information table, marking the registered state machine corresponding to the trigger data, and generating the feedback information by the marked state machine; if the state machine corresponding to the trigger data exists in the preset state information table, marking the state machine corresponding to the trigger data, and generating the feedback information by the marked state machine; meanwhile, counting the time needed by all the marked state machines to process in each state, selecting the longest time Tmax spent by state processing from the time needed by state processing, and packing the time Tmax into the feedback information; wherein the feedback information comprises a marked state machine type, a marked state machine state and a time Tmax;
the method for queuing the feedback information in the task queue to obtain a queuing result, and detecting the queuing result according to preset time to obtain a detection result includes:
the task queue carries out queue sequencing on the states of the state machines in the feedback information according to the sequence received by the state machines to obtain the queuing result;
setting the preset time according to the time Tmax in the feedback information, starting a task timer according to the preset time, periodically detecting the state of a state machine in a task queue queuing result by the task timer, and outputting the detection result; wherein the detection period of the task timer is less than the time Tmax;
detecting the queuing result according to the preset time to obtain a detection result, wherein the detecting comprises:
acquiring a current state jump mark;
acquiring a next state jump mark;
detecting a state jump result of the state machine in the queuing result according to the preset time, if the state jump result is that a current state jump mark is not updated to a next state jump mark, continuously detecting the state jump result of the state machine, and if the state jump result is that the current state jump mark is updated to the next state jump mark, outputting the detection result;
wherein the state machine is subjected to state processing according to the detection result to obtain a timestamp, comprising,
performing first state processing on a first state machine of the state machines according to the detection result to obtain a first timestamp;
and performing second state processing on a second state machine of the state machines according to the detection result to acquire a second timestamp.
2. The measurement method according to claim 1, wherein performing a first state processing on a first one of the state machines to obtain a first timestamp based on the detection result comprises,
according to the port enabling mark, when the time delay request sends the time delay request message data in the initial state, reading a first sub-timestamp, and updating a state skip mark after reading the first sub-timestamp to be a timestamp reading success mark;
reading a success mark according to the timestamp, reading a fourth sub-timestamp when receiving the delay response message data in a delay response waiting state, analyzing a second sub-timestamp from the delay response message data after reading the fourth sub-timestamp, and updating the state jump mark delay response receiving mark after analyzing the second sub-timestamp;
according to the delay response receiving mark, when the delay response following message data is received in a delay response following waiting state, a third sub-timestamp is analyzed from the delay response following message data, and the state jump mark is updated to be the delay response following receiving mark after the third sub-timestamp is analyzed;
receiving a delay request waiting timing information in a delay request interval waiting state according to the delay response following receiving mark, and updating the state jump mark into a delay request sending interval mark;
according to the time delay request sending interval mark, if the time delay request message data is sent in a time delay request sending state, reading the first sub-timestamp, and updating the state jump mark after reading the first sub-timestamp until the first timestamp meets the requirement of a preset threshold value;
and obtaining a first time stamp according to the first sub-time stamp and the fourth sub-time stamp.
3. The measurement method according to claim 2, wherein performing a second state processing on a second state machine of the state machines according to the detection result to obtain a second timestamp comprises,
according to the port enabling mark, receiving the delay request message data in the initial waiting state of the delay request, and updating the state jump mark into a delay request receiving mark;
according to the time delay request receiving mark, reading a second sub-timestamp in a waiting state of a time delay response timestamp, filling the second sub-timestamp in the time delay response message data, sending the time delay response message data after filling the second timestamp, reading a third sub-timestamp, and updating the state jump mark into a timestamp reading success mark after reading the third sub-timestamp;
according to the timestamp reading success mark, filling the third sub-timestamp in the delay response following message data in a delay request waiting state, sending the delay response following message data, and updating the state jump mark until the second timestamp meets the requirement of a preset threshold value after the delay response following message data is sent and then the delay request message data is received;
and acquiring a second timestamp according to the second sub-timestamp and the third sub-timestamp.
4. The measurement method according to claim 3, wherein calculating path delay measurement data from the time stamps comprises,
calculating the path delay measurement data from the first sub-timestamp, the second sub-timestamp, the third sub-timestamp, and the fourth sub-timestamp.
5. A network path delay measuring device is characterized by comprising a trigger module, a state storage module, a state acquisition module, a task timing queue module and a state processing module, wherein,
the trigger module is used for acquiring trigger data;
the state storage module is used for storing a preset state machine information table;
the state obtaining module is used for obtaining a state machine from the preset state machine information table according to the trigger data and generating feedback information according to the state machine;
acquiring a state machine from the preset state machine information table according to the trigger data, and generating feedback information according to the state machine, wherein the method comprises the following steps:
after receiving the trigger data, confirming whether a state machine corresponding to the trigger data exists in a preset state information table according to the trigger data, if the state machine corresponding to the trigger data does not exist in the preset state information table, registering the state machine corresponding to the trigger data in the preset state information table, marking the registered state machine corresponding to the trigger data, and generating the feedback information by the marked state machine; if the state machine corresponding to the trigger data exists in the preset state information table, marking the state machine corresponding to the trigger data, and generating the feedback information by the marked state machine; meanwhile, counting the time needed by all the marked state machines to process in each state, selecting the longest time Tmax spent by state processing from the time needed by state processing, and packing the time Tmax into the feedback information; wherein the feedback information comprises a marked state machine type, a marked state machine state and a time Tmax;
the task timing queue module is used for queuing the feedback information in a task queue to obtain a queuing result, and detecting the queuing result according to preset time to obtain a detection result;
the method for queuing the feedback information in the task queue to obtain a queuing result, and detecting the queuing result according to preset time to obtain a detection result includes:
the task queue carries out queue sequencing on the states of the state machines in the feedback information according to the sequence received by the state machines to obtain the queuing result;
setting the preset time according to the time Tmax in the feedback information, starting a task timer according to the preset time, periodically detecting the state of a state machine in a task queue queuing result by the task timer, and outputting the detection result; wherein the detection period of the task timer is less than the time Tmax;
detecting the queuing result according to the preset time to obtain a detection result, wherein the detecting comprises:
acquiring a current state jump mark;
acquiring a next state jump mark;
detecting a state jump result of the state machine in the queuing result according to the preset time, if the state jump result is that a current state jump mark is not updated to a next state jump mark, continuously detecting the state jump result of the state machine, and if the state jump result is that the current state jump mark is updated to the next state jump mark, outputting the detection result;
and the state processing module is used for carrying out state processing on the state machine according to the detection result so as to obtain a time stamp, and calculating the path delay measurement data according to the time stamp.
6. A network path delay measurement time synchronization system comprising the network path delay measurement apparatus according to claim 5.
CN201910027368.XA 2019-01-11 2019-01-11 Network path delay measuring method and device and time synchronization system Active CN109818826B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201910027368.XA CN109818826B (en) 2019-01-11 2019-01-11 Network path delay measuring method and device and time synchronization system

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201910027368.XA CN109818826B (en) 2019-01-11 2019-01-11 Network path delay measuring method and device and time synchronization system

Publications (2)

Publication Number Publication Date
CN109818826A CN109818826A (en) 2019-05-28
CN109818826B true CN109818826B (en) 2021-02-09

Family

ID=66603361

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201910027368.XA Active CN109818826B (en) 2019-01-11 2019-01-11 Network path delay measuring method and device and time synchronization system

Country Status (1)

Country Link
CN (1) CN109818826B (en)

Families Citing this family (13)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US10761999B1 (en) * 2019-05-30 2020-09-01 Western Digital Technologies, Inc. Storage device with predictor engine of host turnaround time
CN110661878B (en) * 2019-10-06 2023-08-18 上海淡竹体育科技有限公司 Method and device for synchronously testing instructions and data in sports test system
CN113810243B (en) * 2020-06-17 2022-08-12 上海汽车集团股份有限公司 Delay testing method and device
CN112019291B (en) * 2020-08-31 2022-12-27 合肥中科君达视界技术股份有限公司 Network equipment timing method
CN112148214B (en) * 2020-09-04 2023-01-06 苏州浪潮智能科技有限公司 Node information processing method, equipment and medium in double-control environment
CN112182452A (en) * 2020-09-27 2021-01-05 中国平安财产保险股份有限公司 Page component rendering processing method, device, equipment and computer readable medium
CN112532472B (en) * 2020-11-09 2022-11-04 广东电网有限责任公司广州供电局 Method for testing uploading delay of phasor measurement unit
CN112838904B (en) * 2021-01-08 2023-09-08 中国电子技术标准化研究院 TSN network delay jitter measuring device and method
CN113300874B (en) * 2021-02-09 2024-04-19 阿里巴巴集团控股有限公司 Network performance detection system and method
CN115150339A (en) * 2021-03-31 2022-10-04 瑞昱半导体股份有限公司 Delay adjustment method and data stream processing device
CN113328910A (en) * 2021-05-26 2021-08-31 中国电子科技集团公司第五十四研究所 Link state monitoring method facing spanning tree protocol
CN113259045B (en) * 2021-07-14 2021-09-28 四川腾盾科技有限公司 Remote control real-time transmission processing method for large unmanned aerial vehicle
CN117992126B (en) * 2024-04-07 2024-06-25 西安羚控电子科技有限公司 Processor cooperative work method and system based on software lockstep

Family Cites Families (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103763055B (en) * 2013-10-18 2016-05-18 杭州联汇数字科技有限公司 The method of precise synchronization time a kind of
CN108683472A (en) * 2018-05-09 2018-10-19 西安电子科技大学昆山创新研究院 A kind of clock synchronizing method based on Time delay measurement

Also Published As

Publication number Publication date
CN109818826A (en) 2019-05-28

Similar Documents

Publication Publication Date Title
CN109818826B (en) Network path delay measuring method and device and time synchronization system
US8914662B2 (en) Implementing transparent clock by correcting time information carried in data using residence time information
CN111147907B (en) Method, device and system for synchronously playing multiple intelligent terminals and intelligent terminal
US10057866B2 (en) Media streaming synchronization
US7447164B2 (en) Communication apparatus, transmission apparatus and reception apparatus
US20180316586A1 (en) Method, a computer program product, and a carrier for indicating one-way latency in a data network
US11552871B2 (en) Receive-side timestamp accuracy
US8149880B1 (en) Media streaming synchronization
KR20080073228A (en) Clock synchronization aid device for communication station(s) of a wireless network, and associated clock synchronization device
CN109818702A (en) A kind of IEEE802.1AS clock synchronizing function realizes system and implementation method
US11716162B2 (en) Method and system for controlling network timing precision of a seismic collector, and terminal device
CN103067112A (en) Clock synchronization method and device and network equipment
CN113037417A (en) Method, device and storage medium for realizing one-step mode of precision time protocol message
CN110266422A (en) Sampling clock equipment message residence time processing method, device, equipment and medium
CN112751641B (en) TSN network time synchronization method, equipment and storage medium
CN115865246A (en) Time synchronization device, system and method
US11263112B2 (en) Method and apparatus for evaluating quality of software running environment of device
US8897289B2 (en) Node system and supervisory node
WO2023213080A1 (en) Method for realizing network node time synchronization based on fpga
CN102983959B (en) Method for realizing one-step mode and two-step mode for PTP (precision time synchronization protocol) in a plurality of MAC
CN115733572A (en) Clock synchronization method based on precise time protocol, electronic device and storage medium
CN114629826A (en) Network maximum bandwidth estimation method and device, electronic equipment and storage medium
WO2022204875A1 (en) Measurement method and network device
JP7173058B2 (en) COMMUNICATION DEVICE, AND PROGRAM AND METHOD USED FOR COMMUNICATION DEVICE
WO2021098721A1 (en) Time stamp configuration method and device, clock synchronization method and device, storage medium, and electronic device

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant