CN115208786A - Method for monitoring bandwidth performance of vehicle-mounted Ethernet protocol stack and storage medium - Google Patents

Method for monitoring bandwidth performance of vehicle-mounted Ethernet protocol stack and storage medium Download PDF

Info

Publication number
CN115208786A
CN115208786A CN202210708690.0A CN202210708690A CN115208786A CN 115208786 A CN115208786 A CN 115208786A CN 202210708690 A CN202210708690 A CN 202210708690A CN 115208786 A CN115208786 A CN 115208786A
Authority
CN
China
Prior art keywords
receiving
sending
bytes
time period
network card
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202210708690.0A
Other languages
Chinese (zh)
Inventor
秦民
刘远峰
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
China Automotive Innovation Corp
Original Assignee
China Automotive Innovation Corp
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by China Automotive Innovation Corp filed Critical China Automotive Innovation Corp
Priority to CN202210708690.0A priority Critical patent/CN115208786A/en
Publication of CN115208786A publication Critical patent/CN115208786A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L43/00Arrangements for monitoring or testing data switching networks
    • H04L43/08Monitoring or testing based on specific metrics, e.g. QoS, energy consumption or environmental parameters
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L43/00Arrangements for monitoring or testing data switching networks
    • H04L43/08Monitoring or testing based on specific metrics, e.g. QoS, energy consumption or environmental parameters
    • H04L43/0876Network utilisation, e.g. volume of load or congestion level
    • H04L43/0894Packet rate

