CN109120472B - Interface rate obtaining method and device - Google Patents

Interface rate obtaining method and device Download PDF

Info

Publication number
CN109120472B
CN109120472B CN201810836331.7A CN201810836331A CN109120472B CN 109120472 B CN109120472 B CN 109120472B CN 201810836331 A CN201810836331 A CN 201810836331A CN 109120472 B CN109120472 B CN 109120472B
Authority
CN
China
Prior art keywords
preset
sampling time
obtaining
array
interface
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN201810836331.7A
Other languages
Chinese (zh)
Other versions
CN109120472A (en
Inventor
王志莉
孙潇
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
New H3C Security Technologies Co Ltd
Original Assignee
New H3C Security Technologies Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by New H3C Security Technologies Co Ltd filed Critical New H3C Security Technologies Co Ltd
Priority to CN201810836331.7A priority Critical patent/CN109120472B/en
Publication of CN109120472A publication Critical patent/CN109120472A/en
Application granted granted Critical
Publication of CN109120472B publication Critical patent/CN109120472B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

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
    • H04L43/0876Network utilisation, e.g. volume of load or congestion level
    • H04L43/0894Packet rate
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L1/00Arrangements for detecting or preventing errors in the information received
    • H04L1/004Arrangements for detecting or preventing errors in the information received by using forward error control
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L43/00Arrangements for monitoring or testing data switching networks
    • H04L43/04Processing captured monitoring data, e.g. for logfile generation
    • H04L43/045Processing captured monitoring data, e.g. for logfile generation for graphical visualisation of monitoring data
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L47/00Traffic control in data switching networks
    • H04L47/10Flow control; Congestion control
    • H04L47/22Traffic shaping
    • H04L47/225Determination of shaping rate, e.g. using a moving window
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L47/00Traffic control in data switching networks
    • H04L47/10Flow control; Congestion control
    • H04L47/26Flow control; Congestion control using explicit feedback to the source, e.g. choke packets
    • H04L47/263Rate modification at the source after receiving feedback

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Data Mining & Analysis (AREA)
  • Environmental & Geological Engineering (AREA)
  • Synchronisation In Digital Transmission Systems (AREA)

Abstract

The embodiment of the application provides a method and a device for obtaining an interface rate, which relate to the technical field of networks, wherein the method comprises the following steps: obtaining a first quantity of messages transmitted through a target interface between a preset initial sampling moment and a current sampling moment; obtaining a second number of messages transmitted through the target interface between a preset initial sampling time and a first sampling time, wherein the first sampling time is before the current sampling time and is separated from the current sampling time by a preset number of sampling times, and the preset number is more than 2; obtaining the interface rate of the target interface according to the first number, the second number and the first duration, wherein the first duration is: the time duration from the first sample time to the current sample time. By applying the scheme provided by the embodiment of the application, the more accurate interface rate can be obtained.

Description

Interface rate obtaining method and device
Technical Field
The present application relates to the field of network technologies, and in particular, to a method and an apparatus for obtaining an interface rate.
Background
The communication device needs to know the rate of message transmission of each interface in real time in the working process, namely the interface rate, so as to be used as the basis of subsequent work. For example, a message related to the aggregation port needs to be shunted, and during shunting, shunting needs to be performed based on the interface rate of each interface corresponding to the aggregation port, so as to prevent the communication device from failing to exert its maximum performance due to nonuniform shunting.
Therefore, it is necessary to provide a scheme for obtaining the interface rate to obtain a more accurate interface rate.
Disclosure of Invention
An object of the embodiments of the present application is to provide a method and an apparatus for obtaining an interface rate, so as to obtain a more accurate interface rate. The specific technical scheme is as follows:
in a first aspect, an embodiment of the present application provides an interface rate obtaining method, where the method includes:
obtaining a first quantity of messages transmitted through a target interface between a preset initial sampling moment and a current sampling moment;
obtaining a second quantity of messages transmitted through the target interface between the preset initial sampling time and a first sampling time, wherein the first sampling time is as follows: starting from the current sampling time to a first preset number of sampling times, wherein the preset number is more than 2;
obtaining the interface rate of the target interface according to the first number, the second number and the first duration, wherein the first duration is: the time duration from the first sample time to the current sample time.
In a second aspect, an embodiment of the present application provides an interface rate obtaining apparatus, where the apparatus includes:
the first quantity obtaining module is used for obtaining a first quantity of messages transmitted through a target interface between a preset initial sampling moment and a current sampling moment;
a second quantity obtaining module, configured to obtain a second quantity of the packets transmitted through the target interface between the preset initial sampling time and a first sampling time, where the first sampling time is: starting from the current sampling time to a first preset number of sampling times, wherein the preset number is more than 2;
an interface rate obtaining module, configured to obtain an interface rate of the target interface according to the first number, the second number, and a first duration, where the first duration is: the time duration from the first sample time to the current sample time.
In a third aspect, an embodiment of the present application provides a communication device, including: a processor and a machine-readable storage medium storing machine-executable instructions executable by the processor, the processor being caused by the machine-executable instructions to: the method steps of the first aspect are carried out.
In a fourth aspect, embodiments of the present application provide a machine-readable storage medium storing machine-executable instructions that, when invoked and executed by a processor, cause the processor to: the method steps of the first aspect are carried out.
As can be seen from the above, when the interface rate is obtained by applying the solutions provided in the above embodiments, because the first number and the second number are the numbers of the packets transmitted through the target interface between the preset initial sampling time and the current sampling time and between the preset initial sampling time and the first sampling time, respectively, and the first sampling time is the sampling time of the first preset number from the current sampling time onward, and because the preset number is greater than 2, under the condition that the error of the number of the packets obtained at each sampling time is certain, the interface rate is obtained by using the first number corresponding to the current sampling time and the second number corresponding to the first sampling time, the influence of the error on the interface rate can be reduced, and thus a more accurate interface rate can be obtained.
Drawings
In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings used in the description of the embodiments or the prior art will be briefly described below, it is obvious that the drawings in the following description are only some embodiments of the present application, and for those skilled in the art, other drawings can be obtained according to the drawings without creative efforts.
Fig. 1 is a schematic flowchart of an interface rate obtaining method according to an embodiment of the present disclosure;
FIG. 2a is a diagram illustrating a first data comparison curve provided in an embodiment of the present application;
FIG. 2b is a diagram illustrating a second data comparison curve provided in the embodiments of the present application;
fig. 3 is a schematic structural diagram of an interface rate obtaining apparatus according to an embodiment of the present disclosure;
fig. 4 is a schematic structural diagram of a communication device according to an embodiment of the present application.
Detailed Description
The technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the drawings in the embodiments of the present application, and it is obvious that the described embodiments are only a part of the embodiments of the present application, 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 application.
The execution subject of the interface rate obtaining scheme provided by the embodiment of the application can be communication equipment.
Fig. 1 is a schematic flowchart of a method for obtaining an interface rate according to an embodiment of the present application, where the method includes:
s101: a first number of messages transmitted through a target interface between a preset initial sampling time and a current sampling time is obtained.
During the working process of the communication equipment, the internal chip can count the number of messages transmitted by the target interface. The counting of the number of messages may be performed at certain time intervals. The time of counting the number of packets each time may be referred to as a sampling time, and the time intervals between the sampling times are generally the same.
Specifically, the preset initial sampling time may be a first sampling time after the communication device is started and starts to operate, may be a preset specific sampling time, and may also be a certain sampling time among a plurality of sampling times, which is not limited in this application.
S102: and obtaining a second quantity of messages transmitted through the target interface between the preset initial sampling moment and the first sampling moment.
Wherein, the first sampling time is as follows: and starting from the current sampling time to the first preset number of sampling times, wherein the preset number is more than 2.
The communication device will always count the number of the messages transmitted by the target interface according to the time interval in the working process, and in order to ensure that the second number can be conveniently obtained when the step is executed, the second number can be locally stored after the second number is obtained at the first sampling moment.
Specifically, when the second quantity is stored locally, the second quantity may be stored in a preset list, the second quantity may also be stored in a preset array, and the like, which is not limited in this application.
It should be noted that, in the embodiment of the present application, the execution sequence between the above steps S101 and S102 is not limited.
S103: and acquiring the interface rate of the target interface according to the first number, the second number and the first duration.
Wherein the first duration is: the time duration from the first sample time to the current sample time.
In an embodiment of the present application, when obtaining the interface rate of the target interface according to the first number, the second number, and the first duration, the interface rate of the target interface may be obtained according to the following expression:
Figure BDA0001744565980000041
where Num1 represents the first number, Num2 represents the second number, n represents the preset number, and t represents a time period between adjacent sampling times.
The interface rate obtaining method provided by the embodiment of the present application is described in detail below with reference to the data comparison curve diagrams shown in fig. 2a and fig. 2 b.
In the coordinate system shown in fig. 2a, the horizontal axis represents time, 0, t, 2t, and 3t … … represent each sampling time, the vertical axis represents the number of messages, the black straight line in the graph represents the curve of the number of messages actually transmitted by the interface at each time, and the gray curve represents the curve formed by the number of messages transmitted by the interface counted at each sampling time.
In the first case: according to the message quantities c + Δ c1 and 2c- Δ c2 collected at the sampling time t and 2t, the interface rate can be calculated according to the following expression:
Figure BDA0001744565980000042
where v represents the interface rate.
As can be seen from the above expression, the error between the calculated interface rate and the actual interface rate in this case is:
Figure BDA0001744565980000043
in the second case: according to the scheme provided by the embodiment shown in fig. 1, the interface rate can be calculated according to the following expression according to the packet numbers c + Δ c1 and nc- Δ c3 collected at the sampling time t and nt:
Figure BDA0001744565980000051
as can be seen from the above expression, the error between the calculated interface rate and the actual interface rate in this case is:
Figure BDA0001744565980000052
as can be seen from the first and second cases described above, the error of the calculated interface rate in the second case is almost (n-1) times smaller than the error of the calculated interface rate in the first case. That is to say, when the interface rate is calculated by applying the scheme provided in the embodiment of the present application, the larger the preset number is, that is, the farther the first sampling time is from the current sampling time, the smaller the obtained error of the interface rate is.
As can be seen from the above description, when the interface rate is calculated in the first case, the number of the used packets is the number corresponding to the adjacent sampling time, that is, the interface rate corresponding to the preset number n equal to 2, and when the interface rate is calculated in the second case, the number of the used packets is the number corresponding to the non-adjacent sampling time, that is, the interface rate corresponding to the preset number n equal to 2.
Specific data are shown in table 1 below, wherein,
the sampling moments are respectively: second 0, second 1, second … …, second 10;
and (3) actual transmission message quantity representation: the number of the messages actually transmitted by the interface between 0 second and each sampling moment;
the actual interface rate represents: the actual rate of the interface;
the number of messages counted at each sampling moment is represented as follows: counting the number of the transmitted messages of the interface at each sampling moment to obtain a numerical value;
when n is 2, the interface rate represents: calculating the obtained interface rate by adopting a mode corresponding to the first condition;
when n is 5, the interface rate represents: the interface rate when n is 5 is calculated by sampling the method corresponding to the second case.
TABLE 1
Figure BDA0001744565980000053
Figure BDA0001744565980000061
Since there is no 5 th sampling time from the 0 th second to the 1 st second to the 2 nd second and the 3 rd second, respectively, the values of the interface rate in table 1 when n is 5 for the 0 th to the 3 rd seconds are calculated in the first case providing manner described above.
Fig. 2b shows a graph of the actual interface rate, the interface rate when n is 2, and the interface rate when n is 5, and it can be seen from the data recorded in table 1 and the graph shown in fig. 2b that the calculated interface rate at n-5 is closer to the actual interface rate, that is, the error with the actual interface rate is smaller.
In an embodiment of the application, after the first number of the messages transmitted through the target interface between the preset initial sampling time and the current sampling time is obtained in S101, the elements used for storing the first number in the preset array may be determined according to the current sampling time and in a manner that data is cyclically stored in the array, and the first number is stored as a value of the determined elements.
And the size of the preset array is equal to the preset number.
As will be appreciated by those skilled in the art, an array is made up of individual elements, the size of the array determining the number of elements contained in the array.
The above-mentioned manner of cyclic storage may be understood as: after the data is sequentially stored from the first element to the last element in the array, when new data needs to be stored, the first element of the array is returned to be stored in the first element in an overlaying mode.
In this embodiment, after the first number corresponding to the current sampling time is obtained, the first number is stored in the array, and since the current sampling time is a relative concept, that is, each experienced sampling time can be used as the current sampling time in a period of acquiring data in a working process of the communication device, in this way, it can be understood that after the number of messages corresponding to each sampling time is obtained, the number of messages corresponding to each sampling time is stored in the preset array in a cyclic storage manner.
Assuming that the preset number is 5, the preset array contains 5 elements in total, which are: a [0], a [1], a [2], a [3], a [4], and each sampling time is: 0. 1t, 2t, 3t, 4t, 5t, 6t, 7t, 8t, 9t and 10t, and the corresponding relationship between the number of packets corresponding to each sampling time and each element in the preset array is shown in table 2 below.
TABLE 2
Sampling time 0 1t 2t 3t 4t 5t 6t 7t 8t 9t 10t
Element(s) a[0] a[1] a[2] a[3] a[4] a[0] a[1] a[2] a[3] a[4] a[0]
In an embodiment of the application, when determining, according to the current sampling time and in a manner that data is cyclically stored in an array, that the preset array stores the first number of elements, the sequence number of the current sampling time may be obtained first, and then the preset array stores the first number of elements according to the obtained sequence number and the size of the preset array.
Specifically, when the sequence number of the sampling time starts to count from 0, the obtained sequence number may be directly used as a result of modulo processing of the size of the preset array, and the result may be used as an element in the preset array for storing the first number.
When the sequence number of the sampling timing is counted from 1, the result of the modulo processing of the size of the preset array (obtained sequence number-1) may be taken as an element for storing the first number in the set array.
In another embodiment of the present application, a global static variable may also be set as a count flag, assuming that the flag is i, and the initial value of i is 0. After the number of packets corresponding to each sampling time is obtained from the first sampling time, the elements for storing the number of packets in the preset array can be determined in the following manner:
judging whether the value of i is larger than the size of a preset array or not;
if so, subtracting the size of the preset array from the value of i, namely, taking the value of i-m as the value of i, determining the element ai in the preset array as an element for storing the message quantity, and accumulating the value of i by 1; m is the size of an array;
if not, directly determining the element a [ i ] in the preset array as an element for storing the message quantity, and accumulating the value of i by 1.
On the basis of the foregoing embodiment, in an embodiment of the present application, when the step S102 obtains the second number of the messages transmitted through the target interface between the preset initial sampling time and the first sampling time, the method may be implemented as follows.
Judging whether the determined element is the last element in a preset array or not;
if so, determining the value of the first element in the preset array as a second number of messages transmitted through the target interface between the preset initial sampling moment and the first sampling moment;
and if not, determining the value of the next element of the determined elements in the preset array as a second number.
Taking the correspondence shown in table 2 as an example, it is assumed that the predetermined number is: 5.
if the current sampling time is 4t, the determined element is a 4, that is, the element used for storing the first quantity in the preset array is a 4, a 4 is the last element of the preset array, the second quantity is the value of the element a 0, and the value of the element a 0 is the message quantity corresponding to the sampling time 0. Sample time 0 is the 5 th sample time from sample time 4t onward, and therefore corresponds to the relationship between the current sample time and the first sample time.
If the current sampling time is 5t, the determined element is a 0, that is, the element used for storing the first quantity in the preset array is a 0, the a 0 is the first element of the preset array and is not the last element of the preset array, the second quantity is the value of the element a 1, and the value of the element a 1 is the message quantity corresponding to the sampling time t. The sampling time t is the 5 th sampling time from the sampling time 5t onward, and therefore corresponds to the relationship between the current sampling time and the first sampling time.
As can be seen from the above, when the interface rate is obtained by applying the solutions provided in the above embodiments, because the first number and the second number are the numbers of the packets transmitted through the target interface between the preset initial sampling time and the current sampling time and between the preset initial sampling time and the first sampling time, respectively, and the first sampling time is the sampling time of the first preset number from the current sampling time onward, and because the preset number is greater than 2, under the condition that the error of the number of the packets obtained at each sampling time is certain, the interface rate is obtained by using the first number corresponding to the current sampling time and the second number corresponding to the first sampling time, the influence of the error on the interface rate can be reduced, and thus a more accurate interface rate can be obtained.
Corresponding to the interface rate obtaining method, the embodiment of the application also provides an interface rate obtaining device.
Fig. 3 is a schematic structural diagram of an interface rate obtaining apparatus according to an embodiment of the present application, where the apparatus includes:
a first quantity obtaining module 301, configured to obtain a first quantity of messages transmitted through a target interface between a preset initial sampling time and a current sampling time;
a second quantity obtaining module 302, configured to obtain a second quantity of the packets transmitted through the target interface between the preset initial sampling time and a first sampling time, where the first sampling time is: starting from the current sampling time to a first preset number of sampling times, wherein the preset number is more than 2;
an interface rate obtaining module 303, configured to obtain an interface rate of the target interface according to the first number, the second number, and a first duration, where the first duration is: the time duration from the first sample time to the current sample time.
In an embodiment of the present application, the interface rate obtaining module 303 is specifically configured to obtain the interface rate of the target interface according to the following expression:
Figure BDA0001744565980000091
where Num1 represents the first number, Num2 represents the second number, n represents the preset number, and t represents a time duration between adjacent sampling instants.
In an embodiment of the application, the interface rate obtaining device may further include:
an element determining module, configured to determine, according to the current sampling time and in a manner that data is cyclically stored in an array, elements used for storing the first number in a preset array after the first number obtaining module obtains the first number, where a size of the preset array is equal to the preset number;
and the value storage module is used for storing the first quantity as the value of the determined element.
In an embodiment of the present application, the second quantity obtaining module 302 may include:
the element judging unit is used for judging whether the determined element is the last element in the preset array, if so, the first quantity determining unit is triggered, and if not, the second quantity determining unit is triggered;
the first quantity determining unit is configured to determine a value of a first element in the preset array as a second quantity of messages transmitted through the target interface between the preset initial sampling time and the first sampling time;
and the second quantity determining unit is used for determining the value of the next element of the determined elements in the preset array as the second quantity.
As can be seen from the above, when the interface rate is obtained by applying the solutions provided in the above embodiments, because the first number and the second number are the numbers of the packets transmitted through the target interface between the preset initial sampling time and the current sampling time and between the preset initial sampling time and the first sampling time, respectively, and the first sampling time is the sampling time of the first preset number from the current sampling time onward, and because the preset number is greater than 2, under the condition that the error of the number of the packets obtained at each sampling time is certain, the interface rate is obtained by using the first number corresponding to the current sampling time and the second number corresponding to the first sampling time, the influence of the error on the interface rate can be reduced, and thus a more accurate interface rate can be obtained.
Corresponding to the interface rate obtaining method, the embodiment of the application also provides a communication device.
Fig. 4 is a schematic structural diagram of a communication device according to an embodiment of the present application, where the communication device includes: a processor 401 and a machine-readable storage medium 402, the machine-readable storage medium 402 storing machine-executable instructions executable by the processor 401, the processor 401 being caused by the machine-executable instructions to: the method for obtaining the interface rate provided by the embodiment of the application is realized.
In one embodiment of the present application, there is provided an interface rate obtaining method, including:
obtaining a first quantity of messages transmitted through a target interface between a preset initial sampling moment and a current sampling moment;
obtaining a second number of messages transmitted through the target interface between a preset initial sampling time and a first sampling time, wherein the first sampling time is a first preset number of sampling times before the current sampling time, and the preset number is more than 2;
obtaining the interface rate of the target interface according to the first number, the second number and the first duration, wherein the first duration is: the time duration from the first sample time to the current sample time.
It should be noted that other embodiments of the interface rate obtaining method implemented by the processor 401 through being prompted by machine executable instructions are the same as the embodiments mentioned in the foregoing method embodiments, and are not described herein again.
The machine-readable storage medium may include a Random Access Memory (RAM) and a Non-Volatile Memory (NVM), such as at least one disk Memory. Alternatively, the machine-readable storage medium may be at least one memory device located remotely from the processor.
The Processor may be a general-purpose Processor, including a Central Processing Unit (CPU), a Network Processor (NP), and the like; but also Digital Signal Processors (DSPs), Application Specific Integrated Circuits (ASICs), Field Programmable Gate Arrays (FPGAs) or other Programmable logic devices, discrete Gate or transistor logic devices, discrete hardware components.
As can be seen from the above, when the communication device provided in this embodiment obtains the interface rate, because the first number and the second number are the numbers of the packets transmitted through the target interface between the preset initial sampling time and the current sampling time and between the preset initial sampling time and the first sampling time, respectively, and the first sampling time is the sampling time of the first preset number from the current sampling time onward, and because the preset number is greater than 2, under the condition that the error of the number of the packets obtained at each sampling time is certain, the first number corresponding to the current sampling time and the second number corresponding to the first sampling time are used to obtain the interface rate, which can reduce the influence of the error on the interface rate, and thus can obtain a relatively accurate interface rate.
Corresponding to the above interface rate obtaining method, an embodiment of the present application further provides a machine-readable storage medium storing machine-executable instructions, which, when invoked and executed by a processor, cause the processor to: the method for obtaining the interface rate provided by the embodiment of the application is realized.
In one embodiment of the present application, there is provided an interface rate obtaining method, including:
obtaining a first quantity of messages transmitted through a target interface between a preset initial sampling moment and a current sampling moment;
obtaining a second number of messages transmitted through the target interface between a preset initial sampling time and a first sampling time, wherein the first sampling time is a first preset number of sampling times before the current sampling time, and the preset number is more than 2;
obtaining the interface rate of the target interface according to the first number, the second number and the first duration, wherein the first duration is: the time duration from the first sample time to the current sample time.
It should be noted that other embodiments of the interface rate obtaining method implemented by the processor through the machine executable instructions are the same as the embodiments mentioned in the foregoing method embodiments, and are not described herein again.
As can be seen from the above, when the machine executable instruction stored in the machine readable storage medium provided in this embodiment is executed to obtain the interface rate, because the first number and the second number are the numbers of the packets transmitted through the target interface between the preset initial sampling time and the current sampling time and between the preset initial sampling time and the first sampling time, respectively, and the first sampling time is the sampling time of the first preset number from the current sampling time onward, and because the preset number is greater than 2, under the condition that the error of the number of the packets obtained at each sampling time is certain, the first number corresponding to the current sampling time and the second number corresponding to the first sampling time are used to obtain the interface rate, the influence of the error on the interface rate can be reduced, and thus a relatively accurate interface rate can be obtained.
It is noted that, herein, relational terms such as first and second, and the like may be used solely to distinguish one entity or action from another entity or action without necessarily requiring or implying any actual such relationship or order between such entities or actions. Also, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. The term "comprising", without further limitation, means that the element so defined is not excluded from the group consisting of additional identical elements in the process, method, article, or apparatus that comprises the element.
All the embodiments in the present specification are described in a related manner, and the same and similar parts among the embodiments may be referred to each other, and each embodiment focuses on the differences from the other embodiments. In particular, for the apparatus, the communication device, and the machine-readable storage medium embodiments, since they are substantially similar to the method embodiments, the description is relatively simple, and in relation to the description, reference may be made to some portions of the method embodiments.
The above description is only for the preferred embodiment of the present application, and is not intended to limit the scope of the present application. Any modification, equivalent replacement, improvement and the like made within the spirit and principle of the present application are included in the protection scope of the present application.

Claims (8)

1. A method for interface rate acquisition, the method comprising:
obtaining a first quantity of messages transmitted through a target interface between a preset initial sampling moment and a current sampling moment;
obtaining a second quantity of messages transmitted through the target interface between the preset initial sampling time and a first sampling time, wherein the first sampling time is as follows: starting from the current sampling time to a first preset number of sampling times, wherein the preset number is more than 2;
obtaining the interface rate of the target interface according to the first number, the second number and the first duration, wherein the first duration is: a time duration from the first sampling time to the current sampling time;
after the obtaining of the first number of packets transmitted through the target interface between the preset initial sampling time and the current sampling time, the method further includes:
determining elements used for storing the first number in a preset array according to the current sampling moment and in a mode that data are circularly stored in the array, wherein the size of the preset array is equal to the preset number;
storing the first quantity as a value of the determined element;
determining the elements used for storing the first number in the preset array according to the current sampling moment and in a mode of circularly storing data in the array, wherein the determining comprises:
obtaining a sequence number of the current sampling moment;
when the sequence number of the sampling moment is counted from 0, directly taking a modulo processing result of the obtained sequence number on the size of a preset array as an element for storing the first number in the preset array;
and when the sequence number of the sampling moment is counted from 1, taking a result of performing modulo processing on the size of the preset array by using the value of the obtained sequence number-1 as an element for storing the first number in the preset array.
2. The method of claim 1, wherein obtaining the interface rate of the target interface according to the first number, the second number, and the first duration comprises:
obtaining the interface rate of the target interface according to the following expression:
Figure FDA0002692681750000011
where Num1 represents the first number, Num2 represents the second number, n represents the preset number, and t represents a time duration between adjacent sampling instants.
3. The method of claim 1, wherein the obtaining the second number of packets transmitted through the target interface between the preset starting sampling time and the first sampling time comprises:
judging whether the determined element is the last element in the preset array or not;
if so, determining the value of the first element in the preset array as a second number of messages transmitted through the target interface between the preset initial sampling time and the first sampling time;
and if not, determining the value of the next element of the determined elements in the preset array as the second quantity.
4. An interface rate obtaining apparatus, the apparatus comprising:
the first quantity obtaining module is used for obtaining a first quantity of messages transmitted through a target interface between a preset initial sampling moment and a current sampling moment;
a second quantity obtaining module, configured to obtain a second quantity of the packets transmitted through the target interface between the preset initial sampling time and a first sampling time, where the first sampling time is: starting from the current sampling time to a first preset number of sampling times, wherein the preset number is more than 2;
an interface rate obtaining module, configured to obtain an interface rate of the target interface according to the first number, the second number, and a first duration, where the first duration is: a time duration from the first sampling time to the current sampling time;
the device further comprises:
an element determining module, configured to determine, according to the current sampling time and in a manner that data is cyclically stored in an array, elements used for storing the first number in a preset array after the first number obtaining module obtains the first number, where a size of the preset array is equal to the preset number;
a value storage module for storing the first quantity as a value of the determined element;
the element determination module is specifically configured to:
obtaining a sequence number of the current sampling moment;
when the sequence number of the sampling moment is counted from 0, directly taking a modulo processing result of the obtained sequence number on the size of a preset array as an element for storing the first number in the preset array;
and when the sequence number of the sampling moment is counted from 1, taking a result of performing modulo processing on the size of the preset array by using the value of the obtained sequence number-1 as an element for storing the first number in the preset array.
5. The apparatus according to claim 4, wherein the interface rate obtaining module is specifically configured to obtain the interface rate of the target interface according to the following expression:
Figure FDA0002692681750000031
where Num1 represents the first number, Num2 represents the second number, n represents the preset number, and t represents a time duration between adjacent sampling instants.
6. The apparatus of claim 4, wherein the second quantity obtaining module comprises:
the element judging unit is used for judging whether the determined element is the last element in the preset array, if so, the first quantity determining unit is triggered, and if not, the second quantity determining unit is triggered;
the first quantity determining unit is configured to determine a value of a first element in the preset array as a second quantity of messages transmitted through the target interface between the preset initial sampling time and the first sampling time;
and the second quantity determining unit is used for determining the value of the next element of the determined elements in the preset array as the second quantity.
7. A communication device, comprising: a processor and a machine-readable storage medium storing machine-executable instructions executable by the processor, the processor being caused by the machine-executable instructions to: carrying out the method steps of any one of claims 1 to 3.
8. A machine-readable storage medium having stored thereon machine-executable instructions that, when invoked and executed by a processor, cause the processor to: carrying out the method steps of any one of claims 1 to 3.
CN201810836331.7A 2018-07-26 2018-07-26 Interface rate obtaining method and device Active CN109120472B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201810836331.7A CN109120472B (en) 2018-07-26 2018-07-26 Interface rate obtaining method and device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201810836331.7A CN109120472B (en) 2018-07-26 2018-07-26 Interface rate obtaining method and device

Publications (2)

Publication Number Publication Date
CN109120472A CN109120472A (en) 2019-01-01
CN109120472B true CN109120472B (en) 2020-11-20

Family

ID=64862317

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201810836331.7A Active CN109120472B (en) 2018-07-26 2018-07-26 Interface rate obtaining method and device

Country Status (1)

Country Link
CN (1) CN109120472B (en)

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN116032852B (en) * 2023-03-28 2023-06-02 新华三工业互联网有限公司 Flow control method, device, system, equipment and storage medium based on session

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104038499A (en) * 2014-06-17 2014-09-10 宁波三星电气股份有限公司 MODBUS RTU protocol based data transmission method
TW201626761A (en) * 2015-01-12 2016-07-16 Alpha Networks Inc Testing method of network transmission rate
CN105897494A (en) * 2015-01-26 2016-08-24 明泰科技股份有限公司 Testing method of network transmission rate
CN106227619A (en) * 2016-07-20 2016-12-14 中国航空工业集团公司航空动力控制系统研究所 There is the Flash data storage method of data modification memory ability
CN107172639A (en) * 2017-06-29 2017-09-15 苏州博联科技有限公司 A kind of method of testing of low-power consumption bluetooth transmission rate

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104038499A (en) * 2014-06-17 2014-09-10 宁波三星电气股份有限公司 MODBUS RTU protocol based data transmission method
TW201626761A (en) * 2015-01-12 2016-07-16 Alpha Networks Inc Testing method of network transmission rate
CN105897494A (en) * 2015-01-26 2016-08-24 明泰科技股份有限公司 Testing method of network transmission rate
CN106227619A (en) * 2016-07-20 2016-12-14 中国航空工业集团公司航空动力控制系统研究所 There is the Flash data storage method of data modification memory ability
CN107172639A (en) * 2017-06-29 2017-09-15 苏州博联科技有限公司 A kind of method of testing of low-power consumption bluetooth transmission rate

Also Published As

Publication number Publication date
CN109120472A (en) 2019-01-01

Similar Documents

Publication Publication Date Title
CN112311611B (en) Data anomaly monitoring method and device and electronic equipment
CN109117595B (en) Thermal load prediction method and device, readable medium and electronic equipment
CN112350836B (en) Abnormal positioning method and device of Internet of things and electronic equipment
CN109327353B (en) Service flow determination method and device and electronic equipment
CN106961410B (en) Abnormal access detection method and device
CN109120472B (en) Interface rate obtaining method and device
CN106648839B (en) Data processing method and device
US20150304227A1 (en) Queue Management Method and Apparatus
CN111209998B (en) Training method and device of machine learning model based on data type
CN111857981A (en) Data processing method and device
CN109634822A (en) A kind of function time-consuming statistical method, device, storage medium and terminal device
CN106776614A (en) The display methods and device of sharing platform
CN113225218A (en) Method and device for checking call ticket quality
CN112019393B (en) Method and device for determining time delay
CN111159129A (en) Statistical method and device for log report
CN108667893B (en) Data recommendation method and device and electronic equipment
CN114837776B (en) SCR system control method, electronic device and storage medium
CN113691631B (en) Data cleaning method and device and electronic equipment
CN112532444B (en) Data flow sampling method, system, medium and terminal for network mirror flow
CN113037685B (en) Data transmission method and electronic equipment
CN111309475B (en) Detection task execution method and equipment
CN112486884B (en) IIS bus decoding method, IIS bus decoding device, oscilloscope and computer readable storage medium
CN113497721B (en) Network fault positioning method and device
CN111291127B (en) Data synchronization method, device, server and storage medium
CN110008291B (en) Data early warning method and device, storage medium and electronic equipment

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