Skip to content
This repository was archived by the owner on Nov 15, 2017. It is now read-only.

Commit 071a24b

Browse files
committed
small change to profiler for convenience
1 parent 063af10 commit 071a24b

File tree

2 files changed

+12
-10
lines changed

2 files changed

+12
-10
lines changed

js/profiler.js

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ var time = 0;
3030
var count = -3;
3131
var tstart = 0;
3232
var lastlog = timer.now();
33+
var prompt = '';
3334

3435
/******************************************************************************/
3536

@@ -47,19 +48,20 @@ var avg = function() {
4748

4849
/******************************************************************************/
4950

50-
var start = function() {
51+
var start = function(s) {
52+
prompt = s || '';
5153
tstart = timer.now();
5254
};
5355

5456
/******************************************************************************/
5557

56-
var stop = function(s) {
58+
var stop = function() {
5759
count += 1;
5860
if ( count > 0 ) {
5961
var now = timer.now();
6062
time += (now - tstart);
6163
if ( (now - lastlog) > 10000 ) {
62-
console.log('HTTP Switchboard() > %s: %s ms', s, avg().toFixed(3));
64+
console.log('HTTP Switchboard() > %s: %s ms', prompt, avg().toFixed(3));
6365
lastlog = now;
6466
}
6567
}

js/traffic.js

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -223,7 +223,7 @@ var onBeforeRootFrameRequestHandler = function(details) {
223223
if ( tabId !== httpsb.behindTheSceneTabId ) {
224224
httpsb.cookieHunter.recordPageCookies(pageStats);
225225
}
226-
// quickProfiler.stop('onBeforeRequest');
226+
// quickProfiler.stop();
227227
return;
228228
}
229229

@@ -247,7 +247,7 @@ var onBeforeRootFrameRequestHandler = function(details) {
247247
html = html.replace(/{{now}}/g, String(Date.now()));
248248
var dataURI = 'data:text/html;base64,' + btoa(html);
249249

250-
// quickProfiler.stop('onBeforeRequest');
250+
// quickProfiler.stop();
251251

252252
return { "redirectUrl": dataURI };
253253
};
@@ -278,7 +278,7 @@ var onBeforeRequestHandler = function(details) {
278278
return;
279279
}
280280

281-
// quickProfiler.start();
281+
// quickProfiler.start('onBeforeRequest');
282282

283283
var requestType = details.type;
284284

@@ -292,7 +292,7 @@ var onBeforeRequestHandler = function(details) {
292292
// https://github.com/gorhill/httpswitchboard/issues/202
293293
if ( requestType === 'xmlhttprequest' ) {
294294
if ( requestURL.slice(0, httpsb.projectServerRoot.length) === httpsb.projectServerRoot ) {
295-
// quickProfiler.stop('onBeforeRequest');
295+
// quickProfiler.stop();
296296
return;
297297
}
298298
}
@@ -357,7 +357,7 @@ var onBeforeRequestHandler = function(details) {
357357
// whitelisted?
358358
if ( !block ) {
359359
// console.debug('onBeforeRequestHandler()> ALLOW "%s": %o', details.url, details);
360-
// quickProfiler.stop('onBeforeRequest');
360+
// quickProfiler.stop();
361361
return;
362362
}
363363

@@ -373,11 +373,11 @@ var onBeforeRequestHandler = function(details) {
373373
.replace(/{{fontUrl}}/g, httpsb.fontCSSURL)
374374
.replace(/{{hostname}}/g, requestHostname)
375375
.replace(/{{opacity}}/g, httpsb.userSettings.subframeOpacity.toFixed(2));
376-
// quickProfiler.stop('onBeforeRequest');
376+
// quickProfiler.stop();
377377
return { 'redirectUrl': 'data:text/html,' + encodeURIComponent(html) };
378378
}
379379

380-
// quickProfiler.stop('onBeforeRequest');
380+
// quickProfiler.stop();
381381

382382
return { "cancel": true };
383383
};

0 commit comments

Comments
 (0)