CN100334846C - High precision network delay measuring method based on universal PC - Google Patents
High precision network delay measuring method based on universal PC Download PDFInfo
- Publication number
- CN100334846C CN100334846C CNB2005100322769A CN200510032276A CN100334846C CN 100334846 C CN100334846 C CN 100334846C CN B2005100322769 A CNB2005100322769 A CN B2005100322769A CN 200510032276 A CN200510032276 A CN 200510032276A CN 100334846 C CN100334846 C CN 100334846C
- Authority
- CN
- China
- Prior art keywords
- measurement
- packet
- interface card
- network interface
- universal
- 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.)
- Expired - Fee Related
Links
Images
Landscapes
- Data Exchanges In Wide-Area Networks (AREA)
Abstract
The present invention relates to a testing and monitoring technology for performance of a computer network, which is a network delay measuring method with high precision based on a universal PC. The present invention comprise that by using a software structure and a hardware structure of a universal PC, when a timestamp counter in a CPU replaces an operating system clock to keep time, the frequency of the CPU is simultaneously and periodically estimated, and the error of the measuring clock is eliminated; by modifying an inner core of an operating system, the recording positions of a packet receiving timestamp and a packet sending timestamp are diverted from a measuring program to a network card to drive, and the packet receiving timestamp and the packet sending timestamp driven to record by the network card are directly read from the measuring program so as to eliminate measuring position errors. Compared with the traditional delay measuring method, under the condition of different packet length, the present invention reduces 21% to 150% of measurement errors, greatly improves delay measurement precisions, has stable measuring result, and does not basically influence the throughput of a system. The method is realized by the universal PC structure, has high measuring precision and low measurement cost, and is suitable for commonly use.
Description
Technical field
The present invention relates to computer network performance test and monitoring technique, particularly the application of computer network latency measurement and performance measurement.
Background technology
Time delay is one of build-in attribute of network, also is the basic index of evaluating network performance.Latency measurement also is simultaneously the basis of measuring performance index such as delay variation, the network bandwidth in field extensive application such as network performance monitoring, network behavior analysis, network application designs.Technology before relates generally to the time delay feature of definition, measurement realization and the network path or the equipment of time delay, does not analyze the precision problem of latency measurement.Along with the lifting of network rate, need the cheap high-precision time-delay method of measurement of design.
Latency measurement mainly contains two source of errors: the one, measure influences such as resolution, skew and the shake measurement accuracy of timekeeping of host computer system clock and the error that produces, and be referred to as clocking error here.The one, owing to the measure error that the packet receiving of surveying record, the timestamp of giving out a contract for a project are not real packet receivings, the moment of giving out a contract for a project produces, be referred to as site error here.This two classes error is all being measured the main frame generation, and the purpose of indexs such as measurement time delay, delay variation, bandwidth is awareness network situation and performance, and measurement result will make network performance evaluation inaccurate if comprised the measure error of being brought by main frame.So must eliminate and measure clocking error and the site error that main frame produced, improve the latency measurement precision as far as possible.
(Network Time Protocol NTP) can be used as the clock source of measuring main frame to NTP (Network Time Protocol), and makes the measurement host clock synchronous.But its clock accuracy partly depends on the path delay of time between master synchronization, and this measuring object of latency measurement just.So Network Time Protocol should not be as the clock source of latency measurement.Introduce during measurement as global positioning system (Global Position System, external clock reference GPS) can be eliminated the clocking error of measurement, its clock accuracy can reach 1 microsecond.But gps system costs an arm and a leg, and measures main frame and is connected with gps antenna apart from can not be oversize, and measurement main frame deployed position is limited; In addition, site error is not still eliminated.Designed at present and be exclusively used in the bag DAG card of catching, it can be when packet be received by system logging timestamp, thereby eliminate the site error of measuring.Proposition DAG card and gps system are integrated in " the New Measurements with the RIPE NCC TestTraffic Measurement Setup " of " Proceedings of Passive and ActiveMeasurement Workshop 2002 " literary composition, can eliminate the clocking error and the site error of measurement simultaneously, realize high-precision latency measurement.But the required hardware price costliness of this mode is installed complexity, is difficult to generally dispose in comprising the large scale network measuring system of hundreds of measurement main frames.Under the background that current universal PC hardware performance has been greatly improved, use with low cost based on the high-precision time-delay method of measurement of universal PC framework to realizing, implement convenient, measure accurate large scale network performance monitoring and the network behavior analysis has meaning.
Summary of the invention
The technical problem to be solved in the present invention is, defective at the prior art existence, propose a kind of high precision network delay measuring method based on universal PC, it improves the latency measurement precision based on the universal PC framework by clocking error and the site error of eliminating latency measurement; Have the characteristics that cost is low, measurement result is stablized, be suitable for generally adopting of measuring.
Technical solution of the present invention is that described high precision network delay measuring method based on universal PC comprises:
(1) utilize soft, the hardware structure of universal PC, (Time StampCounter TSC) replaces the operation system clock timing, regularly estimates cpu frequency simultaneously, eliminates the clocking error of measuring with the Time Stamp Counter of CPU inside;
(2) by the retouching operation system kernel, packet receiving, the timestamp of giving out a contract for a project record position are transferred to network interface card from process of measurement and driven, and directly read the packet receiving of network interface card activation record, the timestamp of giving out a contract for a project from process of measurement, eliminate the site error of measuring.
Below the present invention made further specify.
Among the present invention, it is indirect clock source that described cpu frequency is regularly estimated with the high accuracy ntp server.
Among the present invention, described retouching operation system kernel comprises:
A. revise the bag receiver function that network interface card drives, the beginning of the packet receiver function hard_rx () that drives at network interface card partly adds the timing statement.
B. revise the bag receiver module of system, the bag time of reception that makes process of measurement can directly read the network interface card activation record stabs;
C. revise the bag that network interface card drives and send function, the beginning that the packet that drives at network interface card sends function hard_start_xmit () partly adds the timing statement;
D. revise the bag sending module of system and struct sock and the definition of structsk_buff structure type that system kernel is used to store packet, the bag transmitting time that makes process of measurement can directly read the network interface card activation record is stabbed.
Referring to Fig. 1, a kind of detailed process that cpu frequency of the present invention is estimated is, MP is the PC that carries out latency measurement, when estimating cpu frequency, MP sends the NTP request package and writes down TSC register counting as bag transmitting time s to ntp server, after ntp server is received request, the record request time of receipt (T of R) stabbed ts and it is write the NTP bag return to MP; Record TSC register counting was as bag time of receipt (T of R) r after MP received the NTP respond packet, and this moment, MP can obtain a round-trip delay measured value rtt to ntp server, and its unit is the cpu clock cycle; And ntp server is received the timestamp ts of NTP request package.MP is to repeat this process than the minor cycle (as every one second), and after after a while, MP can measure the minimum value of several rtt.Minimal time delay is a packet in the propagation delay time of network and the signal propagation delay sum at physical link, is the intrinsic time delay that is caused by network topology and transmission technology.It is not influenced by offered load, and its size is changeless.Thereby, measure bag for the minimum round-trip delay that two continuous measurements are arrived, their One Way Delay from MP to the ntp server also equate.As shown in Figure 1, establishes i, a j request package and measure minimum rtt, and the request package between them all do not measure minimum rtt, have:
ts
1-s
1/f
CPU=ts
j-s
i/f
CPU
Then:
(s
1-s
1)/F
CPU=ts
1-ts
1
Promptly two request package equal at the time of reception of destination at interval at the transmission time interval of source end.So cpu frequency f
CPUCan estimate by following formula:
f
CPU=(s
j-s
1)/(ts
j-ts
i)
Repeat above-mentioned minimal time delay measuring process MP hour interbody spacer, estimate cpu frequency sustainably, the cpu frequency that caused by factors such as variations in temperature, chip are aging with real-time discovery changes, and guarantees the accuracy of TSC register timing.In addition, for further reducing network to the cpu frequency estimation effect, the near ntp server of chosen distance MP of can trying one's best, that is select the less ntp server of round-trip delay as far as possible.The TSC register value can the rdtsc assembly instruction be read.
As shown in Figure 2, present latency measurement program is measured the transmitting time stamp and the time of reception stamp computing network time delay of wrapping at application program (user's space) record usually.Promptly as shown in the drawing, measure the transmitting time of bag at ts1 position record and stab, measure the packet receiving timestamp of bag at ts5 position record, with the two difference as the latency measurement value.The present invention makes amendment to the network process module of linux system kernel, proposition record in network interface card drives is given out a contract for a project, the time-delay measuring method of packet receiving timestamp, promptly the timestamp of giving out a contract for a project measured in ts2 position record in the drawings, and the packet receiving timestamp measured in record in the ts3 position.This be in the system kernel software the most approaching measurement truly give out a contract for a project, packet receiving position constantly, eliminated the site error in measuring.
Eliminate the site error of packet receiving and mainly divide two steps: record packet receiving timestamp in network interface card drives passes to process of measurement with the packet receiving timestamp that writes down.Record packet receiving timestamp was simpler during network interface card drove, and the beginning of the packet receiver function hard_rx () that drives at network interface card partly adds the timing statement and gets final product.To at first write down the packet receiving timestamp when network interface card is handled the packet that receives like this.How the packet receiving timestamp that writes down is passed to process of measurement and need more analyses.To distribute the buffer memory skb of a struct sk_buff type (include linux skbuff.h) to preserve this packet and some relevant informations when network interface card is received packet, and be used to preserve the packet time of reception comprising the member stamp of a struct timeval structure and stab.Stamp assignment not in unmodified packet receiver function, therefore the end of packet receiver function need before the packet receiving timestamp that writes down copy among the stamp member of buffer memory skb.In the netif_rx of equipment independent stratum () function (net core dev.c), system can beat timestamp and be kept at the stamp member of skb structure the packet that receives, the packet receiving timestamp of network interface card activation record before This move can cover needs to adjust.To be netif_rx () beat before the timestamp to packet method, judges earlier whether the stamp member of skb structure is empty, if be empty, shows that the network interface card driving write down bag time of reception stamp, do not need record again; Otherwise packet is beaten timestamp and is kept among the stamp member of skb structure.The skb structure transmission that will successively make progress afterwards, and be connected among the struct sock structure sk (include net sock.h).The sk structure is created when application call socket () creates socket, exists before socket is closed always.It has preserved the protocol informations such as host-host protocol, local ip address, IP address, destination of packet, and the time of reception that the member stamp that also comprises a struct timeval structure is used to preserve packet stabs.The struct timeval structure member stamp of skb buffer memory finally is copied among the member stamp of sk structure.After application program was created socket, system provided an ioctl () to call, and can carry out I/O control to the socket of creating.The call parameters that this calls a SIOCGSTAMP, the stamp member who is used for reading the sk structure, promptly the packet time of reception stabs.After system kernel carried out above-mentioned change, the latency measurement program after receiving packet be with SIOCGSTAMP before parameter call ioctl () promptly obtains in network interface card drives the packet receiving timestamp of record.The packet time of receipt (T of R) of latency measurement program record will be system's timestamp that ts3 beats the position in Fig. 2 like this, eliminate the site error of packet receiving substantially.
Two steps of the same branch of site error when elimination is given out a contract for a project: in network interface card drives, write down the timestamp of giving out a contract for a project, the timestamp of giving out a contract for a project that writes down is passed to process of measurement.The record timestamp of giving out a contract for a project was simpler during network interface card drove, and the beginning that the packet that drives at network interface card sends function hard_start_xmit () partly adds the timing statement and gets final product.To at first write down the timestamp of giving out a contract for a project when network interface card sends packet like this.How will writing down the timestamp of giving out a contract for a project, to pass to process of measurement then more difficult.At first, revise struct sock and the definition of structsk_buff structure type that system kernel is used to store packet, the member sndstamp that increases struct timeval structure type respectively in two structures is used for preserving the bag transmitting time and stabs.Can send at the packet that network interface card drives then and write down the member sndstamp that struct sk_buff structure buffer memory skb was stabbed and be saved in to the bag transmitting time among the function hard start_xmit ().Send successfully at bag, when system turns back to ip_build_xmit () function, the skb buffer memory will be released, so in ip_build_xmit () function the sndstamp member of skb is copied among the sndstamp member of struct sock structure buffer memory sk.At last, revise ioctl () system call (net/ipv4/af_inet.c), increase by a call parameters SIOCGSNDSTAMP, calling the sndstamp member in the struct sock structure with the ioctl () of this parameter is that the packet transmitting time of network interface card activation record is stabbed copy and given application program.The packet transmitting time of latency measurement program record will be system's timestamp that ts2 beats the position in Fig. 2 like this, eliminate the site error of giving out a contract for a project substantially.
Fig. 4 has shown that the present invention compares with traditional time-delay measuring method, and wherein the inventive method measurement result is steady, has eliminated system errors for measurement and random error greatly, has higher certainty of measurement.
As known from the above, the present invention is a kind of high precision network delay measuring method based on universal PC, and the universal PC framework realizes owing to be based on, and it is low to have a cost of measurement, the characteristics that are suitable for generally adopting; Compare with traditional time-delay measuring method, during Bao Changwei 64 bytes, it is nearly 150% that the inventive method reduces measure error, and measurement result is stable, and throughput of system is not had influence substantially; The Time Stamp Counter with CPU inside that the present invention proposes (Time Stamp Counter, TSC) method that replaces the operation system clock timing has resolution height, stable, characteristics that overhead is little, has eliminated the clocking error of measuring; What proposed passes through the retouching operation system kernel, network interface card is transferred to from process of measurement in sending and receiving bag timestamp record position drive, and has eliminated the latency measurement site error effectively, has realized thus measuring based on the high-precision time-delay of universal PC.
Description of drawings
Fig. 1 is a cpu frequency algorithm for estimating process schematic diagram of the present invention;
Fig. 2 is a timestamp record position transfer schematic diagram of the present invention;
Fig. 3 is the process schematic diagram of time-delay measuring method of the present invention and traditional measurement method;
When Fig. 4 was Bao Changwei 1500 bytes, the measured round-trip delay of the inventive method and conventional method compared.
Embodiment
When implementing the inventive method, use the Pentium IV CPU and the (SuSE) Linux OS of Intel Company.
Replace gettimeofday () system call timing with the tsc counter; Implementation process is shown in Fig. 3 .b:
In the S6 step, the process of measurement transmission delay is measured bag;
In the S7 step, process of measurement calls the bag transmitting time that substitutes gettimeofday () reading and recording with ioctl () and stabs, and the timestamp record is finished by amended network interface card driving;
In the S8 step, the process of measurement receive time delay is measured bag;
In the S9 step, process of measurement calls the bag time of reception that substitutes gettimeofday () reading and recording with ioctl () and stabs, and the timestamp record is driven by amended network interface card and finishes;
Final step S10 comes the computing network time delay according to the current cpu frequency of surveying;
Step S11 regularly estimates the process of cpu frequency.
The process of regularly estimating cpu frequency can increase the program implementation complexity., the cpu frequency estimation procedure of step S11 is realized separately, as system's background process operation for this reason; Delay time during computing network, process of measurement obtains current C PU frequency estimation from background process.When estimating cpu frequency equally the timestamp with the network interface card activation record calculate minimal time delay, to reduce error.
Claims (3)
1, a kind of high precision network delay measuring method based on universal PC is characterized in that, this method comprises:
(1) utilizes soft, the hardware structure of universal PC, replace the operation system clock timing,, regularly estimate cpu frequency in cycle, eliminate the clocking error of measuring simultaneously to be a second with the Time Stamp Counter of CPU inside;
(2) by the retouching operation system kernel, packet receiving, the timestamp of giving out a contract for a project record position are transferred to network interface card from process of measurement and driven, and directly read the packet receiving of network interface card activation record, the timestamp of giving out a contract for a project from process of measurement, eliminate the site error of measuring.
According to the described high precision network delay measuring method of claim 1, it is characterized in that 2, it is indirect clock source that described cpu frequency is regularly estimated with high-accuracy network time protocol server based on universal PC.
According to the described high precision network delay measuring method of claim 1, it is characterized in that 3, described retouching operation system kernel comprises based on universal PC:
A. revise the bag receiver function that network interface card drives, the beginning of the packet receiver function hard_rx () that drives at network interface card partly adds the timing statement;
B. revise the bag receiver module of system, the bag time of reception that makes process of measurement can directly read the network interface card activation record stabs;
C. revise the bag that network interface card drives and send function, the beginning that the packet that drives at network interface card sends function hard_start_xmit () partly adds the timing statement;
D. revise the bag sending module of system and struct sock and the definition of struct sk_buff structure type that system kernel is used to store packet, the bag transmitting time that makes process of measurement can directly read the network interface card activation record is stabbed.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CNB2005100322769A CN100334846C (en) | 2005-10-21 | 2005-10-21 | High precision network delay measuring method based on universal PC |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CNB2005100322769A CN100334846C (en) | 2005-10-21 | 2005-10-21 | High precision network delay measuring method based on universal PC |
Publications (2)
Publication Number | Publication Date |
---|---|
CN1758613A CN1758613A (en) | 2006-04-12 |
CN100334846C true CN100334846C (en) | 2007-08-29 |
Family
ID=36703812
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CNB2005100322769A Expired - Fee Related CN100334846C (en) | 2005-10-21 | 2005-10-21 | High precision network delay measuring method based on universal PC |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN100334846C (en) |
Cited By (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN109918870A (en) * | 2019-02-22 | 2019-06-21 | 武汉大学 | Program code based on Beidou subnanosecond grade high-precision time service executes Time delay measurement device and method |
Families Citing this family (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN100461721C (en) * | 2007-03-01 | 2009-02-11 | 华为技术有限公司 | System, method and apparatus for testing long-distance frame time delay |
CN103560928A (en) * | 2013-10-22 | 2014-02-05 | 东软集团股份有限公司 | Method and system for testing forwarding performance of network equipment |
CN110618604B (en) * | 2019-09-20 | 2022-03-04 | 上海东土远景工业科技有限公司 | Method and device for improving time keeping precision by using NTP auxiliary source |
CN114095398A (en) * | 2021-10-22 | 2022-02-25 | 深信服科技股份有限公司 | Method and device for determining detection time delay, electronic equipment and storage medium |
Citations (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN1330817A (en) * | 1998-09-09 | 2002-01-09 | 夸尔柯姆股份有限公司 | System and method for user terminal clock error measurement and correction |
US20050074033A1 (en) * | 2003-10-03 | 2005-04-07 | Chauveau Claude J. | Method and apparatus for measuring network timing and latency |
US20050096066A1 (en) * | 2003-10-31 | 2005-05-05 | Samsung Electronics Co., Ltd. | Method for decision of time delay by repeater in mobile communication network |
CN1614939A (en) * | 2003-11-06 | 2005-05-11 | 华为技术有限公司 | Realizing method for time-delaying test |
-
2005
- 2005-10-21 CN CNB2005100322769A patent/CN100334846C/en not_active Expired - Fee Related
Patent Citations (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN1330817A (en) * | 1998-09-09 | 2002-01-09 | 夸尔柯姆股份有限公司 | System and method for user terminal clock error measurement and correction |
US20050074033A1 (en) * | 2003-10-03 | 2005-04-07 | Chauveau Claude J. | Method and apparatus for measuring network timing and latency |
US20050096066A1 (en) * | 2003-10-31 | 2005-05-05 | Samsung Electronics Co., Ltd. | Method for decision of time delay by repeater in mobile communication network |
CN1614939A (en) * | 2003-11-06 | 2005-05-11 | 华为技术有限公司 | Realizing method for time-delaying test |
Cited By (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN109918870A (en) * | 2019-02-22 | 2019-06-21 | 武汉大学 | Program code based on Beidou subnanosecond grade high-precision time service executes Time delay measurement device and method |
Also Published As
Publication number | Publication date |
---|---|
CN1758613A (en) | 2006-04-12 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN103427935B (en) | A kind of network delay measuring method eliminating site error and system | |
US6741952B2 (en) | Instrument timing using synchronized clocks | |
US8233506B2 (en) | Correlation technique for determining relative times of arrival/departure of core input/output packets within a multiple link-based computing system | |
CN100334846C (en) | High precision network delay measuring method based on universal PC | |
Emmerich et al. | Mind the gap-a comparison of software packet generators | |
CN103067112B (en) | Clock synchronizing method, device and the network equipment | |
CN110493744A (en) | A kind of synchronous data sampling method and system of master-slave radio sensor | |
US20100185781A1 (en) | System and Method for Measuring Clock Skew on a Network | |
CN115698898B (en) | System and method for synchronizing nodes in a network device | |
CN106357472A (en) | Delay measuring method and device | |
CN106301657B (en) | High time precision large space channel synchronization acquisition system | |
CN112702231B (en) | Network delay measuring method and system | |
US11606156B1 (en) | Clock synchronization | |
CN113411157B (en) | Method, slave clock device, master clock device and system for clock synchronization | |
WO2023213080A1 (en) | Method for realizing network node time synchronization based on fpga | |
CN101848119A (en) | High-accuracy network round-trip delay measuring method for eliminating system processing time | |
CN108628156A (en) | A kind of high precision computation machine serial ports time service method | |
Leira et al. | High-speed optical networks latency measurements in the microsecond timescale with software-based traffic injection | |
Zhou et al. | Hats: high accuracy timestamping system based on netfpga | |
Plakalovic et al. | High-speed FPGA-based Ethernet traffic generator | |
CN111865467A (en) | Clock synchronization system and method between distributed chassis board cards for time delay test | |
CN103684730A (en) | Time synchronization method | |
WO2020132834A1 (en) | Method and device for stamping processing | |
Donnelly et al. | Passive calibration of an active measurement system | |
Chavan et al. | Implementation of fpga-based network synchronization using ieee 1588 precision time protocol (ptp) |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
C06 | Publication | ||
PB01 | Publication | ||
C10 | Entry into substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
C14 | Grant of patent or utility model | ||
GR01 | Patent grant | ||
C19 | Lapse of patent right due to non-payment of the annual fee | ||
CF01 | Termination of patent right due to non-payment of annual fee |