-
Notifications
You must be signed in to change notification settings - Fork 140
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[zero] create core classes and initial measure #128
base: master
Are you sure you want to change the base?
Conversation
56c15de
to
ddda79a
Compare
ddda79a
to
420ecf8
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
@@ -12,44 +12,38 @@ | |||
Я решил исправить эту проблему, оптимизировав эту программу. | |||
|
|||
## Формирование метрики | |||
Для того, чтобы понимать, дают ли мои изменения положительный эффект на быстродействие программы я придумал использовать такую метрику: *тут ваша метрика* | |||
Для того, чтобы понимать, дают ли мои изменения положительный эффект на быстродействие программы я придумал использовать такую метрику: количество потребляемой памяти процессом |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
тут есть нюанс, что это кол-во меняется со временем (можно указать момент в который идёт замер чтоб было чётко, и ещё в идеале и способ замера чтоб было совсем чётко)
|
||
Вот как я построил `feedback_loop`: *как вы построили feedback_loop* | ||
Вот как я построил `feedback_loop`: | ||
- Вынес вычисление метрики в Measurer, в котором запускаются 2 потока - один выполняет бизнес логику, а второй выступает предохранителем при использовании процессом памяти - больше заданного лимита |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
лайк за предохранитель
'browsers' => @current_stat['browsers'] << session['browser'], | ||
'usedIE' => @current_stat['usedIE'] ? true : !!(session['browser'] =~ /INTERNET EXPLORER/), | ||
'alwaysUsedChrome' => @current_stat['alwaysUsedChrome'] ? !!(session['browser'].upcase =~ /CHROME/) : false, | ||
'dates' => @current_stat['dates'] << Date.strptime(session['date'], '%Y-%m-%d').iso8601 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
даты сразу ок
sleep CHECK_USAGE_INTERVAL_SEC | ||
current_memory_usage_mb = `ps -o rss= -p #{Process.pid}`.to_i / 1024 | ||
if current_memory_usage_mb > MEMORY_USAGE_LIMIT_MB | ||
puts "MEMORY USAGE: #{current_memory_usage_mb} MB, BUT LIMIT: #{MEMORY_USAGE_LIMIT_MB}. TERMINATING." |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
No description provided.