Parses linux power trace events.
@constructor
551868
function PowerParser(importer) {
    Parser.call(this, importer);

    // NB: old-style power events, deprecated
    importer.registerEventHandler('power_start',
        PowerParser.prototype.powerStartEvent.bind(this));
    importer.registerEventHandler('power_frequency',
        PowerParser.prototype.powerFrequencyEvent.bind(this));

    importer.registerEventHandler('cpu_frequency',
        PowerParser.prototype.cpuFrequencyEvent.bind(this));
    importer.registerEventHandler('cpu_idle',
        PowerParser.prototype.cpuIdleEvent.bind(this));
  }
797725
function parse(str, options, callback) {
	if (typeof options === 'function') {
		callback = options
		options = {}
	}
	process.nextTick(() => {
		const output = parseSync(str, options)
		callback(output)
	})
}
61244
function ProcessWatcher(pid, parent) {
    var self = this;

    this.dead = false;

    // check first if process is alive
    if (exports.alive(pid) === false) {
      process.nextTick(function () {
        self.dead = true;
        self.emit('dead');
      });
      return self;
    }

    // use disconnect to detect parent death
    if (parent && exports.support.disconnect) {
      var listen = function() {
        self.dead = true;
        self.stop();
        self.emit('dead');
      }

      parent.once('disconnect', listen);
      this.stop = parent.removeListener.bind(null, 'disconnect', listen);

      this.on('newListener', function (eventName) {
        if (eventName !== 'cycle') return;

        process.nextTick(function () {
          self.emit('cycle');
        });
      });

      return self;
    }

    // fallback to an setInterval try/catch check
    var timer = setInterval(function () {
      if (exports.alive(pid) === false) {
        self.dead = true;
        self.stop();
        self.emit('dead');
      }
      self.emit('cycle');
    });
    this.stop = clearInterval.bind(null, timer);
  }
496527
function GestureParser(importer) {
    Parser.call(this, importer);
    importer.registerEventHandler('tracing_mark_write:log',
        GestureParser.prototype.logEvent.bind(this));
    importer.registerEventHandler('tracing_mark_write:SyncInterpret',
        GestureParser.prototype.syncEvent.bind(this));
    importer.registerEventHandler('tracing_mark_write:HandleTimer',
        GestureParser.prototype.timerEvent.bind(this));
  }
784174
function() {
    var con = {};
    con.log = console.log;
    con.warn = console.warn;
    con.info = console.info;
    con.error = console.error;

    var fu = function(type, args) {
      if (!self.uiPrompt.rl || !process.stdout.columns) {
        return con[type].apply(con, args);
      }

      var t = Math.ceil(
        (self.uiPrompt.rl.line.length + 3) / process.stdout.columns
      );
      var text = util.format.apply(console, args);

      self.uiPrompt.rl.output.unmute();
      self.uiPrompt.rl.output.write('\n\x1B[' + t + 'A\x1B[0J');
      self.uiPrompt.rl.output.write(text + '\n');
      self.uiPrompt.rl.output.write(new Array(t).join('\n\x1B[E'));
      self.uiPrompt.rl._refreshLine();
      self.uiPrompt.rl.output.mute();
    };

    console.log = function() {
      fu('log', arguments);
    };
    console.warn = function() {
      fu('warn', arguments);
    };
    console.info = function() {
      fu('info', arguments);
    };
    console.error = function() {
      fu('error', arguments);
    };
  }
226577
function (latest_log) {
		if (latest_log !== null && latest_log.type !== "SYSTEM_DOWN") {
			LOG.warn("server crashed last time", 'handlers.system');
			LOG.event("SYSTEM_CRASHED", SR.Settings.SERVER_INFO);
		}

		LOG.event("SYSTEM_UP", SR.Settings.SERVER_INFO);
	}
876488
function Logger() {
  this._level = LEVELS.NOTICE;
  this._out = process.stdout;
  this._err = process.stderr;

  /* istanbul ignore next: allow server to suppress logs */
  if(process.env.NODE_ENV === Constants.TEST && !process.env.TEST_DEBUG) {
    this.log = function noop(){};
  }
}
836966
function _gpfEventsTriggerHandler (event, eventsHandler, resolvePromise) {
    var eventHandler = _getEventHandler(event, eventsHandler);
    eventHandler(event);
    if (undefined !== resolvePromise) {
        resolvePromise(event);
    }
}
766104
function captureLogs() {
  'use strict';
  console.log('Now capturing logs');
  var methods = [ 'debug', 'info', 'log', 'warn', 'error' ];
  methods.forEach(function (mthd) {
    var realMethod = 'real' + mthd,
      report = captureLog.bind({}, mthd);
    console[realMethod] = console[mthd];
    console[mthd] = function () {
      report(arguments);
      console.reallog.apply(console, arguments);
    };
  });
}
1064581
def parse_event_data(event_data)
      if ((event_data[:type] == 376) || (event_data[:type] == 422)) && !@connected
        @connected = true
        process_callbacks(:connect, event_data)
      end

      process_callbacks(event_data[:type], event_data)
    end
