*
@param {object} profile
@description 找出 gc / program / idle 等属性
512157
function extractMetaNodes(profile) {
        const topLevelNodes = profile.resultRoot.children;
        for (let i = 0; i < topLevelNodes.length && !(profile.gcNode && profile.programNode && profile.idleNode); i++) {
            const node = topLevelNodes[i];
            if (node.functionName === '(garbage collector)')
                profile.gcNode = node;
            else if (node.functionName === '(program)')
                profile.programNode = node;
            else if (node.functionName === '(idle)')
                profile.idleNode = node;
        }
    }
538350
public void getProfile(@NonNull final String profileId, @Nullable Callback<ComapiResult<Map<String, Object>>> callback) {
        adapter.adapt(getProfile(profileId), callback);
    }
477824
public void stopProfile(IoEventType type) {
        switch (type) {
            case MESSAGE_RECEIVED :
                profileMessageReceived = false;
                return;
                
            case MESSAGE_SENT :
                profileMessageSent = false;
                return;
                
            case SESSION_CREATED :
                profileSessionCreated = false;
                return;

            case SESSION_OPENED :
                profileSessionOpened = false;
                return;

            case SESSION_IDLE :
                profileSessionIdle = false;
                return;

            case SESSION_CLOSED :
                profileSessionClosed = false;
                return;
        }
    }
392403
function initProfiler(name) {
        checkInit();
        var profiler = profilerInstances[name];
        if (profiler === void 0) {
            profilerInstances[name] = profiler = new Profiler(name, "ms");
            container.appendChild(profiler.widget.element);
        }
    }
1251771
def removeProfile(self, profile, silent=False):
        
        if not profile:
            return
        
        if not silent:
            title = 'Remove {0}'.format(self.profileText())
            opts  = QMessageBox.Yes | QMessageBox.No
            quest = 'Are you sure you want to remove "%s" from the toolbar?'
            quest %= profile.name() if isinstance(profile, XViewProfile) else profile
            answer = QMessageBox.question(self.window(), title, quest, opts)
        else:
            answer = QMessageBox.Yes
        
        if answer == QMessageBox.Yes:
            reset = profile == self.currentProfile()
            if not reset:
                try:
                    reset = profile == self.currentProfile().name()
                except AttributeError:
                    reset = False
            
            if reset and self.viewWidget():
                self.viewWidget().reset(True)
            
            # remove the actions from this toolbar
            removed = []
            for act in self.actions():
                if not isinstance(act, XViewProfileAction):
                    continue
                if not profile in (act.profile(), act.text()):
                    continue
                
                removed.append(act.profile())
                self.removeAction(act)
                self._profileGroup.removeAction(act)
                act.deleteLater()
            
            if not self.signalsBlocked() and removed:
                for prof in removed:
                    self.profileRemoved.emit(prof)
                self.profilesChanged.emit()
615320
public void setActiveProfile(IProfile profile, boolean fireOnProfileChanged) {
        final boolean isCurrentSelectedProfile = mAccountHeaderBuilder.switchProfiles(profile);
        //if the selectionList is shown we should also update the current selected profile in the list
        if (mAccountHeaderBuilder.mDrawer != null && isSelectionListShown()) {
            mAccountHeaderBuilder.mDrawer.setSelection(profile.getIdentifier(), false);
        }
        //fire the event if enabled and a listener is set
        if (fireOnProfileChanged && mAccountHeaderBuilder.mOnAccountHeaderListener != null) {
            mAccountHeaderBuilder.mOnAccountHeaderListener.onProfileChanged(null, profile, isCurrentSelectedProfile);
        }
    }
