WO2014201906A1 - 流量统计方法及装置 - Google Patents

流量统计方法及装置 Download PDF

Info

Publication number
WO2014201906A1
WO2014201906A1 PCT/CN2014/076248 CN2014076248W WO2014201906A1 WO 2014201906 A1 WO2014201906 A1 WO 2014201906A1 CN 2014076248 W CN2014076248 W CN 2014076248W WO 2014201906 A1 WO2014201906 A1 WO 2014201906A1
Authority
WO
WIPO (PCT)
Prior art keywords
types
packets
input control
type
preset time
Prior art date
Application number
PCT/CN2014/076248
Other languages
English (en)
French (fr)
Inventor
程银魁
钱勇
Original Assignee
中兴通讯股份有限公司
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 中兴通讯股份有限公司 filed Critical 中兴通讯股份有限公司
Priority to US14/899,681 priority Critical patent/US9887892B2/en
Priority to EP14814526.1A priority patent/EP3013000B1/en
Publication of WO2014201906A1 publication Critical patent/WO2014201906A1/zh

Links

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L43/00Arrangements for monitoring or testing data switching networks
    • H04L43/06Generation of reports
    • H04L43/062Generation of reports related to network traffic
    • 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
    • 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

Definitions

  • the present invention relates to the field of communications, and in particular to a traffic statistics method and apparatus.
  • BACKGROUND OF THE INVENTION With the rapid development of the Internet and computer technology, human beings have entered an information society. Due to the rapid development of the network and the widespread popularity of related network applications, the Internet has gradually become an indispensable part of people's daily work and life. However, due to the rapid increase in user traffic and data traffic of existing networks, the processing power and computing strength are correspondingly increased. Therefore, real-time monitoring and traffic statistics of the network become more and more important.
  • counter technology is used.
  • the amount of counter resources is a key factor limiting traffic statistics.
  • the mainstream implementation of the counter technology in the related art is to simultaneously count the number of packets and the number of bytes of the packet.
  • This type of implementation usually uses a counter to perform traffic statistics only for one type of data traffic.
  • Counter resources become a critical factor in limiting traffic statistics if you encounter counter resource strains. If a special situation is encountered, for example: When the implementation of some specific functions needs to read the count of two types of data traffic at the same time, it is difficult to ensure the counting accuracy due to the inevitable time difference between the simultaneous operation of the two counters.
  • the present invention provides a traffic statistics method and apparatus to solve at least the problem that the same counter can only collect statistics on traffic of one type of packet in the related art.
  • a flow statistics method is provided.
  • the traffic statistics method according to the present invention includes: setting an input control parameter for each type of message in each of N types of messages by using the same counter, where N is a positive integer and N 2 , and each input control parameter is a positive integer And the N input control parameters are different from each other; when the first preset time arrives, the N count values are obtained from the counter, wherein the N count values include: N types received by the preset port at the first preset time The sum of the number of messages and the count of N-1 input control parameters.
  • Each input control parameter count is linearly related to the input control parameters of N-1 types of messages selected from N types of messages, and each Enter the control parameter count corresponding to N-1
  • the types of the packets are the same.
  • the N input control parameters and the N counts are used to count the traffic of each type of packets in the N types of packets at the first preset time.
  • the method further includes: separately extracting forwarding information of each type of the M type of the packet, where M is a positive integer and M ⁇ N According to the forwarding information, N types of packets are determined from M types of packets.
  • the forwarding information of each type of packet in the M type of the packet is separately obtained: the feature information of each type of the M type of the packet is obtained, and the feature information is parsed; The forwarding information is extracted from the feature information.
  • the method further includes: dividing the counter into N bit domains according to the sum of the number of N types of packets and the N input control parameters, where Each of the N bit fields corresponds to each of the count sum counts of N types of messages and the N-1 input control parameter counts.
  • the method further includes: acquiring N count values from the counter again when the second preset time arrives; and controlling the parameters by using N inputs
  • the N counts of the N types of packets are used to count the traffic of each type of packets in the N types of packets at the second preset time;
  • the flow of the time and the traffic of each type of the N types of packets at the second preset time are used to calculate the traffic of each type of the N types of packets in the preset time period, where the preset The time period is from the first preset time to the second preset time.
  • the method further includes: according to the N types of packets The feature information of each type of packet is forwarded to various types of packets.
  • a traffic statistics device is provided.
  • the traffic statistics device includes: a setting module configured to set input control parameters for each type of message of N types of messages by using the same counter, wherein N is a positive integer and N 2, each input control The parameters are all positive integers and the N input control parameters are different.
  • the first obtaining module is configured to obtain N count values from the counter when the first preset time arrives, wherein the N count values include: The sum of the number of N types of packets received at the first preset time and the count of N-1 input control parameters, each of the input control parameter counts and the N-1 types of packets selected from the N types of packets
  • the input control parameters are linearly correlated, and are identical to the N-1 types of message parts corresponding to each input control parameter count; the first statistical module, setting The traffic of each type of the N types of packets at the first preset time is separately calculated by using the N input control parameters and the N count values.
  • the foregoing apparatus further includes: an extracting module, configured to respectively extract forwarding information of each type of packet in the M types of packets, where M is a positive integer and M ⁇ N; and the determining module is set to be based on the forwarding information N types of packets are determined from M types of packets.
  • the extracting module includes: an acquiring unit, configured to respectively acquire feature information of each type of packet in the M types of packets, and parse the feature information; and extracting, configured to extract from the parsed feature information Forward the message.
  • the foregoing apparatus further includes: a dividing module, configured to divide the counter into N bit fields according to a total number of N types of messages and N input control parameters, wherein each of the N bit fields respectively One-to-one correspondence with each of the counts of the number of N types of messages and the count of N-1 input control parameters.
  • a dividing module configured to divide the counter into N bit fields according to a total number of N types of messages and N input control parameters, wherein each of the N bit fields respectively One-to-one correspondence with each of the counts of the number of N types of messages and the count of N-1 input control parameters.
  • the apparatus further includes: a second acquiring module, configured to acquire N count values from the counter again when the second preset time arrives; the second statistic module is configured to acquire the control parameters through the N inputs and acquire again The N counts are used to count the traffic of each type of packet in the N types of packets at the second preset time; the calculation module is configured to use each type of packet in the N types of packets at the first The traffic at the preset time and the traffic of each type of the N types of packets in the second preset time are used to calculate the traffic of each type of the N types of packets in the preset time period, where The preset time period is from the first preset time to the second preset time.
  • a second acquiring module configured to acquire N count values from the counter again when the second preset time arrives
  • the second statistic module is configured to acquire the control parameters through the N inputs and acquire again The N counts are used to count the traffic of each type of packet in the N types of packets at the second preset time
  • the calculation module is configured to use each type of packet in
  • the foregoing apparatus further includes: a forwarding module, configured to forward each type of packet according to the feature information of each type of the N types of packets.
  • a forwarding module configured to forward each type of packet according to the feature information of each type of the N types of packets.
  • the same counter is used to set input control parameters for each type of message in N types of messages, N is a positive integer and N 2 , each input control parameter is a positive integer and N input control parameters are mutually
  • the N count values include: a sum of the number of N types of packets received by the preset port at the first preset time and N- 1 input control parameter count, each input control parameter count is linearly related to the input control parameters of N-1 type messages selected from N types of messages, and N- corresponding to each input control parameter count
  • the traffic of the first type of the packets of the N types of packets is calculated by using the N input control parameters and the N count values, and the same technology is used in the related art.
  • the counter can only collect statistics on the traffic of one type of packet, which saves the counter resources and ensures the accuracy of traffic statistics for multiple types of packets at the same time.
  • FIG. 3 is a flow rate statistical device according to an embodiment of the present invention.
  • Figure 4 is a block diagram showing the structure of a traffic statistics device in accordance with a preferred embodiment of the present invention.
  • BEST MODE FOR CARRYING OUT THE INVENTION will be described in detail with reference to the accompanying drawings. It should be noted that the embodiments in the present application and the features in the embodiments may be combined with each other without conflict.
  • 1 is a flow chart of a method of traffic statistics according to an embodiment of the present invention. As shown in FIG.
  • the method may include the following processing steps: Step S102: Set an input control parameter for each type of message in each of N types of packets by using the same counter, where N is a positive integer and N 2 , The input control parameters are all positive integers and the N input control parameters are different; Step S104: When the first preset time arrives, N count values are obtained from the counter, wherein the N count values include: The sum of the number of N types of packets received at the first preset time and the count of N-1 input control parameters, and the count of each input control parameter and the N-1 type of packets selected from the N types of packets The input control parameters are linearly correlated, and are identical to the N-1 types of message parts corresponding to each input control parameter count; Step S106: respectively, counting N types of messages in the N input control parameters and N count values respectively The traffic of each type of message at the first preset time.
  • the same counter can only collect statistics on the traffic of one type of packet.
  • the same counter is used to set input control parameters for each type of message in N types of packets, N is a positive integer and N 2 , and each input control parameter is a positive integer and N
  • the input control parameters are different; when the first preset time arrives, N count values are obtained from the counter, and the N count values include: The sum of the number of N types of packets received at the first preset time and the count of N-1 input control parameters, each of the input control parameter counts and the N-1 types of packets selected from the N types of packets
  • the input control parameters are linearly correlated, and are identical to the N-1 types of message parts corresponding to each input control parameter count; each of the N types of messages is separately counted by N input control parameters and N count values
  • the traffic of the type packet at the first preset time solves the problem that the same counter can only collect statistics on the traffic of one type of packet in the related art, thereby saving counter resources and ensuring that at
  • the traffic of the Type A packet and the traffic of the Type B packet are simultaneously counted by the same counter at time t1, and the input control parameter set by the counter for the Type A packet is ⁇
  • the input control parameter set for the B message is b, where a and b are positive integers, and a ⁇ b.
  • the counter is read at time t1, and the sum of the number of the type A packets and the class B packets is count1, and the count of the input control parameters is co U nt2.
  • the traffic of the class A packets is X
  • the traffic of class B packets is Y, then the following binary equations can be obtained:
  • Y ( acountl - count2 ) I ( a - b ) That is, at time t1, the same counter can be used to obtain the traffic of class A packets (count2 - bcountl ) I ( a - b ) , the traffic of class B packets Is (acountl - count2) I ( a - b).
  • the traffic of the Type A packet, the traffic of the Type B packet, and the traffic of the Type C packet are simultaneously counted by the same counter at the time t1, and the counter is set for the Class A packet.
  • the input control parameter is a
  • the input control parameter set by the counter for the B type message is b
  • the input control parameter set by the counter for the C type message is c
  • a, b, and c are positive integers, and a ⁇ b ⁇ c.
  • the counter is read at time t1, and the total number of class A packets, class B packets, and class C packets is count1, and the input control parameters of class A packets and class B packets are count2, class B.
  • the count of the input control parameters of the message and the C message is C0U nt3.
  • the traffic of the Type A packet is X
  • the traffic of the Type B packet is Y
  • the traffic of the Type C packet is ⁇
  • Step S1 Extract forwarding information of each type of packet in the M type packet, where , M is a positive integer and M ⁇ N;
  • Step S2 Determine N types of packets from M types of packets according to the forwarding information.
  • the M types of packets are received on the preset port, and the forwarding information of the packets of the type can be obtained from each type of packet respectively; and then the preset flag in the information is forwarded.
  • step S1 separately extracting the forwarding information of each type of the M type of the packet may include the following steps: Step S11: Acquire the characteristics of each type of the M type of the packet Information, and parsing the feature information; Step S12: Extract forwarding information from the parsed feature information.
  • the feature information of the message may include, but is not limited to, at least one of the following:
  • VLAN virtual local area network
  • TAG single layer label
  • TAG double layer TAG
  • IP Internet Protocol
  • Transmission Control Protocol (TCP) port number The extraction of the foregoing forwarding information may be divided into the following two steps: First, the feature information in the received message is parsed, and the parsed feature information may include the foregoing items, but not every time. All the above information needs to be selected according to the currently executed packet forwarding process. The second step is to prepare the packet to be sent to the corresponding forwarding process. Before that, the forwarding information needs to be extracted from the above feature information to determine whether Traffic statistics of this type of packets are required.
  • TCP Transmission Control Protocol
  • Step S3 According to the sum of the number of N types of packets and the N input control parameters
  • the counter is divided into N bit fields, wherein each of the N bit fields has a one-to-one correspondence with each of the N-type message sum counts and the N-1 input control parameter counts.
  • the counter can be divided into N bit fields, where one bit field corresponds to the total number of N types of packets, and The remaining N-1 bit fields may correspond one-to-one with each of the N-1 input control parameter counts.
  • Step S4 When the second preset time arrives, obtain N N counters again. Counting the value; Step S5: Counting the traffic of each type of the N types of packets at the second preset time by using the N input control parameters and the N count values obtained again; Step S6: Using N types
  • Each type of the N types of packets is calculated by the traffic of the first preset time in each type of packet and the traffic of each type of the N types of packets at the second preset time. The traffic of the packet in the preset time period, wherein the preset time period is from the first preset time to the second preset time.
  • each type of packet uses the traffic statistics at time t2 and the traffic statistics at time t1 to perform the subtraction operation, so that the traffic statistics of the packets in the preset time range are obtained, so that different types of packets are implemented. Traffic statistics comparison within a preset time period.
  • step S106 after the N input control parameters and the N count values are respectively used to count the traffic of each type of the N types of packets at the first preset time, the processing step is further included: Step S7 The packets of each type are forwarded according to the feature information of each type of packet in the N types of packets. In a preferred embodiment, if the traffic statistics of the N types of packets are completed, each type of packet may be sent to a corresponding forwarding process.
  • one or more items may be extracted from the above-mentioned feature information as an index of a logical port table.
  • the PORT information and the carried VLAN information of the packet need to be obtained.
  • a packet that is forwarded by a Layer 3 packet needs to obtain the destination IP address of the packet.
  • the label information carried in the packet needs to be obtained.
  • the method may include the following processing steps: Step S202: Obtain feature information of each type of packet according to the plurality of types of packets received by the preset port, and then extract forwarding information of the packet of the type from the obtained feature information.
  • the traffic statistics method does not specifically distinguish the type of the packet, that is, the type of the packet can be a data packet, for example, a common Layer 2 or Layer 3 packet, or a Multi-Protocol Label Switching (referred to as Multi-Protocol Label Switching).
  • the MPLS packet, and the Pseudo-Wire Emulation Edge to Edge (PWE3) packet can also be the detection packet, for example, Operation Administration and Maintenance.
  • Step S204 Determine, according to the forwarding information of each type of packet, whether to perform traffic statistics for the packets of the type. If the traffic statistics need to be performed, proceed to step S206 to perform the traffic statistics operation; otherwise, go to step S216; S206: Applying and managing a corresponding counter resource, where the method may include: a memory capacity of the counter (determined according to the type of the message), and identifier information of the counter; Step S208: the counter inputs the control parameter for each type of packet respectively. Set, the actual length of the packet is not the actual length of the packet, but a configurable parameter value.
  • Step S210 Start to use the same counter to perform statistics on traffic of multiple types of packets
  • Step S212 At T
  • the traffic statistics of the counter can be read at any time, which can include: The sum of the counts and the counts of the plurality of input control parameters; Step S214: setting different input control parameters for different types of packets by the same counter, and summing the number of packets of the plurality of types of packets that need to be simultaneously counted, and multiple Input control parameter count, and then establish a multivariate one-time equation group to obtain the traffic of various types of messages that need to be simultaneously counted at time T; Step S216: according to the forwarding path information in the feature information of various types of messages, respectively Types of messages are forwarded to the corresponding destination.
  • the traffic statistics of various types of packets are successfully completed under the premise of ensuring normal forwarding of each type of packet, which satisfies the shortage of counter resources or needs to simultaneously read multiple Implementation of specific network functions and diagnostic methods for different traffic statistics, for example:
  • 0AM diagnostics it is often necessary The statistics of the data transmission and reception in a certain period of time can be performed, and the statistical method provided in the preferred embodiment can effectively avoid the reading time error and ensure the accuracy of the traffic statistics.
  • the same counter resource is used to implement traffic statistics of different types of packets, thereby saving counter resources.
  • the judgment of traffic statistics can be refined to each data stream, thereby improving network flexibility and stability.
  • the traffic statistics device may include: a setting module 100, configured to set an input control parameter for each type of N types of packets by using the same counter, where N is a positive integer and N 2 Each of the input control parameters is a positive integer and the N input control parameters are different from each other; the first obtaining module 102 is configured to acquire N count values from the counter when the first preset time arrives, wherein, the N counts The value includes: a sum of the number of N types of packets received by the preset port at the first preset time and N-1 input control parameter counts, and each input control parameter count and N selected from the N types of packets.
  • the input control parameters of the 1 type message are linearly correlated, and are identical to the N-1 type message parts corresponding to each input control parameter count; the first statistic module 104 is set to pass N input control parameters and N The count value is used to count the traffic of each type of packet in the N types of packets at the first preset time.
  • the device shown in FIG. 3 solves the problem that the same counter can only collect statistics on traffic of one type of packet in the related art, thereby saving counter resources and ensuring multiple types at the same time.
  • the accuracy of packet statistics is improved, which improves the flexibility and stability of the network.
  • FIG. 3 solves the problem that the same counter can only collect statistics on traffic of one type of packet in the related art, thereby saving counter resources and ensuring multiple types at the same time.
  • the accuracy of packet statistics is improved, which improves the flexibility and stability of the network.
  • FIG. 3 solves the problem that the same counter can only collect statistics on traffic of one type of packet in the related art, thereby saving counter resources and ensuring multiple types at the same
  • the apparatus may further include: an extracting module 106, configured to separately extract forwarding information of each type of M type message, where M is a positive integer and M ⁇ N;
  • the determining module 108 is configured to determine N types of packets from the M types of packets according to the forwarding information.
  • the foregoing extraction module 106 may include: an obtaining unit (not shown) configured to respectively acquire feature information of each type of message in the M types of packets, and parse the feature information; Not shown in the figure), it is set to extract forwarding information from the parsed feature information.
  • an obtaining unit not shown
  • the feature information not shown in the figure
  • the foregoing apparatus may further include: a dividing module 110, configured to divide the counter into N bit fields according to a total number of N types of messages and N input control parameters, where N bits Each of the bit fields in the domain corresponds to each of the count sum counts of N types of messages and the count of N-1 input control parameters.
  • the foregoing apparatus may further include: a second acquiring module 112, configured to acquire N count values from the counter again when the second preset time arrives; the second statistic module 114 is set to The traffic of each type of the N types of packets at the second preset time is respectively calculated by using the N input control parameters and the N counts that are obtained again.
  • the calculation module 116 is configured to adopt N types of packets.
  • Each type of report The traffic at the first preset time and the traffic of each type of the N types of packets at the second preset time are calculated in each of the N types of packets within a preset time period.
  • the traffic, wherein the preset time period is from the first preset time to the second preset time.
  • the foregoing apparatus may further include: a forwarding module 118, configured to forward each type of packet according to the feature information of each type of the N types of packets.
  • the technical solution provided by the present invention is received from The feature information of each type of packet is obtained in the type of packet, and then the forwarding information corresponding to each type of packet is extracted from the feature information. If traffic statistics are required for this type of packet, apply the corresponding counter resource, and set the sum of the number of multiple types of packets that need to be counted simultaneously and the input control parameter count by setting the control of the input control parameters to the same counter.
  • the traffic statistics of each type of packet can be obtained at the same time, which satisfies the implementation of specific network functions and diagnostic modes in which the counter resources are tight or needs to simultaneously read multiple different traffic statistics, thereby saving the counter. Resources, at the same time, the judgment of traffic statistics can be refined to each data stream, thereby improving the flexibility and stability of the network.
  • the above modules or steps of the present invention can be implemented by a general-purpose computing device, which can be concentrated on a single computing device or distributed over a network composed of multiple computing devices.
  • the computing device may be implemented by program code executable by the computing device, such that they may be stored in the storage device by the computing device and, in some cases, may be different from the order herein.
  • the steps shown or described are performed, or they are separately fabricated into individual integrated circuit modules, or a plurality of modules or steps are fabricated as a single integrated circuit module.
  • the invention is not limited to any specific combination of hardware and software.
  • the above is only the preferred embodiment of the present invention, and is not intended to limit the present invention, and various modifications and changes can be made to the present invention. Any modifications, equivalent substitutions, improvements, etc. made within the spirit and scope of the present invention are intended to be included within the scope of the present invention.
  • a traffic statistics method and apparatus provided by an embodiment of the present invention have the following beneficial effects: satisfying the implementation of a specific network function and a diagnosis mode in which the counter resource is tight or needs to simultaneously read a plurality of different traffic statistics, This saves counter resources. At the same time, the judgment of traffic statistics can be refined to each data stream, thereby improving the flexibility and stability of the network.

