Information transmission delay calculation method, device, electronic device and storage medium

By analyzing the historical delay data and timestamps in the information, calculating the clock offset and determining the information transmission delay, the problem of path delay information consistency in the alliance chain is solved, and the accuracy of unicast path delay calculation is improved.

CN115941552BActive Publication Date: 2025-01-10HANGZHOU QULIAN TECHNOLOGY CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202211532711.4
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-12-01
Publication Date
2025-01-10
Estimated Expiration
2042-12-01

AI Technical Summary

Technical Problem

In the consortium chain scenario of non-full-connected network topology, due to the clock travel problem of the computing node, the path delay information is difficult to maintain global consistency, which affects the accuracy of unicast path delay calculation.

Method used

By analyzing the information, obtaining historical delay data and timestamps, calculating clock offsets, and determining the delay data from the source node to the target node based on this data, ensuring the global consistency and accuracy of the path delay information.

Benefits of technology

The accuracy and consistency of information transmission path delay calculation in the alliance chain scenario is realized, and the reliability of unicast path delay calculation is improved.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115941552B_ABST
    Figure CN115941552B_ABST
Patent Text Reader

Abstract

This application is applicable to the field of blockchain technology, and provides a method, device, electronic device and storage medium for calculating information transmission delay, wherein the method includes: parsing the information sent by the first node, obtaining the historical delay data carried in the information and the first timestamp corresponding to the sending time of the information; obtaining the second timestamp corresponding to the receiving time of the information; obtaining the clock offset between the current node and the first node; based on the historical delay data, the first timestamp, the second timestamp and the clock offset, determining the target delay data of the information from the source node to the current node. This solution can ensure the maintenance of a system-wide path delay information and improve the calculation accuracy of the path delay.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application belongs to the field of blockchain technology, and in particular, relates to a method, device, electronic device and storage medium for calculating information transmission delay. Background Art

[0002] In the consortium chain scenario of non-fully connected network topology, many messages need to be unicast point-to-point, such as the heartbeat message sent from the slave node to the master node in the consensus, etc. When selecting the transmission path of the unicast message, it is currently proposed to measure the path selection based on the path delay information, which requires the maintenance, selection and replacement of the path based on the path delay information.

[0003] However, in the existing alliance chain scenario, since it corresponds to a distributed system, the clocks of each computing node will have a more obvious drift problem. For example, in the BIOS configuration, the computing node usually relies on the crystal oscillator to output an oscillation signal with a stable frequency to complete the timing. The crystal oscillator material is generally quartz. The operating temperature affects the oscillation frequency of the quartz. In addition, the quartz is also affected by aging and voltage, which makes the oscillation frequency higher or lower. This effect indirectly causes the local timestamp of the node to become faster or slower. The clock offset caused by this will make it difficult to maintain the global path delay information of a system. The path delay calculation lacks global consistency, which affects the unicast path delay calculation. Summary of the invention

[0004] The embodiments of the present application provide a method, device, electronic device and storage medium for calculating information transmission delay to overcome the problem that clock offset makes it difficult to maintain global path delay information of a system, path delay calculation lacks consistency, and affects unicast path delay calculation.

[0005] A first aspect of an embodiment of the present application provides a method for calculating information transmission delay, including:

[0006] Parsing the information sent by the first node to obtain historical delay data carried in the information and a first timestamp corresponding to the time when the information is sent;

[0007] Acquire a second timestamp corresponding to the time of receiving the information;

[0008] Obtaining a clock offset between the current node and the first node;

[0009] Based on the historical delay data, the first timestamp, the second timestamp, and the clock offset, target delay data for the information to be sent from the source node to arrive at the current node is determined.

[0010] Optionally, after determining the target delay data of the information from being sent from the source node to arriving at the current node, the method further includes:

[0011] The historical delay data carried in the information is updated to the target delay data.

[0012] Optionally, the information also carries a first transmission path for the information to jump from the source node to the current node; after determining the target delay data for the information from being sent from the source node to arriving at the current node, the method further includes:

[0013] The first transmission path and the target delay data are associated and stored in a path delay information table.

[0014] Optionally, after determining the target delay data of the information from being sent from the source node to arriving at the current node, the method further includes:

