How to use the heimdalljs.current function in heimdalljs

To help you get started, we’ve selected a few heimdalljs examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github ember-cli / ember-cli / lib / cli / index.js View on Github external
'use strict';

const willInterruptProcess = require('../utilities/will-interrupt-process');
const instrumentation = require('../utilities/instrumentation');
const getConfig = require('../utilities/get-config');
const ciInfo = require('ci-info');

let initInstrumentation;
if (instrumentation.instrumentationEnabled()) {
  const heimdall = require('heimdalljs');
  let initInstrumentationToken = heimdall.start('init');
  initInstrumentation = {
    token: initInstrumentationToken,
    node: heimdall.current,
  };
}

// Main entry point
const requireAsHash = require('../utilities/require-as-hash');
const packageConfig = require('../../package.json');
const logger = require('heimdalljs-logger')('ember-cli:cli/index');
const merge = require('ember-cli-lodash-subset').merge;
const path = require('path');
const heimdall = require('heimdalljs');

let version = packageConfig.version;
let name = packageConfig.name;
let trackingCode = packageConfig.trackingCode;

function loadCommands() {
github broccolijs / broccoli / lib / builder.ts View on Github external
name = node.nodeInfo.sourceDirectory;
      } else {
        name = node.nodeInfo.annotation || node.nodeInfo.name;
      }

      node.__heimdall_cookie__ = heimdall.start({
        name,
        label: node.label,
        broccoliNode: true,
        broccoliId: node.id,
        // we should do this instead of reparentNodes
        // broccoliInputIds: node.inputNodeWrappers.map(input => input.id),
        broccoliCachedNode: false,
        broccoliPluginName: node.nodeInfo.name,
      });
      node.__heimdall__ = heimdall.current;
    });
github broccolijs / broccoli / lib / builder.ts View on Github external
const seen = new Set();
  const queue = [outputNodeWrapper];
  let node;
  let parent;
  let stack: any = [];
  while ((node = queue.pop()) !== undefined) {
    if (parent === node) {
      parent = stack.pop();
    } else {
      queue.push(node);

      let heimdallNode = node.__heimdall__;
      if (heimdallNode === undefined || seen.has(heimdallNode)) {
        // make 0 time node
        const cookie = heimdall.start(Object.assign({}, heimdallNode.id));
        heimdallNode = heimdall.current;
        heimdallNode.id.broccoliCachedNode = true;
        cookie.stop();
        heimdallNode.stats.time.self = 0;
      } else {
        seen.add(heimdallNode);
        // Only push children for non "cached inputs"
        const inputNodeWrappers = node.inputNodeWrappers;
        for (let i = inputNodeWrappers.length - 1; i >= 0; i--) {
          queue.push(inputNodeWrappers[i]);
        }
      }

      if (parent) {
        heimdallNode.remove();
        parent.__heimdall__.addChild(heimdallNode);
        stack.push(parent);
github broccolijs / broccoli / lib / builder.ts View on Github external
function aggregateTime() {
  let queue = [heimdall.current];
  let stack: any = [];
  let parent;
  let node;
  while ((node = queue.pop()) !== undefined) {
    if (parent === node) {
      parent = stack.pop();
      if (parent !== undefined) {
        parent.stats.time.total += node.stats.time.total;
      }
    } else {
      const children = node._children;
      queue.push(node);
      for (let i = children.length - 1; i >= 0; i--) {
        queue.push(children[i]);
      }
      if (parent) {
github heimdalljs / heimdalljs-logger / src / prefixer.js View on Github external
prefix() {
    let parts = [];
    let node = heimdall.current;

    while (node) {
      if (node.isRoot || parts.length >= this.depth) {
        break;
      }

      if (this.matcher(node.id)) {
        parts.push(`${node.id.name}#${node._id}`);
      }

      node = node.parent;
    }

    return parts.length > 0 ? `[${parts.reverse().join(' -> ')}] ` : '';
  }
}

heimdalljs

Structured instrumentation library

MIT
Latest version published 6 years ago

Package Health Score

56 / 100
Full package analysis