CN114827046A - Bus load rate processing method and device and computer readable storage medium - Google Patents
Bus load rate processing method and device and computer readable storage medium Download PDFInfo
- Publication number
- CN114827046A CN114827046A CN202210289448.4A CN202210289448A CN114827046A CN 114827046 A CN114827046 A CN 114827046A CN 202210289448 A CN202210289448 A CN 202210289448A CN 114827046 A CN114827046 A CN 114827046A
- Authority
- CN
- China
- Prior art keywords
- target bus
- transmission
- load rate
- bus
- window
- 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.)
- Granted
Links
Images
Classifications
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L47/00—Traffic control in data switching networks
- H04L47/10—Flow control; Congestion control
- H04L47/27—Evaluation or update of window size, e.g. using information derived from acknowledged [ACK] packets
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L12/00—Data switching networks
- H04L12/28—Data switching networks characterised by path configuration, e.g. LAN [Local Area Networks] or WAN [Wide Area Networks]
- H04L12/40—Bus networks
- H04L12/4013—Management of data rate on the bus
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L12/00—Data switching networks
- H04L12/28—Data switching networks characterised by path configuration, e.g. LAN [Local Area Networks] or WAN [Wide Area Networks]
- H04L12/40—Bus networks
- H04L2012/40208—Bus networks characterized by the use of a particular bus standard
-
- Y—GENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
- Y02—TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
- Y02D—CLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
- Y02D10/00—Energy efficient computing, e.g. low power processors, power management or thermal management
Landscapes
- Engineering & Computer Science (AREA)
- Computer Networks & Wireless Communication (AREA)
- Signal Processing (AREA)
- Quality & Reliability (AREA)
- Small-Scale Networks (AREA)
- Information Transfer Systems (AREA)
Abstract
The invention relates to a bus load rate processing method, a bus load rate processing device and a computer readable storage medium. Wherein, the method comprises the following steps: determining a step length and a total step length number according to the baud rate of data transmission of a target bus, wherein the step length is one bit transmission time, and the total step length number is obtained according to the total transmission time length and the step length of the data transmission of the target bus; establishing a transmission array of a target bus, wherein the length of the transmission array is the total step number; and processing the transmission array based on a sliding window mode to obtain the load rate of the target bus. The invention solves the technical problems of long calculation time consumption and low universality in the processing mode of the bus load rate in the related technology.
Description
Technical Field
The invention relates to the technical field of real-time system bus communication, in particular to a method and a device for processing a bus load rate and a computer readable storage medium.
Background
The load rate reflects the busyness of the bus in a period of time, if data communication is suddenly increased at a certain moment, the load rate is obviously improved, partial data frames cannot be completely transmitted in a specified time, and the real-time performance of the system cannot be guaranteed. In safety-critical distributed real-time systems, it is necessary to ensure that the load rate does not exceed a set threshold. Therefore, the calculation of the real-time bus load rate is an important content.
In the prior art, the load rate of a bus occupied by a message in a sending period is usually calculated, and then the load rate of a Controller Area Network (CAN) bus of a whole Network segment is determined, however, the calculating method has a long using period, a calculated value CAN be obtained within hundreds of milliseconds or even thousands of milliseconds, and the universality is insufficient only for the CAN Network.
For the problems of long calculation time and low universality of the processing method of the bus load rate in the related art, no effective solution is provided at present.
Disclosure of Invention
In order to avoid the disadvantages of the prior art, the invention provides a method and a device for processing a bus load rate and a computer-readable storage medium, so as to at least solve the technical problems that the processing mode of the bus load rate in the related art is long in calculation time and low in universality.
According to an aspect of the embodiments of the present invention, there is provided a method for processing a bus load rate, including: determining a step length and a total step length number according to a baud rate of data transmission of a target bus, wherein the step length is one bit transmission time, and the total step length number is obtained according to the total transmission time length of the data transmission of the target bus and the step length; establishing a transmission array of the target bus, wherein the length of the transmission array is the total step number; and processing the transmission array based on a sliding window mode to obtain the load rate of the target bus.
Optionally, determining the step size and the total step size number according to the baud rate of data transmission performed by the target bus, including: acquiring the baud rate of the target bus for data transmission; determining the step length according to the baud rate; acquiring the total transmission time length of the target bus for data transmission; and determining the total step number according to the total transmission time length and the step length.
Optionally, establishing a transmission array of the target bus includes: acquiring a data stream for data transmission of the target bus; determining the working state of the target bus within a preset step length according to the data flow; and constructing the transmission array according to the working state.
Optionally, before the processing is performed on the transmission array based on a sliding window to obtain the load rate of the target bus, the method further includes: and determining the window size and the sliding step number of the sliding window.
Optionally, processing the transmission array based on a sliding window manner to obtain a load rate of the target bus, including: initializing a window queue, and setting an initial variable for traversing the transmission array; judging whether the transmission array is traversed and ended; stopping processing under the condition that the transmission array is the traversal end; or, under the condition that the transmission array is not the traversal end, judging whether the number of elements contained in the window queue is the predetermined window size; under the condition that the number of elements contained in the window queue is the predetermined window size, deleting the head element of the window queue and adding a target transmission array to the tail of the window queue; or, under the condition that the number of elements contained in the window queue is not the predetermined window size, adding the target transmission array to the tail of the window queue; the target transmission array is a transmission array corresponding to the initial variable; judging whether the initial variable is divided by a predetermined sliding step length number; determining the load rate of the target bus if the initial variable is divided by the predetermined number of sliding steps; or, in the case that the initial variable is not divided by the predetermined number of sliding steps, adding a predetermined value to the initial variable, and continuously determining whether the traversal of the transmission array is ended.
Optionally, determining a load rate of the target bus comprises: acquiring element summation values and queue lengths of the window queues; and obtaining the load rate of the target bus according to the element summation value and the queue length.
Optionally, after determining the load rate of the target bus, the method further comprises: and recording the load rate of the target bus according to a preset format.
According to another aspect of the embodiments of the present invention, there is also provided a processing apparatus for a bus load rate, including: the device comprises a first determining module, a second determining module and a third determining module, wherein the first determining module is used for determining a step length and a total step length number according to a baud rate of data transmission of a target bus, the step length is one bit transmission time, and the total step length number is obtained according to the total transmission time length of the data transmission of the target bus and the step length; the establishing module is used for establishing a transmission array of the target bus, wherein the length of the transmission array is the total step number; and the processing module is used for processing the transmission array based on a sliding window mode to obtain the load rate of the target bus.
According to another aspect of the embodiments of the present invention, there is also provided a computer-readable storage medium, where the computer-readable storage medium includes a stored program, and when the program runs, the apparatus where the computer-readable storage medium is located is controlled to execute the bus load rate processing method described in any one of the above.
According to another aspect of the embodiments of the present invention, there is also provided a processor, configured to execute a program, where the program executes the method for processing the bus load rate described in any one of the above.
In the embodiment of the invention, the baud rate of data transmission according to a target bus is adopted to determine the step length and the total step length number, wherein the step length is the time of one bit transmission, and the total step length number is obtained according to the total transmission time length and the step length of the data transmission of the target bus; establishing a transmission array of a target bus, wherein the length of the transmission array is the total step number; the method comprises the steps of processing a transmission array based on a sliding window mode to obtain the load rate of a target bus, namely processing the transmission array by adopting the sliding window mode to calculate the real-time load rate of the target bus, and achieving the purpose of accurately calculating the load rate at a certain moment during bus transmission, thereby realizing bit-level load rate calculation.
Drawings
The accompanying drawings, which are included to provide a further understanding of the invention and are incorporated in and constitute a part of this application, illustrate embodiment(s) of the invention and together with the description serve to explain the invention without limiting the invention. In the drawings:
FIG. 1 is a flow chart of a method of processing bus load rate according to an embodiment of the invention;
FIG. 2 is a schematic diagram of a sliding window calculation according to an alternative embodiment of the present invention;
FIG. 3 is a flow diagram of a target bus real-time load rate calculation in accordance with an alternative embodiment of the present invention;
fig. 4 is a schematic diagram of a bus load rate processing device according to an embodiment of the present invention.
Detailed Description
In order to make the technical solutions of the present invention better understood, 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.
It should be noted that the terms "first," "second," and the like in the description and claims of the present invention and in the drawings described above are used for distinguishing between similar elements and not necessarily for describing a particular sequential or chronological order. It is to be understood that the data so used is interchangeable under appropriate circumstances such that the embodiments of the invention described herein are capable of operation in sequences other than those illustrated or described herein. Furthermore, the terms "comprises," "comprising," and "having," and any variations thereof, are intended to cover a non-exclusive inclusion, such that a process, method, system, article, or apparatus that comprises a list of steps or elements is not necessarily limited to those steps or elements expressly listed, but may include other steps or elements not expressly listed or inherent to such process, method, article, or apparatus.
Example 1
In order to solve the technical problems of the bus load rate processing method in the related art, such as long computation time and low universality, according to the embodiment of the present invention, an embodiment of a bus load rate processing method is provided, it should be noted that the steps shown in the flowchart of the figure can be executed in a computer system such as a set of computer-executable instructions, and although a logical order is shown in the flowchart, in some cases, the steps shown or described can be executed in an order different from the order here.
Fig. 1 is a flowchart of a bus load rate processing method according to an embodiment of the present invention, as shown in fig. 1, the method includes the following steps:
step S102, determining a step length and a total step length number according to the baud rate of data transmission of a target bus, wherein the step length is one bit transmission time, and the total step length number is obtained according to the total transmission time and the step length of the data transmission of the target bus;
the target Bus includes, but is not limited to, a CAN Bus, a Peripheral Component Interconnect (PCI) Bus, a Universal Serial Bus (USB) Bus, an Industry Standard Architecture (ISA) Bus, an RS-485 Bus, and the like.
The baud rate is the number of baud in a unit time after the signal is modulated, i.e., the number of times the carrier parameter changes in the unit time. It is a measure of the data transfer rate to the target bus, usually in units of "baud per second" (bit/s).
Step S104, establishing a transmission array of the target bus, wherein the length of the transmission array is the total step number;
the transmission array is used for representing the working state of the target bus within a preset step size, wherein the working state comprises at least one of the following: free, busy.
And step S106, processing the transmission array based on a sliding window mode to obtain the load rate of the target bus.
Optionally, before the processing is performed on the transmission array based on the sliding window to obtain the load rate of the target bus, the method further includes: the window size and the number of sliding steps of the sliding window are determined. At this time, the window size and the number of sliding steps of the sliding window may be set, for example, the window size of the sliding window is W steps, and the number of sliding steps of the sliding window is steps. It should be noted that the value of W, steps can be set according to the needs of the application scenario, and is not limited herein.
It should be noted that the bit-level precision load rate calculation is realized in the bus communication simulation, and is applicable to all bus type networks. The calculation method is used for guiding the design of CAN bus communication of a certain control system, ensuring that the real-time load rate of the bus does not exceed 45%, finding a time period with busy transmission and assisting in optimizing the bus design.
Through the steps, the step length and the total step length number can be determined according to the baud rate of data transmission of the target bus, then the transmission array of the target bus is established, wherein the length of the transmission array is the total step length number, the transmission array is processed in a sliding window mode to obtain the load rate of the target bus, namely the transmission array is processed in a sliding window mode to calculate the real-time load rate of the target bus, and the purpose of accurately calculating the load rate at a certain moment during bus transmission is achieved, so that the bit-level load rate calculation is realized, the method is suitable for all bus networks, has the technical effect of high universality, and further solves the technical problem of [ key words ].
Optionally, determining the step size and the total step size according to the baud rate of the data transmission performed by the target bus, including: obtaining a baud rate of data transmission of a target bus; determining a step length according to the baud rate; acquiring the total transmission time of the target bus for data transmission; and determining the total step number according to the total transmission time length and the step length.
In an alternative embodiment, the time for one bit transmission is a step size, and the step size is determined by:
step represents the time represented by one step, the unit is s, the Buadrate represents the baud rate, and the unit is bit/s.
The total number of steps is determined by:
where len represents the total number of steps, t represents the total duration of transmission in units of s, step represents the time of one step in units of s,indicating a rounding down.
In the above embodiment, the baud rate of the data transmission by the target bus may be used to calculate the step length, and then the total transmission duration and the step length of the data transmission by the target bus may be used to calculate the total step length number, so that the step length and the total step length number may be accurately calculated respectively.
Optionally, establishing a transfer array of the target bus includes: acquiring a data stream of a target bus for data transmission; determining the working state of the target bus within a preset step length according to the data flow; and constructing a transmission array according to the working state.
In an alternative embodiment, a length len transport array is constructed, determined by:
wherein, Trans represents the transmission array, Trans [ i ] represents the bus is free or busy in the ith step length, and is obtained by transmitting data stream through the bus, wherein i is more than or equal to 0 and less than len.
In the above embodiment, the data stream of data transmission can be performed by using the target bus, so as to obtain the working state of the target bus within the predetermined step length, and then the working state is reused to quickly construct the transmission array.
Optionally, processing the transmission array based on a sliding window manner to obtain a load rate of the target bus, including: initializing a window queue, and setting an initial variable traversing a transmission array; judging whether the transmission array is traversed and ended; stopping processing under the condition that the transmission array is traversed and ended; or, under the condition that the transmission array is not the traversal end, judging whether the number of elements contained in the window queue is the predetermined window size or not; under the condition that the number of elements contained in the window queue is the predetermined window size, deleting the head element of the window queue, and adding the target transmission array to the tail of the window queue; or, under the condition that the number of elements contained in the window queue is not the predetermined window size, adding the target transmission array to the tail of the window queue; the target transmission array is a transmission array corresponding to the initial variable; judging whether the initial variable is divided by the predetermined sliding step length number; under the condition that the initial variable is divided by the predetermined sliding step number, determining the load rate of the target bus; or, under the condition that the initial variable is not divided by the predetermined number of sliding steps, adding a predetermined value to the initial variable, and continuously judging whether the transmission array is traversed and ended.
The initialization window queue can set the window queue as a queue with a preset step length; the predetermined window size and the predetermined number of sliding steps are respectively the window size and the number of sliding steps of the sliding window before the transmission array is processed based on the sliding window to obtain the load rate of the target bus; the predetermined value includes, but is not limited to, 1, 2, 3, and 4, and the predetermined value may be flexibly set according to needs in a specific implementation process, and is not limited herein.
Fig. 2 is a schematic diagram of sliding window calculation according to an alternative embodiment of the present invention, as shown in fig. 2, the window size of the sliding window is 4 steps, the number of the sliding steps of the sliding window is 1, the transmission array is traversed by using the sliding window method, and the load rate of the target bus is calculated by sliding each time.
Fig. 3 is a flowchart of a target bus real-time load rate calculation according to an alternative embodiment of the present invention, and as shown in fig. 3, the specific implementation process is as follows:
1) initializing a queue WindowQueue with the size of W, storing the transmission condition in a window, and setting an initial variable index of a traversal transmission array to be 0;
2) judging whether the last element of the transmission array is traversed, if so, stopping calculation, and otherwise, continuing;
3) judging whether the number of elements contained in the WindowQueue is equal to W or not, and if yes, deleting the queue head element;
4) adding Trans [ index ] to the tail of the WindowQueue queue;
5) judging whether index is evenly divided by steps, if yes, entering a flow 6), and if not, entering a flow 7);
6) calculating the load rate of the target bus;
7) index plus 1, enter scheme 2).
In the above embodiment, the transmission array is traversed by adopting a sliding window method, and the load rate of the target bus is calculated in a sliding manner each time, so that the real-time bus load rate is obtained.
Optionally, determining a load rate of the target bus comprises: acquiring element summation values of a window queue and queue length; and obtaining the load rate of the target bus according to the element summation value and the queue length.
In an alternative embodiment, the load rate of the target bus may be determined by:
where, Busload represents the load rate of the target bus, sum (windowqueue) represents the element summation value of the window queue, the element summation value is the result of summation of elements inside the queue, and len (windowqueue) represents the queue length, that is, the size of the queue.
In the above embodiment, the load rate of the target bus can be calculated by using the sum of the elements of the window queue and the length of the queue, so that the load rate of the target bus can be accurately obtained.
Optionally, after determining the load rate of the target bus, the method further includes: and recording the load rate of the target bus according to a preset format.
In an alternative embodiment, the recording may be performed in the form of (index, Busload), where the bus load rate of the index step is Busload, and the load rate of the target bus may also be recorded in the form of a table. It should be noted that the predetermined format includes, but is not limited to, the above-mentioned implementation manner.
Example 2
According to another aspect of the embodiments of the present invention, there is also provided a processing apparatus of a bus load rate, and fig. 4 is a schematic diagram of the processing apparatus of the bus load rate according to the embodiments of the present invention, as shown in fig. 4, the processing apparatus of the bus load rate includes: a first determination module 42, a setup module 44, and a processing module 46. The following describes the processing device of the bus load factor in detail.
A first determining module 42, configured to determine a step size and a total step size according to a baud rate of data transmission performed by a target bus, where the step size is a bit transmission time, and the total step size is obtained according to a total transmission time and the step size of data transmission performed by the target bus; the establishing module 44 is configured to establish a transmission array of the target bus, where the length of the transmission array is the total number of steps; and the processing module 46 is configured to process the transmission array based on a sliding window manner, so as to obtain a load rate of the target bus.
It should be noted that the above modules may be implemented by software or hardware, for example, for the latter, the following may be implemented: the modules can be located in the same processor; and/or the modules are located in different processors in any combination.
In the above embodiment, the processing apparatus of the bus load rate may employ the first determining module 42 to determine the step size and the total step size according to the baud rate of the data transmission performed by the target bus, the establishing module 44 to re-establish the transmission array of the target bus, wherein, the length of the transmission array is the total step length, and the processing module 46 processes the transmission array based on the sliding window mode to obtain the load rate of the target bus, namely, the transmission array is processed by adopting a sliding window mode, thereby calculating the real-time load rate of the target bus, achieving the purpose of accurately calculating the load rate at a certain moment during bus transmission, thereby realizing the calculation of the load rate of the bit level, being applicable to all bus networks, having the technical effect of high universality, and the technical problems that the bus load rate processing in the related technology is long in calculation time and low in universality are solved.
It should be noted here that the first determining module 42, the establishing module 44 and the processing module 46 correspond to steps S102 to S106 in embodiment 1, and the modules are the same as the corresponding steps in the implementation example and application scenarios, but are not limited to the disclosure in embodiment 1.
Optionally, the first determining module 42 includes: the first acquisition unit is used for acquiring the baud rate of data transmission of a target bus; the first determining unit is used for determining the step length according to the baud rate; the second acquisition unit is used for acquiring the total transmission time length of the data transmission of the target bus; and the second determining unit is used for determining the total step number according to the total transmission time length and the step length.
Optionally, the establishing module 44 includes: the third acquisition unit is used for acquiring a data stream of the target bus for data transmission; the third determining unit is used for determining the working state of the target bus within a preset step length according to the data flow; and the construction unit is used for constructing a transmission array according to the working state.
Optionally, the apparatus further comprises: a second determination module. The method is used for determining the window size and the sliding step number of the sliding window before the transmission array is processed based on the sliding window mode to obtain the load rate of the target bus.
Optionally, the processing module 46 includes: the initialization unit is used for initializing the window queue and setting an initial variable traversing the transmission array; the first judgment unit is used for judging whether the transmission array is traversed or not; the first processing unit is used for stopping processing under the condition that the transmission array is traversed and ended; or, under the condition that the transmission array is not the traversal end, judging whether the number of elements contained in the window queue is the predetermined window size or not; the second processing unit is used for deleting the head element of the window queue and adding the target transmission array to the tail of the window queue under the condition that the number of elements contained in the window queue is the predetermined window size; or, under the condition that the number of elements contained in the window queue is not the predetermined window size, adding the target transmission array to the tail of the window queue; the target transmission array is a transmission array corresponding to the initial variable; the second judging unit is used for judging whether the initial variable is divided by the predetermined sliding step length number; the third processing unit is used for determining the load rate of the target bus under the condition that the initial variable is divided by the predetermined sliding step length; or, under the condition that the initial variable is not divided by the predetermined number of sliding steps, adding a predetermined value to the initial variable, and continuously judging whether the transmission array is traversed and ended.
Optionally, the third processing unit includes: the acquiring subunit is used for acquiring the element summation value of the window queue and the queue length; and the processing subunit is used for obtaining the load rate of the target bus according to the element summation value and the queue length.
Optionally, the processing module 46 further includes: and the recording unit is used for recording the load rate of the target bus according to a preset format after determining the load rate of the target bus.
Example 3
According to another aspect of the embodiments of the present invention, there is also provided a computer-readable storage medium, which includes a stored program, wherein when the program runs, a device in which the computer-readable storage medium is located is controlled to execute the processing method of the bus load rate of any one of the above.
Optionally, in this embodiment, the computer-readable storage medium may be located in any one of a group of computer terminals in a computer network and/or in any one of a group of mobile terminals, and the computer-readable storage medium includes a stored program.
Optionally, the program when executed controls an apparatus in which the computer-readable storage medium is located to perform the following functions: determining a step length and a total step length number according to the baud rate of data transmission of a target bus, wherein the step length is one bit transmission time, and the total step length number is obtained according to the total transmission time length and the step length of the data transmission of the target bus; establishing a transmission array of a target bus, wherein the length of the transmission array is the total step number; and processing the transmission array based on a sliding window mode to obtain the load rate of the target bus.
Optionally, determining the step size and the total step size according to the baud rate of the data transmission performed by the target bus, including: obtaining a baud rate of data transmission of a target bus; determining a step length according to the baud rate; acquiring the total transmission time of the target bus for data transmission; and determining the total step number according to the total transmission time length and the step length.
Optionally, establishing a transfer array of the target bus includes: acquiring a data stream of a target bus for data transmission; determining the working state of the target bus within a preset step length according to the data flow; and constructing a transmission array according to the working state.
Optionally, before the processing is performed on the transmission array based on the sliding window to obtain the load rate of the target bus, the method further includes: the window size and the number of sliding steps of the sliding window are determined.
Optionally, processing the transmission array based on a sliding window manner to obtain a load rate of the target bus, including: initializing a window queue, and setting an initial variable traversing a transmission array; judging whether the transmission array is traversed and ended; stopping processing under the condition that the transmission array is traversed and ended; or, under the condition that the transmission array is not the traversal end, judging whether the number of elements contained in the window queue is the predetermined window size or not; under the condition that the number of elements contained in the window queue is the predetermined window size, deleting the head element of the window queue, and adding the target transmission array to the tail of the window queue; or, under the condition that the number of elements contained in the window queue is not the predetermined window size, adding the target transmission array to the tail of the window queue; the target transmission array is a transmission array corresponding to the initial variable; judging whether the initial variable is divided by the predetermined sliding step length number; under the condition that the initial variable is divided by the predetermined sliding step number, determining the load rate of the target bus; or, under the condition that the initial variable is not divided by the predetermined number of sliding steps, adding a predetermined value to the initial variable, and continuously judging whether the transmission array is traversed and ended.
Optionally, determining a load rate of the target bus comprises: acquiring element summation values of a window queue and queue length; and obtaining the load rate of the target bus according to the element summation value and the queue length.
Optionally, after determining the load rate of the target bus, the method further includes: and recording the load rate of the target bus according to a preset format.
Example 4
According to another aspect of the embodiments of the present invention, there is also provided a processor, configured to execute a program, where the program executes a method for processing a bus load rate of any one of the foregoing methods.
Optionally, an embodiment of the present invention provides an apparatus, where the apparatus includes a processor, a memory, and a program stored in the memory and capable of being executed on the processor, and when the processor executes the program, the following steps are implemented:
determining a step length and a total step length number according to the baud rate of data transmission of a target bus, wherein the step length is one bit transmission time, and the total step length number is obtained according to the total transmission time length and the step length of the data transmission of the target bus; establishing a transmission array of a target bus, wherein the length of the transmission array is the total step number; and processing the transmission array based on a sliding window mode to obtain the load rate of the target bus.
Optionally, determining the step size and the total step size according to the baud rate of the data transmission performed by the target bus, including: obtaining a baud rate of data transmission of a target bus; determining a step length according to the baud rate; acquiring the total transmission time of the target bus for data transmission; and determining the total step number according to the total transmission time length and the step length.
Optionally, establishing a transfer array of the target bus includes: acquiring a data stream of a target bus for data transmission; determining the working state of the target bus within a preset step length according to the data flow; and constructing a transmission array according to the working state.
Optionally, before the processing is performed on the transmission array based on the sliding window to obtain the load rate of the target bus, the method further includes: the window size and the number of sliding steps of the sliding window are determined.
Optionally, processing the transmission array based on a sliding window manner to obtain a load rate of the target bus, including: initializing a window queue, and setting an initial variable traversing a transmission array; judging whether the transmission array is traversed and ended; stopping processing under the condition that the transmission array is traversed and ended; or, under the condition that the transmission array is not the traversal end, judging whether the number of elements contained in the window queue is the predetermined window size or not; under the condition that the number of elements contained in the window queue is the predetermined window size, deleting the head element of the window queue, and adding the target transmission array to the tail of the window queue; or, under the condition that the number of elements contained in the window queue is not the predetermined window size, adding the target transmission array to the tail of the window queue; the target transmission array is a transmission array corresponding to the initial variable; judging whether the initial variable is divided by the predetermined sliding step length number; under the condition that the initial variable is divided by the predetermined sliding step number, determining the load rate of the target bus; or, under the condition that the initial variable is not divided by the predetermined number of sliding steps, adding a predetermined value to the initial variable, and continuously judging whether the transmission array is traversed and ended.
Optionally, determining a load rate of the target bus comprises: acquiring element summation values of a window queue and queue length; and obtaining the load rate of the target bus according to the element summation value and the queue length.
Optionally, after determining the load rate of the target bus, the method further includes: and recording the load rate of the target bus according to a preset format.
Optionally, the invention also provides a computer program product adapted to perform a program for initializing the following method steps when executed on a data processing device:
determining a step length and a total step length number according to the baud rate of data transmission of a target bus, wherein the step length is one bit transmission time, and the total step length number is obtained according to the total transmission time length and the step length of the data transmission of the target bus; establishing a transmission array of a target bus, wherein the length of the transmission array is the total step number; and processing the transmission array based on a sliding window mode to obtain the load rate of the target bus.
Optionally, determining the step size and the total step size according to the baud rate of the data transmission performed by the target bus, including: obtaining a baud rate of data transmission of a target bus; determining a step length according to the baud rate; acquiring the total transmission time of the target bus for data transmission; and determining the total step number according to the total transmission time length and the step length.
Optionally, establishing a transfer array of the target bus includes: acquiring a data stream of a target bus for data transmission; determining the working state of the target bus within a preset step length according to the data flow; and constructing a transmission array according to the working state.
Optionally, before the processing is performed on the transmission array based on the sliding window to obtain the load rate of the target bus, the method further includes: the window size and the number of sliding steps of the sliding window are determined.
Optionally, processing the transmission array based on a sliding window manner to obtain a load rate of the target bus, including: initializing a window queue, and setting an initial variable traversing a transmission array; judging whether the transmission array is traversed and ended; stopping processing under the condition that the transmission array is traversed and ended; or, under the condition that the transmission array is not the traversal end, judging whether the number of elements contained in the window queue is the predetermined window size or not; under the condition that the number of elements contained in the window queue is the predetermined window size, deleting the head element of the window queue, and adding the target transmission array to the tail of the window queue; or, under the condition that the number of elements contained in the window queue is not the predetermined window size, adding the target transmission array to the tail of the window queue; the target transmission array is a transmission array corresponding to the initial variable; judging whether the initial variable is divided by the predetermined sliding step length number; under the condition that the initial variable is divided by the predetermined sliding step number, determining the load rate of the target bus; or, under the condition that the initial variable is not divided by the predetermined number of sliding steps, adding a predetermined value to the initial variable, and continuously judging whether the transmission array is traversed and ended.
Optionally, determining a load rate of the target bus comprises: acquiring element summation values of a window queue and queue length; and obtaining the load rate of the target bus according to the element summation value and the queue length.
Optionally, after determining the load rate of the target bus, the method further includes: and recording the load rate of the target bus according to a preset format.
The above-mentioned serial numbers of the embodiments of the present invention are merely for description and do not represent the merits of the embodiments.
In the above embodiments of the present invention, the descriptions of the respective embodiments have respective emphasis, and for parts that are not described in detail in a certain embodiment, reference may be made to related descriptions of other embodiments.
In the embodiments provided in the present application, it should be understood that the disclosed technology can be implemented in other ways. The above-described embodiments of the apparatus are merely illustrative, and for example, the division of the units may be a logical division, and in actual implementation, there may be another division, for example, multiple units or components may be combined or integrated into another system, or some features may be omitted, or not executed. In addition, the shown or discussed mutual coupling or direct coupling or communication connection may be an indirect coupling or communication connection through some interfaces, units or modules, and may be in an electrical or other form.
The units described as separate parts may or may not be physically separate, and parts displayed as units may or may not be physical units, may be located in one place, or may be distributed on a plurality of units. Some or all of the units can be selected according to actual needs to achieve the purpose of the solution of the embodiment.
In addition, functional units in the embodiments of the present invention may be integrated into one processing unit, or each unit may exist alone physically, or two or more units are integrated into one unit. The integrated unit can be realized in a form of hardware, and can also be realized in a form of a software functional unit.
The integrated unit, if implemented in the form of a software functional unit and sold or used as a stand-alone product, may be stored in a computer readable storage medium. Based on such understanding, the technical solution of the present invention may be embodied in the form of a software product, which is stored in a storage medium and includes instructions for causing a computer device (which may be a personal computer, a server, or a network device) to execute all or part of the steps of the method according to the embodiments of the present invention. And the aforementioned storage medium includes: a U-disk, a Read-Only Memory (ROM), a Random Access Memory (RAM), a removable hard disk, a magnetic disk, or an optical disk, and various media capable of storing program codes.
The foregoing is only a preferred embodiment of the present invention, and it should be noted that, for those skilled in the art, various modifications and decorations can be made without departing from the principle of the present invention, and these modifications and decorations should also be regarded as the protection scope of the present invention.
Claims (10)
1. A method for processing bus load rate is characterized by comprising the following steps:
determining a step length and a total step length number according to a baud rate of data transmission of a target bus, wherein the step length is one bit transmission time, and the total step length number is obtained according to the total transmission time length of the data transmission of the target bus and the step length;
establishing a transmission array of the target bus, wherein the length of the transmission array is the total step number;
and processing the transmission array based on a sliding window mode to obtain the load rate of the target bus.
2. The method of claim 1, wherein determining the step size and the total number of steps based on the baud rate of the data transmission on the target bus comprises:
acquiring the baud rate of the target bus for data transmission;
determining the step length according to the baud rate;
acquiring the total transmission time length of the target bus for data transmission;
and determining the total step number according to the total transmission time length and the step length.
3. The method of claim 1, wherein establishing a transfer array for the target bus comprises:
acquiring a data stream for data transmission of the target bus;
determining the working state of the target bus within a preset step length according to the data flow;
and constructing the transmission array according to the working state.
4. The method of claim 1, wherein before the processing the transmission array based on a sliding window to obtain the load rate of the target bus, the method further comprises:
and determining the window size and the sliding step number of the sliding window.
5. The method according to any one of claims 1 to 4, wherein processing the transmission array based on a sliding window manner to obtain the load rate of the target bus comprises:
initializing a window queue, and setting an initial variable for traversing the transmission array;
judging whether the transmission array is traversed and ended;
stopping processing under the condition that the transmission array is the traversal end; or, under the condition that the transmission array is not the traversal end, judging whether the number of elements contained in the window queue is the predetermined window size;
under the condition that the number of elements contained in the window queue is the predetermined window size, deleting the head element of the window queue and adding a target transmission array to the tail of the window queue; or, under the condition that the number of elements contained in the window queue is not the predetermined window size, adding the target transmission array to the tail of the window queue; the target transmission array is a transmission array corresponding to the initial variable;
judging whether the initial variable is divided by a predetermined sliding step length number;
determining the load rate of the target bus if the initial variable is divided by the predetermined number of sliding steps; or, in the case that the initial variable is not divided by the predetermined number of sliding steps, adding a predetermined value to the initial variable, and continuously determining whether the traversal of the transmission array is ended.
6. The method of claim 5, wherein determining the load rate of the target bus comprises:
acquiring element summation values and queue lengths of the window queues;
and obtaining the load rate of the target bus according to the element summation value and the queue length.
7. The method of claim 5, wherein after determining the load rate of the target bus, the method further comprises:
and recording the load rate of the target bus according to a preset format.
8. A bus load rate processing apparatus, comprising:
the device comprises a first determining module, a second determining module and a third determining module, wherein the first determining module is used for determining a step length and a total step length number according to a baud rate of data transmission of a target bus, the step length is one bit transmission time, and the total step length number is obtained according to the total transmission time length of the data transmission of the target bus and the step length;
the establishing module is used for establishing a transmission array of the target bus, wherein the length of the transmission array is the total step number;
and the processing module is used for processing the transmission array based on a sliding window mode to obtain the load rate of the target bus.
9. A computer-readable storage medium, comprising a stored program, wherein when the program runs, the apparatus on which the computer-readable storage medium is located is controlled to execute the bus load rate processing method according to any one of claims 1 to 7.
10. A processor, characterized in that the processor is configured to run a program, wherein the program is configured to execute the method of processing the bus load rate according to any one of claims 1 to 7 when running.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202210289448.4A CN114827046B (en) | 2022-03-22 | 2022-03-22 | Bus load rate processing method and device and computer readable storage medium |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202210289448.4A CN114827046B (en) | 2022-03-22 | 2022-03-22 | Bus load rate processing method and device and computer readable storage medium |
Publications (2)
Publication Number | Publication Date |
---|---|
CN114827046A true CN114827046A (en) | 2022-07-29 |
CN114827046B CN114827046B (en) | 2023-07-11 |
Family
ID=82531597
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202210289448.4A Active CN114827046B (en) | 2022-03-22 | 2022-03-22 | Bus load rate processing method and device and computer readable storage medium |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN114827046B (en) |
Citations (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN106992879A (en) * | 2017-03-14 | 2017-07-28 | 中国第汽车股份有限公司 | A kind of computational methods of CAN load factor |
CN107070743A (en) * | 2017-03-17 | 2017-08-18 | 广州致远电子股份有限公司 | A kind of CAN load factor detection method and device |
CN111784066A (en) * | 2020-07-09 | 2020-10-16 | 南方电网科学研究院有限责任公司 | Method, system and equipment for predicting annual operation efficiency of power distribution network |
WO2021238090A1 (en) * | 2020-05-27 | 2021-12-02 | 东风柳州汽车有限公司 | Adaptive adjustment control method and apparatus, gateway terminal, and storage medium |
-
2022
- 2022-03-22 CN CN202210289448.4A patent/CN114827046B/en active Active
Patent Citations (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN106992879A (en) * | 2017-03-14 | 2017-07-28 | 中国第汽车股份有限公司 | A kind of computational methods of CAN load factor |
CN107070743A (en) * | 2017-03-17 | 2017-08-18 | 广州致远电子股份有限公司 | A kind of CAN load factor detection method and device |
WO2021238090A1 (en) * | 2020-05-27 | 2021-12-02 | 东风柳州汽车有限公司 | Adaptive adjustment control method and apparatus, gateway terminal, and storage medium |
CN111784066A (en) * | 2020-07-09 | 2020-10-16 | 南方电网科学研究院有限责任公司 | Method, system and equipment for predicting annual operation efficiency of power distribution network |
Non-Patent Citations (3)
Title |
---|
TERENCE HAZEL等: "\"OPERATION OF POWER SYSTEMS INCORPORATING FAULT CURRENT LIMITING DEVICES\"", 《2015 PETROLEUM AND CHENICAL INDUSTRY CONFERENCE EUROPE》 * |
卫威;左政;李振龙;孙乐乐;方伟家;: "乘用车CAN总线通信负载率算法设计", 汽车电器, no. 12 * |
肖龙龙;程谋森;张为华;: "运载器控制系统CAN总线数据传输仿真与评估研究", 弹箭与制导学报, no. 02 * |
Also Published As
Publication number | Publication date |
---|---|
CN114827046B (en) | 2023-07-11 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN108563518A (en) | Master-slave machine communication method, device, terminal equipment and storage medium | |
CN111694644A (en) | Message processing method and device based on robot operating system and computer equipment | |
CN108132868A (en) | A kind of data monitoring method, device, computing device and storage medium | |
CN111984733A (en) | Data transmission method and device based on block chain and storage medium | |
CN112040001A (en) | Request processing method and device based on distributed storage | |
CN112416568A (en) | Duration estimation method and duration estimation device for audio and video transcoding task | |
CN107888442B (en) | Port rate determining method and computer equipment | |
CN112612430B (en) | Printing control method of printer, related equipment and storage medium | |
CN108259096B (en) | Short message channel parameter configuration method and device | |
CN110389840A (en) | Load consumption method for early warning, device, computer equipment and storage medium | |
CN108255659A (en) | A kind of application program capacity monitoring method and its system | |
CN114827046A (en) | Bus load rate processing method and device and computer readable storage medium | |
CN109462510B (en) | CDN node quality evaluation method and device | |
CN113238856A (en) | RDMA (remote direct memory Access) -based memory management method and device | |
CN110377539B (en) | Data transmission method, device and medium based on high-speed signal switching chip | |
CN111614526A (en) | Method, device, storage medium and terminal for rapidly maintaining HINOC link | |
CN116208574A (en) | Message processing method, device, electronic equipment and computer readable storage medium | |
CN112822119B (en) | Flow control method, flow control equipment and storage medium based on reverse token bucket | |
CN113806071B (en) | Data synchronization method and system for edge computing application | |
CN115410235A (en) | Fingerprint input method and device, storage medium and terminal | |
CN117097789A (en) | Data processing method and device, electronic equipment and storage medium | |
CN114363208A (en) | Method and device for testing energy efficiency ratio of data center, electronic equipment and storage medium | |
CN111224916B (en) | DDOS attack detection method and device | |
CN111641959A (en) | Method and device for detecting network environment information | |
CN111131065A (en) | Method and equipment for optimizing forwarding path quality under load balance |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
GR01 | Patent grant | ||
GR01 | Patent grant |