sixtenbe / ping-graph-tool Goto Github PK
View Code? Open in Web Editor NEWA simple GUI tool in python using wxpython and matplotlib to graph the ping to an address.
A simple GUI tool in python using wxpython and matplotlib to graph the ping to an address.
It can be quite unpractical when the program forgets all the data when you reduce the data depth to the minimum of 100 entries. Instead the maximum depth of 10 000 entries should always be remembered and a subset of the entries should be used when graphing the ping and calculating the stats.
This way one can for example quickly check the average ping over the last 2.7 hours and then go back to just viewing the last 500 or so.
Currently this only supports windows using popen with ping.exe, which even has some problems with differences between languages of windows and it most certainly won't work on linux/mac
So the ping part should probably be reimplemented using socks, but I believe this will instead require sudo/admin privileges, at least if a ICMP ping is used, but maybe a tcp ping might be possible to implement without requiring the program to run as sudo.
I think a lot more of the logic should be split out into its own functions and many of these function should be moved out of the main .pyw file into a file of its own and unittests should be applied to all these functions.
This does not really go for the wxplot.py file as that just is a mess in which it probably is difficult to split out anything as almost everything is related to the matplotlib objects.
The program sometimes throws an assert error, which originates from matplotlib in some way I think. Essentially from some googling I did on this problem at one time, said it was a problem with GUI handles leaking, which I thought I fixed by force removing the line objects from the canvas when stopping.
Luckily this error doesn't stop the execution of the program, it just throws up a msgbox when the error is captured and I've only encountered the bug when running a fullscreen program (a game) and the program has been running for at least a few hours, actively plotting.
In the end I currently think this is somehow related to how I do the .blit in matplotlib to reduce CPU strain. It might be that a different call should be used than .blit(ax.bbox) to update the canvas, but the commands that I've found when googling doesn't seem to exist when I try them. A method I've seen in some guides about using blit called for using canvas.Update() to draw without encountering any leaks with the wx-backend, but that command doesn't seem to exist.
Custom ui with enable/disable grid and a button to mark currently viewed area don't appear with matplotlib 1.5. Was working with matplotlib 1.1.
Uncaught exception:
Traceback (most recent call last):
File "I:\Dropbox\ping\ping_gui.pyw", line 246, in onPlotting
self.line_ping, self.line_timeout]
File "I:\Dropbox\ping\wxplot.py", line 822, in update_plot_only
self.canvas.flush_events()
File "C:\Python27\lib\site-packages\matplotlib\backends\backend_wx.py", line 758, in flush_events
wx.Yield()
File "C:\Python27\lib\site-packages\wx-2.8-msw-unicode\wx\_core.py", line 7698, in Yield
return _core_.Yield(*args)
PyAssertionError: C++ assertion "wxAssertFailure" failed at ..\..\src\msw\app.cpp(707) in wxApp::Yield(): wxYield called recursively
Following error will occur at random intervals, but usually it seems to be a few days in between.
When displaying a large amount of data in the plot (e.g 3000 points) it can get hard to see what happens and a way to improve this would be to put the data through an averaging window and for example reduce the amount of points to a 1/5 averaged.
This must somehow also handle dropped packages some way in the averaged data. A solution I've seen in cacti is to color code the line depending on the amount of packet loss (colors would have to be predefined and fully locked, not practical to do dynamically), and cacti also used a transparent gray fill color to display the standard deviation.
See this image below to understand the messiness that you can get.
Ping cycle now stops on unhandled exception and the ping must be manually stoped and started for it to function.
This is probably a side effect of thread safety fixes.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.