[0015] Based on the path delay data corresponding to the plurality of information transmission paths respectively stored in the path delay information table, selecting a second transmission path where the second node is located from the path delay information table;

[0016] The information is sent to the second node based on the second transmission path.

[0017] Optionally, the acquiring a clock offset between the current node and the first node includes:

[0018] Sending a request message carrying a third timestamp corresponding to the message sending time to the first node;

[0019] Obtain a reply message fed back by the first node based on the request message, the reply message carrying a first difference and a fourth timestamp corresponding to the time when the reply message is sent, the first difference is a difference between a fifth timestamp and the third timestamp, and the fifth timestamp corresponds to the time when the first node receives the request message;

[0020] Parsing the reply information to obtain the first difference and the fourth timestamp;

[0021] Obtaining a second difference between a sixth timestamp corresponding to the moment of receipt of the reply information and the fourth timestamp;

[0022] The clock offset is determined based on the first difference and the second difference.

[0023] Optionally, determining the clock offset based on the first difference and the second difference includes:

[0024] Based on the first difference and the second difference, the clock offset is calculated according to the following formula:

[0025] T=(c2s–s2c) / 2

[0026] Among them, T is the clock offset, c2s is the first difference, and s2c is the second difference.

[0027] Optionally, the determining, based on the historical delay data, the first timestamp, the second timestamp, and the clock offset, target delay data for the information to be sent from the source node to arrive at the current node includes:

[0028] Based on the historical delay data, the first timestamp, the second timestamp, and the clock offset, the target delay data of the information from the source node to the current node is calculated according to the following formula:

[0029] msg.delay2=now-msg.timeStamp-clockDelta+msg.delay1;

[0030] Among them, msg.delay2 is the target delay data, now is the second timestamp, msg.timeStamp is the first timestamp, clockDelta is the clock offset, and msg.delay1 is the historical delay data.

[0031] A second aspect of an embodiment of the present application provides an information transmission delay calculation device, including:

[0032] A parsing module, configured to parse the information sent by the first node to obtain the historical delay data carried in the information and a first timestamp corresponding to the sending time of the information;

[0033] A first acquisition module, used to acquire a second timestamp corresponding to the time when the information is received;

[0034] A second acquisition module, used to acquire a clock offset between the current node and the first node;

[0035] The delay determination module is used to determine the target delay data of the information from being sent from the source node to arriving at the current node based on the historical delay data, the first timestamp, the second timestamp and the clock offset.

[0036] A third aspect of an embodiment of the present application provides an electronic device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the steps of the method described in the first aspect when executing the computer program.

[0037] A fourth aspect of an embodiment of the present application provides a computer-readable storage medium, wherein the computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the steps of the method described in the first aspect are implemented.

[0038] A fifth aspect of the present application provides a computer program product, which, when executed on an electronic device, enables the electronic device to execute the steps of the method described in the first aspect.

[0039] As can be seen from the above, in an embodiment of the present application, by parsing the information sent by the first node, the historical delay data carried in the information and the first timestamp corresponding to the time when the information is sent are obtained, and the second timestamp corresponding to the time when the information is received, and the clock offset between the current node and the first node are obtained, and then based on the historical delay data, the first timestamp, the second timestamp and the clock offset, the target delay data of the information from the source node to the current node is determined. In this process, the message that needs to be sent in the system is used to carry the path information, and the delay information of the path is also calculated during the message propagation process. The delay data carried in the message that needs to be sent in the system is used to ensure the uniformity and global consistency of the path delay information in the node where the information arrives during the information transmission process, thereby improving the calculation accuracy of the path delay. BRIEF DESCRIPTION OF THE DRAWINGS

[0040] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.

[0041] Figure 1 This is a process of calculating the information transmission delay provided by the embodiment of the present application. Figure 1 ;

[0042] Figure 2 This is a process of calculating the information transmission delay provided by the embodiment of the present application. Figure 2 ;

[0043] Figure 3 is a structural diagram of an information transmission device provided in an embodiment of the present application;

[0044] Figure 4 It is a structural diagram of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION

