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

Performance Improvements #77

Merged
merged 15 commits into from
Mar 4, 2018
22 changes: 17 additions & 5 deletions _locales/en_US/messages.json
Original file line number Diff line number Diff line change
Expand Up @@ -63,26 +63,26 @@

"settingsNoRulesFoundText": { "message": "no rules found" },
"settingsRemoveDomainButtonText": { "message": "remove domain" },
"settingsBackgroundOptionsTitle": { "message": "automatic settings" },
"settingsAutomaticSettingsOptionsTitle": { "message": "automatic settings" },

"settingsDomainDetectedTitle": { "message": "when a new website is accessed:" },
"settingsAddDomainToCodeInjectionLabel": { "message": "add to [code injection]" },
"settingsAddDomainToWebsiteRulesLabel": { "message": "add to [website rules]" },
"settingsEventDetectedTitle": { "message": "when a new JavaScript event is detected:" },
"settingsAddEventToDefaultTitle": { "message": "add to [default rules]:" },
"settingsAddEventToDefaultTitle": { "message": "add to [default rules]" },
"settingsAddEventNoneLabel": { "message": "none" },
"settingsAddEventCommonLabel": { "message": "common" },
"settingsAddEventAllLabel": { "message": "all" },
"settingsAddEventAlmostAllLabel": { "message": "almost all" },
"settingsAddEventToWebsiteTitle": { "message": "add to [website rules]:" },
"settingsAddEventToWebsiteTitle": { "message": "add to [website rules]" },

"settingsNotRecommendedText": { "message": "not recommended" },
"settingsDefinitelyNotRecommendedText": { "message": "definitely not recommended" },

"settingsReportsTitle": { "message": "reports" },
"settingsIndexedDbMdnHref": { "message": "https://developer.mozilla.org/en-US/docs/Web/API/IndexedDB_API" },
"settingsRecordsText": { "message": "records" },
"settingsEnableReportsGenerationText": { "message": "enable reports generation" },
"settingsEnableReportsGenerationText": { "message": "reports generation" },
"settingsMostExecutedJavaScriptCodesText": { "message": "most executed JavaScript codes:" },
"settingsDomainsMostJavaScriptCodesText": { "message": "domains that most runs JavaScript codes:" },
"settingsFilterButtonText": { "message": "filter" },
Expand All @@ -95,5 +95,17 @@
"checkboxShowPerformanceMetrics": { "message": "performance metrics" },
"sortByText": { "message": "sort by" },
"sortByCallsText": { "message": "executions" },
"sortByTimeText": { "message": "time spent" }
"sortByTimeText": { "message": "time spent" },

"settingsBackgroundPerformanceTitle": { "message": "performance" },

"disableText": { "message": "disable" },

"logsFilterInPlaceholder": { "message": "include (regular expression works!)" },
"logsFilterOutPlaceholder": { "message": "exclude (regular expression works!)" },
"logsFilterAllText": { "message": "all tabs" },
"logsFilterAutoDetectText": { "message": "detect" },
"logsStartButtonText": { "message": "start" },
"logsStopButtonText": { "message": "stop" },
"logsClearButtonText": { "message": "clear" }
}
22 changes: 17 additions & 5 deletions _locales/es/messages.json
Original file line number Diff line number Diff line change
Expand Up @@ -63,26 +63,26 @@

"settingsNoRulesFoundText": { "message": "ninguna regla encontrada" },
"settingsRemoveDomainButtonText": { "message": "eliminar dominio" },
"settingsBackgroundOptionsTitle": { "message": "configuraciones automáticas" },
"settingsAutomaticSettingsOptionsTitle": { "message": "configuraciones automáticas" },

"settingsDomainDetectedTitle": { "message": "cuando se accede a un nuevo sitio:" },
"settingsAddDomainToCodeInjectionLabel": { "message": "añadir en [inyecciones de código]" },
"settingsAddDomainToWebsiteRulesLabel": { "message": "añadir en [reglas por sitio web]" },
"settingsEventDetectedTitle": { "message": "cuando se detecta un nuevo evento JavaScript:" },
"settingsAddEventToDefaultTitle": { "message": "añadir en [reglas estándar]:" },
"settingsAddEventToDefaultTitle": { "message": "añadir en [reglas estándar]" },
"settingsAddEventNoneLabel": { "message": "ningúno" },
"settingsAddEventCommonLabel": { "message": "comunes" },
"settingsAddEventAllLabel": { "message": "todos" },
"settingsAddEventAlmostAllLabel": { "message": "casi todos" },
"settingsAddEventToWebsiteTitle": { "message": "añadir en [reglas por sitio web]:" },
"settingsAddEventToWebsiteTitle": { "message": "añadir en [reglas por sitio web]" },