Landscapes

  • Engineering & Computer Science (AREA)
  • Environmental & Geological Engineering (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Data Exchanges In Wide-Area Networks (AREA)

Abstract

The invention discloses a method for monitoring bandwidth performance of a vehicle-mounted Ethernet protocol stack and a storage medium, relates to the technical field of vehicle-mounted Ethernet, and solves the problems that the time consumption and the cost are high when the actual flow bandwidth value of a TCP/IP protocol stack is determined in the prior art. The method comprises the following steps: and receiving an acquisition instruction which is sent by the terminal equipment and comprises the identifier of the target network card port, wherein the acquisition instruction is used for indicating the acquisition of the number of bytes sent and the number of bytes received by the target network card port in a target time period. And acquiring the number of sending bytes and the number of receiving bytes in the target time period. And respectively determining the current sending rate and the current receiving rate of the target network card port according to the sending byte number, the receiving byte number and the target time period. And determining the maximum value of the current sending rate and the pre-stored historical maximum sending rate as the actual sending flow bandwidth value of the target network card port, and determining the maximum value of the current receiving rate and the pre-stored historical maximum receiving rate as the actual receiving flow bandwidth value.

Description

Method for monitoring bandwidth performance of vehicle-mounted Ethernet protocol stack and storage medium
Technical Field
The invention relates to the technical field of vehicle-mounted Ethernet, in particular to a method for monitoring the bandwidth performance of a vehicle-mounted Ethernet protocol stack and a storage medium.
Background
The vehicle-mounted Ethernet is a novel local area network technology for connecting electronic units in a vehicle, and a layered architecture of the traditional Ethernet is adopted, namely a link layer, a network layer, a transmission layer and an application layer.
The link layer communicates with the driver layer, and the transmission rate of the driver layer is determined by the specification of the chip used by the ethernet, such as 100Mbps for the hundred mega ethernet and 1000Mbps for the gigabit ethernet. The process of transmitting and receiving user data of Internet Protocol (IP) datagrams of ethernet frames is placed in a Transmission Control Protocol/Internet Protocol (TCP/IP) Protocol stack. Different software architectures and different code may have an impact on the processing speed of user data. That is, under the condition of the same hardware, the TCP/IP protocol stacks are different, and the actual bandwidth utilization rate of the physical medium is different. Based on this, the performance of a certain TCP/IP protocol stack can be evaluated by the actual bandwidth utilization of the specific rate physical medium. And the actual bandwidth utilization rate is related to the actual traffic bandwidth value and the standard traffic bandwidth value of the TCP/IP protocol stack.
In the prior art, when determining an actual flow bandwidth value of a TCP/IP protocol stack of a vehicle-mounted ethernet, a mode of testing speed by a tester in a butt joint manner is usually adopted, or a mode of calculating after manually capturing a packet is usually adopted to obtain the actual flow bandwidth value of the TCP/IP protocol stack. However, both of the two modes need to build a software and hardware environment, and the cost is high.
Disclosure of Invention
The invention provides a method for monitoring the bandwidth performance of a vehicle-mounted Ethernet protocol stack and a storage medium, which solve the problems of time consumption and higher cost in the prior art for determining the actual flow bandwidth value of a TCP/IP protocol stack of a vehicle-mounted Ethernet.
In order to achieve the purpose, the invention adopts the following technical scheme:
in a first aspect, the present invention provides a method for monitoring bandwidth performance of a vehicle-mounted ethernet protocol stack, where the method includes:
receiving an acquisition instruction sent by terminal equipment, wherein the acquisition instruction comprises an identifier of a target network card port, the target network card port is one of a plurality of network card ports included in a link layer of the vehicle-mounted Ethernet, the acquisition instruction is used for indicating the number of bytes sent and the number of bytes received by the acquisition target network card port in a target time period, the target time period takes the moment of receiving the acquisition instruction as an initial moment, and the duration of the target time period is preset duration;
acquiring the number of sending bytes and the number of receiving bytes in a target time period;
determining the current sending rate of the port of the target network card according to the sending byte number and the target time period, and determining the current receiving rate of the port of the target network card according to the receiving byte number and the target time period;
and determining the maximum value of the current sending rate and the pre-stored historical maximum sending rate as the actual sending flow bandwidth value of the target network card port, and determining the maximum value of the current receiving rate and the pre-stored historical maximum receiving rate as the actual receiving flow bandwidth value.
In the process of monitoring the bandwidth performance of the vehicle-mounted Ethernet protocol stack, after receiving an acquisition instruction sent by the terminal equipment, the automobile microcontroller starts to acquire the number of bytes sent and the number of bytes received by a target network card port in a target time period according to the identification of the target network card port included in the acquisition instruction. After the automobile microcontroller obtains the number of sending bytes and the number of receiving bytes in the target time period, the current sending rate of the target network card port can be determined according to the number of sending bytes and the target time period, and the current receiving rate of the target network card port can be determined according to the number of receiving bytes and the target time period. And similarly, the automobile microcontroller determines the maximum value of the current receiving rate and the pre-stored historical maximum receiving rate as the actual receiving flow bandwidth value of the target network card port. According to the method for monitoring the bandwidth performance of the vehicle-mounted Ethernet protocol stack, the automobile microcontroller can acquire the receiving and sending byte number of the corresponding network card port in the link layer of the vehicle-mounted Ethernet in the target time period only according to the received acquisition instruction, and calculate the receiving and sending byte number in the target time period, so as to obtain the current receiving and sending rate of the network card port, compare the current receiving and sending rate with the pre-stored historical maximum receiving and sending rate, and determine the maximum value of the current receiving and sending rate and the historical maximum receiving and sending rate as the actual receiving and sending flow bandwidth value. Based on this, under the condition that no external device is relied on and no testing environment is required to be set up, the automobile microcontroller can directly obtain the actual transceiving flow bandwidth value of each network card port included in the link layer of the vehicle-mounted Ethernet, and further obtain the actual flow bandwidth value of the TCP/IP protocol stack of the vehicle-mounted Ethernet, so that the operation time can be saved, and the testing cost can be reduced.
In a possible implementation manner, the obtaining the number of transmitted bytes and the number of received bytes in the target time period includes:
acquiring a first sending byte number and a first receiving byte number at the starting moment;
acquiring a second sending byte number and a second receiving byte number at the termination time, wherein the termination time is later than the starting time, and the time difference between the termination time and the starting time is a preset duration;
determining the number of sending bytes of a target network card port according to the first number of sending bytes and the second number of sending bytes;
and determining the number of received bytes of the target network card port according to the first number of received bytes and the second number of received bytes.
In a possible implementation manner, the method for monitoring bandwidth performance of a vehicle-mounted ethernet protocol stack further includes:
determining the second sending byte number as the first sending byte number of the starting time of the next time period of the target time period;
determining the second receiving byte number as the first receiving byte number of the starting time of the next time period;
the starting time of the next time period is the ending time of the target time period, and the duration of the next time period is the preset duration.
In a possible implementation manner, the method for monitoring bandwidth performance of a vehicle-mounted ethernet protocol stack further includes:
receiving a query request sent by a terminal device, wherein the query request is used for requesting an actual sending flow bandwidth value and an actual receiving flow bandwidth value of a target network card port;
and sending the actual sending flow bandwidth value and the actual receiving flow bandwidth value to the terminal equipment.
In a possible implementation manner, the method for monitoring bandwidth performance of a vehicle-mounted ethernet protocol stack further includes:
receiving a calculation stopping instruction sent by terminal equipment;
and stopping acquiring the number of sending bytes and the number of receiving bytes according to the calculation stopping instruction.
In a second aspect, the present invention provides a device for monitoring bandwidth performance of a vehicle-mounted ethernet protocol stack, where the device for monitoring bandwidth performance of a vehicle-mounted ethernet protocol stack includes:
the receiving unit is used for receiving an acquisition instruction sent by the terminal equipment, wherein the acquisition instruction comprises an identifier of a target network card port, the target network card port is one of a plurality of network card ports included in a link layer of the vehicle-mounted Ethernet, the acquisition instruction is used for indicating the number of bytes sent and the number of bytes received by the acquisition target network card port in a target time period, the target time period takes the moment of receiving the acquisition instruction as the starting moment, and the duration of the target time period is preset duration;
the acquisition unit is used for acquiring the number of transmitted bytes and the number of received bytes in a target time period;
the determining unit is used for determining the current sending rate of the target network card port according to the sending byte number and the target time period, and determining the current receiving rate of the target network card port according to the receiving byte number and the target time period; and determining the maximum value of the current sending rate and the pre-stored historical maximum sending rate as the actual sending traffic bandwidth value of the target network card port, and determining the maximum value of the current receiving rate and the pre-stored historical maximum receiving rate as the actual receiving traffic bandwidth value.
In a possible implementation manner, the obtaining unit is specifically configured to:
acquiring a first sending byte number and a first receiving byte number at the starting moment;
acquiring a second sending byte number and a second receiving byte number at the termination time, wherein the termination time is later than the starting time, and the time difference between the termination time and the starting time is a preset duration;
determining the number of sending bytes of a target network card port according to the first number of sending bytes and the second number of sending bytes;
and determining the number of received bytes of the port of the target network card according to the first number of received bytes and the second number of received bytes.
In a possible implementation manner, the determining unit is further configured to determine the second sending byte number as a first sending byte number at a starting time of a next time period of the target time period, and determine the second receiving byte number as a first receiving byte number at the starting time of the next time period;
the starting time of the next time period is the ending time of the target time period, and the duration of the next time period is the preset duration.
In a possible implementation manner, the receiving unit is further configured to receive an inquiry request sent by the terminal device, where the inquiry request is used to request an actual sending traffic bandwidth value and an actual receiving traffic bandwidth value of a target network card port;
the vehicle-mounted Ethernet protocol stack bandwidth performance monitoring device also comprises a sending unit;
and the sending unit is used for sending the actual sending traffic bandwidth value and the actual receiving traffic bandwidth value to the terminal equipment.
In a possible implementation manner, the receiving unit is further configured to receive a calculation stop instruction sent by the terminal device;
the obtaining unit is further configured to stop obtaining the number of transmitted bytes and the number of received bytes according to the stop calculation instruction.
In a third aspect, the present invention provides an automotive microcontroller comprising: a processor and a memory. The memory is for storing computer program code, the computer program code including computer instructions. When the processor executes the computer instructions, the automotive microcontroller performs the on-board ethernet protocol stack bandwidth performance monitoring method as described in the first aspect and any one of its possible implementations.
In a fourth aspect, the present invention provides a computer-readable storage medium having stored thereon computer instructions that, when run on a car microcontroller, cause the car microcontroller to execute the method for monitoring bandwidth performance of an on-board ethernet protocol stack as described in the first aspect or any one of the possible implementations of the first aspect.
Drawings
FIG. 1 is a schematic structural diagram of an automotive microcontroller according to an embodiment of the present invention;
fig. 2 is a schematic flowchart of a method for monitoring bandwidth performance of a vehicle-mounted ethernet protocol stack according to an embodiment of the present invention;
fig. 3 is a second schematic flowchart of a method for monitoring bandwidth performance of a vehicle-mounted ethernet protocol stack according to an embodiment of the present invention;
fig. 4 is a third schematic flowchart of a method for monitoring bandwidth performance of a vehicle-mounted ethernet protocol stack according to an embodiment of the present invention;
fig. 5 is a schematic structural diagram of a device for monitoring bandwidth performance of a vehicle-mounted ethernet protocol stack according to an embodiment of the present invention;
fig. 6 is a second schematic structural diagram of a device for monitoring bandwidth performance of a vehicle-mounted ethernet protocol stack according to an embodiment of the present invention.
Detailed Description
The technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are only a part of the embodiments of the present invention, and not all of the embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
In the following, the terms "first", "second" are used for descriptive purposes only and are not to be understood as indicating or implying relative importance or implicitly indicating the number of technical features indicated. Thus, a feature defined as "first" or "second" may explicitly or implicitly include one or more of that feature. In the description of the embodiments of the present disclosure, "a plurality" means two or more unless otherwise specified. Additionally, the use of "based on" or "according to" means open and inclusive, as a process, step, calculation, or other action that is "based on" or "according to" one or more stated conditions or values may in practice be based on additional conditions or exceeding the stated values.
In order to solve the problems that the determination of the actual traffic bandwidth value of the TCP/IP protocol stack of the vehicle-mounted ethernet in the prior art is time-consuming and high in cost, embodiments of the present invention provide a method for monitoring the bandwidth performance of the vehicle-mounted ethernet protocol stack and a storage medium. In the process of monitoring the bandwidth performance of the vehicle-mounted Ethernet protocol stack, after receiving an acquisition instruction sent by the terminal equipment, the automobile microcontroller starts to acquire the number of bytes sent and the number of bytes received by a target network card port in a target time period according to the identification of the target network card port included in the acquisition instruction. After the automobile microcontroller obtains the number of sending bytes and the number of receiving bytes in the target time period, the current sending rate of the target network card port can be determined according to the number of sending bytes and the target time period, and the current receiving rate of the target network card port can be determined according to the number of receiving bytes and the target time period. And similarly, the automobile microcontroller determines the maximum value of the current receiving rate and the pre-stored historical maximum receiving rate as the actual receiving flow bandwidth value of the target network card port. As can be seen from the above, in the method for monitoring bandwidth performance of a vehicle-mounted ethernet protocol stack according to the embodiment of the present invention, an automobile microcontroller can obtain the number of bytes transmitted and received by a corresponding network card port in a link layer of a vehicle-mounted ethernet network within a target time period only according to a received acquisition instruction, and calculate the number of bytes transmitted and received within the target time period, so as to obtain the current transmission and reception rate of the network card port, compare the current transmission and reception rate with the pre-stored historical maximum transmission and reception rate, and determine the maximum value of the current transmission and reception rate and the historical maximum transmission and reception rate as the actual transmission and reception flow bandwidth value. Based on this, under the conditions that no external device is relied on and no testing environment is required to be built, the automobile microcontroller can directly obtain the actual transceiving flow bandwidth value of each network card port included in the link layer of the vehicle-mounted Ethernet, and further obtain the actual flow bandwidth value of the TCP/IP protocol stack of the vehicle-mounted Ethernet, so that the operation time can be saved, and the testing cost is reduced.
Fig. 1 is a schematic structural diagram of an automotive microcontroller, and as shown in fig. 1, the automotive microcontroller may include: a processor 11, a memory 12, a communication interface 13, and a bus 14. The processor 11, the memory 12 and the communication interface 13 may be connected by a communication bus 14.
The processor 11 is a control center of a vehicle microcontroller, and may be one processor 11 or a collective name of a plurality of processing elements. For example, the processor 11 may be a general-purpose Central Processing Unit (CPU), or may be another general-purpose processor 11. Wherein the general purpose processor 11 may be a microprocessor 11 or any conventional processor 11 etc.
For one embodiment, processor 11 may include one or more CPUs, such as CPU0 and CPU1 shown in FIG. 1.
The memory 12 may be, but is not limited to, a read-only memory 12 (ROM) or other type of static storage device that can store static information and instructions, a random access memory 12 (RAM) or other type of dynamic storage device that can store information and instructions, an electrically erasable programmable read-only memory 12 (EEPROM), a magnetic disk storage medium or other magnetic storage device, or any other medium that can be used to carry or store desired program code in the form of instructions or data structures and that can be accessed by a computer.
In a possible implementation, the memory 12 may be present separately from the processor 11, and the memory 12 may be connected to the processor 11 via a bus 14 for storing instructions or program code. When the processor 11 calls and executes the instructions or program codes stored in the memory 12, the method for monitoring the bandwidth performance of the in-vehicle ethernet protocol stack according to the following embodiments of the present invention can be implemented.
In another possible implementation, the memory 12 may also be integrated with the processor 11.
The communication interface 13 is used for connecting an automobile Microcontroller (MCU) with other devices through a communication network, where the communication network may be an ethernet, a Radio Access Network (RAN), a Wireless Local Area Network (WLAN), or the like. The communication interface 13 may comprise a receiving unit for receiving data and a transmitting unit for transmitting data.
The bus 14 may be an Industry Standard Architecture (ISA) bus 14, a Peripheral Component Interconnect (PCI) bus 14, an Extended ISA (EISA) bus 14, or the like. The bus 14 may be divided into an address bus 14, a data bus 14, a control bus 14, etc. For ease of illustration, only one thick line is shown in FIG. 1, but does not indicate only one bus 14 or one type of bus 14.
It should be noted that the configuration shown in fig. 1 does not constitute a limitation of the automotive microcontroller, which may include more or less components than those shown in fig. 1, or some components in combination, or a different arrangement of components than those shown in fig. 1.
The execution main body of the vehicle-mounted Ethernet protocol stack bandwidth performance monitoring method provided by the embodiment of the invention is a vehicle-mounted Ethernet protocol stack bandwidth performance monitoring device. The device for monitoring the bandwidth performance of the vehicle-mounted Ethernet protocol stack can be the vehicle microcontroller, a CPU in the vehicle microcontroller and a control module used for monitoring the bandwidth performance of the vehicle-mounted Ethernet protocol stack in the vehicle microcontroller. The embodiment of the invention takes a method for monitoring the bandwidth performance of a vehicle-mounted Ethernet protocol stack executed by an automobile microcontroller as an example, and explains the method for monitoring the bandwidth performance of the vehicle-mounted Ethernet protocol stack provided by the invention.
The following describes a method for monitoring bandwidth performance of a vehicle-mounted ethernet protocol stack according to an embodiment of the present invention with reference to the accompanying drawings.
As shown in fig. 2, the method for monitoring bandwidth performance of an on-vehicle ethernet protocol stack according to the embodiment of the present invention includes the following steps 201 to 204.
201. Receiving an acquisition instruction sent by a terminal device, wherein the acquisition instruction comprises an identifier of a target network card port, the target network card port is one of a plurality of network card ports included in a link layer of the vehicle-mounted Ethernet, the acquisition instruction is used for indicating the number of bytes sent and the number of bytes received by the acquisition target network card port in a target time period, the target time period takes the moment of receiving the acquisition instruction as an initial moment, and the duration of the target time period is preset duration.
The vehicle-mounted ethernet is in communication connection with the terminal device through a User Datagram Protocol (UDP) or a transport layer communication Protocol (TCP), and performs information interaction through a configuration frame. For example, the terminal device sends an acquisition instruction for starting acquisition of the number of transmitted bytes and the number of received bytes of a target network card port of the vehicle-mounted ethernet in a target time period to the MCU. A table is defined in table 1 for the TCP/UDP data frame structure.
Table 1.Tcp/UDP data frame structure definition table
HEADER1 HEADER2 KEY LEN DATA CHECKSUM
1(Byte) 1(Byte) 2(Byte) 4(Byte) N(Byte) 4(Byte)
0xAA 0x55 Instruction code Frame length Frame data Check bit
The Cyclic Redundancy Check (CRC) algorithm used for the check bits in table 1 is the CRC-32 algorithm. I.e. cheksum = CRC32 (HEADER 1, HEADER2, KEY, LEN, DATA). KEY is an instruction code, including: a command code or a response code. LEN is the frame length, indicates the length of the whole data frame, and includes a frame header + KEY + LEN + frame tail (12 bytes), and the storage sequence of the data frame is a big end sequence by default.
Optionally, according to the frame structure definition in table 1, when the number of transmitted bytes and the number of received bytes of the target network card port in the target time period need to be acquired, a command code 0x0002 with a length of 12+1 and a parameter of the identifier of the target network card port may be sent to the MCU, where the command code is an acquisition instruction.
Optionally, when the MCU receives the acquisition instruction to start acquiring the number of bytes sent and the number of bytes received at the target network card port, the MCU sends a response code 0x8002 with a length of 12+1 and a parameter of the identifier of the target network card port to the terminal device, so as to notify the terminal device that the acquisition of the number of bytes sent and the number of bytes received at the target network card port has started.
Alternatively, the target time period may be 1 second, 10 seconds, 60 seconds, or 5 minutes, which may be determined according to the requirements and the performance of the hardware. And, the target time period may be accumulated by 1 ms, 10 ms, 50 ms or 100 ms of the AUTOSAR OS standard.
202. And acquiring the number of sending bytes and the number of receiving bytes in the target time period.
In the embodiment of the invention, a protocol stack bandwidth performance monitoring (EthMonitor) module is added in a vehicle-mounted Ethernet communication module of an automobile open system architecture (AUTOSAR), and after the EthMonitor module receives an acquisition instruction, two AUTOSAR standard interfaces Eth _ GetRxStats () and Eth _ GetTxStats () of the ETH MCAL module are called in a target time period, so that the number of transmitted bytes and the number of received bytes of a target network card port in the target time period can be acquired.
Optionally, obtaining the number of bytes sent in the target time period may include the following steps: and acquiring a first sending byte number at the starting time and acquiring a second sending byte number at the ending time. And determining the number of sending bytes of the target network card port according to the first number of sending bytes and the second number of sending bytes.
Illustratively, at the starting time, the EthMonitor module calls an AUTOSAR standard interface ETH _ GetTxStats () of the ETH MCAL module to obtain the first number of bytes sent. At the termination time, the EthMonitor module calls the AUTOSAR standard interface Eth _ GetTxStats () of the ETH MCAL module again to obtain the second sending byte number. According to the following formula (1), the number of bytes sent by the target network card port can be determined.
TXbytes=TXbytes2-TXbytes1 (1)
Wherein TXBytes1 is a first sending byte number; TXbytes2 is the second number of bytes sent.
Optionally, obtaining the number of received bytes in the target time period may include the following steps: a first number of received bytes at the start time is obtained, and a second number of received bytes at the end time is obtained. And determining the number of received bytes of the target network card port according to the first number of received bytes and the second number of received bytes.
Illustratively, at the starting time, the EthMonitor module calls an AUTOSAR standard interface ETH _ GetRxStats () of the ETH MCAL module to acquire the first number of received bytes. At the termination time, the EthMonitor module calls the AUTOSAR standard interface Eth _ GetRxStats () of the ETH MCAL module again to obtain the second received byte number. According to the following formula (2), the number of received bytes of the target network card port can be determined.
RXbytes=RXbytes2-RXbytes1 (2)
Wherein RXBytes1 is the first byte number of transmission; RXbytes2 is the second number of bytes sent.
203. And determining the current sending rate of the target network card port according to the sending byte number and the target time period, and determining the current receiving rate of the target network card port according to the receiving byte number and the target time period.
After the number of transmitted bytes and the number of received bytes of the target network card port in the target time period are determined, the current transmission rate of the target network card port can be determined according to the following formula (3), and the current reception rate of the target network card port can be determined according to the following formula (4).
Figure BDA0003706322310000091
Figure BDA0003706322310000092
The TXBytes is the number of bytes sent by a target network card port in a target time period; RXBytes is the number of received bytes of a target network card port in a target time period; TXSpeed k The current sending rate of the target network card port is obtained; RXSpeed k The current receiving rate of the target network card port is obtained; t is the duration of the target time period.
204. And determining the maximum value of the current sending rate and the pre-stored historical maximum sending rate as the actual sending flow bandwidth value of the target network card port, and determining the maximum value of the current receiving rate and the pre-stored historical maximum receiving rate as the actual receiving flow bandwidth value.
When the target time period is the first time period of the current flow monitoring process, it is described that both the historical maximum sending rate and the historical maximum receiving rate are 0. Therefore, the current sending rate can be directly determined as the actual sending traffic bandwidth value of the target network card port, and the current receiving rate can be determined as the actual receiving traffic bandwidth value of the target network card port.
When the target time period is the nth time period (N is a positive integer greater than or equal to 2) in the current traffic monitoring process, it is indicated that the historical maximum sending rate and the historical maximum receiving rate exist. Therefore, the current sending rate of the nth time period needs to be compared with the maximum sending rate of the N-1 th time period, and the maximum value is taken as the actual sending traffic bandwidth value of the target network card port. Similarly, the current receiving rate in the nth time period needs to be compared with the maximum receiving rate in the (N-1) th time period, and the maximum value is taken as the actual receiving traffic bandwidth value of the port of the target network card.
It should be noted that, for the second time period, the historical maximum transmission rate is the current transmission rate of the first time period, and the historical maximum reception rate is the current reception rate of the first time period.
In the process of monitoring the bandwidth performance of the vehicle-mounted Ethernet protocol stack, after receiving an acquisition instruction sent by the terminal equipment, the MCU starts to acquire the number of bytes sent and the number of bytes received by a target network card port in a target time period according to the identification of the target network card port included in the acquisition instruction. After the MCU obtains the number of sending bytes and the number of receiving bytes in the target time period, the current sending rate of the port of the target network card can be determined according to the number of sending bytes and the target time period, and the current receiving rate of the port of the target network card can be determined according to the number of receiving bytes and the target time period. And similarly, the MCU determines the maximum value of the current receiving rate and the pre-stored historical maximum receiving rate as the actual receiving flow bandwidth value of the target network card port. As can be seen from the above, in the method for monitoring bandwidth performance of a vehicle-mounted ethernet protocol stack according to the embodiment of the present invention, the MCU can obtain the number of bytes transmitted and received by the network card port corresponding to the link layer of the vehicle-mounted ethernet network within the target time period only according to the received acquisition instruction, and calculate the number of bytes transmitted and received within the target time period, so as to obtain the current transmission and reception rate of the network card port, compare the current transmission and reception rate with the pre-stored historical maximum transmission and reception rate, and determine the maximum value of the current transmission and reception rate with the actual transmission and reception flow bandwidth value. Based on this, under the condition that no external device is relied on and no testing environment is required to be set up, the MCU can directly obtain the actual transceiving flow bandwidth value of each network card port included in the link layer of the vehicle-mounted Ethernet, and further obtain the actual flow bandwidth value of the TCP/IP protocol stack of the vehicle-mounted Ethernet, so that the operation time can be saved, and the testing cost is reduced.
Referring to fig. 2, as shown in fig. 3, the method for monitoring bandwidth performance of an on-board ethernet protocol stack according to the embodiment of the present invention may further include the following step 301.
301. And determining the second sending byte number as a first sending byte number of the starting moment of the next time period of the target time period, and determining the second receiving byte number as a first receiving byte number of the starting moment of the next time period.
The starting time of the next time period is the ending time of the target time period, and the duration of the next time period is the preset duration.
In order to determine the current sending rate and the current receiving rate of the next time period, the second sending byte number is determined as the first sending byte number of the starting moment of the next time period of the target time period, and the second receiving byte number is determined as the first receiving byte number of the starting moment of the next time period, so as to determine the current sending rate and the current receiving rate of each time period in continuous time periods.
Optionally, when the user does not need to monitor the protocol stack bandwidth performance of the vehicle-mounted ethernet, the calculation stop instruction may be sent to the MCU through the terminal device. And the automobile microcontroller receives a calculation stopping instruction sent by the terminal equipment, and stops acquiring the number of sent bytes and the number of received bytes according to the calculation stopping instruction.
Illustratively, according to the frame structure definition table in table 1, when it is necessary to stop the number of bytes transmitted and the number of bytes received by the target network card port in the target time period, a command code 0x0003 having a length of 12+1 and having a parameter of the identifier of the target network card port may be transmitted to the car microcontroller, and the command code is the stop calculation instruction.
Optionally, when the automobile microcontroller receives the calculation stop instruction to stop calculating the number of bytes sent and the number of bytes received by the target network card port, the automobile microcontroller sends a response code 0x8003 with a length of 12+1 and a parameter of the identifier of the target network card port to the terminal device, so as to notify that the terminal device has stopped acquiring the number of bytes sent and the number of bytes received by the target network card port.
Referring to fig. 3, as shown in fig. 4, the method for monitoring bandwidth performance of an in-vehicle ethernet protocol stack according to the embodiment of the present invention may further include the following steps 401 and 402.
401. And receiving a query request sent by the terminal equipment, wherein the query request is used for requesting the actual sending flow bandwidth value and the actual receiving flow bandwidth value of the target network card port.
Optionally, when a user wants to obtain an actual transmission traffic bandwidth value and an actual reception traffic bandwidth value of the vehicle-mounted ethernet, a command code 0x0001 with a length of 12+1 and a parameter of the identifier of the target network card port may be transmitted to the MCU through the terminal device, where the command code is a query request.
402. And sending the actual sending traffic bandwidth value and the actual receiving traffic bandwidth value to the terminal equipment.
Optionally, after receiving the query request requesting the actually transmitted traffic bandwidth value and the actually received traffic bandwidth value of the target network card port, the MCU may send a response code 0x8001 with a length of 12+9 and parameters of the identifier of the target network card port, the actually transmitted traffic bandwidth value, and the actually received traffic bandwidth value to the terminal device, so as to notify the terminal device of the actually transmitted traffic bandwidth value and the actually received traffic bandwidth value of the target network card port.
The scheme provided by the embodiment of the invention is mainly introduced from the perspective of equipment. It will be appreciated that the apparatus, in order to carry out the above-described functions, comprises corresponding hardware structures and/or software modules for performing the respective functions. Those of skill in the art will readily appreciate that the present invention can be implemented in hardware or a combination of hardware and computer software, in conjunction with the exemplary algorithm steps described in connection with the embodiments disclosed herein. Whether a function is performed as hardware or computer software drives hardware depends upon the particular application and design constraints imposed on the solution. Skilled artisans may implement the described functionality in varying ways for each particular application, but such implementation decisions should not be interpreted as causing a departure from the scope of the present invention.
Fig. 5 shows a schematic diagram of a possible composition of the in-vehicle ethernet protocol stack bandwidth performance monitoring apparatus 500 involved in the foregoing embodiment, and as shown in fig. 5, the in-vehicle ethernet protocol stack bandwidth performance monitoring apparatus 500 may include: a receiving unit 501, an obtaining unit 502 and a determining unit 503.
The receiving unit 501 is configured to receive an acquisition instruction sent by a terminal device, where the acquisition instruction includes an identifier of a target network card port, the target network card port is one of multiple network card ports included in a link layer of a vehicle-mounted ethernet, the acquisition instruction is used to instruct to acquire the number of bytes sent and the number of bytes received by the target network card port in a target time period, the target time period takes a time of receiving the acquisition instruction as a start time, and a duration of the target time period is a preset time length. An obtaining unit 502 is configured to obtain the number of transmitted bytes and the number of received bytes in the target time period. A determining unit 503, configured to determine a current sending rate of the target network card port according to the number of sending bytes and the target time period, and determine a current receiving rate of the target network card port according to the number of receiving bytes and the target time period; and determining the maximum value of the current sending rate and the pre-stored historical maximum sending rate as the actual sending traffic bandwidth value of the target network card port, and determining the maximum value of the current receiving rate and the pre-stored historical maximum receiving rate as the actual receiving traffic bandwidth value.
Optionally, the obtaining unit 502 is specifically configured to:
acquiring a first sending byte number and a first receiving byte number at the starting moment;
acquiring a second sending byte number and a second receiving byte number at the termination time, wherein the termination time is later than the starting time, and the time difference between the termination time and the starting time is a preset duration;
determining the number of sending bytes of a target network card port according to the first number of sending bytes and the second number of sending bytes;
and determining the number of received bytes of the port of the target network card according to the first number of received bytes and the second number of received bytes.
Optionally, the determining unit 503 is further configured to determine the second number of transmitted bytes as a first number of transmitted bytes at a starting time of a next time period of the target time period, and determine the second number of received bytes as a first number of received bytes at the starting time of the next time period.
The starting time of the next time period is the ending time of the target time period, and the duration of the next time period is preset duration.
Optionally, the receiving unit 501 is further configured to receive a query request sent by a terminal device, where the query request is used to request an actually sent traffic bandwidth value and an actually received traffic bandwidth value of a target network card port;
fig. 6 shows another possible composition diagram of the in-vehicle ethernet protocol stack bandwidth performance monitoring apparatus 500 related in the above embodiment, and as shown in fig. 6, the in-vehicle ethernet protocol stack bandwidth performance monitoring apparatus 500 may further include a sending unit 601.
Optionally, the sending unit 601 is configured to send the actually sent traffic bandwidth value and the actually received traffic bandwidth value to the terminal device.
Optionally, the receiving unit 501 is further configured to receive a calculation stop instruction sent by the terminal device.
Optionally, the obtaining unit 502 is further configured to stop obtaining the number of bytes sent and the number of bytes received according to the stop calculation instruction.
Of course, the device for monitoring bandwidth performance of the vehicle-mounted ethernet protocol stack provided in the embodiment of the present invention includes, but is not limited to, the above modules.
In actual implementation, the receiving unit 501, the obtaining unit 502, the determining unit 503 and the sending unit 601 may be implemented by the processor 11 shown in fig. 1 calling the program code in the memory 12. For a specific implementation process, reference may be made to the description of the method for monitoring the bandwidth performance of the vehicle-mounted ethernet protocol stack shown in fig. 2 to fig. 4, which is not described herein again.
Another embodiment of the present invention further provides a computer-readable storage medium, where a computer instruction is stored in the computer-readable storage medium, and when the computer instruction runs on a vehicle-mounted ethernet protocol stack bandwidth performance monitoring apparatus, the vehicle-mounted ethernet protocol stack bandwidth performance monitoring apparatus executes each step executed by the vehicle-mounted ethernet protocol stack bandwidth performance monitoring apparatus in the method flow shown in the foregoing method embodiment.
Another embodiment of the present invention further provides a chip system, and the chip system is applied to a device for monitoring bandwidth performance of a vehicle-mounted ethernet protocol stack. The system-on-chip includes one or more interface circuits, and one or more processors 11. The interface circuit and the processor 11 are interconnected by a line. The interface circuit is adapted to receive signals from a memory 12 of the in-vehicle ethernet protocol stack bandwidth performance monitoring apparatus and to send said signals to the processor 11, said signals comprising computer instructions stored in said memory 12. When the processor 11 executes the computer instructions, the in-vehicle ethernet protocol stack bandwidth performance monitoring apparatus executes the steps executed by the in-vehicle ethernet protocol stack bandwidth performance monitoring apparatus in the method flow shown in the above-mentioned method embodiment.
In another embodiment of the present invention, a computer program product is further provided, where the computer program product includes instructions that, when the instructions are executed on a vehicle-mounted ethernet protocol stack bandwidth performance monitoring apparatus, cause the vehicle-mounted ethernet protocol stack bandwidth performance monitoring apparatus to execute each step executed by the vehicle-mounted ethernet protocol stack bandwidth performance monitoring apparatus in the method flow shown in the foregoing method embodiment.
In the above embodiments, the implementation may be wholly or partially realized by software, hardware, firmware, or any combination thereof. When implemented using a software program, it may be implemented in whole or in part in the form of a computer program product. The computer program product includes one or more computer instructions. The processes or functions according to embodiments of the present invention occur, in whole or in part, when computer-executable instructions are loaded and executed on a computer. The computer may be a general purpose computer, a special purpose computer, a network of computers, or other programmable device. The computer instructions may be stored on a computer readable storage medium or transmitted from one computer readable storage medium to another computer readable storage medium, for example, the computer instructions may be transmitted from one website, computer, server, or data center to another website, computer, server, or data center via wire (e.g., coaxial cable, fiber optic, digital Subscriber Line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.). Computer-readable storage media can be any available media that can be accessed by a computer or data storage device including one or more available media integrated servers, data centers, and the like. The usable medium may be a magnetic medium (e.g., floppy disk, hard disk, magnetic tape), an optical medium (e.g., DVD), or a semiconductor medium (e.g., solid State Disk (SSD)), among others.
The above description is only an embodiment of the present invention, but the scope of the present invention is not limited thereto, and any changes or substitutions within the technical scope of the present invention are intended to be covered by the scope of the present invention. Therefore, the protection scope of the present invention shall be subject to the protection scope of the appended claims.

Claims (12)

1. A method for monitoring the bandwidth performance of a vehicle-mounted Ethernet protocol stack is characterized by comprising the following steps:
receiving an acquisition instruction sent by a terminal device, wherein the acquisition instruction comprises an identifier of a target network card port, the target network card port is one of a plurality of network card ports included in a link layer of the vehicle-mounted Ethernet, the acquisition instruction is used for indicating acquisition of the number of bytes sent and the number of bytes received by the target network card port in a target time period, the target time period takes the moment of receiving the acquisition instruction as a starting moment, and the duration of the target time period is a preset duration;
acquiring the sending byte number and the receiving byte number in the target time period;
determining the current sending rate of the target network card port according to the sending byte number and the target time period, and determining the current receiving rate of the target network card port according to the receiving byte number and the target time period;
and determining the maximum value of the current sending rate and the pre-stored historical maximum sending rate as the actual sending flow bandwidth value of the target network card port, and determining the maximum value of the current receiving rate and the pre-stored historical maximum receiving rate as the actual receiving flow bandwidth value.
2. The method for monitoring bandwidth performance of an on-vehicle ethernet protocol stack according to claim 1, wherein said obtaining the number of bytes sent and the number of bytes received in the target time period comprises:
acquiring a first sending byte number and a first receiving byte number of the starting moment;
acquiring a second sending byte number and a second receiving byte number at a termination time, wherein the termination time is later than the starting time, and the time difference between the termination time and the starting time is the preset duration;
determining the number of sending bytes of the target network card port according to the first number of sending bytes and the second number of sending bytes;
and determining the receiving byte number of the target network card port according to the first receiving byte number and the second receiving byte number.
3. The method for monitoring the bandwidth performance of the vehicle-mounted Ethernet protocol stack according to claim 2, wherein the method for monitoring the bandwidth performance of the vehicle-mounted Ethernet protocol stack further comprises:
determining the second sending byte number as a first sending byte number of the starting time of the next time period of the target time period;
determining the second receiving byte number as a first receiving byte number of the starting time of the next time period;
wherein the starting time of the next time period is the ending time of the target time period, and the duration of the next time period is the preset duration.
4. The method for monitoring the bandwidth performance of the vehicle-mounted Ethernet protocol stack according to any one of claims 1 to 3, wherein the method for monitoring the bandwidth performance of the vehicle-mounted Ethernet protocol stack further comprises:
receiving a query request sent by the terminal device, wherein the query request is used for requesting the actual sending traffic bandwidth value and the actual receiving traffic bandwidth value of the target network card port;
and sending the actual sending traffic bandwidth value and the actual receiving traffic bandwidth value to the terminal equipment.
5. The method for monitoring the bandwidth performance of the vehicle-mounted Ethernet protocol stack according to claim 3, wherein the method for monitoring the bandwidth performance of the vehicle-mounted Ethernet protocol stack further comprises:
receiving a calculation stopping instruction sent by the terminal equipment;
and stopping acquiring the sending byte number and the receiving byte number according to the calculation stopping instruction.
6. A vehicle-mounted Ethernet protocol stack bandwidth performance monitoring device is characterized by comprising:
the receiving unit is used for receiving an acquisition instruction sent by terminal equipment, wherein the acquisition instruction comprises an identifier of a target network card port, the target network card port is one of a plurality of network card ports included in a link layer of the vehicle-mounted Ethernet, the acquisition instruction is used for indicating acquisition of the number of sending bytes and the number of receiving bytes of the target network card port in a target time period, the target time period takes the moment of receiving the acquisition instruction as a starting moment, and the duration of the target time period is a preset duration;
an obtaining unit, configured to obtain the number of transmitted bytes and the number of received bytes in the target time period;
a determining unit, configured to determine a current sending rate of the target network card port according to the number of sending bytes and the target time period, and determine a current receiving rate of the target network card port according to the number of receiving bytes and the target time period; and determining the maximum value of the current sending rate and the pre-stored historical maximum sending rate as the actual sending traffic bandwidth value of the target network card port, and determining the maximum value of the current receiving rate and the pre-stored historical maximum receiving rate as the actual receiving traffic bandwidth value.
7. The device for monitoring bandwidth performance of the vehicle-mounted ethernet protocol stack according to claim 6, wherein the acquiring unit is specifically configured to:
acquiring a first sending byte number and a first receiving byte number of the starting moment;
acquiring a second sending byte number and a second receiving byte number at the termination time, wherein the termination time is later than the starting time, and the time difference between the termination time and the starting time is the preset duration;
determining the number of sending bytes of the target network card port according to the first number of sending bytes and the second number of sending bytes;
and determining the receiving byte number of the target network card port according to the first receiving byte number and the second receiving byte number.
8. The on-vehicle ethernet protocol stack bandwidth performance monitoring apparatus according to claim 7, wherein the determining unit is further configured to determine the second number of bytes sent as a first number of bytes sent at a starting time of a next time period of the target time period, and determine the second number of bytes received as a first number of bytes received at the starting time of the next time period;
wherein the starting time of the next time period is the ending time of the target time period, and the duration of the next time period is the preset duration.
9. The device for monitoring bandwidth performance of an on-vehicle ethernet protocol stack according to any one of claims 6 to 8, wherein the receiving unit is further configured to receive an inquiry request sent by the terminal device, where the inquiry request is used to request the actual sending traffic bandwidth value and the actual receiving traffic bandwidth value of the target network card port;
the vehicle-mounted Ethernet protocol stack bandwidth performance monitoring device also comprises a sending unit;
and the sending unit is configured to send the actual sending traffic bandwidth value and the actual receiving traffic bandwidth value to the terminal device.
10. The device for monitoring the bandwidth performance of the vehicle-mounted ethernet protocol stack according to claim 8, wherein the receiving unit is further configured to receive a stop computation instruction sent by the terminal device;
the obtaining unit is further configured to stop obtaining the number of sent bytes and the number of received bytes according to the calculation stop instruction.
11. An automotive microcontroller, characterized in that the automotive microcontroller comprises: a processor and a memory; the memory for storing computer program code, the computer program code comprising computer instructions; when the processor executes the computer instructions, the automotive microcontroller performs the on-board ethernet protocol stack bandwidth performance monitoring method of any one of claims 1-5.
12. A computer readable storage medium comprising computer instructions that, when run on an automotive microcontroller, cause the automotive microcontroller to perform the on-board ethernet protocol stack bandwidth performance monitoring method of any one of claims 1-5.
CN202210708690.0A 2022-06-21 2022-06-21 Method for monitoring bandwidth performance of vehicle-mounted Ethernet protocol stack and storage medium Pending CN115208786A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202210708690.0A CN115208786A (en) 2022-06-21 2022-06-21 Method for monitoring bandwidth performance of vehicle-mounted Ethernet protocol stack and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202210708690.0A CN115208786A (en) 2022-06-21 2022-06-21 Method for monitoring bandwidth performance of vehicle-mounted Ethernet protocol stack and storage medium

Publications (1)

Publication Number Publication Date
CN115208786A true CN115208786A (en) 2022-10-18

Family

ID=83576581

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202210708690.0A Pending CN115208786A (en) 2022-06-21 2022-06-21 Method for monitoring bandwidth performance of vehicle-mounted Ethernet protocol stack and storage medium

Country Status (1)

Country Link
CN (1) CN115208786A (en)

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101977130A (en) * 2010-10-19 2011-02-16 中兴通讯股份有限公司 Method and device for monitoring bandwidth of Ethernet port in real time
CN106656647A (en) * 2015-10-30 2017-05-10 北京国双科技有限公司 Real-time flow monitoring method and real-time flow monitoring device
CN113347055A (en) * 2021-04-29 2021-09-03 海南视联通信技术有限公司 Method and device for monitoring flow rate and computer readable storage medium
CN113645087A (en) * 2021-06-21 2021-11-12 天津津航计算技术研究所 Method for calculating network bandwidth utilization rate under VxWorks

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101977130A (en) * 2010-10-19 2011-02-16 中兴通讯股份有限公司 Method and device for monitoring bandwidth of Ethernet port in real time
CN106656647A (en) * 2015-10-30 2017-05-10 北京国双科技有限公司 Real-time flow monitoring method and real-time flow monitoring device
CN113347055A (en) * 2021-04-29 2021-09-03 海南视联通信技术有限公司 Method and device for monitoring flow rate and computer readable storage medium
CN113645087A (en) * 2021-06-21 2021-11-12 天津津航计算技术研究所 Method for calculating network bandwidth utilization rate under VxWorks

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
黄治国,李颖: "《中小企业网络管理员工作实践.网络命令与运维工具卷》", 30 June 2020, 北京:中国铁道出版社, pages: 105 *

Similar Documents

Publication Publication Date Title
CN111835627B (en) Communication method of vehicle-mounted gateway, vehicle-mounted gateway and intelligent vehicle
WO2019010686A1 (en) Data processing method and data processing apparatus
KR102286050B1 (en) Method for preventing diagnostic errors in vehicle network and apparatus for the same
KR102471960B1 (en) Apparatus for security of vehicle can communication and method thereof
US20050207360A1 (en) Configuring a transmission mode between devices
CN113852563A (en) Message data transmission method and device, terminal equipment and readable storage medium
US8170027B2 (en) Apparatus and method for supporting higher data rates on links with variable frame sizes
CN111490947A (en) Data packet transmitting method, data packet receiving method, system, device and medium
WO2012174166A1 (en) Communication devices for transmitting data based on available resources
KR101334017B1 (en) Apparatus of checking a validity of message on network for a vehicle and method of thereof
CN113993196B (en) Node control method, system, equipment and storage medium of vehicle-mounted Ethernet
CN115208786A (en) Method for monitoring bandwidth performance of vehicle-mounted Ethernet protocol stack and storage medium
KR20000005265A (en) Multiplex communication interface circuit and method
US20240214401A1 (en) In-vehicle relay device, relay method, and relay program
CN116132550A (en) Data transmission method and device, electronic equipment and storage medium
JP7005201B2 (en) Communication message converter
US20210036960A1 (en) Traffic control method and related apparatus
CN114697269A (en) Data communication method, apparatus, device and medium
US20040240388A1 (en) System and method for dynamic assignment of timers in a network transport engine
CN110677466A (en) Application program downloading method, device, gateway and storage medium
CN111555929B (en) Method and device for limiting network flow, electronic equipment and storage medium
CN115277747B (en) Vehicle network repair method, system, computer device and readable storage medium
CN114040036B (en) Data processing method, device and storage medium
CN114780480B (en) Data transmission method, device and equipment
CN116996592B (en) Network card, data transmission processing method and data receiving processing method

Legal Events

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