763619
function log_event(req, code, message, elapsed) {
  return {
    code:           code,
    message:        message,
    elapsed:        elapsed,
    request:        req,
    url:            req.originalUrl || req.url,
    method:         req.method,
    headers:        req.headers,
    httpVersion:    req.httpVersion,
    remoteAddress:  req.connection.remoteAddress
  };
}
404251
function(eventName, cpuNumber, pid, ts, eventBase) {
      var event = /type=(\d+) state=(\d) cpu_id=(\d+)/.exec(eventBase.details);
      if (!event)
        return false;

      var targetCpuNumber = parseInt(event[3]);
      var cpuState = parseInt(event[2]);
      this.cpuStateSlice(ts, targetCpuNumber, event[1], cpuState);
      return true;
    }
842255
function signals() {

  /**
   *  Signal handler.
   */
  function interrupt(signal) {
    this.log.notice('received %s, scheduling shutdown', signal);
    this.shutdown(0, process.exit);
  }

  interrupt = interrupt.bind(this);

  function iterate(signal) {

    /* test environment listener leak */
    if(process.listeners(signal).length) return;

    process.once(signal, function() {
      interrupt(signal);
    })
  }

  ['SIGINT', 'SIGTERM'].forEach(iterate.bind(this));
}
414750
function trace() {
      var args = Array.prototype.slice.call(arguments);
      var traceLevel = args.shift();
      if (traceLevel.level & enabledLevels) {
        args.unshift('[' + traceLevel.name + '] ' + new Date().toISOString() + ' - ' + aName + ':');
        console.log.apply(console, args);
      }
    }
431822
function DeviceLoader() {
  var self = this;

  // call super class
  EventEmitter2.call(this, {
    wildcard: true,
    delimiter: ':',
    maxListeners: 1000 // default would be 10!
  });

  if (this.log) {
    this.log = _.wrap(this.log, function(func, msg) {
      func(self.constructor.name + ': ' + msg);
    });
  } else if (DeviceLoader.prototype.log) {
    DeviceLoader.prototype.log = _.wrap(DeviceLoader.prototype.log, function(func, msg) {
      func(self.constructor.name + ': ' + msg);
    });
    this.log = DeviceLoader.prototype.log;
  } else {
    var debug = require('debug')(this.constructor.name);
    this.log = function(msg) {
      debug(msg);
    };
  }

  this.lookupIntervalId = null;
  this.oldDevices = [];

  this.isRunning = false;
}
759022
function PatternEmitter() {
  EventEmitter.call(this);

  this.event = '';
  this._regexesCount = 0;

  this._events = this._events || {};
  this._patternEvents = this._patternEvents || {};
  this._regexes = this._regexes || {};
}
1101478
function() {
      var csr = new tr.ClockSyncRecord('ftrace_importer', 0, {});
      this.model_.clockSyncRecords.push(csr);
      if (this.stackFrameEvents_) {
        this.importStackFrames_(
            this.stackFrameEvents_, 'g', false /* addRootFrame */);
      }

      if (this.traceAnnotations_)
        this.importAnnotations_();

      var events = this.events_;
      for (var eI = 0; eI < events.length; eI++) {
        var event = events[eI];
        if (event.args === '__stripped__') {
          event.argsStripped = true;
          event.args = undefined;
        }

        if (event.ph === 'B' || event.ph === 'E') {
          this.processDurationEvent(event);

        } else if (event.ph === 'X') {
          var slice = this.processCompleteEvent(event);
          // TODO(yuhaoz): If Chrome supports creating other events with flow,
          // we will need to call processFlowEvent for them also.
          // https://github.com/catapult-project/catapult/issues/1259
          if (slice !== undefined && event.bind_id !== undefined)
            this.processFlowEvent(event, slice);

        } else if (event.ph === 'b' || event.ph === 'e' || event.ph === 'n' ||
                   event.ph === 'S' || event.ph === 'F' || event.ph === 'T' ||
                   event.ph === 'p') {
          this.processAsyncEvent(event);

        // Note, I is historic. The instant event marker got changed, but we
        // want to support loading old trace files so we have both I and i.
        } else if (event.ph === 'I' || event.ph === 'i' || event.ph === 'R') {
          this.processInstantEvent(event);

        } else if (event.ph === 'P') {
          this.processTraceSampleEvent(event);

        } else if (event.ph === 'C') {
          this.processCounterEvent(event);

        } else if (event.ph === 'M') {
          this.processMetadataEvent(event);

        } else if (event.ph === 'N' || event.ph === 'D' || event.ph === 'O') {
          this.processObjectEvent(event);

        } else if (event.ph === 's' || event.ph === 't' || event.ph === 'f') {
          this.processFlowEvent(event);

        } else if (event.ph === 'v') {
          this.processMemoryDumpEvent(event);

        } else {
          this.model_.importWarning({
            type: 'parse_error',
            message: 'Unrecognized event phase: ' +
                event.ph + ' (' + event.name + ')'
          });
        }
      }

      // Remove all the root stack frame children as they should
      // already be added.
      tr.b.iterItems(this.v8ProcessRootStackFrame_, function(name, frame) {
        frame.removeAllChildren();
      });
    }