"settingsNotRecommendedText": { "message": "no recomendado" },
"settingsDefinitelyNotRecommendedText": { "message": "definitivamente no recomendado" },

"settingsReportsTitle": { "message": "informes" },
"settingsIndexedDbMdnHref": { "message": "https://developer.mozilla.org/es/docs/Web/API/IndexedDB_API" },
"settingsRecordsText": { "message": "registros" },
"settingsEnableReportsGenerationText": { "message": "habilitar la generación de informes" },
"settingsEnableReportsGenerationText": { "message": "generación de informes" },
"settingsMostExecutedJavaScriptCodesText": { "message": "códigos JavaScript más ejecutados:" },
"settingsDomainsMostJavaScriptCodesText": { "message": "los dominios que más ejecutan los códigos JavaScript:" },
"settingsFilterButtonText": { "message": "filtrar" },
Expand All @@ -95,5 +95,17 @@
"checkboxShowPerformanceMetrics": { "message": "métricas de rendimiento" },
"sortByText": { "message": "ordenar por" },
"sortByCallsText": { "message": "ejecuciones" },
"sortByTimeText": { "message": "tiempo" }
"sortByTimeText": { "message": "tiempo" },

"settingsBackgroundPerformanceTitle": { "message": "desempeño" },

"disableText": { "message": "desactivar" },

"logsFilterInPlaceholder": { "message": "incluir (¡expresión regular funciona!)" },
"logsFilterOutPlaceholder": { "message": "borrar (¡expresión regular funciona!)" },
"logsFilterAllText": { "message": "todas las lengüetas" },
"logsFilterAutoDetectText": { "message": "detectar" },
"logsStartButtonText": { "message": "comenzar" },
"logsStopButtonText": { "message": "detener" },
"logsClearButtonText": { "message": "limpiar" }
}
22 changes: 17 additions & 5 deletions _locales/pt_BR/messages.json
Original file line number Diff line number Diff line change
Expand Up @@ -63,26 +63,26 @@

"settingsNoRulesFoundText": { "message": "nenhuma regra encontrada" },
"settingsRemoveDomainButtonText": { "message": "remover domínio" },
"settingsBackgroundOptionsTitle": { "message": "configurações automáticas" },
"settingsAutomaticSettingsOptionsTitle": { "message": "configurações automáticas" },

"settingsDomainDetectedTitle": { "message": "quando um novo site for acessado:" },
"settingsAddDomainToCodeInjectionLabel": { "message": "adicionar em [injeção de códigos]" },
"settingsAddDomainToWebsiteRulesLabel": { "message": "adicionar em [regras por site]" },
"settingsEventDetectedTitle": { "message": "quando um novo evento JavaScript for detectado:" },
"settingsAddEventToDefaultTitle": { "message": "adicionar em [regras padrões]:" },
"settingsAddEventToDefaultTitle": { "message": "adicionar em [regras padrões]" },
"settingsAddEventNoneLabel": { "message": "nenhum" },
"settingsAddEventCommonLabel": { "message": "comuns" },
"settingsAddEventAllLabel": { "message": "todos" },
"settingsAddEventAlmostAllLabel": { "message": "quase todos" },
"settingsAddEventToWebsiteTitle": { "message": "adicionar em [regras por site]:" },
"settingsAddEventToWebsiteTitle": { "message": "adicionar em [regras por site]" },

"settingsNotRecommendedText": { "message": "não recomendado" },
"settingsDefinitelyNotRecommendedText": { "message": "definitivamente não recomendado" },