Landscapes

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

Abstract

本发明公开了一种流量统计方法及装置,在该方法中,采用同一计数器分别为N种类型报文中的每种类型报文设置输入控制参数,N为正整数且N≥2,每个输入控制参数均为正整数且N个输入控制参数互异;在第一预设时刻到达时,从计数器中获取N个计数值,N个计数值包括:预设端口在第一预设时刻接收到的N种类型报文的数量总和以及N-1个输入控制参数计数,每个输入控制参数计数与从N种类型报文中选取的N-1种类型报文的输入控制参数呈线性相关且与每个输入控制参数计数对应的N-1种类型报文部分相同;通过N个输入控制参数和N个计数值分别统计N种类型报文中的每种类型报文在第一预设时刻的流量,进而节省了计数器资源。

Description

流量统计方法及装置 技术领域 本发明涉及通信领域, 具体而言, 涉及一种流量统计方法及装置。 背景技术 随着因特网和计算机技术的飞速发展, 人类进入了信息化社会。 由于网络的迅猛 发展以及相关网络应用的广泛普及, 互联网已经逐渐成为人们日常工作与生活中不可 或缺的部分。 但是, 由于目前现有网络的用户访问量和数据流量的急剧增长, 其处理 能力与计算强度也相应地增大, 因此, 对网络的实时监控和流量统计显得越发重要。 相关技术中流量统计的实现方式主要有以下三种: 其一是由代理服务器实现、 其 二是由本地路由器实现、 其三是由自制网桥实现。 然而, 不管采用何种实现方式, 其 均采用了计数器技术。 由此可见,计数器资源的多少是限制流量统计的一个关键因素。 相关技术中计数器技术的主流实现方式都是对报文的数量和报文的字节数同时进行统 计, 此类实现方式通常采用一个计数器只能对一种数据流量完成流量统计。 如果遇到 计数器资源紧张的情况, 计数器资源就将成为限制流量统计的至关重要的因素。 如果 遇到特殊情况, 例如: 在某些具体功能的实现需要同时读取两类数据流量的计数时, 由于两个计数器的同时操作不可避免的出现时间差, 难以确保计数精度。 发明内容 本发明提供了一种流量统计方法及装置, 以至少解决相关技术中采用同一个计数 器仅能对一种类型报文的流量进行统计的问题。 根据本发明的一个方面, 提供了一种流量统计方法。 根据本发明的流量统计方法包括: 采用同一计数器分别为 N种类型报文中的每种 类型报文设置输入控制参数, 其中, N为正整数且 N 2, 每个输入控制参数均为正整 数且 N个输入控制参数互异; 在第一预设时刻到达时, 从计数器中获取 N个计数值, 其中, N个计数值包括: 预设端口在第一预设时刻接收到的 N种类型报文的数量总和 以及 N-1 个输入控制参数计数, 每个输入控制参数计数与从 N种类型报文中选取的 N-1种类型报文的输入控制参数呈线性相关,并且与每个输入控制参数计数对应的 N-1 种类型报文部分相同; 通过 N个输入控制参数和 N个计数值分别统计 N种类型报文 中的每种类型报文在第一预设时刻的流量。 优选地, 在采用计数器分别为每种类型报文设置输入控制参数之前, 还包括: 分 别提取 M种类型报文中的每种类型报文的转发信息, 其中, M为正整数且 M^N; 根 据转发信息从 M种类型报文中确定 N种类型报文。 优选地,分别提取 M种类型报文中的每种类型报文的转发信息包括: 分别获取 M 种类型报文中的每种类型报文的特征信息, 并对特征信息进行解析; 从解析后的特征 信息中提取转发信息。 优选地, 在根据转发信息从 M种类型报文中确定 N种类型报文之后, 还包括: 根据 N种类型报文的数量总和与 N个输入控制参数将计数器划分为 N个位域, 其中, N个位域中的每个位域分别与 N种类型报文的数量总和计数以及 N-1个输入控制参数 计数中每种计数 对应。 优选地, 在根据转发信息从 M种类型报文中确定 N种类型报文之后, 还包括: 在第二预设时刻到达时, 再次从计数器中获取 N个计数值; 通过 N个输入控制参数和 再次获取到的 N个计数值分别统计 N种类型报文中的每种类型报文在第二预设时刻的 流量;采用 N种类型报文中的每种类型报文在第一预设时刻的流量与 N种类型报文中 的每种类型报文在第二预设时刻的流量计算 N种类型报文中的每种类型报文在预设时 间段内的流量, 其中, 预设时间段为从第一预设时刻至第二预设时刻。 优选地, 在通过 N个输入控制参数和 N个计数值分别统计 N种类型报文中的每 种类型报文在第一预设时刻的流量之后, 还包括: 根据 N种类型报文中的每种类型报 文的特征信息分别对各种类型报文进行转发。 根据本发明的另一方面, 提供了一种流量统计装置。 根据本发明的流量统计装置包括: 设置模块, 设置为采用同一计数器分别为 N种 类型报文中的每种类型报文设置输入控制参数, 其中, N为正整数且 N 2, 每个输入 控制参数均为正整数且 N个输入控制参数互异; 第一获取模块, 设置为在第一预设时 刻到达时, 从计数器中获取 N个计数值, 其中, N个计数值包括: 预设端口在第一预 设时刻接收到的 N种类型报文的数量总和以及 N-1个输入控制参数计数, 每个输入控 制参数计数与从 N种类型报文中选取的 N-1种类型报文的输入控制参数呈线性相关, 并且与每个输入控制参数计数对应的 N-1种类型报文部分相同; 第一统计模块, 设置 为通过 N个输入控制参数和 N个计数值分别统计 N种类型报文中的每种类型报文在 第一预设时刻的流量。 优选地, 上述装置还包括: 提取模块, 设置为分别提取 M种类型报文中的每种类 型报文的转发信息, 其中, M为正整数且 M^N; 确定模块, 设置为根据转发信息从 M种类型报文中确定 N种类型报文。 优选地, 提取模块包括: 获取单元, 设置为分别获取 M种类型报文中的每种类型 报文的特征信息, 并对特征信息进行解析; 提取单元, 设置为从解析后的特征信息中 提取转发信息。 优选地, 上述装置还包括: 划分模块, 设置为根据 N种类型报文的数量总和与 N 个输入控制参数将计数器划分为 N个位域, 其中, N个位域中的每个位域分别与 N种 类型报文的数量总和计数以及 N-1个输入控制参数计数中每种计数一一对应。 优选地, 上述装置还包括: 第二获取模块, 设置为在第二预设时刻到达时, 再次 从计数器中获取 N个计数值; 第二统计模块, 设置为通过 N个输入控制参数和再次获 取到的 N个计数值分别统计 N种类型报文中的每种类型报文在第二预设时刻的流量; 计算模块,设置为采用 N种类型报文中的每种类型报文在第一预设时刻的流量与 N种 类型报文中的每种类型报文在第二预设时刻的流量计算 N种类型报文中的每种类型报 文在预设时间段内的流量, 其中, 预设时间段为从第一预设时刻至第二预设时刻。 优选地, 上述装置还包括: 转发模块, 设置为根据 N种类型报文中的每种类型报 文的特征信息分别对各种类型报文进行转发。 通过本发明, 采用同一计数器分别为 N种类型报文中的每种类型报文设置输入控 制参数, N为正整数且 N 2, 每个输入控制参数均为正整数且 N个输入控制参数互 异; 在第一预设时刻到达时, 从计数器中获取 N个计数值, 该 N个计数值包括: 预设 端口在第一预设时刻接收到的 N种类型报文的数量总和以及 N-1 个输入控制参数计 数, 每个输入控制参数计数与从 N种类型报文中选取的 N-1种类型报文的输入控制参 数呈线性相关, 并且与每个输入控制参数计数对应的 N-1种类型报文部分相同; 通过 N个输入控制参数和 N个计数值分别统计 N种类型报文中的每种类型报文在第一预设 时刻的流量, 解决了相关技术中采用同一个计数器仅能对一种类型报文的流量进行统 计的问题, 进而节省了计数器资源, 并且确保了在同一时刻对多种类型的报文进行流 量统计的精度, 提高了网络的灵活性与稳定性。 附图说明 此处所说明的附图用来提供对本发明的进一步理解, 构成本申请的一部分, 本发 明的示意性实施例及其说明用于解释本发明, 并不构成对本发明的不当限定。 在附图 中: 图 1是根据本发明实施例的流量统计方法的流程图; 图 2是根据本发明优选实施例的流量统计方法的流程图; 图 3是根据本发明实施例的流量统计装置的结构框图; 图 4是根据本发明优选实施例的流量统计装置的结构框图。 具体实施方式 下文中将参考附图并结合实施例来详细说明本发明。 需要说明的是, 在不冲突的 情况下, 本申请中的实施例及实施例中的特征可以相互组合。 图 1是根据本发明实施例的流量统计方法的流程图。 如图 1所示, 该方法可以包 括以下处理步骤: 步骤 S102:采用同一计数器分别为 N种类型报文中的每种类型报文设置输入控制 参数, 其中, N为正整数且 N 2, 每个输入控制参数均为正整数且 N个输入控制参 数互异; 步骤 S104: 在第一预设时刻到达时, 从计数器中获取 N个计数值, 其中, N个计 数值包括: 预设端口在第一预设时刻接收到的 N种类型报文的数量总和以及 N-1个输 入控制参数计数, 每个输入控制参数计数与从 N种类型报文中选取的 N-1种类型报文 的输入控制参数呈线性相关, 并且与每个输入控制参数计数对应的 N-1种类型报文部 分相同; 步骤 S106: 通过 N个输入控制参数和 N个计数值分别统计 N种类型报文中的每 种类型报文在第一预设时刻的流量。 相关技术中, 采用同一个计数器仅能对一种类型报文的流量进行统计。 采用如图 1所示的方法, 采用同一计数器分别为 N种类型报文中的每种类型报文设置输入控制 参数, N为正整数且 N 2,每个输入控制参数均为正整数且 N个输入控制参数互异; 在第一预设时刻到达时, 从计数器中获取 N个计数值, 该 N个计数值包括: 预设端口 在第一预设时刻接收到的 N种类型报文的数量总和以及 N-1个输入控制参数计数, 每 个输入控制参数计数与从 N种类型报文中选取的 N-1种类型报文的输入控制参数呈线 性相关, 并且与每个输入控制参数计数对应的 N-1种类型报文部分相同; 通过 N个输 入控制参数和 N个计数值分别统计 N种类型报文中的每种类型报文在第一预设时刻的 流量, 解决了相关技术中采用同一个计数器仅能对一种类型报文的流量进行统计的问 题, 进而节省了计数器资源, 并且确保了在同一时刻对多种类型的报文进行流量统计 的精度, 提高了网络的灵活性与稳定性。 作为本发明的一个优选实施例,假设采用同一个计数器在 tl时刻同时统计的 A类 报文的流量和 B类报文的流量, 该计数器为 A类报文设置的输入控制参数为^ 该计 数器为 B类报文设置的输入控制参数为 b, 其中, a和 b均为正整数, 且 a≠b。 在 tl 时刻读取计数器, 得到 A类报文和 B类报文的数量总和的计数为 countl , 输入控制参 数的计数为 coUnt2, 此时, 如果进一步假设 A类报文的流量为 X, B类报文的流量为 Y, 则可以得出如下二元一次方程组:
X + Υ = countl 方程式 1 aX + bY = count2 方程式 2 由于 a、 b、 countl和 count2均已知, 因此可以计算出:
X= ( count2 - bcountl ) I ( a - b )
Y= ( acountl - count2 ) I ( a - b ) 即在 tl时刻, 采用同一个计数器可以得出 A类报文的流量为 (count2 - bcountl ) I ( a - b ) , B类报文的流量为 (acountl - count2) I ( a - b)。 作为本发明的另一个优选实施例, 假设采用同一个计数器在 tl时刻同时统计的 A 类报文的流量、 B类报文的流量以及 C类报文的流量, 该计数器为 A类报文设置的输 入控制参数为 a, 该计数器为 B类报文设置的输入控制参数为 b, 该计数器为 C类报 文设置的输入控制参数为 c, 其中, a、 b、 c均为正整数, 且 a≠b≠c。 在 tl时刻读取 计数器, 得到 A类报文、 B类报文和 C类报文的数量总和的计数为 countl, A类报文 和 B类报文的输入控制参数的计数为 count2, B类报文和 C类报文的输入控制参数的 计数为 C0Unt3。 此时, 如果进一步假设 A类报文的流量为 X, B类报文的流量为 Y, C类报文的流量为 Ζ, 则可以得出如下三元一次方程组:
Χ + Y = countl 方程式 1 aX + b Y = count2 方程式 2 b Y + cZ = count3 方程式 3 由于 a、 b、 c、 countl count2和 count3均已知, 因此可以计算出: X= ( count2 - bcountl ) I (a-b) Y= (acountl - count2) I (a-b)
Z= [count3 - (a+1 ) count2 - ab countl ) ] / (ac - be) 即在 tl时刻, 采用同一个计数器可以得出 A类报文的流量为 (count2- bcountl) / (a-b), B类报文的流量为 (acountl -count2) / (a-b), C类报文的流量为 [count3 - (a+1) count2 -ab countl ) ] / ( ac _ be )。 需要说明的是,上述优选实施例仅用于对权利要求 1所记载的技术方案进行解释, 并不构成对本发明的限制, 如果采用同一个计数器对 N种类型报文的流量进行统计, 则可以建立 N元一次方程组进行求解。 优选地, 在步骤 S102, 采用计数器分别为每种类型报文设置输入控制参数之前, 还可以包括以下操作: 步骤 S1: 分别提取 M种类型报文中的每种类型报文的转发信息, 其中, M为正 整数且 M^N; 步骤 S2: 根据转发信息从 M种类型报文中确定 N种类型报文。 在优选实施例中, 假设在预设端口接收到 M种类型报文, 首先可以分别从每种类 型报文中获取该种类型报文的转发信息; 然后通过转发信息中的预设标志位来确定此 种类型报文是否需要进行流量统计, 如果不需要, 则可以直接将此种类型的报文进行 转发, 如果需要, 则可以采用上述统计方法在预设时刻对此种类型报文的流量进行统 计。 优选地, 在上述步骤 S1中, 分别提取 M种类型报文中的每种类型报文的转发信 息可以包括以下步骤: 步骤 S11: 分别获取 M种类型报文中的每种类型报文的特征信息, 并对特征信息 进行解析; 步骤 S12: 从解析后的特征信息中提取转发信息。 在优选实施例中, 报文的特征信息可以包括但不限于以下至少之一:
( 1 ) 报文进入的端口 (PORT) 信息;
(2)报文中携带的虚拟局域网(VLAN)信息,其中,可以包括:单层标签(TAG)、 双层 TAG;
(3 ) VLAN优先级信息;
(4) 转发标签信息;
( 5 ) 报文的源媒体接入控制 (MAC) 地址和目的 MAC地址;
(6) 报文的源因特网协议 (IP) 地址和目的 IP地址;
(7) 传输控制协议 (TCP) 端口号。 上述转发信息的提取可以分为以下两个操作步骤: 第一步、 对接收到的报文中的特征信息进行解析, 解析出来的特征信息可以包含 上述各项内容, 然而并非每次均需提取上述全部信息, 而是需要结合当前执行的报文 转发流程从中进行选择; 第二步、 准备将报文送入相应的转发流程, 在此之前, 需要从上述特征信息中提 取转发信息以确定是否需要对此种类型的报文进行流量统计。 优选地, 在步骤 S2, 根据转发信息从 M种类型报文中确定 N种类型报文之后, 还可以包括以下步骤: 步骤 S3 : 根据 N种类型报文的数量总和与 N个输入控制参数将计数器划分为 N 个位域, 其中, N个位域中的每个位域分别与 N种类型报文的数量总和计数以及 N-1 个输入控制参数计数中每种计数一一对应。 在优选实施例中, 如果采用同一个计数器同时对 N种类型报文进行流量统计, 那 么可以将该计数器划分成 N个位域,其中一个位域对应 N种类型报文的数量总和计数, 而其余的 N-1个位域可以与 N-1个输入控制参数计数中的每种计数一一对应。 优选地, 在步骤 S2, 根据转发信息从 M种类型报文中确定 N种类型报文之后, 还可以包括以下操作: 步骤 S4: 在第二预设时刻到达时, 再次从计数器中获取 N个计数值; 步骤 S5: 通过 N个输入控制参数和再次获取到的 N个计数值分别统计 N种类型 报文中的每种类型报文在第二预设时刻的流量; 步骤 S6: 采用 N种类型报文中的每种类型报文在第一预设时刻的流量与 N种类 型报文中的每种类型报文在第二预设时刻的流量计算 N种类型报文中的每种类型报文 在预设时间段内的流量, 其中, 预设时间段为从第一预设时刻至第二预设时刻。 在优选实施例中, 如果需要得到预设时间段内 (例如: 从 tl时刻至 t2时刻)各种 类型报文的流量统计对比, 则可以在 tl时刻读取计数器中 N个位域中的全部计数,再 根据该计数器为每种类型报文设置的输入控制参数, 以统计出各种类型报文在 tl时刻 的流量; 同理, 按照上述方式可以统计出各种类型报文在 t2时刻的流量。 最后, 每种 类型报文分别采用在 t2时刻的流量统计与在 tl时刻的流量统计执行减法操作,从而得 到此种类型报文在预设时间段内的流量统计, 以实现不同类型报文在预设时间段内的 流量统计对比。 由此可见, 仅通过简单地运算即可实现不同类型报文之间在预设时间 段内的流量统计对比, 而且是在同一个计数器中完成的, 确保了流量统计的精度。 优选地, 在步骤 S106, 通过 N个输入控制参数和 N个计数值分别统计 N种类型 报文中的每种类型报文在第一预设时刻的流量之后, 还可以包括处理步骤: 步骤 S7:根据 N种类型报文中的每种类型报文的特征信息分别对各种类型报文进 行转发。 在优选实施例中, 如果已经完成对上述 N种类型报文的流量统计, 那么可以分别 将每种类型报文送入相应的转发流程。 此时可以从上述特征信息中提取一项或多项作 为逻辑端口 (Logic Port)表的索引, 例如: 对于二层转发的报文, 需要获取报文进入 的 PORT信息以及携带的 VLAN信息; 对于一个三层转发的报文, 需要获取报文的目 的 IP地址; 而对于一个标签转发的报文, 则需要获取报文中携带的标签信息。 下面结合图 2所示的优选实施方式对上述优选实施过程做进一步的描述。 图 2是根据本发明优选实施例的流量统计方法的流程图。 如图 2所示, 该方法可 以包括以下处理步骤: 步骤 S202: 根据预设端口接收到的多种类型报文, 分别获取每种类型报文的特征 信息, 然后从获取到的特征信息中提取该种类型报文的转发信息; 在该优选实施例中, 流量统计方法并不具体区分报文的类型, 即报文的类型可以 是数据报文,例如:普通的二三层报文,也可以是多协议标签交换(Multi-Protocol Label Switching, 简称为 MPLS)报文、边缘到边缘的伪线仿真(Pseudo-Wire Emulation Edge to Edge,简称为 PWE3 )报文,还可以是检测报文,例如:操作、管理和维护(Operations Administration and Maintenance, 简称为 OAM) 报文, 双向转发检测 (Bidirectional Forwarding Detection , 简称为 BFD ) 报文, 连接故障管理 (Connectivity Fault Management, 简称为 CFM) 报文。 步骤 S204:根据每种类型报文的转发信息判断是否需要对此种类型报文进行流量 统计, 如果需要进行流量统计, 则继续执行步骤 S206, 执行流量统计操作; 否则, 转 到步骤 S216; 步骤 S206: 申请和管理相应的计数器资源, 其中, 可以包括: 计数器的内存容量 (需要根据报文的种类确定)、 计数器的标识信息; 步骤 S208: 计数器分别为每种类型报文进行输入控制参数的设置, 此时输入的并 非此种类型报文的实际长度, 而是一个可配置的参数值; 针对每种类型报文的流量统 计仅能采用一个参数值, 各种类型报文的输入控制参数均为正整数, 并且对每种类型 报文进行流量统计使用的输入控制参数互不相同; 步骤 S210: 开始使用同一个计数器实现对多种不同类型报文的流量进行统计; 步骤 S212: 在 T时刻读取计数器的流量统计结果, 可以包括: 各种类型报文数量 总和的计数以及多个输入控制参数计数; 步骤 S214: 通过同一计数器对不同类型报文设置不同的输入控制参数, 以及得到 的需要同时统计的多种类型报文的报文数量总和计数、 多个输入控制参数计数, 然后 建立多元一次方程组即可得到在 T时刻需要同时统计的各种类型报文的流量; 步骤 S216: 根据各种类型报文的特征信息中的转发路径信息, 分别将每种类型报 文转发至相应的目的地。 由此可见, 在该优选实施例中, 在保证每种类型报文正常转发的前提下, 成功地 完成了对各种类型报文的流量统计, 满足了计数器资源紧张或者需要同时读取多个不 同流量统计的特定网络功能和诊断方式的实现, 例如: 在执行 0AM诊断时, 经常需 要对某时间段内的收发数据包进行统计, 而按照该优选实施例中提供的统计方式可以 有效地避免读取时间误差, 确保了流量统计精度。 采用同一个计数器资源实现多种不 同类型报文的流量统计, 从而节省了计数器资源, 同时, 流量统计的判断还可以细化 至每条数据流, 由此提高了网络的灵活性和稳定性。 图 3是根据本发明实施例的流量统计装置的结构框图。 如图 3所示, 该流量统计 装置可以包括: 设置模块 100, 设置为采用同一计数器分别为 N种类型报文中的每种 类型报文设置输入控制参数, 其中, N为正整数且 N 2, 每个输入控制参数均为正整 数且 N个输入控制参数互异; 第一获取模块 102, 设置为在第一预设时刻到达时, 从 计数器中获取 N个计数值, 其中, N个计数值包括: 预设端口在第一预设时刻接收到 的 N种类型报文的数量总和以及 N-1个输入控制参数计数, 每个输入控制参数计数与 从 N种类型报文中选取的 N-1种类型报文的输入控制参数呈线性相关, 并且与每个输 入控制参数计数对应的 N-1种类型报文部分相同; 第一统计模块 104, 设置为通过 N 个输入控制参数和 N个计数值分别统计 N种类型报文中的每种类型报文在第一预设时 刻的流量。 采用如图 3所示的装置, 解决了相关技术中采用同一个计数器仅能对一种类型报 文的流量进行统计的问题, 进而节省了计数器资源, 并且确保了在同一时刻对多种类 型的报文进行流量统计的精度, 提高了网络的灵活性与稳定性。 优选地, 如图 4所示, 上述装置还可以包括: 提取模块 106, 设置为分别提取 M 种类型报文中的每种类型报文的转发信息,其中, M为正整数且 M^N;确定模块 108, 设置为根据转发信息从 M种类型报文中确定 N种类型报文。 优选地, 上述提取模块 106可以包括: 获取单元(图中未示出), 设置为分别获取 M种类型报文中的每种类型报文的特征信息, 并对特征信息进行解析; 提取单元 (图 中未示出), 设置为从解析后的特征信息中提取转发信息。 优选地, 如图 4所示, 上述装置还可以包括: 划分模块 110, 设置为根据 N种类 型报文的数量总和与 N个输入控制参数将计数器划分为 N个位域, 其中, N个位域中 的每个位域分别与 N种类型报文的数量总和计数以及 N-1个输入控制参数计数中每种 计数 对应。 优选地, 如图 4所示, 上述装置还可以包括: 第二获取模块 112, 设置为在第二 预设时刻到达时, 再次从计数器中获取 N个计数值; 第二统计模块 114, 设置为通过 N个输入控制参数和再次获取到的 N个计数值分别统计 N种类型报文中的每种类型报 文在第二预设时刻的流量; 计算模块 116, 设置为采用 N种类型报文中的每种类型报 文在第一预设时刻的流量与 N种类型报文中的每种类型报文在第二预设时刻的流量计 算 N种类型报文中的每种类型报文在预设时间段内的流量, 其中, 预设时间段为从第 一预设时刻至第二预设时刻。 优选地, 如图 4所示, 上述装置还可以包括: 转发模块 118, 设置为根据 N种类 型报文中的每种类型报文的特征信息分别对各种类型报文进行转发。 从以上的描述中, 可以看出, 上述实施例实现了如下技术效果 (需要说明的是这 些效果是某些优选实施例可以达到的效果):本发明所提供的技术方案通过从接收到的 多种类型报文中获取每种类型报文的特征信息, 然后从特征信息中提取每种类型报文 所对应的转发信息。 如果需要对此种类型报文进行流量统计, 则申请相应的计数器资 源, 通过对同一计数器设置输入控制参数的控制, 实现需要同时计数的多种类型报文 的数量总和计数和输入控制参数计数, 然后通过简单地运算, 即可在同一时刻得到每 种类型报文的流量统计, 满足了计数器资源紧张或者需要同时读取多个不同流量统计 的特定网络功能和诊断方式的实现, 从而节省了计数器资源, 同时, 流量统计的判断 还可以细化至每条数据流, 由此提高了网络的灵活性和稳定性。 显然, 本领域的技术人员应该明白, 上述的本发明的各模块或各步骤可以用通用 的计算装置来实现, 它们可以集中在单个的计算装置上, 或者分布在多个计算装置所 组成的网络上, 可选地, 它们可以用计算装置可执行的程序代码来实现, 从而, 可以 将它们存储在存储装置中由计算装置来执行, 并且在某些情况下, 可以以不同于此处 的顺序执行所示出或描述的步骤, 或者将它们分别制作成各个集成电路模块, 或者将 它们中的多个模块或步骤制作成单个集成电路模块来实现。 这样, 本发明不限制于任 何特定的硬件和软件结合。 以上所述仅为本发明的优选实施例而已, 并不用于限制本发明, 对于本领域的技 术人员来说, 本发明可以有各种更改和变化。 凡在本发明的精神和原则之内, 所作的 任何修改、 等同替换、 改进等, 均应包含在本发明的保护范围之内。 工业实用性 如上所述, 本发明实施例提供的一种流量统计方法及装置具有以下有益效果: 满 足了计数器资源紧张或者需要同时读取多个不同流量统计的特定网络功能和诊断方式 的实现, 从而节省了计数器资源, 同时, 流量统计的判断还可以细化至每条数据流, 由此提高了网络的灵活性和稳定性。