708337
function onUpdateProfile() {
  var displayName = $('#display-name').val();
  var photoURL = $('#photo-url').val();
  activeUser().updateProfile({
    'displayName': displayName,
    'photoURL': photoURL
  }).then(function() {
    refreshUserData();
    alertSuccess('Profile updated!');
  }, onAuthError);
}
156115
function runFirefox (options) {
  options = options || {};
  var profilePath = options.profile;
  var env = extend({}, process.env, options.env || {});
  var args = [];
  if (profilePath) {
    if (isProfileName(profilePath)) {
      args.unshift("-P", profilePath);
    }
    else {
      args.unshift("-profile", profilePath);
    }
  }
  if (options["new-instance"]) {
    args.unshift("-new-instance");
  }
  if (options["no-remote"]) {
    args.unshift("-no-remote");
  }
  if (options["foreground"]) {
    args.unshift("-foreground");
  }
  if (options["binary-args"]) {
    if (Array.isArray(options["binary-args"])) {
      args = args.concat(options["binary-args"]);
    }
    else {
      args = args.concat(parse(options["binary-args"]));
    }
  }
  // support for starting the remote debugger server
  if (options["listen"]) {
    args.unshift(options.listen);
    args.unshift("-start-debugger-server");
  }

  return normalizeBinary(options.binary).then(function(binary) {
    // Using `spawn` so we can stream logging as they come in, rather than
    // buffer them up until the end, which can easily hit the max buffer size.
    var firefox = spawn(binary, args, { env: env });

    firefox.on("close", function () {
      process.removeListener("exit", killFirefox);
    });

    function killFirefox () {
      firefox.kill();
    }

    // Kill child process when main process is killed
    process.once("exit", killFirefox);

    return {
      process: firefox,
      binary: binary,
      args: args
    };
  });
}
57496
function( profile ) {

	// Extract profile additions
	var profile_additions = [];
	if (profile && profile.getopt)
		profile_additions = profile.getopt();

	// Validate command-line
	var opt = getopt.create([
	  ['p' , 'profile=NAME'  	   , 'Specify the profile to use for the compiler'],
	  ['o' , 'out=BUNDLE'	  	   , 'Specify the name of the bundle'],
	  ['O' , 'optimise=LEVEL+'     , 'Specify optimisation level'],
	  ['b' , 'basedir=DIR'  	   , 'Specify bundle base directory'],
	].concat( profile_additions ).concat([
	  [''  , 'log=FLAGS' 	 	   , 'Enable logging (see flags below)'],
	  ['s' , 'sparse'              , 'Create a sparse bundle rather than a solid one'],
	  ['h' , 'help'                , 'Display this help'],
	  ['v' , 'version'             , 'Show version'],
	]))
	.setHelp(
	  "Usage: jbb -p <profile> -o <file> [OPTION] <source>\n" +
	  "Compile one or more bundles to a binary format.\n" +
	  "\n" +
	  "[[OPTIONS]]\n" +
	  "\n" +
	  "Logging Flags:\n" +
	  "\n" +
	  "  p                        Log primitive opcodes\n" +
	  "  a                        Log array opcodes\n" +
	  "  c                        Log array chunk opcodes\n" +
	  "  b                        Log array bulk operations opcodes\n" +
	  "  s                        Log string opcodes\n" +
	  "  r                        Log internal cross-reference\n" +
	  "  R                        Log external cross-reference\n" +
	  "  o                        Log object opcodes\n" +
	  "  e                        Log file embedding opcodes\n" +
	  "  o                        Log object opcodes\n" +
	  "  O                        Log plain object opcodes\n" +
	  "  d                        Log protocol debug operations\n" +
	  "  w                        Log low-level byte writes\n" +
	  "  -                        Log everything\n" +
	  "\n" +
	  "Installation: npm install three-bundles\n" +
	  "Respository:  https://github.com/wavesoft/three-bundles"
	)
	.bindHelp()     // bind option 'help' to default action
	.parseSystem(); // parse command line

	// Return options
	return opt;

}
1089259
function profile1() {
  var start, end;
  var totalTimes = [];
  var totalMS = 0;
  var loopIterations = P1_ITER;
  var idx, results;
  
  createDatabase(false);
  
  for(idx=0; idx<P1_ITER; idx++) {
    start = process.hrtime();

    results = coll.chain().simplesort("b").data();

    end = process.hrtime(start);
    totalTimes.push(end);
  }
  
  for (var idx = 0; idx < totalTimes.length; idx++) {
    totalMS += totalTimes[idx][0] * 1e3 + totalTimes[idx][1] / 1e6;
  }

  totalMS = totalMS.toFixed(2);
  var rate = loopIterations * 1000 / totalMS;
  rate = rate.toFixed(2);
  console.log("'a' unfiltered, 'b' unindexed : " + totalMS + "ms (" + rate + " ops/s) " + loopIterations + " iterations");
}
518643
public void addProfile(KeyDecodingProfile profile) {
        for (CharacterPattern pattern : profile.getPatterns()) {
            synchronized(bytePatterns) {
                //If an equivalent pattern already exists, remove it first
                bytePatterns.remove(pattern);
                bytePatterns.add(pattern);
            }
        }
    }
