Add trace information to console

This commit is contained in:
Raymond Hill 2024-01-27 07:22:32 -05:00
parent 8be8ac57a7
commit f200bbf5d5
No known key found for this signature in database
GPG Key ID: 25E1490B761470C2
1 changed files with 9 additions and 4 deletions

View File

@ -850,8 +850,7 @@ onBroadcast(msg => {
let t0 = 0; let t0 = 0;
const onDone = ( ) => { const onDone = ( ) => {
const td = Date.now() - t0; ubolog(`loadFilterLists() All filters in memory at ${Date.now() - t0} ms`);
ubolog(`loadFilterLists() took ${td} ms`);
staticNetFilteringEngine.freeze(); staticNetFilteringEngine.freeze();
staticExtFilteringEngine.freeze(); staticExtFilteringEngine.freeze();
@ -859,14 +858,16 @@ onBroadcast(msg => {
vAPI.net.unsuspend(); vAPI.net.unsuspend();
filteringBehaviorChanged(); filteringBehaviorChanged();
vAPI.storage.set({ 'availableFilterLists': µb.availableFilterLists }); ubolog(`loadFilterLists() All filters ready at ${Date.now() - t0} ms`);
logger.writeOne({ logger.writeOne({
realm: 'message', realm: 'message',
type: 'info', type: 'info',
text: `Reloading all filter lists: done, took ${td} ms` text: `Reloading all filter lists: done, took ${Date.now() - t0} ms`
}); });
vAPI.storage.set({ 'availableFilterLists': µb.availableFilterLists });
broadcast({ broadcast({
what: 'staticFilteringDataChanged', what: 'staticFilteringDataChanged',
parseCosmeticFilters: µb.userSettings.parseAllABPHideFilters, parseCosmeticFilters: µb.userSettings.parseAllABPHideFilters,
@ -882,6 +883,7 @@ onBroadcast(msg => {
}; };
const applyCompiledFilters = (assetKey, compiled) => { const applyCompiledFilters = (assetKey, compiled) => {
ubolog(`loadFilterLists() Loading filters from ${assetKey} at ${Date.now() - t0} ms`);
const snfe = staticNetFilteringEngine; const snfe = staticNetFilteringEngine;
const sxfe = staticExtFilteringEngine; const sxfe = staticExtFilteringEngine;
let acceptedCount = snfe.acceptedCount + sxfe.acceptedCount; let acceptedCount = snfe.acceptedCount + sxfe.acceptedCount;
@ -915,6 +917,8 @@ onBroadcast(msg => {
µb.selfieManager.destroy(); µb.selfieManager.destroy();
staticFilteringReverseLookup.resetLists(); staticFilteringReverseLookup.resetLists();
ubolog(`loadFilterLists() All filters removed at ${Date.now() - t0} ms`);
// We need to build a complete list of assets to pull first: this is // We need to build a complete list of assets to pull first: this is
// because it *may* happens that some load operations are synchronous: // because it *may* happens that some load operations are synchronous:
// This happens for assets which do not exist, or assets with no // This happens for assets which do not exist, or assets with no
@ -950,6 +954,7 @@ onBroadcast(msg => {
µb.loadFilterLists = function() { µb.loadFilterLists = function() {
if ( loadingPromise instanceof Promise ) { return loadingPromise; } if ( loadingPromise instanceof Promise ) { return loadingPromise; }
ubolog('loadFilterLists() Start');
t0 = Date.now(); t0 = Date.now();
loadedListKeys.length = 0; loadedListKeys.length = 0;
loadingPromise = Promise.all([ loadingPromise = Promise.all([