[0045] In the following description, specific details such as specific system structures, technologies, etc. are provided for the purpose of illustration rather than limitation, so as to provide a thorough understanding of the embodiments of the present application. However, it should be clear to those skilled in the art that the present application may also be implemented in other embodiments without these specific details. In other cases, detailed descriptions of well-known systems, devices, circuits, and methods are omitted to prevent unnecessary details from obstructing the description of the present application.

[0046] It should be understood that when used in this specification and the appended claims, the term "comprising" indicates the presence of described features, integers, steps, operations, elements and / or components, but does not exclude the presence or addition of one or more other features, integers, steps, operations, elements, components and / or groups thereof.

[0047] It should also be understood that the terms used in this application specification are only for the purpose of describing specific embodiments and are not intended to limit the application. As used in this application specification and the appended claims, unless the context clearly indicates otherwise, the singular forms "a", "an" and "the" are intended to include plural forms.

[0048] It should be further understood that the term “and / or” used in the specification and appended claims refers to any combination and all possible combinations of one or more of the associated listed items, and includes these combinations.

[0049] As used in this specification and the appended claims, the term "if" may be interpreted as "when" or "upon" or "in response to determining" or "in response to detecting," depending on the context. Similarly, the phrases "if it is determined" or "if [described condition or event] is detected" may be interpreted as meaning "upon determination" or "in response to determining" or "upon detection of [described condition or event]" or "in response to detecting [described condition or event]," depending on the context.

[0050] It should be understood that the size of the serial numbers of the steps in this embodiment does not mean the order of execution. The execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiment of the present application.

[0051] In order to illustrate the technical solution described in this application, a specific embodiment is provided below for illustration.

[0052] See also Figure 1 , Figure 1 This is a process of calculating the information transmission delay provided by the embodiment of the present application. Figure 1 .like Figure 1 As shown, a method for calculating information transmission delay comprises the following steps:

[0053] Step 101: parse information sent by a first node to obtain historical delay data carried in the information and a first timestamp corresponding to the time when the information is sent.

[0054] The information sent by the first node includes a delay field, and the delay field is used to write historical delay data and a first timestamp corresponding to the time when the information is sent.

[0055] In this embodiment, no additional routing messages are used to build the network topology and maintain the path delay. Instead, the path information is carried by the messages that need to be sent in the system, and the path delay information is also calculated during the message propagation process. Therefore, the calculation of delay data does not require the use of additional routing messages to build the network topology and maintain the path delay, avoiding dependence on servers outside the blockchain system network.

[0056] Specifically, whether it is a broadcast, multicast, or unicast message, the source node that generates the message sets the delay to 0, writes it into the message, and then sends it to other nodes.

[0057] Every time a message passes through a node, the delay data written into the message by the previous node is parsed, and then the delay from the time the message is sent from the source node to the current node is calculated.

[0058] Step 102: Obtain a second timestamp corresponding to the time when the information is received.

[0059] Step 103: Obtain a clock offset between the current node and the first node.

[0060] The clock offset may be obtained by calculating the time difference based on the corresponding timestamps in the information transmission process between the current node and the first node.

[0061] In an optional implementation manner, the acquiring a clock offset between the current node and the first node includes:

[0062] Sending a request message carrying a third timestamp corresponding to the message sending time to the first node;

[0063] Obtain a reply message fed back by the first node based on the request message, the reply message carrying a first difference and a fourth timestamp corresponding to the time when the reply message is sent, the first difference is a difference between a fifth timestamp and the third timestamp, and the fifth timestamp corresponds to the time when the first node receives the request message;

[0064] Parsing the reply information to obtain the first difference and the fourth timestamp;

[0065] Obtaining a second difference between a sixth timestamp corresponding to the moment of receipt of the reply information and the fourth timestamp;

[0066] The clock offset is determined based on the first difference and the second difference.

[0067] In this process, by sending a request message to the first node and obtaining a reply message based on the request message feedback from the first node, the difference between the timestamps corresponding to the messages is calculated through the set message exchange process, and then the clock offset between the current node and the first node is determined.

[0068] Further, in an optional implementation manner, determining the clock offset based on the first difference and the second difference includes:

[0069] Based on the first difference and the second difference, the clock offset is calculated according to the following formula:

[0070] T=(c2s–s2c) / 2

[0071] Among them, T is the clock offset, c2s is the first difference, and s2c is the second difference.

