Skip to content
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

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

Kroch4ka
Copy link

No description provided.

@Kroch4ka Kroch4ka force-pushed the nikita_golubev branch 3 times, most recently from 56c15de to ddda79a Compare March 16, 2025 08:27
Copy link
Collaborator

@spajic spajic left a 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 @@
Я решил исправить эту проблему, оптимизировав эту программу.

## Формирование метрики
Для того, чтобы понимать, дают ли мои изменения положительный эффект на быстродействие программы я придумал использовать такую метрику: *тут ваша метрика*
Для того, чтобы понимать, дают ли мои изменения положительный эффект на быстродействие программы я придумал использовать такую метрику: количество потребляемой памяти процессом
Copy link
Collaborator

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 потока - один выполняет бизнес логику, а второй выступает предохранителем при использовании процессом памяти - больше заданного лимита
Copy link
Collaborator

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
Copy link
Collaborator

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."
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants