Join TikTok


= times) return true; } return false; } function maxWithHidden(datas) { var max = 0; for(var i = 0; i max) max = data; } } return max; } window.__getPerformanceMemory__ = function(withHidden) { var memory = window.performance && window.performance.memory; if (withHidden === undefined) withHidden = true; if (memory) { if (withHidden) { return { jsHeapSizeLimit: formatNumberWithHidden(byteToM(memory.jsHeapSizeLimit)), totalJSHeapSize: formatNumberWithHidden(byteToM(memory.totalJSHeapSize)), usedJSHeapSize: formatNumberWithHidden(byteToM(memory.usedJSHeapSize)) } } return { jsHeapSizeLimit: byteToM(memory.jsHeapSizeLimit), totalJSHeapSize: byteToM(memory.totalJSHeapSize), usedJSHeapSize: byteToM(memory.usedJSHeapSize) } } return {}; } window.__PERF_STORE__ = { totalJSHeapSize: [], usedJSHeapSize: [] }; window.__CPU_TIME_STORE = []; window.__IS_PDF_RENDER_DURATION__ = false; var interval = 500; var activeTime = Date.now(); var cpuCheckTimes = 10; var memoryCheckTimes = 1; var sentried = false; var memoryLimit = 512; var lastReportMemoryTime = 0; var reportMemoryPerTime = 5000; var cpuSentried = false; var jsHeapSizeLimit = window.performance && window.performance.memory && window.performance.memory.jsHeapSizeLimit; var tabSessionReferrer = (function() { var sessionReferrerKey = ‘__tabSessionReferrer__’; var sessionReferrer try { sessionReferrer = window.sessionStorage.getItem(sessionReferrerKey); if (sessionReferrer == null) { sessionReferrer = document.referrer; window.sessionStorage.setItem(sessionReferrerKey, sessionReferrer); } } catch { return document.referrer; } return sessionReferrer; })(); if (jsHeapSizeLimit) { memoryLimit = Math.min(memoryLimit, byteToM(jsHeapSizeLimit / 2)); } function checkPerf() { setTimeout(function() { try { var checkTime = +(Date.now()); var memory = window.__getPerformanceMemory__(); var diffTime = checkTime – activeTime – interval; if (window.__CPU_TIME_STORE.length >= cpuCheckTimes) { window.__CPU_TIME_STORE = []; cpuSentried = false; } window.__CPU_TIME_STORE.push(formatNumberWithHidden(diffTime)); if (memory.jsHeapSizeLimit) { if (window.__PERF_STORE__.totalJSHeapSize.length >= memoryCheckTimes) { window.__PERF_STORE__ = { totalJSHeapSize: [], usedJSHeapSize: [], }; } window.__PERF_STORE__.totalJSHeapSize.push(memory.totalJSHeapSize); window.__PERF_STORE__.usedJSHeapSize.push(memory.usedJSHeapSize); } var cpuOverload = isOverload(window.__CPU_TIME_STORE, 3, 500); var memoryOverload = isOverload(window.__PERF_STORE__.usedJSHeapSize, 1, memoryLimit); if ( !document.hidden && ((cpuOverload && !cpuSentried) || (memoryOverload && (checkTime – lastReportMemoryTime) > reportMemoryPerTime)) ) { if (memoryOverload) { lastReportMemoryTime = checkTime; } var info = ‘performance overload: cpu(‘ + ~~cpuOverload + ‘), memery(‘ + ~~memoryOverload + ‘)’; if (window.Sentry) { if (cpuOverload) { cpuSentried = true; window.Sentry.addBreadcrumb({ category: ‘teaLog’, message: ‘perf_cpu’, }); if (window.__SHOW_PERF_INFO__) { console.log(‘CPU Overload’, window.__CPU_TIME_STORE.join(‘,’)); } } if (memoryOverload) { window.Sentry.addBreadcrumb({ category: ‘teaLog’, message: ‘perf_memory’, }); memoryLimit = Math.max(memoryLimit, window.__getPerformanceMemory__(false).usedJSHeapSize || 0) + 150; if (window.__SHOW_PERF_INFO__) { console.log(‘Memory Overload’, window.__PERF_STORE__.totalJSHeapSize.join(‘,’)); } } if (!sentried) { window.Sentry.captureMessage(info, ‘error’); } } sentried = true; } if (window.__SHOW_PERF_INFO__) { console.log(cpuOverload, memoryOverload, diffTime, memory.totalJSHeapSize, memory.usedJSHeapSize, memory.jsHeapSizeLimit); } } catch (error) { console.log(error); } activeTime = Date.now(); checkPerf(); }, interval); }; checkPerf(); var TAB_ID; try { TAB_ID = window.sessionStorage.getItem(‘__TAB_ID__’); if (TAB_ID) TAB_ID = Number(TAB_ID); if (!TAB_ID || !/^d+$/.test(TAB_ID)) TAB_ID = Date.now(); window.sessionStorage.setItem(‘__TAB_ID__’, TAB_ID); } catch (error) { TAB_ID = Date.now(); } window.__TAB_ID__ = TAB_ID; if (window.__SENTRY_INIT__) { function replaceQuery(url) { return url && url.replace(/([?&])([^=&#]+)=([^&#]*)/g, ‘$1$2=’); } var integrations; if (window.Sentry) { integrations = [ new window.Sentry.Integrations.Breadcrumbs({ console: false, fetch: false, xhr: false }), new window.Sentry.Integrations.GlobalHandlers({ onunhandledrejection: false }) ]; } window.__SENTRY_INIT__({ dsn: window.__SENTRY_DSN__, integrations: integrations, release: window.__RELEASE__, environment: window.__ENV__, beforeBreadcrumb(breadcrumb) { try { var supportedCategories = [ ‘ui.click’, ‘ui.input’, ‘navigation’, ‘teaLog’, ]; var category = breadcrumb.category; if ([ ‘ui.click’, ‘ui.input’, ].indexOf(category) !== -1) { breadcrumb.message = breadcrumb.message && breadcrumb.message.replace(/[(name|alt|title)=.*?]/g, ‘[$1=]’); } if ([ ‘navigation’, ].indexOf(category) !== -1) { var bData = breadcrumb.data || {}; breadcrumb.data = { from: replaceQuery(bData.from), to: replaceQuery(bData.to) } } if (window.__TEA_TRACk__ && supportedCategories.indexOf(category) !== -1) { var teaEventName = ‘sentry_’ + category.replace(/./g, ‘_’); var memory = window.__getPerformanceMemory__(false); var data = breadcrumb.data; if (category === ‘teaLog’ && data) { data = data.info; } else if (typeof data !== ‘string’ && data) { data = JSON.stringify(data); } data = data && data.replace(/”/g, “‘”); window.__TEA_TRACk__(teaEventName, { type: breadcrumb.type, level: breadcrumb.level, category: category, message: breadcrumb.message, data: data, tabId: TAB_ID, userAgent: window.navigator && window.navigator.userAgent, jsHeapSizeLimit: memory.jsHeapSizeLimit, totalJSHeapSize: window.__PERF_STORE__.totalJSHeapSize.concat(memory.totalJSHeapSize).join(‘,’), usedJSHeapSize: window.__PERF_STORE__.usedJSHeapSize.concat(memory.usedJSHeapSize).join(‘,’), currentTotalJSHeapSize: memory.totalJSHeapSize, currentUsedJSHeapSize: memory.usedJSHeapSize, cpu: window.__CPU_TIME_STORE.join(‘,’), maxCPU: maxWithHidden(window.__CPU_TIME_STORE), url: replaceQuery(window.location.href), url_path: window.location.pathname, referrer: replaceQuery(document.referrer), isPdfRenderDuration: window.__IS_PDF_RENDER_DURATION__ ? 1 : 0, tabSessionReferrer: tabSessionReferrer, }); } } catch (error) { console.log(error); } return breadcrumb; }, }); } })(); ]]>Join TikTok >>s juffeel s#’ } catch(e) { } ]]>

Source

Leave a Reply

Close Menu
×
×

Cart