Claims

权 利 要 求 书
1. 一种流量统计方法, 包括:
采用同一计数器分别为 N种类型报文中的每种类型报文设置输入控制参 数, 其中, N为正整数且 N 2, 每个输入控制参数均为正整数且 N个输入控 制参数互异;
在第一预设时刻到达时, 从所述计数器中获取 N个计数值, 其中, 所述 N 个计数值包括: 预设端口在所述第一预设时刻接收到的所述 N种类型报文的数 量总和以及 N-1个输入控制参数计数,每个输入控制参数计数与从所述 N种类 型报文中选取的 N-1种类型报文的输入控制参数呈线性相关, 并且与所述每个 输入控制参数计数对应的 N-1种类型报文部分相同;
通过所述 N个输入控制参数和所述 N个计数值分别统计所述 N种类型报 文中的每种类型报文在所述第一预设时刻的流量。
2. 根据权利要求 1所述的方法, 其中, 在采用所述计数器分别为所述每种类型报 文设置所述输入控制参数之前, 还包括:
分别提取 M种类型报文中的每种类型报文的转发信息, 其中, M为正整 数且 M^N;
根据所述转发信息从所述 M种类型报文中确定所述 N种类型报文。
3. 根据权利要求 2所述的方法, 其中, 分别提取所述 M种类型报文中的每种类型 报文的转发信息包括:
分别获取所述 M种类型报文中的每种类型报文的特征信息,并对所述特征 信息进行解析;
从解析后的特征信息中提取所述转发信息。
4. 根据权利要求 2所述的方法, 其中, 在根据所述转发信息从所述 M种类型报文 中确定所述 N种类型报文之后, 还包括:
根据所述 N种类型报文的数量总和与所述 N个输入控制参数将所述计数器 划分为 N个位域, 其中, 所述 N个位域中的每个位域分别与所述 N种类型报 文的数量总和计数以及 N-1个输入控制参数计数中每种计数一一对应。
5. 根据权利要求 2所述的方法, 其中, 在根据所述转发信息从所述 M种类型报文 中确定所述 N种类型报文之后, 还包括:
在第二预设时刻到达时, 再次从所述计数器中获取 N个计数值; 通过所述 N个输入控制参数和所述再次获取到的 N个计数值分别统计所述 N种类型报文中的每种类型报文在所述第二预设时刻的流量;
采用所述 N种类型报文中的每种类型报文在所述第一预设时刻的流量与所 述 N种类型报文中的每种类型报文在所述第二预设时刻的流量计算所述 N种类 型报文中的每种类型报文在预设时间段内的流量, 其中, 所述预设时间段为从 所述第一预设时刻至所述第二预设时刻。
6. 根据权利要求 2所述的方法,其中,在通过所述 N个输入控制参数和所述 N个 计数值分别统计所述 N种类型报文中的每种类型报文在所述第一预设时刻的流 量之后, 还包括:
根据所述 N种类型报文中的每种类型报文的特征信息分别对各种类型报文 进行转发。
7. 一种流量统计装置, 包括:
设置模块, 设置为采用同一计数器分别为 N种类型报文中的每种类型报文 设置输入控制参数, 其中, N为正整数且 N 2, 每个输入控制参数均为正整数 且 N个输入控制参数互异;
第一获取模块, 设置为在第一预设时刻到达时, 从所述计数器中获取 N个 计数值, 其中, 所述 N个计数值包括: 预设端口在所述第一预设时刻接收到的 所述 N种类型报文的数量总和以及 N-1个输入控制参数计数,每个输入控制参 数计数与从所述 N种类型报文中选取的 N-1种类型报文的输入控制参数呈线性 相关, 并且与所述每个输入控制参数计数对应的 N-1种类型报文部分相同; 第一统计模块,设置为通过所述 N个输入控制参数和所述 N个计数值分别 统计所述 N种类型报文中的每种类型报文在所述第一预设时刻的流量。
8. 根据权利要求 7所述的装置, 其中, 所述装置还包括: 提取模块, 设置为分别提取 M种类型报文中的每种类型报文的转发信息, 其中, M为正整数且 M^N;
确定模块, 设置为根据所述转发信息从所述 M种类型报文中确定所述 N 种类型报文。
9. 根据权利要求 8所述的装置, 其中, 所述提取模块包括:
获取单元,设置为分别获取所述 M种类型报文中的每种类型报文的特征信 息, 并对所述特征信息进行解析;
提取单元, 设置为从解析后的特征信息中提取所述转发信息。
10. 根据权利要求 8所述的装置, 其中, 所述装置还包括:
划分模块,设置为根据所述 N种类型报文的数量总和与所述 N个输入控制 参数将所述计数器划分为 N个位域,其中,所述 N个位域中的每个位域分别与 所述 N种类型报文的数量总和计数以及 N-1个输入控制参数计数中每种计数一 一对应。
11. 根据权利要求 8所述的装置, 其中, 所述装置还包括:
第二获取模块, 设置为在第二预设时刻到达时, 再次从所述计数器中获取 N个计数值;
第二统计模块, 设置为通过所述 N个输入控制参数和所述再次获取到的 N 个计数值分别统计所述 N种类型报文中的每种类型报文在所述第二预设时刻的 流量;
计算模块, 设置为采用所述 N种类型报文中的每种类型报文在所述第一预 设时刻的流量与所述 N种类型报文中的每种类型报文在所述第二预设时刻的流 量计算所述 N种类型报文中的每种类型报文在预设时间段内的流量, 其中, 所 述预设时间段为从所述第一预设时刻至所述第二预设时刻。
12. 根据权利要求 8所述的装置, 其中, 所述装置还包括:
转发模块, 设置为根据所述 N种类型报文中的每种类型报文的特征信息分 别对各种类型报文进行转发。
PCT/CN2014/076248 2013-06-20 2014-04-25 流量统计方法及装置 WO2014201906A1 (zh)