763874
def live_profile(script, argv, profiler_factory, interval, spawn, signum,
                 pickle_protocol, mono):
    """"""
    filename, code, globals_ = script
    sys.argv[:] = [filename] + list(argv)
    parent_sock, child_sock = socket.socketpair()
    stderr_r_fd, stderr_w_fd = os.pipe()
    pid = os.fork()
    if pid:
        # parent
        os.close(stderr_w_fd)
        viewer, loop = make_viewer(mono)
        # loop.screen._term_output_file = open(os.devnull, 'w')
        title = get_title(filename)
        client = ProfilingClient(viewer, loop.event_loop, parent_sock, title)
        client.start()
        try:
            loop.run()
        except KeyboardInterrupt:
            os.kill(pid, signal.SIGINT)
        except BaseException:
            # unexpected profiler error.
            os.kill(pid, signal.SIGTERM)
            raise
        finally:
            parent_sock.close()
        # get exit code of child.
        w_pid, status = os.waitpid(pid, os.WNOHANG)
        if w_pid == 0:
            os.kill(pid, signal.SIGTERM)
        exit_code = os.WEXITSTATUS(status)
        # print stderr of child.
        with os.fdopen(stderr_r_fd, 'r') as f:
            child_stderr = f.read()
        if child_stderr:
            sys.stdout.flush()
            sys.stderr.write(child_stderr)
        # exit with exit code of child.
        sys.exit(exit_code)
    else:
        # child
        os.close(stderr_r_fd)
        # mute stdin, stdout.
        devnull = os.open(os.devnull, os.O_RDWR)
        for f in [sys.stdin, sys.stdout]:
            os.dup2(devnull, f.fileno())
        # redirect stderr to parent.
        os.dup2(stderr_w_fd, sys.stderr.fileno())
        frame = sys._getframe()
        profiler = profiler_factory(base_frame=frame, base_code=code)
        profiler_trigger = BackgroundProfiler(profiler, signum)
        profiler_trigger.prepare()
        server_args = (interval, noop, pickle_protocol)
        server = SelectProfilingServer(None, profiler_trigger, *server_args)
        server.clients.add(child_sock)
        spawn(server.connected, child_sock)
        try:
            exec_(code, globals_)
        finally:
            os.close(stderr_w_fd)
            child_sock.shutdown(socket.SHUT_WR)
