MCPcopy Create free account
hub / github.com/google/pprof / viewer

Function viewer

internal/driver/html/common.js:396–709  ·  view source on GitHub ↗
(baseUrl, nodes, options)

Source from the content-addressed store, hash-verified

394// current: function() Map[Number,Boolean]
395// Overridable mechanism for fetching set of currently selected nodes.
396function viewer(baseUrl, nodes, options) {
397 'use strict';
398
399 // Elements
400 const search = document.getElementById('search');
401 const graph0 = document.getElementById('graph0');
402 const svg = (graph0 == null ? null : graph0.parentElement);
403 const toptable = document.getElementById('toptable');
404
405 let regexpActive = false;
406 let selected = new Map();
407 let origFill = new Map();
408 let searchAlarm = null;
409 let buttonsEnabled = true;
410
411 // Return current selection.
412 function getSelection() {
413 if (selected.size > 0) {
414 return selected;
415 } else if (options && options.current) {
416 return options.current();
417 }
418 return new Map();
419 }
420
421 function handleDetails(e) {
422 e.preventDefault();
423 const detailsText = document.getElementById('detailsbox');
424 if (detailsText != null) {
425 if (detailsText.style.display === 'block') {
426 detailsText.style.display = 'none';
427 } else {
428 detailsText.style.display = 'block';
429 }
430 }
431 }
432
433 function handleKey(e) {
434 if (e.keyCode != 13) return;
435 setHrefParams(window.location, function (params) {
436 params.set('f', search.value);
437 });
438 e.preventDefault();
439 }
440
441 function handleSearch() {
442 // Delay expensive processing so a flurry of key strokes is handled once.
443 if (searchAlarm != null) {
444 clearTimeout(searchAlarm);
445 }
446 searchAlarm = setTimeout(selectMatching, 300);
447
448 regexpActive = true;
449 updateButtons();
450 }
451
452 function selectMatching() {
453 searchAlarm = null;

Callers 1

stackViewerFunction · 0.85

Calls 5

updateButtonsFunction · 0.85
initMenusFunction · 0.85
initPanAndZoomFunction · 0.85
addActionFunction · 0.85
initConfigManagerFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…