[0072] In the specific implementation process, the process of calculating the clock offset once is as follows:

[0073] After establishing a connection, two nodes will send clock offset calculation request messages (hereinafter referred to as request messages) to each other, and reply with corresponding clock offset calculation reply messages (hereinafter referred to as reply messages) after receiving the request messages to calculate the clock offset.

[0074] For example, suppose two nodes A and B establish a connection. The process of A calculating the clock offset of B is as follows:

[0075] When A sends a request message to B, it adds its current timestamp to the message and then sends it to B;

[0076] After B receives the request message, it subtracts the timestamp of A in the message from its own current timestamp and records the result as c2s. It writes c2s into the reply message body and adds its own current timestamp to the message, and then sends it to A.

[0077] A receives the reply message, parses it to get c2s, and subtracts the timestamp of B in the reply message from its own current timestamp, and records the result as s2c;

[0078] A can use (c2s–s2c) / 2 to calculate the clock offset with respect to B;

[0079] The same goes for the other way around.

[0080] Furthermore, the mathematical principle of clock offset calculation is described as follows:

[0081] First, we assume that the propagation delay of a message from A to B is the same as that of a message from B to A. Let the clock deviation between B and A be clockDelta, and the clock deviation between A and B be negative clockDelta.

[0082] The c2s obtained in the above process can actually be regarded as consisting of two parts:

[0083] The propagation delay between A and B;

[0084] The clock deviation between B and A is clockDelta.

[0085] The s2c obtained in the above process can actually be regarded as consisting of two parts:

[0086] The propagation delay between A and B;

[0087] B. The clock deviation between A and B is negative clockDelta.

[0088] c2s = propagation delay between A and B + timestamp of A's request to send at B's clock

[0089] - The timestamp of the request sent by A under A's clock

[0090] = propagation delay between A and B + clockDelta

[0091] s2c = propagation delay between A and B + timestamp of B's ​​reply sent at A's clock

[0092] - The timestamp of the reply sent by B according to B's clock

[0093] = propagation delay between A and B - clockDelta

[0094] clockDelta=(c2s-s2c) / 2

[0095] In this process, based on the request message and the corresponding reply message, the time difference for the request message to be transmitted between the two nodes and the time difference for the reply message to be transmitted between the two nodes are calculated respectively, and further averaged, thereby eliminating clock deviation to a certain extent.

[0096] Among them, in the overall process of calculating the clock offset, each node sends clock delay calculation related messages (i.e. the aforementioned request message and the corresponding reply message) to each other, and each pair of nodes that send clock delay calculation related messages to each other is taken as a unit. The clock offset clockDelta calculated based on the request message and reply message transmitted between the two nodes and the original clockDelta calculated last time between the two nodes are compared with the absolute values, and the value with the smaller absolute value is selected and saved, and it is used as the aforementioned original clockDelta. In this way, after multiple cumulative calculations, the value with the smaller absolute value of the clock offset is saved each time, and finally the clock offset with the smallest absolute value between the two nodes can be obtained, and the clock offset is used as the calculation of the path delay to ensure accurate calculation under the minimum clock offset state.

[0097] Step 104: Determine target delay data for the information to be sent from the source node to the current node based on the historical delay data, the first timestamp, the second timestamp, and the clock offset.

[0098] Every time a message passes through a node, the delay data written into the message by the previous node is parsed. This delay data is the historical delay data. Then, the delay from when the information arrives at the current node to when the message is sent from the source node is calculated based on this historical delay data.

[0099] In one example, the delay data is specifically the delay time of information transmission along the jump path. Correspondingly, the aforementioned historical delay data is specifically the delay time corresponding to the jump path of the previous node of the information transmitted from the source node to the current node; the target delay data is specifically the delay time corresponding to the jump path of the information transmitted from the source node to the current node.

[0100] In an optional implementation, determining target delay data for the information from being sent from the source node to arriving at the current node based on the historical delay data, the first timestamp, the second timestamp, and the clock offset includes:

[0101] Based on the historical delay data, the first timestamp, the second timestamp, and the clock offset, the target delay data of the information from the source node to the current node is calculated according to the following formula:

[0102] msg.delay2=now-msg.timeStamp-clockDelta+msg.delay1;