143193
function profile(excludeRegex) {
  var categories = [];
  return {
    forCategory: forCategory,
    toArray    : toArray,
    toString   : toString
  };

  function toArray() {
    return categories;
  }

  function toString() {
    return categories
      .map(String)
      .filter(Boolean)
      .join('\n');
  }

  /**
   * Create a category for analysis.
   * @param {string} [label] Optional category label
   * @param {{forCategory:function, start:function, stop:function, report:function, toString:function}} A new instance
   */
  function forCategory(label) {
    var eventsByFilename = {},
        isUsed           = false,
        self             = {
          forCategory: forCategory,
          start      : start,
          stop       : stop,
          report     : report,
          toString   : toString
        };

    label = label || ('category-' + String.fromCharCode(65 + categories.length));
    categories.push(self);
    return self;

    /**
     * Start a segment delineated by the given key.
     * @param {string} key A key to delineate a segment
     * @returns {function} A transform that causes a start event when the file is completed streaming
     */
    function start(key) {
      return createEventTransform(key);
    }

    /**
     * Stop the currently delineated segment.
     * @returns {function} A transform that causes a stop event when the file is completed streaming
     */
    function stop() {
      return createEventTransform(null);
    }

    /**
     * Create a transform that pushes time-stamped events data to the current filename.
     * @param {*} data The event data
     * @returns {function} A browserify transform that captures events on file contents complete
     */
    function createEventTransform(data) {
      return inspect(onComplete);

      function onComplete(filename) {
        isUsed = true;
        var now = Date.now();
        var events = eventsByFilename[filename] = eventsByFilename[filename] || [];
        events.push(now, data);
      }
    }

    /**
     * Create a json report of time verses key verses filename.
     */
    function report() {
      return Object.keys(eventsByFilename)
        .filter(testIncluded)
        .reduce(reduceFilenames, {});

      function testIncluded(filename) {
        return !excludeRegex || !excludeRegex.test(filename);
      }

      function reduceFilenames(reduced, filename) {
        var totalsByKey = {},
            list        = eventsByFilename[filename],
            lastKey     = null,
            lastTime    = NaN;

        // events consist of time,key pairs
        for (var i = 0; i < list.length; i += 2) {
          var time = list[i],
              key  = list[i + 1];
          if (lastKey) {
            var initial = totalsByKey[key] || 0,
                delta   = ((time - lastTime) / 1000) || 0;
            totalsByKey[lastKey] = initial + delta;
          }
          lastKey = key;
          lastTime = time;
        }

        // total at the end to guarantee consistency
        var total = 0;
        for (var key in totalsByKey) {
          total += totalsByKey[key];
        }
        totalsByKey.total = total;

        // store by the short filename
        var short = path.relative(process.cwd(), filename);
        reduced[short] = totalsByKey;
        return reduced;
      }
    }

    /**
     * A string representation of the report, sorted by longest time.
     */
    function toString() {
      var json            = report(),
          filenames       = Object.keys(json),
          longestFilename = filenames.reduce(reduceFilenamesToLength, 0),
          columnOrder     = orderColumns(),
          headerRow       = [label].concat(columnOrder).map(leftJustify).join(' '),
          delimiter       = (new Array(headerRow.length + 1)).join('-');

      if (isUsed) {
        return [delimiter, headerRow, delimiter]
          .concat(rows())
          .concat(delimiter)
          .filter(Boolean)
          .join('\n');
      } else {
        return '';
      }

      /**
       * Establish the column names, in order, left justified (for the maximum length).
       */
      function orderColumns() {
        var keyTotals = filenames.reduce(reduceFilenamesToKeyTotal, {});
        return sort(keyTotals);

        function reduceFilenamesToKeyTotal(reduced, filename) {
          var item = json[filename];
          return Object.keys(item)
            .reduce(reducePropToLength.bind(item), reduced);
        }
      }

      /**
       * Map each filename to a data row, in decreasing time order.
       */
      function rows() {
        var fileTotals = filenames.reduce(reducePropToLength.bind(json), {}),
            fileOrder  = sort(fileTotals);
        return fileOrder.map(rowForFile);

        function rowForFile(filename) {
          var data = json[filename];
//          console.log(JSON.stringify(data, null, 2));
          return [filename]
            .concat(columnOrder
              .map(dataForColumn)
              .map(formatFloat))
            .map(leftJustify)
            .join(' ');

          function dataForColumn(column) {
            return data[column];
          }

          function formatFloat(number) {
            var padding  = '000',
                warning  = ((number > 99) ? '>' : ' '),
                integer  = (padding + Math.min(99, Math.floor(number))).slice(-2),
                fraction = (padding + Math.round(1000 * number)).slice(-3);
            return warning + integer + '.' + fraction;
          }
        }
      }

      function reduceFilenamesToLength(reduced, filename) {
        return Math.max(filename.length, reduced);
      }

      function leftJustify(name, i) {
        var length = i ? Math.max(7, columnOrder[i - 1].length) : longestFilename;
        var padding = (new Array(length + 1)).join(' ');
        return (name + padding).slice(0, length);
      }

      function reducePropToLength(reduced, key) {
        var value = (typeof this[key] === 'object') ? this[key].total : this[key];
        reduced[key] = (reduced[key] || 0) + value;
        return reduced;
      }

      function sort(object) {
        return Object.keys(object)
          .reduce(createObjects.bind(object), [])
          .sort(sortTimeDescending)
          .map(getColumnName);

        function createObjects(reduced, field) {
          reduced.push({
            name: field,
            time: Math.round(this[field] * 1000) / 1000  // millisecond precision
          });
          return reduced;
        }

        function sortTimeDescending(a, b) {
          return b.time - a.time;
        }

        function getColumnName(object) {
          return object.name;
        }
      }
    }
  }
}
951436
public DrawerView selectProfile(DrawerProfile profile) {
        if (mProfileAdapter.getItems().contains(profile)) {
            DrawerProfile oldProfile = mProfileAdapter.getItem(0);

            if (mProfileAdapter.getCount() > 1) {
                closeProfileList();
                animateToProfile(profile);

                mProfileAdapter.remove(profile);
                mProfileAdapter.insert(profile, 0);
            } else {
                mProfileAdapter.remove(profile);
                mProfileAdapter.insert(profile, 0);

                if (hasOnProfileSwitchListener()) {
                    onProfileSwitchListener.onSwitch(oldProfile, oldProfile.getId(), profile, profile.getId());
                }
            }
        }
        return this;
    }
