Giter VIP home page Giter VIP logo

udp-latency's Introduction

Hi there!

πŸ§‘πŸ½β€πŸ’» I am currently working on the following projects:

  • πŸ”¬ R&D on Time-Sensitive Networking:
    1. TSNKit: A scheduling and benchmark toolkit for Time-Sensitive Networking in Python.
    2. RtGen-TC/RtGen-DPDK: A deterministic traffic generator based on kernel/DPDK and NIC offloading function.
  • πŸͺ NASA-RETHi-DataSystem: Developing Resilient Extra-Terrestrial Habitat

🀷 Some small projects from me:

  • πŸ‹ Fruittoeat: An ios APP helps you track and decide what fruit to eat
  • 🧸 Learning Python the Smart Way: An efficient and joyful way to learn Python language [δΈ­ζ–‡]
  • πŸ“ˆ udp-latency: A tiny end-to-end latency testing tool implemented by UDP protocol in Python
  • πŸ“ mvtest: A Distribution-Free Test of Independence Based on Mean Variance Index
  • 🐢 doit4u: ChatGPT based natural language hybrid Python programming
  • 🦭 sealhacker: Extracting seal with Python OpenCV.
  • 🎨 Morandi palette: 18 colors palette inspired by Giorgio Morandi

Snake animation

udp-latency's People

Contributors

chuanyuxue avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

udp-latency's Issues

round-trip latency is similar to one-way latency

Hi @ChuanyuXue,

I got similar results when testing udp_rrt and udp_latency. It seems like division 2 of udp_rrt.py needs to be removed in the following function.

def listen(self, buffer_size: int, verbose: bool, save: Optional[str], q: Queue)-> None:
        latency = 0.0
        while True:
            msg, _ = self._udp_socket.recvfrom(buffer_size)
            recv_time = time.time_ns()
            packet_index = int.from_bytes(msg[:4], 'big')
            send_time = int.from_bytes(msg[4:12], 'big')
            old_latency = latency
            latency = round(((recv_time - send_time) * 1e-9) / 2, 6)
            jitter = abs(latency - old_latency)
            recv_size = len(msg)

Can it be used for Load testing?

Hi @ChuanyuXue,
Firstly thanks for developing such a wonderful tool! I just wanna know if you have any idea on how to use this/convert this to generate a bursty traffic which could be used for load testing?Any insights?/

divide by zero on Windows

When I run it on a single Windows computer, I get a divide by zero with the default options:

C:\Users\Devin\Downloads>C:\Python310\python.exe udp_latency.py -c
| ---------- Sychonizing Server & Client by PTP ------------ |
| Client: 20002 | Packet: 1 | Time: 1716832507661762600 | Data size: 1468 |
Traceback (most recent call last):
File "C:\Users\Devin\Downloads\udp_latency.py", line 269, in
client.send(
File "C:\Users\Devin\Downloads\udp_latency.py", line 102, in send
* (len(self.log) / (frequency * (current_time - start_time) * 1e-9))
ZeroDivisionError: float division by zero

I can run it fine by using --dyna False on the client side.

When I run it on my computer, the current_time and start_time are the same, which results in a divide by zero:
frequency: 1.0
current_time: 1716832724571958100
start_time: 1716832724571958100
current_time - start_time: 0

I suspect that this is only an issue on Windows and is because of the following:
https://stackoverflow.com/a/1938096

I wonder what the best approach is to prevent the divide by zero, would something like the following work or would this skew the results?
if (current_time == start_time):
current_time = start_time + 1 # prevent divide by zero if using dyna on Windows due to +/- 16 ms accuracy (https://stackoverflow.com/a/1938096)

Would it be better to run without dyna?

quick question

Hi @ChuanyuXue, a quick question is what is the reason we choose socket instead of scapy to implement the udp latency? Thank you very much for your answering.

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.