[0103] Among them, msg.delay2 is the target delay data, now is the second timestamp, msg.timeStamp is the first timestamp, clockDelta is the clock offset, and msg.delay1 is the historical delay data.

[0104] That is, every time a message passes through a node, the delay data written into the message by the previous node is parsed, and then the delay from the time the message is sent from the source node to the current node is calculated according to the following formula:

[0105] now-msg.timeStamp-clockDelta+msg.delay

[0106] The parameters are described as follows:

[0107] now: The timestamp of the current node.

[0108] msg.timeStamp: The timestamp when the previous node forwarded the message (this timestamp is written into the message body when forwarding).

[0109] clockDelta: The clock offset between the current node and the previous node (see 3.2 for specific calculation).

[0110] msg.delay: The delay calculated by the previous node that the message passed (from the source node to the previous node), and this delay is written into the message body before the previous node forwards it, so it can be successfully obtained at the current node.

[0111] In the above process, each node along the way can obtain its own path to the message source node and the corresponding delay information. Because broadcast messages and multicast messages basically cover the entire network, after one or two rounds of broadcasting or multicasting of the information, the node can basically obtain all the path information, and the corresponding delay data is also calculated for the node to select the path reference when forwarding the message. Even for unicast messages, the path and delay data from the node to the source node can be obtained from the path carried in the message.

[0112] Further, in an optional implementation manner, after determining the target delay data for the information to be sent from the source node to arrive at the current node, the method further includes:

[0113] The historical delay data carried in the information is updated to the target delay data.

[0114] Here, after determining the target delay data from the time the information is sent from the source node to the time it reaches the current node, in order to ensure the accuracy of the delay data calculation during information jumps, the historical delay data carried in it must be updated once the information jumps, to ensure that the historical delay data corresponds to all the historical nodes that the information passes through after being sent from the source node, to ensure effective recording and effective calculation of the delay data.

[0115] In an embodiment of the present application, by parsing the information sent by the first node, the historical delay data carried in the information and the first timestamp corresponding to the time when the information is sent are obtained, and the second timestamp corresponding to the time when the information is received and the clock offset between the current node and the first node are obtained. Then, based on the historical delay data, the first timestamp, the second timestamp and the clock offset, the target delay data of the information from the source node to the current node is determined. In this process, the message that needs to be sent in the system is used to carry the path information, and the delay information of the path is also calculated during the message propagation process. The delay data carried in the message that needs to be sent in the system is used to ensure the uniformity and global consistency of the path delay information in the node where the information arrives during the information transmission process, thereby improving the calculation accuracy of the path delay.

[0116] The embodiments of the present application also provide different implementation methods of the information transmission delay calculation method.

[0117] See also Figure 2 , Figure 3 This is a process of calculating the information transmission delay provided by the embodiment of the present application. Figure 2 .like Figure 2 As shown, a method for transmitting information comprises the following steps:

[0118] Step 201, parsing information sent by a first node to obtain historical delay data carried in the information and a first timestamp corresponding to a time when the information is sent;

[0119] The implementation process of this step is the same as the implementation process of step 101 in the aforementioned embodiment, and will not be repeated here.

[0120] Step 202, obtaining a second timestamp corresponding to the time of receiving the information;

[0121] The implementation process of this step is the same as the implementation process of step 102 in the aforementioned embodiment, and will not be repeated here.

[0122] Step 203, obtaining a clock offset between the current node and the first node;

[0123] The implementation process of this step is the same as the implementation process of step 103 in the aforementioned embodiment, and will not be repeated here.

[0124] Step 204: Determine target delay data for the information to be sent from the source node to the current node based on the historical delay data, the first timestamp, the second timestamp, and the clock offset.

[0125] The implementation process of this step is the same as the implementation process of step 104 in the aforementioned embodiment, and will not be repeated here.

[0126] Furthermore, in an optional implementation, the information also carries a first transmission path for the information to jump from the source node to the current node.

[0127] Correspondingly, the method further includes:

[0128] Step 205: associate the first transmission path with the target delay data and store them in a path delay information table.

[0129] Differently, in an optional implementation, after determining the target delay data for the information to be sent from the source node to arrive at the current node, the method may further include:

