3

I wrote a python program that basically takes a text file with 86400 lines containing web server ping responses. I extract the round trip from each line and add it to an array called roundtriptimes. I then sort the array and now want to be able to plot a CDF of the data using matplotlib. My current code below:

    import re
    import numpy as np
    import matplotlib.pyplot as plt

    ping = open("pingresponse.txt")
    rawping = ping.read()
    roundtriptimes = re.findall(r'time=(\d+.\d+)', rawping)
    roundtriptimes[:] = [float(x) for x in roundtriptimes]

    sortedtime = np.sort(roundtriptimes)
    p = 1. * np.arange(len(roundtriptimes))/(len(roundtriptimes) - 1)
    plt.plot(sortedtime, p)
    plt.show()

I've read the other post on this topic but none of their solutions seemed to work for me. I am trying to get a CDF plot that looks like below:

enter image description here But instead I get a sharply increasing slope. I just want to make sure the CDF calculations I am making is correct.

enter image description here Any help would be greatly appreciated.

  • 1
    This looks right. Not particularly useful, but not abnormal either. You have a few packets with big delays that push the upper limit to 600 ms. – Satō Katsura Oct 5 '16 at 7:38
  • Okay awesome thank you so much, just was afraid my cdf calculations were off instead of realizing it was my some outliers skewing it. Thank you – user192403 Oct 5 '16 at 11:52
1

Answered in the comments:

This looks right. Not particularly useful, but not abnormal either. You have a few packets with big delays that push the upper limit to 600 ms. – Sato Katsura Oct 5 at 7:38

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.