CN111464385A - Second counting type statistical method and device - Google Patents
Second counting type statistical method and device Download PDFInfo
- Publication number
- CN111464385A CN111464385A CN202010237293.0A CN202010237293A CN111464385A CN 111464385 A CN111464385 A CN 111464385A CN 202010237293 A CN202010237293 A CN 202010237293A CN 111464385 A CN111464385 A CN 111464385A
- Authority
- CN
- China
- Prior art keywords
- total
- count
- statistical
- counting
- response
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Pending
Links
Images
Classifications
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L43/00—Arrangements for monitoring or testing data switching networks
- H04L43/08—Monitoring or testing based on specific metrics, e.g. QoS, energy consumption or environmental parameters
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L43/00—Arrangements for monitoring or testing data switching networks
- H04L43/50—Testing arrangements
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
The embodiment of the application provides a second counting type counting method and device. The hardware only needs to count the total count value, so that the consumption of the second counting type counting on the resources by the hardware is reduced, particularly, when the total counting type counting value and the second counting type counting value need to be simultaneously carried out, the hardware only needs to carry out the total counting type counting, the second counting type counting is carried out by combining with the software, the occupation of the hardware on the resources is obviously reduced, and the utilization rate of the hardware resources is improved.
Description
Technical Field
The application relates to the technical field of computers, in particular to a second counting type statistical method and device.
Background
Generally, various types of information need to be counted inside the communication device, and the information is expressed in the form of a statistical value, for example, the number of packets received by a certain physical port is counted. In the application process of the communication equipment, in order to match high-speed data transmission, the statistics is completed by hardware, and the software is responsible for reading. However, as the amount of statistical information increases, the resource consumption of various types of hardware statistics increases, thereby degrading the operating performance of the communication device. Therefore, an information statistics method is needed to reduce the resource consumption of hardware.
Disclosure of Invention
In order to solve the technical problems in the prior art, the application provides a second counting type statistical method and device, which can realize second counting type statistics and reduce resource consumption of hardware.
In one aspect, the present application provides a second counting type statistical method, including:
at a first moment, acquiring a first statistic response by sending a reading statistic request; wherein the first statistical response comprises: a first total count;
at a second moment, a second statistical response is obtained by sending a reading statistical request; wherein the second statistical response comprises: a second total count;
and calculating a second counting type statistic value according to the first statistic response and the second statistic response.
Optionally, the first statistical response further includes: acquiring a third moment corresponding to the first total count;
the second statistical response further comprises: and acquiring a fourth moment corresponding to the second total count.
Optionally, the first total count includes: counting the total number of the first message;
the second total count includes: the second message total count.
Optionally, the first total packet count includes: the first received message total count;
the second total packet count includes: the second received message total count;
alternatively, the first and second electrodes may be,
the first total packet count includes: a first total transmitted message count;
the second total packet count includes: second message total sent count.
Optionally, the time interval between the first time and the second time is 1 s.
In another aspect, a second counting type statistic device is characterized by comprising an acquisition unit and a calculation unit:
the acquisition unit is used for acquiring a first statistical response by sending a reading statistical request at a first moment; wherein the first statistical response comprises: a first total count;
the obtaining unit is further configured to obtain a second statistical response by sending a read statistical request at a second time; wherein the second statistical response comprises: a second total count;
and the calculating unit is used for calculating a second counting type statistic value according to the first statistic response and the second statistic response.
Optionally, the first statistical response further includes: acquiring a third moment corresponding to the first total count;
the second statistical response further comprises: and acquiring a fourth moment corresponding to the second total count.
Optionally, the first total count includes: counting the total number of the first message;
the second total count includes: the second message total count.
Optionally, the first total packet count includes: the first received message total count;
the second total packet count includes: the second received message total count;
alternatively, the first and second electrodes may be,
the first total packet count includes: a first total transmitted message count;
the second total packet count includes: second message total sent count.
Optionally, the time interval between the first time and the second time is 1 s.
The method has the following advantages:
according to the technical scheme, the software sends the reading statistical request to the hardware at different moments to obtain the first total count and the second total count corresponding to the different moments, and the second count type statistical value is calculated and obtained based on the first total count and the second total count. The hardware only needs to count the total count value, so that the consumption of the second counting type counting on the resources by the hardware is reduced, particularly, when the total counting type counting value and the second counting type counting value need to be simultaneously carried out, the hardware only needs to carry out the total counting type counting, the second counting type counting is carried out by combining with the software, the occupation of the hardware on the resources is obviously reduced, and the utilization rate of the hardware resources is improved.
Drawings
In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings needed to be 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 described in the present application, and other drawings can be obtained by those skilled in the art without creative efforts.
Fig. 1 is a schematic flow chart of a second counting type statistical method according to an embodiment of the present disclosure;
fig. 2 is an application scenario diagram of the second counting type statistic method according to the embodiment of the present application;
fig. 3 is a schematic structural diagram of a second counting type statistic device according to an embodiment of the present application.
Detailed Description
In order to make the technical solutions of the present application better understood, 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.
In the related art, the hardware can use its own resources to realize the second counting type statistics, that is, the hardware starts counting after clearing the count value, reads the total count value as the current second counting type statistics value after 1s, and clears the count value and counts again, thereby realizing the second counting type statistics by consuming its own resources. However, as the amount of information to be counted increases, the resources consumed by the hardware to realize the counting also increase, and if the resources increase to a certain extent, the performance of the hardware is affected.
Aiming at the problems, in the process of analyzing and simplifying the hardware design of statistical information, all types of statistical values are carefully analyzed, a strong association exists between the two types of statistical values, and the other type of statistical value can be obtained through conversion of one type of statistical value.
In order to reduce resource consumption of hardware, the application provides a second counting type statistical method and device, the total counting value of the hardware is utilized, the second counting type statistical value is calculated by combining software, and resource consumption of the hardware for second counting type statistics is reduced.
The embodiments provided in the present application will be specifically described below with reference to the accompanying drawings.
Referring to fig. 1, fig. 1 is a schematic flow chart of a second counting type statistical method provided in an embodiment of the present application. As shown in fig. 1, the method comprises the steps of:
s101: at a first moment, acquiring a first statistic response by sending a reading statistic request; wherein the first statistical response comprises: the first total count.
For convenience of description, the following description will be given by taking as an example the implementation of two associated total count type statistics a and corresponding second count type statistics B, where a denotes the total count and B denotes the second count. The statistical function of a is implemented on hardware, the initial value is 0, the total count type statistical value of the hardware is updated every time, a is accumulated on the basis of the previous update, for example, the length of the received message (i.e. the number of bytes contained in the message) is increased by 1 on the basis of the original value of the hardware when the hardware receives the message every time, and the like. In practical application, the counting manner may be set according to the actually required total count type statistic, and is not limited herein.
At a first time t0, the software sends a read statistic request to the hardware, after the hardware receives the read statistic request, the hardware responds to the read statistic request, and the software obtains a first statistic response, wherein the first statistic response includes a second total count a 0.
S102: at a second moment, a second statistical response is obtained by sending a reading statistical request; wherein the second statistical response comprises: the second total count.
At a second time t1, the software sends a read statistic request to the hardware, and after the hardware receives the read statistic request, the hardware responds to the read statistic request, and the software obtains a second statistic response, where the second statistic response includes a second total count An.
In practical applications, software may count the number of messages, that is, a may represent a total message count, and then the first total count a0 may represent a first total message count, and the second total count An may represent a second total message count.
The application also provides a feasible implementation manner, and the software can count the number of received or sent messages, that is, a represents the total count of the received or sent messages, the first total count a0 can represent the total count of the first received messages, and the second total count An can represent the total count of the second received messages; alternatively, the first total count a0 may represent a first total transmitted packet count, and the second total count An may represent a second total transmitted packet count.
S103: and calculating a second counting type statistic value according to the first statistic response and the second statistic response.
After the software obtains the first statistical response and the second statistical response, the second count type statistical value B may be calculated as (An-a0)/(t1-t0) according to the first total count a0 and the second total count An, and the first time t0 and the second time t 1.
The present application provides a possible implementation, and the application interval between T0 and T1 may be 1 s. In practical application, the time intervals of T0 and T1 can be set according to requirements.
It will be appreciated that there is some deviation between the time the software retrieves the first statistical response and the time the hardware responds to the read statistical request. In order to improve the accuracy of the second counting type statistic, the embodiment of the present application provides a feasible implementation manner, that is, the acquiring, by the software, the first statistic response further includes: acquiring a third time T0 corresponding to the first total count A0; the software obtaining the second statistical response further comprises: a fourth time T1 corresponding to the second total count An is obtained.
Based on the above, the software can calculate the second counting type statistic value B ═ (An-a0)/(T1-T0) from the third time T0, the fourth time T1, the first total count a0, and the second total count An.
In the second counting type statistical method provided in the above embodiment, the software sends the reading statistical request to the hardware at different times to obtain the first total count and the second total count corresponding to the different times, and the second counting type statistical value is calculated based on the first total count and the second total count. The hardware only needs to count the total count value, so that the consumption of the second counting type counting on the resources by the hardware is reduced, particularly, when the total counting type counting value and the second counting type counting value need to be simultaneously carried out, the hardware only needs to carry out the total counting type counting, the second counting type counting is carried out by combining with the software, the occupation of the hardware on the resources is obviously reduced, and the utilization rate of the hardware resources is improved.
To facilitate understanding of the above-described second counting type statistical method, the following description is given by taking a hardware received message as an example in conjunction with fig. 2.
Referring to fig. 2, fig. 2 is an application scenario diagram of the second counting type statistic method according to the embodiment of the present application.
As shown in fig. 2, in this scenario, a represents the total packet count received by the hardware, B represents the packet count received by the hardware every second, the initial value of a is 0, and each time the hardware receives a new packet, a is incremented by 1 based on the original value. When no message is received, the value of A is kept unchanged. While the hardware is able to record the device's own system T. The software issues a request for reading the statistical value to the hardware at the frequency of once per second, the hardware sends the count A and the system time T at the moment to the software when receiving the request, the software calculates the statistical value B through the change value of the statistical value A and the change value of the system time T read twice after receiving the data sent by the hardware, and refreshes the statistical value A and the statistical value B on the interface at the frequency of once per second, wherein the statistical value A is directly sent by the hardware, and the statistical value B is calculated by the software according to the statistical value A.
As shown in fig. 2, at time T0, the hardware receives a request for reading statistics value issued by the software, then sends the values a0 and T0 of the statistics value a to the software, and receives a request for reading statistics value the next time at time T1, during which time, since a new message is received, the statistics value a is refreshed to be a new value An, the hardware sends An and T1 again, the software calculates the value B1 of the statistics value B at this time to be (An-a0)/(T1-T0), and refreshes a1 and B1 to the interface.
Aiming at the second counting type statistical method provided by the embodiment, the embodiment of the application also provides a corresponding second counting type statistical device.
Referring to fig. 3, fig. 3 is a schematic structural diagram of a second counting type statistic device according to an embodiment of the present application. As shown in fig. 3, the apparatus 300 includes an acquisition unit 301 and a calculation unit 302:
the obtaining unit 301 is configured to obtain a first statistical response by sending a read statistical request at a first time; wherein the first statistical response comprises: a first total count;
the obtaining unit 301 is further configured to obtain a second statistical response by sending a read statistical request at a second time; wherein the second statistical response comprises: a second total count;
the calculating unit 302 is configured to calculate a second counting type statistic according to the first statistical response and the second statistical response.
Optionally, the first statistical response further includes: acquiring a third moment corresponding to the first total count;
the second statistical response further comprises: and acquiring a fourth moment corresponding to the second total count.
Optionally, the first total count includes: counting the total number of the first message;
the second total count includes: the second message total count.
Optionally, the first total packet count includes: the first received message total count;
the second total packet count includes: the second received message total count;
alternatively, the first and second electrodes may be,
the first total packet count includes: a first total transmitted message count;
the second total packet count includes: second message total sent count.
Optionally, the time interval between the first time and the second time is 1 s.
In the second counting type statistic device provided in the above embodiment, the software sends the reading statistic request to the hardware at different times to obtain the first total count and the second total count corresponding to the different times, and the second counting type statistic value is calculated based on the first total count and the second total count. The hardware only needs to count the total count value, so that the consumption of the second counting type counting on the resources by the hardware is reduced, particularly, when the total counting type counting value and the second counting type counting value need to be simultaneously carried out, the hardware only needs to carry out the total counting type counting, the second counting type counting is carried out by combining with the software, the occupation of the hardware on the resources is obviously reduced, and the utilization rate of the hardware resources is improved.
It should be noted that, in the present specification, the embodiments are described in a progressive manner, each embodiment focuses on differences from other embodiments, and the same and similar parts among the embodiments may be referred to each other. The system or the device disclosed by the embodiment corresponds to the method disclosed by the embodiment, so that the description is simple, and the relevant points can be referred to the method part for description.
It is further 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. Without further limitation, an element defined by the phrase "comprising an … …" does not exclude the presence of other identical elements in a process, method, article, or apparatus that comprises the element.
The steps of a method or algorithm described in connection with the embodiments disclosed herein may be embodied directly in hardware, in a software module executed by a processor, or in a combination of the two. A software module may reside in Random Access Memory (RAM), memory, Read Only Memory (ROM), electrically programmable ROM, electrically erasable programmable ROM, registers, hard disk, a removable disk, a CD-ROM, or any other form of storage medium known in the art.
The foregoing is merely a preferred embodiment of the invention and is not intended to limit the invention in any manner. Although the present invention has been described with reference to the preferred embodiments, it is not intended to be limited thereto. Those skilled in the art can make numerous possible variations and modifications to the present teachings, or modify equivalent embodiments to equivalent variations, without departing from the scope of the present teachings, using the methods and techniques disclosed above. Therefore, any simple modification, equivalent change and modification made to the above embodiments according to the technical essence of the present invention are still within the scope of the protection of the technical solution of the present invention, unless the contents of the technical solution of the present invention are departed.
Claims (10)
1. A second counting type statistical method, characterized in that the method comprises:
at a first moment, acquiring a first statistic response by sending a reading statistic request; wherein the first statistical response comprises: a first total count;
at a second moment, a second statistical response is obtained by sending a reading statistical request; wherein the second statistical response comprises: a second total count;
and calculating a second counting type statistic value according to the first statistic response and the second statistic response.
2. The method of claim 1, wherein the first statistical response further comprises: acquiring a third moment corresponding to the first total count;
the second statistical response further comprises: and acquiring a fourth moment corresponding to the second total count.
3. The method of claim 1, wherein the first total count comprises: counting the total number of the first message;
the second total count includes: the second message total count.
4. The method of claim 3, wherein the first packet total count comprises: the first received message total count;
the second total packet count includes: the second received message total count;
alternatively, the first and second electrodes may be,
the first total packet count includes: a first total transmitted message count;
the second total packet count includes: second message total sent count.
5. The method of claim 1, wherein the time interval between the first time and the second time is 1 s.
6. A second counting type statistic device, characterized in that said device comprises an acquisition unit and a calculation unit:
the acquisition unit is used for acquiring a first statistical response by sending a reading statistical request at a first moment; wherein the first statistical response comprises: a first total count;
the obtaining unit is further configured to obtain a second statistical response by sending a read statistical request at a second time; wherein the second statistical response comprises: a second total count;
and the calculating unit is used for calculating a second counting type statistic value according to the first statistic response and the second statistic response.
7. The apparatus of claim 6, wherein the first statistical response further comprises: acquiring a third moment corresponding to the first total count;
the second statistical response further comprises: and acquiring a fourth moment corresponding to the second total count.
8. The apparatus of claim 6, wherein the first total count comprises: counting the total number of the first message;
the second total count includes: the second message total count.
9. The apparatus of claim 8, wherein the first packet total count comprises: the first received message total count;
the second total packet count includes: the second received message total count;
alternatively, the first and second electrodes may be,
the first total packet count includes: a first total transmitted message count;
the second total packet count includes: second message total sent count.
10. The apparatus of claim 6, wherein the time interval between the first time and the second time is 1 s.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202010237293.0A CN111464385A (en) | 2020-03-30 | 2020-03-30 | Second counting type statistical method and device |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202010237293.0A CN111464385A (en) | 2020-03-30 | 2020-03-30 | Second counting type statistical method and device |
Publications (1)
Publication Number | Publication Date |
---|---|
CN111464385A true CN111464385A (en) | 2020-07-28 |
Family
ID=71680224
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202010237293.0A Pending CN111464385A (en) | 2020-03-30 | 2020-03-30 | Second counting type statistical method and device |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN111464385A (en) |
Citations (7)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
WO2002001801A2 (en) * | 2000-06-30 | 2002-01-03 | Measure Technology Ireland Limited | Measure and recording of traffic parameters in data transmission networks |
CN102413055A (en) * | 2011-12-19 | 2012-04-11 | 曙光信息产业(北京)有限公司 | System and method for marking timestamps of messages based on software and hardware |
CN103746856A (en) * | 2014-01-28 | 2014-04-23 | 华为技术有限公司 | Method for preventing service interruption and network equipment |
CN107332732A (en) * | 2017-06-26 | 2017-11-07 | 迈普通信技术股份有限公司 | A kind of method of sampling of message flow, device and routing device |
CN107996023A (en) * | 2016-11-23 | 2018-05-04 | 华为技术有限公司 | Monitor method, equipment and the Virtual Networking System of virtual network |
CN108121675A (en) * | 2017-12-04 | 2018-06-05 | 北京信而泰科技股份有限公司 | Timestamp synchronous method and device between different clock-domains |
CN110071853A (en) * | 2019-04-30 | 2019-07-30 | 新华三技术有限公司 | A kind of message statistical method and the network equipment |
-
2020
- 2020-03-30 CN CN202010237293.0A patent/CN111464385A/en active Pending
Patent Citations (7)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
WO2002001801A2 (en) * | 2000-06-30 | 2002-01-03 | Measure Technology Ireland Limited | Measure and recording of traffic parameters in data transmission networks |
CN102413055A (en) * | 2011-12-19 | 2012-04-11 | 曙光信息产业(北京)有限公司 | System and method for marking timestamps of messages based on software and hardware |
CN103746856A (en) * | 2014-01-28 | 2014-04-23 | 华为技术有限公司 | Method for preventing service interruption and network equipment |
CN107996023A (en) * | 2016-11-23 | 2018-05-04 | 华为技术有限公司 | Monitor method, equipment and the Virtual Networking System of virtual network |
CN107332732A (en) * | 2017-06-26 | 2017-11-07 | 迈普通信技术股份有限公司 | A kind of method of sampling of message flow, device and routing device |
CN108121675A (en) * | 2017-12-04 | 2018-06-05 | 北京信而泰科技股份有限公司 | Timestamp synchronous method and device between different clock-domains |
CN110071853A (en) * | 2019-04-30 | 2019-07-30 | 新华三技术有限公司 | A kind of message statistical method and the network equipment |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
Zhuo et al. | Win-Coupon: An incentive framework for 3G traffic offloading | |
CN111177201B (en) | Data stream processing method and related device | |
CN102281290B (en) | Emulation system and method for a PaaS (Platform-as-a-service) cloud platform | |
CN102681999A (en) | Method and device for collecting and sending user action information | |
EP3952233A1 (en) | Tcp congestion control method, apparatus, terminal, and readable storage medium | |
CN106464733B (en) | The method and device of virtual resource in a kind of adjustment cloud computing | |
CN103067297A (en) | Dynamic load balancing method and device based on resource consumption prediction | |
CN103647670A (en) | Sketch based data center network flow analysis method | |
CN110831038A (en) | Network slice resource scheduling method and device | |
CN114979158B (en) | Resource monitoring method, system, equipment and computer readable storage medium | |
CN112260889B (en) | Linux-based process flow monitoring method, system and equipment | |
WO2023109806A1 (en) | Method and apparatus for processing active data for internet of things device, and storage medium | |
CN113468226A (en) | Service processing method, device, electronic equipment and storage medium | |
CN115208518A (en) | Data transmission control method, device and computer readable storage medium | |
US10638336B2 (en) | Method of enabling improved efficiency in a first communications network, network entity, network device, computer programs and computer program products | |
CN102802214A (en) | System and method for rate self-adaptation based on WLAN (Wireless Local Area Network) | |
Chang et al. | Time dependent adaptive pricing for mobile internet access | |
WO2021147319A1 (en) | Data processing method, apparatus, device, and medium | |
CN111464385A (en) | Second counting type statistical method and device | |
JP2022542365A (en) | Start or postpone radio transmission according to dwell time limit | |
CN113760640A (en) | Monitoring log processing method, device, equipment and storage medium | |
CN109150819B (en) | A kind of attack recognition method and its identifying system | |
CN108390770A (en) | A kind of information generating method, device and server | |
CN112929432B (en) | Broadcasting method, equipment and storage medium based on repeated broadcasting history | |
US10257114B2 (en) | Method and apparatus for allocating network medium resources |
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 | ||
RJ01 | Rejection of invention patent application after publication | ||
RJ01 | Rejection of invention patent application after publication |
Application publication date: 20200728 |