[0130] Based on the path delay data corresponding to the plurality of information transmission paths respectively stored in the path delay information table, selecting a second transmission path where the second node is located from the path delay information table;

[0131] The information is sent to the second node based on the second transmission path.

[0132] Here, by using the path delay data corresponding to multiple information transmission paths recorded in the path delay information table, path selection can be implemented for the information from the source node through the current node and then continuing to be transmitted to the destination node, so as to use the path delay data to determine the path with the highest transmission efficiency and improve the information transmission speed.

[0133] In an embodiment of the present application, by parsing the information sent by the first node, the historical delay data carried in the information and the first timestamp corresponding to the time when the information is sent are obtained, and the second timestamp corresponding to the time when the information is received and the clock offset between the current node and the first node are obtained, and then based on the historical delay data, the first timestamp, the second timestamp and the clock offset, the target delay data of the information from the source node to the current node is determined. In this process, the message that needs to be sent in the system is used to carry the path information, and the delay information of the path is also calculated during the message propagation process, ensuring the maintenance of a system-wide path delay information, improving the calculation accuracy of the path delay, and constructing a path delay information table to achieve effective selection of the information transmission path and improve the efficiency of information transmission.

[0134] See also Figure 3 , Figure 3 This is a structural diagram of an information transmission device provided in an embodiment of the present application. For the sake of convenience of explanation, only the parts related to the embodiment of the present application are shown.

[0135] The information transmission delay calculation device 300 comprises:

[0136] The parsing module 301 is used to parse the information sent by the first node to obtain the historical delay data carried in the information and the first timestamp corresponding to the sending time of the information;

[0137] A first acquisition module 302 is used to acquire a second timestamp corresponding to the time when the information is received;

[0138] A second acquisition module 303 is used to acquire a clock offset between the current node and the first node;

[0139] The delay determination module 304 is used to determine the target delay data of the information from being sent from the source node to arriving at the current node based on the historical delay data, the first timestamp, the second timestamp and the clock offset.

[0140] The device further comprises:

[0141] An information updating module is used to update the historical delay data carried in the information to the target delay data.

[0142] The information also carries a first transmission path for the information to jump from the source node to the current node; the device also includes:

[0143] A storage module is used to associate the first transmission path with the target delay data and store them in a path delay information table.

[0144] The device also includes:

[0145] An information forwarding module is used to select a second transmission path where a second node is located from the path delay information table based on the path delay data corresponding to multiple information transmission paths respectively stored in the path delay information table; and send the information to the second node based on the second transmission path.

[0146] The second acquisition module 303 is specifically used for:

[0147] Sending a request message carrying a third timestamp corresponding to the message sending time to the first node;

[0148] Obtain a reply message fed back by the first node based on the request message, the reply message carrying a first difference and a fourth timestamp corresponding to the time when the reply message is sent, the first difference is a difference between a fifth timestamp and the third timestamp, and the fifth timestamp corresponds to the time when the first node receives the request message;

[0149] Parsing the reply information to obtain the first difference and the fourth timestamp;

[0150] Obtaining a second difference between a sixth timestamp corresponding to the moment of receipt of the reply information and the fourth timestamp;

[0151] The clock offset is determined based on the first difference and the second difference.

[0152] The second acquisition module 303 is more specifically used for:

[0153] Based on the first difference and the second difference, the clock offset is calculated according to the following formula:

[0154] T=(c2s–s2c) / 2

[0155] Among them, T is the clock offset, c2s is the first difference, and s2c is the second difference.

[0156] The delay determination module 304 is specifically configured to:

[0157] Based on the historical delay data, the first timestamp, the second timestamp, and the clock offset, the target delay data of the information from the source node to the current node is calculated according to the following formula:

[0158] msg.delay2=now-msg.timeStamp-clockDelta+msg.delay1;

[0159] Among them, msg.delay2 is the target delay data, now is the second timestamp, msg.timeStamp is the first timestamp, clockDelta is the clock offset, and msg.delay1 is the historical delay data.

[0160] The information transmission delay calculation device provided in the embodiment of the present application can implement each process of the embodiment of the above-mentioned information transmission delay calculation method and can achieve the same technical effect. To avoid repetition, it will not be repeated here.

