blackmius / bug-free-octo-adventure Goto Github PK
View Code? Open in Web Editor NEWУтилита ping
Утилита ping
перед каждой функцией описать что она делает в виде
https://www.cs.swarthmore.edu/~newhall/unixhelp/c_codestyle.html#:~:text=In%20header%20files%2C%20function%20comments,how%20the%20function%20is%20implemented.
другие строчки если действие тривиальное пишите зачем оно делается, а не что там делается
int time = 0; // завел счетчик времени
а не // присвоил переменной time значение 0
bug-free-octo-adventure/src/Pinger.cpp
Lines 100 to 104 in 27a9533
советую заменить подсчет на рекурсивную формулу в цикле
// мин макс
minTime = min(time, minTime)
maxTime = max(time, maxTime)
// рекуррентное среднее
prevAvg = avg
avg = (1 - 1/n) * avg + time / n
// формула для рекуррентного вычисления среднего отклонения
mdev = Math.sqrt(mdev + (time - avg)(time - prevAvg) / n)
(http://www.scalaformachinelearning.com/2015/10/recursive-mean-and-standard-deviation.html#:~:text=The%20mean%20and%20standard%20deviation%20for%20n%20observations%20can%20be,for%20the%20standard%20deviation%20is)
bug-free-octo-adventure/src/Pinger.cpp
Line 13 in 27a9533
штука которая резолвит имена по aliases а потом по днс
ну вообще грех не пользоваться тем, что уже написано, но все же, другие челы сами реализовывали
bug-free-octo-adventure/src/Pinger.cpp
Line 112 in 6b76a0f
время между пингами не точно секунду отрабатывает, там rtt задержка + еще sleep не всегда точно отрабатывает, надо какой-то другой подход попробовать
bug-free-octo-adventure/src/Pinger.cpp
Line 96 in 4c1c9ea
bug-free-octo-adventure/include/Pinger.h
Line 30 in 27a9533
если это функция внутренней реализации пинг, которую не будут вызывать извне, то она не особо нужна в заголовке
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.