"settingsReportsTitle": { "message": "relatórios" },
"settingsIndexedDbMdnHref": { "message": "https://developer.mozilla.org/pt-BR/docs/Web/API/IndexedDB_API" },
"settingsRecordsText": { "message": "registros" },
"settingsEnableReportsGenerationText": { "message": "habilitar geração de relatórios" },
"settingsEnableReportsGenerationText": { "message": "geração de relatórios" },
"settingsMostExecutedJavaScriptCodesText": { "message": "códigos JavaScript mais executados:" },
"settingsDomainsMostJavaScriptCodesText": { "message": "domínios que mais executam códigos JavaScript:" },
"settingsFilterButtonText": { "message": "filtrar" },
Expand All @@ -95,5 +95,17 @@
"checkboxShowPerformanceMetrics": { "message": "métricas de desempenho" },
"sortByText": { "message": "ordenar por" },
"sortByCallsText": { "message": "execuções" },
"sortByTimeText": { "message": "tempo gasto" }
"sortByTimeText": { "message": "tempo gasto" },

"settingsBackgroundPerformanceTitle": { "message": "desempenho" },

"disableText": { "message": "desabilitar" },

"logsFilterInPlaceholder": { "message": "incluir (expressão regular funciona!)" },
"logsFilterOutPlaceholder": { "message": "excluir (expressão regular funciona!)" },
"logsFilterAllText": { "message": "todas as abas" },
"logsFilterAutoDetectText": { "message": "detectar" },
"logsStartButtonText": { "message": "iniciar" },
"logsStopButtonText": { "message": "parar" },
"logsClearButtonText": { "message": "limpar" }
}
1 change: 1 addition & 0 deletions builds/test/local_web_server.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
ruby -rwebrick -e'WEBrick::HTTPServer.new(:Port => 3000, :DocumentRoot => Dir.pwd).start'
59 changes: 59 additions & 0 deletions builds/test/performance_monitor.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
def memory_and_cpu_for(grep)
[
'ps aux',
'grep -v grep',
"grep '#{grep}'",
"awk '{print $2}'",
'xargs -I % pstree -p %',
"grep -o '([0-9]\\+)'",
"grep -o '[0-9]\\+'",
'xargs ps -o %mem,%cpu,cmd -p',
"awk '{memory+=$1;cpu+=$2} END {print memory,cpu}'"
].join(' | ')
end

def installed_mb_memory
`free -m | grep Mem | awk '{print $2}'`.to_i
end
@app_A = 'lum-prev'
@app_B = 'lum-next'
@memory = installed_mb_memory
@monitor_A = memory_and_cpu_for(@app_A)
@monitor_B = memory_and_cpu_for(@app_B)

def print_current_stats(app, monitor)
mem_pct, cpu_pct = `#{monitor}`.split(' ').map(&:to_f)
mem_mb = '%4.5s' % ((mem_pct/100) * @memory).to_i.to_s

mem_pct_str = '%5.4s' % mem_pct
cpu_pct_str = '%5.4s' % cpu_pct

bar_size = 15

mem_pct_bar = ('█' * ((mem_pct/100) * bar_size).ceil)
mem_spaces = (bar_size - mem_pct_bar.size)
if mem_spaces < 0
mem_spaces = 0
end
mem_pct_bar = mem_pct_bar + (' ' * mem_spaces)

cpu_pct_bar = ('█' * ((cpu_pct/100) * bar_size).ceil)
cpu_spaces = (bar_size - cpu_pct_bar.size)
if cpu_spaces < 0
cpu_spaces = 0
end
cpu_pct_bar = cpu_pct_bar + (' ' * cpu_spaces)

"#{app} | RAM: #{mem_mb} MB #{mem_pct_bar} | CPU: #{cpu_pct_str}% #{cpu_pct_bar}"
end

def print_compare
'| ' + print_current_stats(@app_A, @monitor_A) + ' | ' + print_current_stats(@app_B, @monitor_B) + ' |'
end

while true do
begin
puts print_compare
rescue => _
end
end
4 changes: 4 additions & 0 deletions builds/test/start.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
ps aux | grep 'firefox' | awk '{print $2}' | xargs -I % kill -9 %

firefox-trunk -P lum-prev &
firefox-trunk -P lum-next &
16 changes: 13 additions & 3 deletions css/devtools/logs.css
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,16 @@ select {
padding:0 1%;
}

td.count {
width: 1px;
text-align: right;
}
td.time {
width: 1px;
white-space: nowrap;
text-align: right;
}

.filters { display: inline-block; }

#filter_in, #filter_out {
Expand All @@ -37,15 +47,15 @@ select {
height: 91px;
}

.table-area {
#table-area {
padding-top: 91px;
}

#form.multitab {
height: 119px;
}

.table-area.multitab {
#table-area.multitab {
padding-top: 119px;
}

Expand All @@ -57,7 +67,7 @@ select {
border-bottom: 6px solid #CCC;
}