[0161] Figure 44 is a structural diagram of an electronic device provided in an embodiment of the present application. As shown in the figure, the electronic device 4 of the embodiment includes: at least one processor 40 ( Figure 4 Only one is shown in the figure), a memory 41, and a computer program 42 stored in the memory 41 and executable on the at least one processor 40, wherein the processor 40 implements the steps of any of the above-mentioned method embodiments when executing the computer program 42.

[0162] The electronic device 4 may be a computing device such as a desktop computer, a notebook, a PDA, or a cloud server. The electronic device 4 may include, but is not limited to, a processor 40 and a memory 41. Those skilled in the art will appreciate that Figure 4 It is only an example of the electronic device 4 and does not constitute a limitation of the electronic device 4. It may include more or fewer components than shown in the figure, or a combination of certain components, or different components. For example, the electronic device may also include input and output devices, network access devices, buses, etc.

[0163] The processor 40 may be a central processing unit (CPU), or other general-purpose processors, digital signal processors (DSP), application-specific integrated circuits (ASIC), field-programmable gate arrays (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. A general-purpose processor may be a microprocessor or any conventional processor, etc.

[0164] The memory 41 may be an internal storage unit of the electronic device 4, such as a hard disk or memory of the electronic device 4. The memory 41 may also be an external storage device of the electronic device 4, such as a plug-in hard disk, a smart media card (SMC), a secure digital (SD) card, a flash card, etc. equipped on the electronic device 4. Further, the memory 41 may also include both an internal storage unit and an external storage device of the electronic device 4. The memory 41 is used to store the computer program and other programs and data required by the electronic device. The memory 41 may also be used to temporarily store data that has been output or is to be output.

[0165] The technicians in the relevant field can clearly understand that for the convenience and simplicity of description, only the division of the above-mentioned functional units and modules is used as an example for illustration. In practical applications, the above-mentioned function allocation can be completed by different functional units and modules as needed, that is, the internal structure of the device can be divided into different functional units or modules to complete all or part of the functions described above. The functional units and modules in the embodiment can be integrated in a processing unit, or each unit can exist physically separately, or two or more units can be integrated in one unit. The above-mentioned integrated unit can be implemented in the form of hardware or in the form of software functional units. In addition, the specific names of the functional units and modules are only for the convenience of distinguishing each other, and are not used to limit the scope of protection of this application. The specific working process of the units and modules in the above-mentioned system can refer to the corresponding process in the aforementioned method embodiment, which will not be repeated here.

[0166] In the above embodiments, the description of each embodiment has its own emphasis. For parts that are not described or recorded in detail in a certain embodiment, reference can be made to the relevant descriptions of other embodiments.

[0167] Those of ordinary skill in the art will appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professional and technical personnel can use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of this application.

[0168] In the embodiments provided in the present application, it should be understood that the disclosed devices / electronic devices and methods can be implemented in other ways. For example, the device / electronic device embodiments described above are merely schematic. For example, the division of the modules or units is only a logical function division. There may be other division methods in actual implementation, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of devices or units, which can be electrical, mechanical or other forms.

[0169] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.

[0170] In addition, each functional unit in each embodiment of the present application may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of software functional units.

[0171] If the integrated module / unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the present application implements all or part of the processes in the above-mentioned embodiment method, and can also be completed by instructing the relevant hardware through a computer program. The computer program can be stored in a computer-readable storage medium, and the computer program can implement the steps of the above-mentioned various method embodiments when executed by the processor. Among them, the computer program includes computer program code, and the computer program code can be in source code form, object code form, executable file or some intermediate form. The computer-readable medium may include: any entity or device capable of carrying the computer program code, recording medium, U disk, mobile hard disk, disk, optical disk, computer memory, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), electric carrier signal, telecommunication signal and software distribution medium. It should be noted that the content contained in the computer-readable medium can be appropriately increased or decreased according to the requirements of legislation and patent practice in the jurisdiction. For example, in some jurisdictions, according to legislation and patent practice, computer-readable media do not include electric carrier signals and telecommunication signals.

[0172] The present application implements all or part of the processes in the above-mentioned embodiment method, and may also be implemented through a computer program product. When the computer program product runs on an electronic device, the electronic device can implement the steps in the above-mentioned method embodiments when executing the computer program product.

