CN105791035A - Data statistical method and device - Google Patents
Data statistical method and device Download PDFInfo
- Publication number
- CN105791035A CN105791035A CN201410777095.8A CN201410777095A CN105791035A CN 105791035 A CN105791035 A CN 105791035A CN 201410777095 A CN201410777095 A CN 201410777095A CN 105791035 A CN105791035 A CN 105791035A
- Authority
- CN
- China
- Prior art keywords
- data statistics
- index
- index information
- message
- list
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Granted
Links
Landscapes
- Data Exchanges In Wide-Area Networks (AREA)
Abstract
The invention provides a data statistical method and device. The method comprises the following steps of: obtaining a data statistical message including index information and data statistical information; judging whether the index information same as the index information in the data statistical message exists in an index list or not; and, if the index information same as the index information in the data statistical message exists in the index list, determining updated data statistical information corresponding to the index information in the index list according to the data statistical information corresponding to the index information in the index list and the data statistical information in the data statistical message. By means of the data statistical method in the embodiment of the invention, data in a network can be accounted accurately and rapidly.
Description
Technical field
The present invention relates to network communication technology field, particularly to a kind of data statistical approach and device.
Background technology
Along with the application of network is more and more extensive, the data traffic in network also gets more and more.In order to facilitate network manager to grasp the feature of network traffic data in time, urgently desirable to provide the quick data statistical approach of one.
In prior art, processing the data in statistics network usually by data statistics message adds unblock, wherein, data statistics message includes the index address of data and the data statistics value corresponding with this index address.When data statistics message adding unblock and processing, first data statistics message locked by data statistics device, and count the data statistics value under the index address in this data statistics message when locking successfully;After statistics completes, this data statistics message is unlocked.
But, the situation failed owing to being likely to occur locking when data statistics message is locked, for two continuous data statistical message that index address is identical, when second data statistics message is locked, if locking unsuccessfully, after needing first data statistics message of wait to unlock, just relocking second data statistics message to add up, it is consuming time longer that data statistics Messages-Waiting relocks;It addition, data statistics device needs to perform continually to add solution latching operation in data statistics process, adding solution latching operation itself consuming time also long, therefore the speed of data statistics is slower.
Summary of the invention
In view of this, the present invention provides a kind of data statistical approach and device, to solve the slow problem of data statistics.
First aspect according to embodiments of the present invention, it is provided that a kind of data statistical approach, described method includes:
Obtaining data statistics message, described data statistics message includes index information and data statistics;
Judge whether described index list exists the index information identical with the index information in described data statistics message;
If described index list exists the index information identical with the index information in described data statistics message, then according to data statistics corresponding with described index information in described index list, and the data statistics in described data statistics message, it is determined that the data statistics after renewal corresponding with described index information in described index list.
Second aspect according to embodiments of the present invention, it is provided that a kind of data statistics device, described device includes:
Acquiring unit, is used for obtaining data statistics message, and described data statistics message includes index information and data statistics;
Judging unit, for judging whether there is the index information identical with the index information in described data statistics message in described index list;
Updating block, for when described index list exists the index information identical with the index information in described data statistics message, according to data statistics corresponding with described index information in described index list, and the data statistics in described data statistics message, it is determined that the data statistics after renewal corresponding with described index information in described index list.
In sum, owing to have employed technique scheme, the invention has the beneficial effects as follows:
In the embodiment of the present invention, data statistics device is by indexing list, and when there is the index information identical with index information in the data statistics message obtained in index list, according to the data statistics message in data statistics corresponding with this index information in index list and data statistics message, determine the data statistics after renewal corresponding with this index information in index list, it is possible to the data in statistics network quickly and accurately.
Accompanying drawing explanation
Fig. 1 is an embodiment flow chart of data statistical approach of the present invention;
Fig. 2 is another embodiment flow chart of data statistical approach of the present invention;
Fig. 3 is another embodiment flow chart of data statistical approach of the present invention;
Fig. 4 is a kind of hardware structure diagram of data statistics device place of the present invention equipment;
Fig. 5 is an embodiment block diagram of data statistics device of the present invention.
Detailed description of the invention
In order to make those skilled in the art be more fully understood that the technical scheme in the embodiment of the present invention, and it is understandable to enable the above-mentioned purpose of the embodiment of the present invention, feature and advantage to become apparent from, below in conjunction with accompanying drawing, technical scheme in the embodiment of the present invention is described in further detail.
Referring to Fig. 1, for an embodiment flow chart of data statistical approach of the present invention, the method may comprise steps of:
Step 101, acquisition data statistics message, can include index information and data statistics in this data statistics message.Wherein, this index information can be index address or the acquisition sequencing according to data statistics message, for the index value that the index address of data distributes;This data statistics can be the data statistics value in units of word or byte etc..Data statistics device can find these data according to the index information of data;Data statistics according to data may determine that the quantity of these data, and such as these data occupy how many words or bytes etc..
In a preferred embodiment of the invention, after data statistics device obtains data statistics message first, data statistics device can index list, and this index list includes index information and the data statistics corresponding with this index information.
Data statistics device is when indexing list, first index address and the data statistics of these data can be obtained according to this data statistics message, the data form of this data statistics message is as shown in Figure 2, wherein, this data statistics message includes eight bytes, index address accounts for four bytes (namely 32), data statistics accounts for three bytes (namely 24), such as, for the data statistics message that data form is " 0x1234abcd00605040 ", the index address of data is " 0x1234abcd ", and data statistics is " 0x060504 ";For the data statistics message that data form is " 0x1a2b3c4d00010203 ", the index address of these data is " 0x1a2b3c4d ", and data statistics is " 0x010203 ".
Data statistics device is after the index address obtaining these data, it is possible to according to the acquisition sequencing of data statistics message, the index address for data distributes index value, thus obtaining the index information of these data.Wherein, the index address distribution numerical value that data statistics device can be the data statistics message obtained first is the index value of 1, by that analogy.Owing in data statistics message, the index address of each data is likely discrete value, and maximum index address is likely to be breached 0xffffffff, the internal memory that the value of index address more takies greatly is more big, therefore data statistics device is by the index value corresponding with the index address of these data for the distribution of each data, the utilization rate of internal memory can be improved, reduce the waste of hardware resource.
Data statistics device is after the index information obtaining these data, it is possible to create new list item to store index information and the data statistics corresponding with this index information, thus indexing list.
Step 102, judging whether index list exists the index information identical with the index information in data statistics message, if existing, then performing step 103;Otherwise, step 104 is performed.
In a preferred embodiment of the invention, when data statistics device obtains data statistics message again, due to index list not for empty, therefore data statistics device needs to judge whether to exist in index list the index information identical with the index information in data statistics message.
Step 103, according to data statistics corresponding with this index information in index list, and the data statistics of this data statistics message, it is determined that the data statistics after renewal corresponding with this index information in index list.
In a preferred embodiment of the invention, when the data statistics value that this data statistics is in units of word or byte etc., data statistics device can by data statistics value corresponding with this index information in index list, it is added with the data statistics value of this data statistics message, and the result that will add up is as the data statistics value after renewal corresponding with this index information in index list.
Step 104, in index list, create new list item, store the index information in data statistics message and data statistics.
As seen from the above-described embodiment, data statistics device is by indexing list, and when there is the index information identical with index information in the data statistics message obtained in index list, according to the data statistics message in data statistics corresponding with this index information in index list and data statistics message, determine the data statistics after renewal corresponding with this index information in index list, it is possible to count the data in network quickly and accurately.
In the above-described embodiments, due to FPGA (Field-ProgrammableGateArray, i.e. field programmable gate array) there is the feature of high-speed read-write, therefore data statistics device can adopt FPGA to realize the statistics of data in network, thus improving data statistics speed.Further, since data volume is relatively larger in network, index list can be stored in DRAM (DynamicRandomAccessMemory, dynamic random access memory) by data statistics device, thus reducing space occupancy rate.
Referring to Fig. 3, flow chart for another embodiment of data statistical approach of the present invention, in this embodiment, data statistics device obtains three data statistics message A, B1 and B2 successively, wherein data statistics message A, B1 and B2 data statistics value be 100, index information in data statistics message B1 and B2 is identical, and the index information in data statistics message A and data statistics message B1 and B2 differs.Index list is not for empty, and is all absent from the index information identical with the index information of data statistics message A, B1 and B2 in index list, adopts and may include that during the method statistic data in the present invention
Step 301, obtain data statistics message A time, owing to index list being absent from the index information identical with the index information in data statistics message A, in index list, therefore set up new list item to the index information storing in data statistics message A and data statistics value.
Step 302, obtain data statistics message B1 time, owing to index list being absent from the index information identical with the index information in data statistics message B1, in index list, therefore set up new list item to the index information storing in data statistics message B1 and data statistics value.
Step 303, obtain data statistics message B2 time, owing to the index information in data statistics message B1 and B2 is identical, therefore index list exists the index information identical with the index information in data statistics message B2, now, the data statistics value 100 of the data statistics message B1 stored in index list can be added by data statistics device with the data statistics value 100 in data statistics message B2, using the result 200 that is added as the data statistics value after renewal corresponding with this index information in index list.
Corresponding with aforementioned data statistical method embodiment, present invention also offers the embodiment of data statistics device.
Data statistics device embodiment of the present invention can be realized by software, it is also possible to is realized by the mode of hardware or software and hardware combining.Implemented in software for example, as the device on a logical meaning, it is that computer program instructions corresponding in nonvolatile memory is read to run in internal memory and formed by the processor by its place equipment.Say from hardware view; as shown in Figure 4; a kind of hardware structure diagram for data statistics device place of the present invention equipment; except the processor shown in Fig. 4, network interface, memorizer; in embodiment, the equipment at device place generally can also include other hardware, such as the forwarding chip etc. of responsible process message;This equipment from hardware configuration is it is also possible that distributed equipment, it is possible to include multiple interface card, in order to carry out the extension of Message processing at hardware view.
Referring to Fig. 5, for an embodiment block diagram of data statistics device of the present invention, this device may include that
Acquiring unit 510, is used for obtaining data statistics message, and described data statistics message includes index information and data statistics;
Judging unit 520, for judging whether there is the index information identical with the index information in described data statistics message in described index list;
Updating block 530, for when described index list exists the index information identical with the index information in described data statistics message, according to data statistics corresponding with described index information in described index list, and the data statistics in described data statistics message, it is determined that the data statistics after renewal corresponding with described index information in described index list.
In an optional implementation, described device can also include:
Setting up unit 540, for indexing list after obtaining data statistics message, described index list includes index information and the data statistics corresponding with described index information.
In another optional implementation, described device can also include:
Creating unit 550, for when described index list is absent from the index information identical with the index information in described data statistics message, described index list creates for new list item, stores the index information in described data statistics message and data statistics.
In another optional implementation,
Described updating block 530, specifically for when described index list exists the index information identical with the index information in described data statistics message, if the data statistics of described index list and described data statistics message is data statistics value, then by data statistics value corresponding with described index information in described index list, it is added with the data statistics value in described data statistics message, and using the result of described addition as the data statistics value after renewal corresponding with described index information in described index list.
In another optional implementation,
Index information in described index list and described data statistics message may include that the index address of data or according to the acquisition sequencing of described data statistics message, for the index value that the index address of each data distributes.
What in said apparatus, the function of unit and the process that realizes of effect specifically referred in said method corresponding step realizes process, does not repeat them here.
For device embodiment, owing to it corresponds essentially to embodiment of the method, so relevant part illustrates referring to the part of embodiment of the method.Device embodiment described above is merely schematic, the wherein said unit illustrated as separating component can be or may not be physically separate, the parts shown as unit can be or may not be physical location, namely may be located at a place, or can also be distributed on multiple NE.Some or all of module therein can be selected according to the actual needs to realize the purpose of the present invention program.Those of ordinary skill in the art, when not paying creative work, are namely appreciated that and implement.
As seen from the above-described embodiment, data statistics device is by indexing list, and when there is the index information identical with index information in the data statistics message obtained in index list, according to the data statistics message in data statistics corresponding with this index information in index list and data statistics message, determine the data statistics after renewal corresponding with this index information in index list, it is possible to the data in statistics network quickly and accurately.
Those skilled in the art, after considering description and putting into practice invention disclosed herein, will readily occur to other embodiment of the present invention.The application is intended to any modification of the present invention, purposes or adaptations, and these modification, purposes or adaptations are followed the general principle of the present invention and include the undocumented known general knowledge in the art of the present invention or conventional techniques means.Description and embodiments is considered only as exemplary, and the true scope of the present invention and spirit are pointed out by claim below.
It should be appreciated that the invention is not limited in precision architecture described above and illustrated in the accompanying drawings, and various amendment and change can carried out without departing from the scope.The scope of the present invention is only limited by appended claim.
Claims (10)
1. a data statistical approach, it is characterised in that described method includes:
Obtaining data statistics message, described data statistics message includes index information and data statistics;
Judge whether index list exists the index information identical with the index information in described data statistics message;
If described index list exists the index information identical with the index information in described data statistics message, then according to data statistics corresponding with described index information in described index list, and the data statistics in described data statistics message, it is determined that the data statistics after renewal corresponding with described index information in described index list.
2. method according to claim 1, it is characterised in that after described acquisition data statistics message, described method also includes:
Indexing list, described index list includes index information and the data statistics corresponding with described index information.
3. method according to claim 1, it is characterised in that described method also includes:
If described index list is absent from the index information identical with the index information in described data statistics message, then in described index list, creates new list item, store the index information in described data statistics message and data statistics.
4. method according to claim 1, it is characterized in that, according to data statistics corresponding with described index information in described index list, and the data statistics in described data statistics message, determine the data statistics after renewal corresponding with described index information in described index list, particularly as follows:
When the data statistics of described index list and described data statistics message is data statistics value, by data statistics value corresponding with described index information in described index list, it is added with the data statistics value in described data statistics message, and using the result of described addition as the data statistics value after renewal corresponding with described index information in described index list.
5. method according to any one of claim 1 to 4, it is characterized in that, index information in described index list and described data statistics message includes: the index address of data or the acquisition sequencing according to described data statistics message, for the index value that the index address of each data distributes.
6. a data statistics device, it is characterised in that described device includes:
Acquiring unit, is used for obtaining data statistics message, and described data statistics message includes index information and data statistics;
Judging unit, for judging whether there is the index information identical with the index information in described data statistics message in described index list;
Updating block, for when described index list exists the index information identical with the index information in described data statistics message, according to data statistics corresponding with described index information in described index list, and the data statistics in described data statistics message, it is determined that the data statistics after renewal corresponding with described index information in described index list.
7. device according to claim 6, it is characterised in that described device also includes:
Setting up unit, for indexing list after obtaining data statistics message, described index list includes index information and the data statistics corresponding with described index information.
8. device according to claim 6, it is characterised in that described device also includes:
Creating unit, for when being absent from the index information identical with the index information in described data statistics message in described index list, creating new list item, store the index information in described data statistics message and data statistics in described index list.
9. device according to claim 6, it is characterized in that, described updating block, specifically for when described index list exists the index information identical with the index information in described data statistics message, if the data statistics of described index list and described data statistics message is data statistics value, then by data statistics value corresponding with described index information in described index list, it is added with the data statistics value in described data statistics message, and using the result of described addition as the data statistics value after renewal corresponding with described index information in described index list.
10. the device according to any one of claim 6 to 9, it is characterized in that, index information in described index list and described data statistics message includes: the index address of data or the acquisition sequencing according to described data statistics message, for the index value that the index address of each data distributes.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201410777095.8A CN105791035B (en) | 2014-12-15 | 2014-12-15 | Data statistical approach and device |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201410777095.8A CN105791035B (en) | 2014-12-15 | 2014-12-15 | Data statistical approach and device |
Publications (2)
Publication Number | Publication Date |
---|---|
CN105791035A true CN105791035A (en) | 2016-07-20 |
CN105791035B CN105791035B (en) | 2019-05-07 |
Family
ID=56374660
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201410777095.8A Active CN105791035B (en) | 2014-12-15 | 2014-12-15 | Data statistical approach and device |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN105791035B (en) |
Citations (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN101119246A (en) * | 2007-09-20 | 2008-02-06 | 杭州华三通信技术有限公司 | Data packet sampling statistic method and apparatus |
CN101321088A (en) * | 2008-07-18 | 2008-12-10 | 北京星网锐捷网络技术有限公司 | Method and device for IP data flow information statistics |
CN102255754A (en) * | 2011-07-08 | 2011-11-23 | 中国人民解放军国防科学技术大学 | Serial accessing high speed backbone network traffic acquisition and monitoring method |
US20130294249A1 (en) * | 2012-04-23 | 2013-11-07 | Huawei Technologies Co., Ltd. | Method, apparatus, and system for flow measurement |
CN103647666A (en) * | 2013-12-13 | 2014-03-19 | 北京中创信测科技股份有限公司 | Method and apparatus for counting call detail record (CDR) messages and outputting results in real time |
-
2014
- 2014-12-15 CN CN201410777095.8A patent/CN105791035B/en active Active
Patent Citations (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN101119246A (en) * | 2007-09-20 | 2008-02-06 | 杭州华三通信技术有限公司 | Data packet sampling statistic method and apparatus |
CN101321088A (en) * | 2008-07-18 | 2008-12-10 | 北京星网锐捷网络技术有限公司 | Method and device for IP data flow information statistics |
CN102255754A (en) * | 2011-07-08 | 2011-11-23 | 中国人民解放军国防科学技术大学 | Serial accessing high speed backbone network traffic acquisition and monitoring method |
US20130294249A1 (en) * | 2012-04-23 | 2013-11-07 | Huawei Technologies Co., Ltd. | Method, apparatus, and system for flow measurement |
CN103647666A (en) * | 2013-12-13 | 2014-03-19 | 北京中创信测科技股份有限公司 | Method and apparatus for counting call detail record (CDR) messages and outputting results in real time |
Also Published As
Publication number | Publication date |
---|---|
CN105791035B (en) | 2019-05-07 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
US10915365B2 (en) | Determining a quantity of remote shared partitions based on mapper and reducer nodes | |
CN106844041B (en) | Memory management method and memory management system | |
US8381230B2 (en) | Message passing with queues and channels | |
CN108572876B (en) | Method and device for realizing read-write lock | |
CN105224255B (en) | A kind of storage file management method and device | |
CN105843819B (en) | Data export method and device | |
EP3958122A1 (en) | Memory management method, apparatus, and system | |
CN103927305B (en) | It is a kind of that the method and apparatus being controlled is overflowed to internal memory | |
CN103324713B (en) | Data processing method and device in multistage server and data processing system | |
US10599436B2 (en) | Data processing method and apparatus, and system | |
DE112017003294T5 (en) | Technologies for scalable sending and receiving of packets | |
CN103150149A (en) | Method and device for processing redo data of database | |
US11210343B2 (en) | Graph data processing method and apparatus thereof | |
CN110119304A (en) | A kind of interruption processing method, device and server | |
CN103246653A (en) | Data processing method and device | |
US20130061009A1 (en) | High Performance Free Buffer Allocation and Deallocation | |
US8543722B2 (en) | Message passing with queues and channels | |
US9923794B2 (en) | Method, apparatus, and system for identifying abnormal IP data stream | |
CN103853504B (en) | Data access method of caching system | |
US8341368B2 (en) | Automatic reallocation of structured external storage structures | |
CN106411545A (en) | Service attribute counting method and device | |
CN105022833A (en) | Data processing method, nodes and monitoring system | |
CN105791035A (en) | Data statistical method and device | |
CN110716814B (en) | Performance optimization method and device for inter-process large-data-volume communication | |
CN108021448A (en) | A kind of optimization method and device of kernel spacing |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
C06 | Publication | ||
PB01 | Publication | ||
C10 | Entry into substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
CB02 | Change of applicant information |
Address after: Binjiang District and Hangzhou city in Zhejiang Province Road 310051 No. 68 in the 6 storey building Applicant after: Hangzhou Dipu Polytron Technologies Inc Address before: Binjiang District and Hangzhou city in Zhejiang Province Road 310051 No. 68 in the 6 storey building Applicant before: Hangzhou Dipu Technology Co., Ltd. |
|
CB02 | Change of applicant information | ||
GR01 | Patent grant | ||
GR01 | Patent grant |