.table-area {
#table-area {
position: fixed;
bottom:0;
height: 100%;
Expand Down
10 changes: 4 additions & 6 deletions html/logs/logs.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,23 +8,21 @@
<link rel="stylesheet" type="text/css" href="../../../vendor/bootstrap/bootstrap.min.css">

<link rel="stylesheet" type="text/css" href="../../css/devtools/logs.css">
<script src="../../vendor/jquery/jquery-3.3.1.min.js" type="text/javascript"></script>
<script src="../../vendor/mustachejs/mustache.min.js" type="text/javascript"></script>
<script src="../../js/utils/numbers.js" type="text/javascript"></script>
<script src="../../js/utils/load_template.js" type="text/javascript"></script>
<script src="../../js/logs/logs.js" type="text/javascript"></script>
</head>
<body>
<div id="form">
</div>

<div class="table-area">
<div id="table-area">
<div class="table-container">
<table class="table table-bordered table-striped table-sm">
<tbody>
</tbody>
<table id="log-table" class="table table-bordered table-striped table-sm">
</table>
</div>
</div>

<script src="../../js/logs/logs.js" type="text/javascript"></script>
</body>
</html>
16 changes: 8 additions & 8 deletions html/logs/templates/form.html
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
<form>
<input id="filter_in" type="text" placeholder="include filter (regex allowed)" {{#started}}disabled{{/started}} value="{{filter_in}}"></input>
<input id="filter_out" type="text" placeholder="exclude filter (regex allowed)" {{#started}}disabled{{/started}} value="{{filter_out}}"></input>
<input id="filter_in" type="text" placeholder="{{filter_in_placeholder}}" {{#started}}disabled{{/started}} value="{{filter_in}}"></input>
<input id="filter_out" type="text" placeholder="{{filter_out_placeholder}}" {{#started}}disabled{{/started}} value="{{filter_out}}"></input>
<br>
{{#multitab_support}}
<select id="tab_filter" {{#started}}disabled{{/started}}>
<option {{#option_selected}}all{{/option_selected}} value="all">all</option>
<option {{#option_selected}}auto{{/option_selected}} value="auto">auto detect: {{current_tab.id}} - {{current_tab.domain}}</option>
<option {{#option_selected}}all{{/option_selected}} value="all">{{filter_all_text}}</option>
<option {{#option_selected}}auto{{/option_selected}} value="auto">{{filter_auto_detect_text}}: {{tab_text}} {{current_tab.id}} - {{current_tab.domain}}</option>
{{#tabs}}
<option {{#option_selected}}{{id}}{{/option_selected}} value="{{id}}">{{id}}: {{domain}}</option>
<option {{#option_selected}}{{id}}{{/option_selected}} value="{{id}}">{{tab_text}} {{id}}: {{domain}}</option>
{{/tabs}}
</select>
<br>
{{/multitab_support}}
<button id="start" {{#started}}disabled{{/started}}>start</button>
<button id="stop" {{^started}}disabled{{/started}}>stop</button>
<button id="clear">clear</button>
<button id="start" {{#started}}disabled{{/started}}>{{start_button_text}}</button>
<button id="stop" {{^started}}disabled{{/started}}>{{stop_button_text}}</button>
<button id="clear">{{clear_button_text}}</button>
</form>
9 changes: 0 additions & 9 deletions html/logs/templates/row.html

This file was deleted.

31 changes: 31 additions & 0 deletions html/settings/performance/options.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">

<title></title>

<link rel="stylesheet" type="text/css" href="../../../vendor/bootstrap/bootstrap.min.css">

<link rel="stylesheet" type="text/css" href="../../../css/settings/settings.css">
<script src="../../../vendor/jquery/jquery-3.3.1.min.js" type="text/javascript"></script>
<script src="../../../vendor/mustachejs/mustache.min.js" type="text/javascript"></script>
<script src="../../../js/utils/load_template.js" type="text/javascript"></script>
<script src="../../../js/settings/settings.js" type="text/javascript"></script>
<script src="../../../js/settings/performance/options.js" type="text/javascript"></script>
</head>
<body>
<div id="loading"></div>
<div class="container-fluid">
<div class="row">
<div class="col-3">
<nav class="navbar"></nav>
</div>
<div class="col-8 settings-content">
<div id="form"></div>
</div>
</div>
</div>
</body>
</html>
Loading