[0173] The embodiments described above are only used to illustrate the technical solutions of the present application, rather than to limit them. Although the present application has been described in detail with reference to the aforementioned embodiments, a person skilled in the art should understand that the technical solutions described in the aforementioned embodiments may still be modified, or some of the technical features may be replaced by equivalents. Such modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present application, and should all be included in the protection scope of the present application.

Claims

1. A method for calculating information transmission delay, characterized in that: include: Parsing the information sent by the first node to obtain historical delay data carried in the information and a first timestamp corresponding to the time when the information is sent; the historical delay data is specifically a delay time corresponding to a jump path of a previous node from a source node to a current node; Acquire a second timestamp corresponding to the time of receiving the information; Obtaining a clock offset between the current node and the first node; Based on the historical delay data, the first timestamp, the second timestamp, and the clock offset, the target delay data of the information from the source node to the current node is calculated according to the following formula: ; in, delaying data for said target, is the second timestamp, is the first timestamp, is the clock offset, is the historical delay data; The target delay data is specifically the delay time corresponding to the jump path for information to be transmitted from the source node to the current node.

2. The method according to claim 1, characterized in that After determining the target delay data from when the information is sent from the source node to when it reaches the current node, the method further includes: The historical delay data carried in the information is updated to the target delay data.

3. The method according to claim 1, characterized in that The information also carries a first transmission path for the information to jump from the source node to the current node; after determining the target delay data for the information from the source node to the current node, the method further includes: The first transmission path and the target delay data are associated and stored in a path delay information table.

4. The method according to claim 3, characterized in that After determining the target delay data from when the information is sent from the source node to when it reaches the current node, the method further includes: Based on the path delay data corresponding to the plurality of information transmission paths respectively stored in the path delay information table, selecting a second transmission path where the second node is located from the path delay information table; The information is sent to the second node based on the second transmission path.

5. The method according to claim 1, characterized in that The acquiring the clock offset between the current node and the first node includes: Sending a request message carrying a third timestamp corresponding to the message sending time to the first node; Obtain a reply message fed back by the first node based on the request message, the reply message carrying a first difference and a fourth timestamp corresponding to the time when the reply message is sent, the first difference is a difference between a fifth timestamp and the third timestamp, and the fifth timestamp corresponds to the time when the first node receives the request message; Parsing the reply information to obtain the first difference and the fourth timestamp; Obtaining a second difference between a sixth timestamp corresponding to the moment of receipt of the reply information and the fourth timestamp; The clock offset is determined based on the first difference and the second difference.

6. The method according to claim 5, characterized in that The determining the clock offset based on the first difference and the second difference includes: Based on the first difference and the second difference, the clock offset is calculated according to the following formula: T = (c2s – s2c) / 2 Wherein, T is the clock offset, c2s is the first difference, and s2c is the second difference.

7. An information transmission delay calculation device, characterized in that: include: A parsing module, configured to parse the information sent by the first node, and obtain historical delay data carried in the information and a first timestamp corresponding to the time when the information is sent; the historical delay data is specifically a delay time corresponding to a jump path of a node before the information is transmitted from a source node to a current node; A first acquisition module, used to acquire a second timestamp corresponding to the time when the information is received; A second acquisition module, used to acquire a clock offset between the current node and the first node; a delay determination module, configured to determine target delay data for the information from being sent from the source node to arriving at the current node based on the historical delay data, the first timestamp, the second timestamp, and the clock offset; the target delay data is specifically a delay time corresponding to a jump path for the information to be transmitted from the source node to the current node; The delay determination module calculates the target delay data of the information from the source node to the current node based on the historical delay data, the first timestamp, the second timestamp and the clock offset according to the following formula: ; in, delaying data for said target, is the second timestamp, is the first timestamp, is the clock offset, is the historical delay data.

8. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that: When the processor executes the computer program, the steps of the method according to any one of claims 1 to 6 are implemented.

9. A computer-readable storage medium storing a computer program, characterized in that: When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 6 are implemented.

Citation Information

Patent Citations

  • A network path delay measurement method and device and a time synchronization system

    CN109818826A

  • Dual-core system clock synchronization method and device based on timestamp marking circuit

    CN111726189A