Priority Applications (2)

Application Number Priority Date Filing Date Title
US14/899,681 US9887892B2 (en) 2013-06-20 2014-04-25 Traffic statistics collection method and device
EP14814526.1A EP3013000B1 (en) 2013-06-20 2014-04-25 Traffic statistics collection method and apparatus

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201310247017.2A CN104243226B (zh) 2013-06-20 2013-06-20 流量统计方法及装置
CN201310247017.2 2013-06-20

Publications (1)

Publication Number Publication Date
WO2014201906A1 true WO2014201906A1 (zh) 2014-12-24

Family

ID=52103919

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2014/076248 WO2014201906A1 (zh) 2013-06-20 2014-04-25 流量统计方法及装置

Country Status (4)

Country Link
US (1) US9887892B2 (zh)
EP (1) EP3013000B1 (zh)
CN (1) CN104243226B (zh)
WO (1) WO2014201906A1 (zh)

Families Citing this family (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104350789B (zh) * 2014-05-09 2019-02-26 华为终端(东莞)有限公司 功率调节装置及方法
CN107579875B (zh) * 2017-09-08 2020-04-24 北京物芯科技有限责任公司 一种网络报文统计方法及装置
US10951508B2 (en) * 2018-01-09 2021-03-16 Ciena Corporation End-to-end data path integrity validation at layer 2

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1479495A (zh) * 2002-08-28 2004-03-03 ��Ϊ�������޹�˾ 一种在桥转发过程中对广播报文的流量进行抑制的方法
CN101488835A (zh) * 2009-02-13 2009-07-22 华为技术有限公司 一种链路检测方法、装置和通信系统
CN101626323A (zh) * 2009-07-23 2010-01-13 中兴通讯股份有限公司 一种网络数据流量监测方法和装置
CN101820394A (zh) * 2010-03-22 2010-09-01 中兴通讯股份有限公司 接入流量的统计方法及设备
CN103001828A (zh) * 2012-12-04 2013-03-27 北京星网锐捷网络技术有限公司 基于数据流的报文统计方法和装置、网络设备

Family Cites Families (13)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20020108059A1 (en) 2000-03-03 2002-08-08 Canion Rodney S. Network security accelerator
US7117504B2 (en) * 2001-07-10 2006-10-03 Microsoft Corporation Application program interface that enables communication for a network software platform
US20030105855A1 (en) * 2001-11-26 2003-06-05 Big Pipe Inc. Usage-based billing method and system for computer networks
US20040210348A1 (en) 2003-04-04 2004-10-21 Raphael Imhof Building system with network operation monitoring
US7870200B2 (en) * 2004-05-29 2011-01-11 Ironport Systems, Inc. Monitoring the flow of messages received at a server
US20070086352A1 (en) * 2004-10-20 2007-04-19 France Telecom Method of monitoring multimedia stream exchange session initialization messages and a server and an installation for carrying out said method
US20060168070A1 (en) * 2005-01-06 2006-07-27 Tervela, Inc. Hardware-based messaging appliance
BRPI0716414A2 (pt) * 2006-08-08 2013-09-24 Siemens Energy & Automat dispositivo, sistema e mÉtodos para atribuir um endereÇo de màdulo olc
US8589541B2 (en) * 2009-01-28 2013-11-19 Headwater Partners I Llc Device-assisted services for protecting network capacity
US9270559B2 (en) * 2009-01-28 2016-02-23 Headwater Partners I Llc Service policy implementation for an end-user device having a control application or a proxy agent for routing an application traffic flow
CN101616036A (zh) * 2009-07-21 2009-12-30 清华大学 参数在线可控的基于自适应非线性抽样的业务流统计方法
US9106353B2 (en) * 2011-12-13 2015-08-11 Jds Uniphase Corporation Time synchronization for network testing equipment
CN104795631A (zh) * 2014-01-22 2015-07-22 深圳富泰宏精密工业有限公司 壳体,该壳体的制作方法及应用该壳体的电子装置

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1479495A (zh) * 2002-08-28 2004-03-03 ��Ϊ�������޹�˾ 一种在桥转发过程中对广播报文的流量进行抑制的方法
CN101488835A (zh) * 2009-02-13 2009-07-22 华为技术有限公司 一种链路检测方法、装置和通信系统
CN101626323A (zh) * 2009-07-23 2010-01-13 中兴通讯股份有限公司 一种网络数据流量监测方法和装置
CN101820394A (zh) * 2010-03-22 2010-09-01 中兴通讯股份有限公司 接入流量的统计方法及设备
CN103001828A (zh) * 2012-12-04 2013-03-27 北京星网锐捷网络技术有限公司 基于数据流的报文统计方法和装置、网络设备

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
See also references of EP3013000A4 *

Also Published As

Publication number Publication date
CN104243226A (zh) 2014-12-24
EP3013000B1 (en) 2017-03-15
US9887892B2 (en) 2018-02-06
EP3013000A4 (en) 2016-04-27
US20160134496A1 (en) 2016-05-12
CN104243226B (zh) 2018-09-11
EP3013000A1 (en) 2016-04-27

Similar Documents

Publication Publication Date Title
EP3139560B1 (en) Packet processing method, device and computer storage medium
US9998357B2 (en) Multipath transmission based packet traffic control method and apparatus
CN106416171B (zh) 一种特征信息分析方法及装置
US9094307B1 (en) Measuring latency within a networking device
Zdonik et al. SpringerBriefs in Computer Science
WO2015153225A1 (en) Peer-based handoff performance measurement
WO2015085748A1 (zh) 交换装置及丢包方法
WO2016184245A1 (zh) 一种隧道丢包检测方法、装置及网络通信设备
US20090282291A1 (en) Internal maintenance association end point (mep) for sharing state information
US11489836B2 (en) Method, apparatus, and system for collecting access control list
Hyun et al. Real‐time and fine‐grained network monitoring using in‐band network telemetry
WO2017000802A1 (zh) 一种业务故障定位方法及装置
US11706152B2 (en) Methods and systems for queue and pipeline latency metrology in network devices and smart NICs
JP2023514790A (ja) ネットワーク性能検出方法及び機器、並びにネットワーク装置
WO2014117737A1 (zh) Oam报文处理方法、设备及系统
CN108809752B (zh) 一种网络流量的自适应监控方法、装置、npb设备及介质
WO2014201906A1 (zh) 流量统计方法及装置
WO2019157802A1 (zh) 测量网络性能的方法、设备和网络系统
CN112532468B (zh) 网络测量系统、方法、设备及存储介质
WO2019001101A1 (zh) 路由路径分析方法及设备
US11582156B2 (en) Traffic detection method, apparatus, and system
US7944857B2 (en) Method and system for deriving tunnel path information in MPLS networks
WO2014000509A1 (zh) 一种传输监控方法及装置
JP2018029303A (ja) 通知システムおよび通知方法
CN108111327B (zh) 网络操作管理维护方法和装置

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 14814526

Country of ref document: EP

Kind code of ref document: A1

WWE Wipo information: entry into national phase

Ref document number: 14899681

Country of ref document: US

NENP Non-entry into the national phase

Ref country code: DE

REEP Request for entry into the european phase

Ref document number: 2014814526

Country of ref document: EP

WWE Wipo information: entry into national phase

Ref document number: 2014814526

Country of ref document: EP