Network buffer size verification method and device
By simulation generation and processing of discrete event queues and combining statistical data to verify the network buffer size, the problem of being unable to quickly verify the network buffer size in the existing technology is solved, and efficient buffer verification and cost savings are achieved.
Patent Information
- Application Number
- CN202210065702.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-01-20
- Publication Date
- 2024-12-27
- Estimated Expiration
- 2042-01-20
AI Technical Summary
Existing network simulation software cannot quickly and efficiently verify the size of network buffers, resulting in time-consuming and laborious development and verification processes.
Through simulation, the discrete event queues are generated to be processed, discrete events are processed in turn and the processing results are recorded, and the size of the network buffer is verified based on the final statistical data, including judging the frame type, channel and buffer idle state, and calculating the required packets Buffer space value and adjust the preset value to meet the needs.
It realizes rapid and efficient verification of network buffer size, improves efficiency and saves costs, and solves the problem of verifying buffer size in the prior art.
Smart Images

Figure CN114422378B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of computer network technology, and in particular to a method and device for verifying the size of a network buffer. Background Art
[0002] Network simulation simulates the behaviors in the network by calculating the interactions between entities in the network, such as nodes and routers, through software, and equates the behaviors in the network, such as sending and receiving data, to randomly occurring discrete events. It is a technology for network planning, design and analysis driven by statistical models. There are many common network simulation software, such as open source software NS-2, NS-3, OMNeT++, J-SIM, etc., and commercial simulation software OPNET, QualNet, etc. These products generally support the simulation of multiple standard protocols, such as TCP / IP, wireless communication and other standard protocols. Take the widely used NS-2 as an example: NS-2 is essentially a discrete event simulator, developed based on two languages, C++ and Otcl (Object tcl). Among them, Otcl is used to form an interpreter, which is suitable for writing simulation models and configuring simulation parameters; C++ is mainly responsible for executing the simulation process, and users can write their own libraries and protocols based on C++. NS-2 is based on the simulation principle driven by discrete events, and supports the delay time and topology of the simulation network, but does not support the simulation verification of the size of the network buffer. If you want to verify the network buffer, you need to rewrite the development, which is time-consuming and laborious. Summary of the invention
[0003] The purpose of this application is to solve one of the above-mentioned technical problems at least to a certain extent.
[0004] To this end, the first purpose of the present application is to propose a network buffer size verification method that can quickly and effectively verify the size of the network buffer, improve efficiency and save costs.
[0005] The second objective of the present application is to provide a network buffer size verification device.
[0006] The third objective of the present application is to provide a computer device.
[0007] A fourth object of the present application is to provide a non-transitory computer-readable storage medium.
[0008] In order to achieve the above object, the first embodiment of the present application proposes a method for verifying the size of a network buffer, including:
[0009] S1, simulation generates a discrete event queue to be processed, wherein the discrete event includes the actions of each node in the network sending and receiving messages;
[0010] S2, taking a discrete event from the head of the discrete event queue to be processed, and processing the discrete event;
[0011] S3, obtaining the processing result of the discrete event, and recording the processing result into the statistical data of the network;
[0012] S4, repeating steps S2 and S3 until all discrete events in the discrete event queue to be processed are processed and final statistical data are obtained;
[0013] S5: Verify the network buffer according to the final statistical data.
[0014] Optionally, the simulation generates a discrete event queue to be processed, including:
[0015] The discrete events are sorted based on a first-in-first-out principle, thereby generating the discrete event queue to be processed.
[0016] Optionally, when the discrete event is receiving a message, processing the discrete event includes:
[0017] When receiving a message, determine the frame type of the received message;
[0018] If the frame type of the received message is a redundant frame, redundant frame processing is performed on the received message.
[0019] Optionally, processing the discrete event further includes:
[0020] If the frame type of the received message is a return frame, the received message is subjected to return frame discard processing, and the corresponding processing result is recorded.
[0021] Optionally, processing the discrete event further includes:
[0022] If the frame type of the received message is a data frame sent by other nodes, further determining whether the current channel is empty;
[0023] If the current channel is empty, forward and update the received message, and record the corresponding processing result;
[0024] If the current channel is not empty, the received message is queued and further determined whether the current buffer is empty;
[0025] If the current buffer is not empty, it is determined that an error has occurred and the queue is exited, and the corresponding processing result is recorded;
[0026] If the current buffer is empty, the received message is parsed and it is determined whether the received message is parsed correctly;
[0027] If the received message is parsed incorrectly, the received message is discarded and the corresponding processing result is recorded;
[0028] If the received message is parsed correctly, the received message is updated to the mapping area, and it is determined whether the current bus is idle;
[0029] If the current bus is idle, process the data in the received message and record the corresponding processing result;
[0030] If the current bus is not idle, wait for processing the received message until the bus is idle.
[0031] Optionally, when the discrete event is sending a message, processing the discrete event includes:
[0032] Determine whether the current channel is empty;
[0033] If the current channel is empty, send the local message;
[0034] If the current channel is not empty, the local message is queued and processed, and it is further determined whether the sending buffer is empty;
[0035] If the sending buffer is not empty, it is determined that an error has occurred and the queue is exited, and the corresponding processing result is recorded;
[0036] If the sending buffer is empty, cache the local message and determine whether the received message has been sent;
[0037] If the received message is sent, the local message is sent;
[0038] If the receiving message has not been sent, wait to send the local message until the receiving message is sent.
[0039] Optionally, verifying the network buffer according to the final statistical data includes:
[0040] The statistical data includes the message type of the message, the size and quantity of a single message corresponding to the message type;
[0041] Calculate a first value of a network buffer required for a certain type of message based on the size and quantity of the single message;
[0042] A second value of the network buffer required for the message is calculated according to the first values corresponding to the different message types;
[0043] If the second value is greater than a preset value, the preset value is adjusted, and the preset value is a space occupancy value of the network buffer.
[0044] The network buffer size verification method of the embodiment of the present application generates a discrete event queue to be processed through simulation, processes the discrete events in the discrete event queue in sequence, records the corresponding processing results and records them in statistical data, and then verifies the network buffer based on the final statistical data. The size of the network buffer can be verified quickly and effectively, thereby improving efficiency and saving costs.
[0045] In order to achieve the above-mentioned purpose, the second aspect of the present application proposes a network buffer size verification device, including:
[0046] A generation module, used for simulating and generating a discrete event queue to be processed, wherein the discrete event includes the actions of each node in the network sending and receiving messages;
[0047] A processing module, used for taking a discrete event from the head of the discrete event queue to be processed and processing the discrete event;
[0048] An acquisition module, used for acquiring the processing result of the discrete event and recording the processing result into the statistical data of the network;
[0049] The processing module is further used to complete processing of all discrete events in the discrete event queue to be processed;
[0050] The acquisition module is also used to obtain final statistical data after all discrete events are processed;
[0051] The verification module is used to verify the network buffer according to the final statistical data.
[0052] Optionally, the generating module is used to:
[0053] The discrete events are sorted based on a first-in-first-out principle, thereby generating the discrete event queue to be processed.
[0054] Optionally, the processing module is used to:
[0055] When the discrete event is receiving a message, upon receiving the message, determining the frame type of the received message;
[0056] If the frame type of the received message is a redundant frame, redundant frame processing is performed on the received message.
[0057] Optionally, the processing module is further used to:
[0058] If the frame type of the received message is a return frame, the received message is subjected to return frame discard processing, and the corresponding processing result is recorded.
[0059] Optionally, the processing module is further used to:
[0060] If the frame type of the received message is a data frame sent by other nodes, further determining whether the current channel is empty;
[0061] If the current channel is empty, forward and update the received message, and record the corresponding processing result;
[0062] If the current channel is not empty, the received message is queued and further determined whether the current buffer is empty;
[0063] If the current buffer is not empty, it is determined that an error has occurred and the queue is exited, and the corresponding processing result is recorded;
[0064] If the current buffer is empty, the received message is parsed and it is determined whether the received message is parsed correctly;
[0065] If the received message is parsed incorrectly, the received message is discarded and the corresponding processing result is recorded;
[0066] If the received message is parsed correctly, the received message is updated to the mapping area, and it is determined whether the current bus is idle;
[0067] If the current bus is idle, process the data in the received message and record the corresponding processing result;
[0068] If the current bus is not idle, wait for processing the received message until the bus is idle.
[0069] Optionally, the processing module is used to:
[0070] When the discrete event is sending a message, determining whether the current channel is empty;
[0071] If the current channel is empty, send the local message;
[0072] If the current channel is not empty, the local message is queued and processed, and it is further determined whether the sending buffer is empty;
[0073] If the sending buffer is not empty, it is determined that an error has occurred and the queue is exited, and the corresponding processing result is recorded;
[0074] If the sending buffer is empty, cache the local message and determine whether the received message has been sent;
[0075] If the received message is sent, the local message is sent;
[0076] If the receiving message has not been sent, wait to send the local message until the receiving message is sent.
[0077] Optionally, the verification module is used to:
[0078] The statistical data includes the message type of the message, the size and quantity of a single message corresponding to the message type;
[0079] Calculate a first value of a network buffer required for a certain type of message based on the size and quantity of the single message;
[0080] A second value of the network buffer required for the message is calculated according to the first values corresponding to different message types;
[0081] If the second value is greater than a preset value, the preset value is adjusted, and the preset value is a space occupancy value of the network buffer.
[0082] The network buffer size verification device of the embodiment of the present application generates a discrete event queue to be processed through simulation, processes the discrete events in the discrete event queue in sequence, records the corresponding processing results and records them in statistical data, and then verifies the network buffer according to the final statistical data. It can quickly and effectively verify the size of the network buffer, improve efficiency and save costs.
[0083] In order to achieve the above-mentioned purpose, the third aspect embodiment of the present application proposes a computer device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, when the processor executes the computer program, it implements the network buffer size verification method as described in the first aspect embodiment.
[0084] In order to achieve the above-mentioned purpose, the fourth aspect embodiment of the present application also proposes a non-temporary computer-readable storage medium, on which a computer program is stored, characterized in that when the computer program is executed by a processor, the network buffer size verification method as described in the first aspect embodiment is implemented.
[0085] Additional aspects and advantages of the present application will be given in part in the description below, and in part will become apparent from the description below, or will be learned through the practice of the present application. BRIEF DESCRIPTION OF THE DRAWINGS
[0086] The drawings constituting part of the present application are used to provide a further understanding of the present application. The exemplary embodiments and descriptions of the present application are used to explain the present application and do not constitute an improper limitation on the present application. In the drawings:
[0087] Figure 1 is a flow chart of a method for verifying the size of a network buffer according to an embodiment of the present application;
[0088] Figure 2 Is the process of processing received messages Figure 1 ;
[0089] Figure 3 Is the process of processing received messages Figure 2 ;
[0090] Figure 4 Is the process of processing received messages Figure 3 ;
[0091] Figure 5 It is a flow chart for processing sent messages;
[0092] Figure 6 It is a schematic diagram of the simulation software structure;
[0093] Figure 7 is a flow chart of the process of receiving external frames;
[0094] Figure 8 It is a flowchart of the process of sending local frames;
[0095] Fig. 9 It is a structural diagram of a network buffer size verification device according to an embodiment of the present application. DETAILED DESCRIPTION
[0096] It should be noted that, in the absence of conflict, the embodiments and features in the embodiments of the present application can be combined with each other. The present application will be described in detail below with reference to the accompanying drawings and in combination with the embodiments.
[0097] The present application is further described in detail below in conjunction with specific embodiments. These embodiments should not be construed as limiting the scope of protection claimed in the present application.
[0098] The following describes a method and device for verifying the network buffer size according to an embodiment of the present application with reference to the accompanying drawings.
[0099] Figure 1 is a flow chart of a method for verifying the size of a network buffer according to an embodiment of the present application. Figure 1 As shown, the method comprises the following steps:
[0100] S1, the simulation generates a discrete event queue to be processed.
[0101] Among them, discrete events include the actions of each node in the network sending and receiving messages.
[0102] Specifically, discrete events may be sorted based on a first-in, first-out principle, thereby generating a discrete event queue to be processed.
[0103] S2, taking a discrete event from the head of the discrete event queue to be processed and processing the discrete event.
[0104] After the discrete event queue is generated, the discrete events can be taken out in sequence for processing according to the order of queueing.
[0105] Discrete events can be divided into two cases: receiving messages and sending messages.
[0106] The following describes in detail the process of processing received messages and processing sent messages respectively.
[0107] 1) When the discrete event is receiving a message, the specific process can be as follows Figure 2 As shown:
[0108] S21, when receiving a message, determining the frame type of the received message.
[0109] S22: If the frame type of the received message is a redundant frame, perform redundant frame processing on the received message.
[0110] like Figure 3 As shown, the process of processing the received message also includes:
[0111] S23, if the frame type of the received message is a return frame, the received message is discarded as a return frame and a corresponding processing result is recorded.
[0112] like Figure 4 As shown, the process of processing the received message also includes:
[0113] S24: If the frame type of the received message is a data frame sent by other nodes, further determine whether the current channel is empty.
[0114] S25, if the current channel is empty, forward and update the received message, and record the corresponding processing result.
[0115] Afterwards, the process jumps to step S28.
[0116] S26, if the current channel is not empty, the received message is queued and processed, and it is further determined whether the current buffer is empty.
[0117] S27, if the current buffer is not empty, it is determined that an error occurs and the queue is exited, and the corresponding processing result is recorded.
[0118] S28, if the current buffer is empty, parse the received message and determine whether the received message is parsed correctly.
[0119] S29: If the received message is parsed incorrectly, the received message is discarded and the corresponding processing result is recorded.
[0120] S210, if the received message is parsed correctly, the received message is updated to the mapping area, and it is determined whether the current bus is idle.
[0121] S211, if the current bus is idle, process the data in the received message and record the corresponding processing result.
[0122] S212: If the current bus is not idle, wait for processing of the received message until the bus is idle.
[0123] 2) When the discrete event is sending a message, the specific process is as follows Figure 5 As shown:
[0124] S213, determine whether the current channel is empty.
[0125] S214: If the current channel is empty, send a local message.
[0126] S215, if the current channel is not empty, the local message is queued and processed, and it is further determined whether the sending buffer is empty.
[0127] S216, if the sending buffer is not empty, it is determined that an error occurs and the queue is exited, and the corresponding processing result is recorded.
[0128] S217: If the sending buffer is empty, cache the local message and determine whether the received message has been sent.
[0129] S218: If the received message is sent completely, send a local message.
[0130] S219: If the received message has not been sent completely, wait to send the local message until the received message has been sent completely.
[0131] S3, obtain the processing results of the discrete events and record the processing results in the statistical data of the network.
[0132] After processing the discrete events, the corresponding processing results can be obtained and recorded in the statistical data of the network to provide data basis for network buffer verification.
[0133] S4, repeating steps S2 and S3 until all discrete events in the discrete event queue to be processed are processed and final statistical data are obtained.
[0134] S5, verify the network buffer according to the final statistical data.
[0135] The statistical data includes the message type of the message, and the size and quantity of a single message corresponding to the message type.
[0136] The specific verification process is as follows: based on the size and quantity of the single message, a first value of the network buffer required for a certain type of message is calculated; according to the first values corresponding to different message types, a second value of the network buffer required for the message is calculated; if the second value is greater than a preset value, the preset value is adjusted, and the preset value is a pre-set space occupancy value of the network buffer.
[0137] For example, the message type may include two types, one is a data transmission message, and the other is a diagnostic message. The two types of messages each occupy a different amount of space. The number of data transmission messages and diagnostic messages can be counted separately.
[0138] The size of a single message of a data transmission message multiplied by the corresponding number can be used to calculate the size of the space occupied by the data transmission message; similarly, the size of a single message of a diagnostic message multiplied by the corresponding number can be used to calculate the size of the space occupied by the diagnostic message. The sizes of the spaces occupied by the two are added together to finally obtain the second value of the network buffer required by the message. Finally, the second value is compared with the preset value. If the second value is greater than the preset value, it means that the cache space corresponding to the preset value is insufficient and needs to be adjusted; if the second value is less than or equal to the preset value, it means that the cache space corresponding to the preset value is sufficient and no adjustment is required.
[0139] The network buffer size verification method of the embodiment of the present application generates a discrete event queue to be processed through simulation, processes the discrete events in the discrete event queue in sequence, records the corresponding processing results and records them in statistical data, and then verifies the network buffer based on the final statistical data. The size of the network buffer can be verified quickly and effectively, thereby improving efficiency and saving costs.
[0140] A specific embodiment is described below.
[0141] This application simulates and verifies the size of the network buffer based on the principle of discrete event system simulation. The simulation software regards the interactive behaviors such as sending and receiving of the network as discrete events, and organizes discrete events in the form of a first-in-first-out queue to form a discrete event queue to be processed. During the simulation, a random event is taken out from the head of the queue for processing each time, and the event is deleted from the discrete event queue, and the statistical data of the network is updated according to the processing result of the discrete event. After processing this event, the next event is taken out from the queue for processing until all events in the discrete event queue are completed. The network buffer is obtained by counting the address space occupied by each message in the discrete event queue.
[0142] The simulation software architecture can be Figure 6As shown. The main function of the network configuration module is to provide users with an interface for configuring network topology and related parameters, such as the time for each node to send and receive messages, the size of each message, etc. The core module is the simulation core of the entire software, including the scheduler, the list of pending events, and the network node model. The core module processes the summary of pending events in the list in a first-in-first-out order according to the clock. During the simulation process, it records the events that occurred in the network and the time when the events occurred. The result output module outputs the data information recorded during the simulation process to the user for reference.
[0143] Specifically, the simulation process of the simulation software may include two situations: receiving external messages (receiving external frames) and sending local messages (sending local frames).
[0144] like Figure 7 As shown, the process of receiving an external frame includes:
[0145] S701, frame arrives.
[0146] S702, determine the frame type.
[0147] S703: If it is a redundant frame, perform redundant frame processing.
[0148] S704: If it is a return frame, discard the return frame and record the processing result.
[0149] S705: If the data frame is sent from other nodes, further determine whether the channel is empty.
[0150] S706: If the channel is empty, forward the external frame, update the data, and record the processing result.
[0151] After that, jump to step S710.
[0152] S707, if the channel is not empty, the external frame starts to queue.
[0153] S708, determine whether the buffer is empty.
[0154] S709: If the buffer is not empty, a fatal error is generated and the process exits, while recording the processing result.
[0155] S710: If the buffer is empty, parse the external frame.
[0156] S711, determine whether the analysis is correct.
[0157] S712: If the parsing is wrong, the external frame is discarded and the processing result is recorded.
[0158] S713: If the parsing is correct, the external frame is updated to the mapping area.
[0159] S714, determine whether the bus is idle.
[0160] S715, if the bus is not idle, the external data waits for updating, and returns to step S714.
[0161] S716: If the bus is idle, update the external data and record the processing result.
[0162] like Figure 8 As shown in the figure, the process of sending a local frame includes:
[0163] S801, sending a local frame.
[0164] S802: Determine whether the channel is empty.
[0165] S803: If the channel is empty, send a local frame.
[0166] S804: If the channel is not empty, the local frame starts to queue.
[0167] S805, determining whether the local frame sending buffer is empty.
[0168] S806: If the buffer is not empty, a fatal error is generated and the process exits, while recording the processing result.
[0169] S807: If the buffer is empty, cache the local frame.
[0170] S808, determining whether the external frame has been sent.
[0171] If the sending is completed, jump to step S803, otherwise wait for the external frame to be sent to be completed.
[0172] In this application, simulation is used to verify whether the size of the network buffer meets the requirements. Specifically, based on the discrete event generator simulation of the sending and receiving behavior of messages on the network, the sending of messages is regarded as the occurrence of discrete events, and the receiving and processing of messages are regarded as the processing of discrete events. The number of messages to be processed in the network is obtained by counting the discrete events to be processed. According to the size of each frame message, the buffer size required for caching messages in the network can be obtained, which solves the problem that the current network simulation does not support buffer verification.
[0173] In order to implement the above embodiment, the present application also proposes a network buffer size verification device.
[0174] Fig. 9 It is a structural diagram of a network buffer size verification device according to an embodiment of the present application.
[0175] like Fig. 9As shown, the device includes a generating module 91 , a processing module 92 , an acquiring module 93 and a verifying module 94 .
[0176] The generating module 91 is used to simulate and generate a discrete event queue to be processed, wherein the discrete event includes the action of each node in the network sending and receiving messages.
[0177] The generating module 91 is specifically used to sort the discrete events based on the first-in-first-out principle, so as to generate a discrete event queue to be processed.
[0178] The processing module 92 is used to take out a discrete event from the head of the discrete event queue to be processed and process the discrete event.
[0179] When the discrete event is a received message, the processing module 92 is specifically configured to:
[0180] When receiving a message, determine the frame type of the received message;
[0181] If the frame type of the received message is a redundant frame, redundant frame processing is performed on the received message.
[0182] The processing module 92 is further used for:
[0183] If the frame type of the received message is a return frame, the received message is discarded as a return frame and the corresponding processing result is recorded.
[0184] The processing module 92 is further used for:
[0185] If the frame type of the received message is a data frame sent by other nodes, it is further determined whether the current channel is empty;
[0186] If the current channel is empty, forward and update the received message, and record the corresponding processing results;
[0187] If the current channel is not empty, the received message will be queued and processed, and further determine whether the current buffer is empty;
[0188] If the current buffer is not empty, it is determined that an error has occurred and the queue is exited, and the corresponding processing result is recorded;
[0189] If the current buffer is empty, the received message is parsed and it is determined whether the received message parsing is correct;
[0190] If the received message is parsed incorrectly, the received message is discarded and the corresponding processing result is recorded;
[0191] If the received message is parsed correctly, the received message is updated to the mapping area, and it is determined whether the current bus is idle;
[0192] If the current bus is idle, the data in the received message is processed and the corresponding processing result is recorded;
[0193] If the current bus is not idle, wait to process the received message until the bus is idle.
[0194] When the discrete event is sending a message, the processing module 92 is specifically configured to:
[0195] Determine whether the current channel is empty;
[0196] If the current channel is empty, send the local message;
[0197] If the current channel is not empty, the local message is queued and processed, and further judgment is made as to whether the sending buffer is empty;
[0198] If the sending buffer is not empty, it is determined that an error has occurred and the queue is exited, and the corresponding processing result is recorded;
[0199] If the sending buffer is empty, cache the local message and determine whether the received message has been sent;
[0200] If the received message is sent, the local message is sent;
[0201] If the receiving message has not been sent, wait to send the local message until the receiving message is sent.
[0202] The acquisition module 93 is used to acquire the processing result of the discrete event and record the processing result into the statistical data of the network.
[0203] The processing module 92 is further used to complete processing of all discrete events in the discrete event queue to be processed.
[0204] The acquisition module 93 is also used to acquire final statistical data after all discrete events are processed.
[0205] The verification module 94 is used to verify the network buffer according to the final statistical data.
[0206] The verification module 94 is specifically used for:
[0207] Calculate a first value of a network buffer required for a certain type of message based on the size and quantity of the single message;
[0208] A second value of the network buffer required for the message is calculated according to the first values corresponding to the different message types;
[0209] If the second value is greater than a preset value, the preset value is adjusted. The preset value is the space occupancy value of the network buffer. The statistical data includes the message type of the message, and the size and quantity of a single message corresponding to the message type.
[0210] It should be understood that the network buffer size verification device of this embodiment is consistent with the description of the network buffer size verification method of the first aspect embodiment, and will not be repeated here.
[0211] The network buffer size verification device of the embodiment of the present application generates a discrete event queue to be processed through simulation, processes the discrete events in the discrete event queue in sequence, records the corresponding processing results and records them in statistical data, and then verifies the network buffer according to the final statistical data. It can quickly and effectively verify the size of the network buffer, improve efficiency and save costs.
[0212] In order to implement the above embodiments, the present application also proposes a computer device.
[0213] The computer device includes a memory, a processor, and a computer program stored in the memory and executable on the processor. When the processor executes the computer program, the network buffer size verification method of the first aspect embodiment is implemented.
[0214] In order to implement the above embodiments, the present application also proposes a non-transitory computer-readable storage medium.
[0215] The non-temporary computer-readable storage medium stores a computer program thereon, and when the computer program is executed by a processor, the method for verifying the network buffer size as described in the first aspect of the embodiment is implemented.
[0216] It should be noted that, in this article, relational terms such as first and second, etc. are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, the elements defined by the sentence "comprise a ..." do not exclude the existence of other identical elements in the process, method, article or device including the elements.
[0217] The logic and / or steps represented in the flowchart or otherwise described herein, for example, can be considered as an ordered list of executable instructions for implementing logical functions, and can be embodied in any computer-readable medium for use by an instruction execution system, device or apparatus (such as a computer-based system, a system including a processor, or other system that can fetch instructions from an instruction execution system, device or apparatus and execute the instructions), or in combination with these instruction execution systems, devices or apparatuses. For the purpose of this specification, "computer-readable medium" can be any device that can contain, store, communicate, propagate or transmit a program for use by an instruction execution system, device or apparatus, or in combination with these instruction execution systems, devices or apparatuses. More specific examples of computer-readable media (a non-exhaustive list) include the following: an electrical connection with one or more wires (electronic device), a portable computer disk box (magnetic device), a random access memory (RAM), a read-only memory (ROM), an erasable and programmable read-only memory (EPROM or flash memory), a fiber optic device, and a portable compact disk read-only memory (CDROM). In addition, the computer-readable medium may even be paper or other suitable medium on which the program is printed, since the program may be obtained electronically, for example, by optically scanning the paper or other medium and then editing, interpreting or otherwise processing in a suitable manner if necessary, and then stored in a computer memory.
[0218] It should be understood that the various parts of the present application can be implemented by hardware, software, firmware or a combination thereof. In the above-mentioned embodiments, multiple steps or methods can be implemented by software or firmware stored in a memory and executed by a suitable instruction execution system. For example, if implemented by hardware, as in another embodiment, it can be implemented by any one of the following technologies known in the art or their combination: a discrete logic circuit having a logic gate circuit for implementing a logic function for a data signal, a dedicated integrated circuit having a suitable combination of logic gate circuits, a programmable gate array (PGA), a field programmable gate array (FPGA), etc.
[0219] It should be noted that, in the description of this specification, the description with reference to the terms "one embodiment", "some embodiments", "example", "specific example", or "some examples" etc. means that the specific features, structures, materials or characteristics described in conjunction with the embodiment or example are included in at least one embodiment or example of the present application. In this specification, the schematic representations of the above terms do not necessarily refer to the same embodiment or example. Moreover, the specific features, structures, materials or characteristics described may be combined in any one or more embodiments or examples in a suitable manner. In addition, those skilled in the art may combine and combine the different embodiments or examples described in this specification and the features of the different embodiments or examples, without contradiction.
[0220] In the description of this specification, the description with reference to the terms "one embodiment", "some embodiments", "example", "specific example", or "some examples" etc. means that the specific features, structures, materials or characteristics described in conjunction with the embodiment or example are included in at least one embodiment or example of the present application. In this specification, the schematic representations of the above terms do not necessarily refer to the same embodiment or example. Moreover, the specific features, structures, materials or characteristics described may be combined in any one or more embodiments or examples in a suitable manner. In addition, those skilled in the art may combine and combine the different embodiments or examples described in this specification and the features of the different embodiments or examples, without contradiction.
Claims
1. A method for verifying the size of a network buffer, characterized in that: The following steps are involved: S1, simulation generates a discrete event queue to be processed, wherein the discrete event includes the actions of each node in the network sending and receiving messages; S2, taking a discrete event from the head of the discrete event queue to be processed, and processing the discrete event; S3, obtaining the processing result of the discrete event, and recording the processing result into the statistical data of the network; S4, repeating steps S2 and S3 until all discrete events in the discrete event queue to be processed are processed and final statistical data are obtained; S5, verifying the network buffer according to the final statistical data; The verifying of the network buffer according to the final statistical data includes: The statistical data includes the message type of the message, the size and quantity of a single message corresponding to the message type; Calculate a first value of a network buffer required for a certain type of message based on the size and quantity of the single message; A second value of the network buffer required for the message is calculated according to the first values corresponding to different message types; If the second value is greater than a preset value, the preset value is adjusted, and the preset value is a space occupancy value of the network buffer.
2. The method according to claim 1, characterized in that The simulation generates a queue of discrete events to be processed, including: The discrete events are sorted based on a first-in-first-out principle, thereby generating the discrete event queue to be processed.
3. The method according to claim 1, characterized in that When the discrete event is a received message, processing the discrete event includes: When receiving a message, determine the frame type of the received message; If the frame type of the received message is a redundant frame, redundant frame processing is performed on the received message.
4. The method according to claim 3, characterized in that Processing the discrete event also includes: If the frame type of the received message is a return frame, the received message is subjected to return frame discard processing, and the corresponding processing result is recorded.
5. The method according to claim 3, characterized in that Processing the discrete event also includes: If the frame type of the received message is a data frame sent by other nodes, further determining whether the current channel is empty; If the current channel is empty, forward and update the received message, and record the corresponding processing result; If the current channel is not empty, the received message is queued and further determined whether the current buffer is empty; If the current buffer is not empty, it is determined that an error has occurred and the queue is exited, and the corresponding processing result is recorded; If the current buffer is empty, the received message is parsed and it is determined whether the received message is parsed correctly; If the received message is parsed incorrectly, the received message is discarded and the corresponding processing result is recorded; If the received message is parsed correctly, the received message is updated to the mapping area, and it is determined whether the current bus is idle; If the current bus is idle, process the data in the received message and record the corresponding processing result; If the current bus is not idle, wait for processing the received message until the bus is idle.
6. The method according to claim 1, characterized in that When the discrete event is sending a message, processing the discrete event includes: Determine whether the current channel is empty; If the current channel is empty, send the local message; If the current channel is not empty, the local message is queued and processed, and further judging whether the sending buffer is empty; If the sending buffer is not empty, it is determined that an error has occurred and the queue is exited, and the corresponding processing result is recorded; If the sending buffer is empty, cache the local message and determine whether the received message has been sent; If the received message is sent, the local message is sent; If the receiving message has not been sent, wait to send the local message until the receiving message is sent.
7. A network buffer size verification device, characterized in that: include: A generation module, used for simulating and generating a discrete event queue to be processed, wherein the discrete event includes the actions of each node in the network sending and receiving messages; A processing module, used for taking a discrete event from the head of the discrete event queue to be processed and processing the discrete event; An acquisition module, used for acquiring the processing result of the discrete event and recording the processing result into the statistical data of the network; The processing module is further used to complete processing of all discrete events in the discrete event queue to be processed; The acquisition module is also used to obtain final statistical data after all discrete events are processed; A verification module, configured to verify the network buffer according to the final statistical data, wherein the statistical data includes a message type of the message, a single message size and a number corresponding to the message type; Calculate a first value of a network buffer required for a certain type of message based on the size and quantity of the single message; A second value of the network buffer required for the message is calculated according to the first values corresponding to different message types; If the second value is greater than a preset value, the preset value is adjusted, and the preset value is a space occupancy value of the network buffer.
8. A computer device, characterized in that: The method comprises a memory, a processor and a computer program stored in the memory and executable on the processor. When the processor executes the computer program, the method for verifying the size of a network buffer as described in any one of claims 1 to 6 is implemented.
9. A non-transitory computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the method for verifying the network buffer size according to any one of claims 1 to 6 is implemented.
Citation Information
Patent Citations
Wireless sensor network emulator facing mobile node data transmission
CN102355677A
Data interaction method and interface for simulation communication network and simulation power grid
CN111917750A
Scheduling discrete event simulation
US20130304442A1
Flow Control in Remote Direct Memory Access Data Communications with Mirroring of Ring Buffers
US20180143939A1
Automatic memory management method, corresponding micro-controller unit and computer program product
US20210026695A1