817455
def setCurrentProfile(self, prof):
        
        if prof is None:
            self.clearActive()
            return
        
        # loop through the profiles looking for a match
        profile = None
        blocked = self.signalsBlocked()
        self.blockSignals(True)
        for act in self._profileGroup.actions():
            if prof in (act.profile(), act.profile().name()):
                act.setChecked(True)
                profile = act.profile()
            else:
                act.setChecked(False)
        self.blockSignals(blocked)
        
        # update the current profile
        if profile == self._currentProfile and not self._viewWidget.isEmpty():
            return
        
        self._currentProfile = profile
        if self._viewWidget and profile and not blocked:
            self._viewWidget.restoreProfile(profile)
        
        if not blocked:
            self.loadProfileFinished.emit(profile)
            self.currentProfileChanged.emit(profile)
1328347
def editProfile(self, profile):
        
        mod = XViewProfileDialog.edit(self.window(), profile)
        if not mod:
            return False
        
        # update the action interface
        for act in self._profileGroup.actions():
            if act.profile() == profile:
                act.setProfile(profile)
                break
        
        # signal the change
        if not self.signalsBlocked():
            self.profileChanged.emit(profile)
            self.profilesChanged.emit()
        
        return True
603030
function resolve_general_awsConfig(silentFlag){
    let awsInfoFilePath = pathManager.getGeneralAWSInfoFilePath()
    let awsConfigFilePath = pathManager.getGeneralAWSConfigFilePath()

    let awsInfo = awsInfoTemplate
    if(!fs.existsSync(awsInfoFilePath)){
        if(fs.existsSync(awsConfigFilePath)){ //meaning it was generated by older version of the cli
            awsInfo.IsUsingProfile = false
            awsInfo.ProfileName = ""
        }else{ //meaning this usage is started from fresh
            awsInfo.IsUsingProfile = true
            awsInfo.ProfileName = "default"
        }
        awsInfo.AWSInfoFilePath = awsInfoFilePath
        awsInfo.AWSConfigFilePath = awsConfigFilePath
        awsInfo.LastProfileSyncTime = ""
        let jsonString = JSON.stringify(awsInfo, null, '\t')
        fs.writeFileSync(awsInfoFilePath, jsonString, 'utf8')
    }else{
        awsInfo = JSON.parse(fs.readFileSync(awsInfoFilePath, 'utf8'))
    }

    let executeSyncProfile = false
    if(fs.existsSync(awsConfigFilePath)){
        executeSyncProfile = isSyncProfileNeeded(awsInfo)
    }else{
        if(awsInfo.IsUsingProfile){
            executeSyncProfile = true
        }else{
            let awsConfig = awsConfigTemplate
            let jsonString = JSON.stringify(awsConfig)
            fs.writeFileSync(awsConfigFilePath, jsonString, 'utf8')
        }
    }
    if(executeSyncProfile){
        syncProfile(awsInfo, silentFlag)
    }
    return awsInfo
}