Git Product home page Git Product logo

netlatency's Introduction

Netlatency

Build Status

The netlatency toolset is used to measure the latency and jitter parameters of an ethernet connection. The nl-tx generates UDP packets with embedded system timestamp (tx-user) and sequence number. The netlantency-rx captures these packets and dumps the collected receiving information such as timestamp from the linux network stack and the receiving system time (rx-user). nl-rx can detect receiving errors (dropped packets or sequence error).

The following timestamp values can be accessed on the nl-rx.

Timestamp Description
interval-start The interval start timestamp
tx-wakeup The wakeup timestamp of nl-tx
tx-program The timestamp when calling the send function
tx-kernel-netsched Linux kernel timestamp SOF_TIMESTAMPING_TX_SCHED
tx-kernel-driver Linux kernel timestamp SOF_TIMESTAMPING_TX_SOFTWARE
rx-hardware Linux kernel timestamp SOF_TIMESTAMPING_RX_HARDWARE
rx-program Timestamp when handling the testpacket in nl-rx

For linux kernel timestamp please refer to the kernel documentation:

https://www.kernel.org/doc/Documentation/networking/timestamping.txt

Build

  • libglib2.0-dev
  • libjansson-dev

Shortcomings

There is no byte order translation. Therefore, the sender and receiver application must run on the same CPU architecture.

nl-tx

Synopsis

Usage:
  nl-tx [OPTION...] DEVICE - transmit timestamped test packets

Help Options:
  -?, --help            Show help options

Application Options:
  -d, --destination     Destination MAC address
  -h, --histogram       Create histogram data
  -i, --interval        Interval in milli seconds (default is 1000msec)
  -c, --count           Transmit packet count
  -m, --memlock         Configure memlock (default is 1)
  -P, --padding         Set the packet size
  -p, --prio            Set scheduler priority (default is 99)
  -Q, --queue-prio      Set skb priority
  -v, --verbose         Be verbose
  -V, --version         Show version inforamtion and exit

This tool sends ethernet test packets.

Outputs

// not implemented yet
{
  "type": "settings",
  "object": {
    "interval": 1000,
  }
}

nl-rx

Synopsis

Usage:
  -rx [OPTION...] DEVICE - receive timestamped test packets

Help Options:
  -?, --help          Show help options

Application Options:
  -v, --verbose       Be verbose
  -q, --quiet         Suppress error messages
  -c, --count         Receive packet count
  -s, --socket        Write packet results to socket
  -h, --histogram     Write packet histogram in JSON format
  -e, --ethertype     Set ethertype to filter(Default is 0x0808, ETH_P_ALL is 0x3)
  -f, --rxfilter      Set hw rx filterfilter
  -p, --ptp           Set hw rx filterfilter
  -V, --version       Show version inforamtion and exit

This tool receives and analyzes incoming ethernet test packets.

Output

{
  "type": "rx-packet",
  "object": {
    "sequence-number": 1,
    "packet-size": 64,
    "tx-user-timestamp": "",
    "tx-user-target-timestamp": "",
    "rx-hw-timestamp" "",
    "rx-user-timestamp" "",
  }
}

{
  "type": "rx-packet",
  "object": {
    "sequence-number": 1,
    "stream-id": result->stream_id,
    "interval-usec": result->interval_usec,
    "offset-usec": result->offset_usec,
    "packet-size": result->packet_size,
    "timestamps": {
      "names": [
        "interval-start":,
        "tx-wakeup",
        "tx-program",
        "tx-kernel-netsched",
        "tx-kernel-driver",
        "rx-hardware",
        "rx-kernel-driver",
        "rx-program",
      ]
      "values": [
        <TIMESTAMP>,
        <TIMESTAMP>,
        <TIMESTAMP>,
        <TIMESTAMP>,
        <TIMESTAMP>,
        <TIMESTAMP>,
        <TIMESTAMP>,
        <TIMESTAMP>,
      ],
    }
  }
}

{
  "type": "rx-error",
  "object": {
    "dropped-packets": 1,
    "sequence-error": true,
  }
}


// not implemented yet
{
  "type": "rx-packet-tx-timestamp",
  "object": {
    "sequence-number": 1,
    "tx-hw-timestamp": "",
  }
}

Helper: nl-calc

The nl-calc tool stores the testpacket results of nl-rx and builds information for histogram analysis. Including Application accurancy/latency, full transmit latency (from application to RX hardware) and rx jitter.

Histogram type Description
program-latency Histogram data of program wakeup time. It is used to observe the application accuracy.
scheduled-times Histogram data of packets runtime.
jitter Histogram data of packets runtime in a smaller window with nanosecond resolution.

Helper: nl-report

The nl-report tool displays the data generated by nl-calc in graphs.

Helper: nl-trace

The nl-trace displays the output by nl-rx in a box-plot graphic. Each type of timestamp is collected and the data depicted. Hence a time distribution of the latency till the point of record can be seen.

For closer information about meaning of box-plot take a look at:

https://en.wikipedia.org/wiki/Box_plot

Usage Examples

Receive testpackets and send with socat to UDP port

On receive servers site:

$ nl-rx enp2s0  -v |  socat - udp-sendto:127.0.0.1:5000

On client site:

$ socat - udp4-listen:5000,reuseaddr,fork

Receive testpackets, calc latency, generate histogram and plot in file

$ nl-rx enp2s0 -c 10000 -v | nl-calc -  | nl-report - /tmp/plot.png

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.