B2G/gecko/browser/components/tabview/telemetry.js
/**
   * Adds telemetry values to gather usage statistics.
   */
Adds telemetry values to gather usage statistics.
Adds telemetry values to gather usage statistics .
function Telemetry_collect() {
    let stackedGroupsCount = 0;
    let childCounts = [];
    GroupItems.groupItems.forEach(function (groupItem) {
      if (!groupItem.isEmpty()) {
        childCounts.push(groupItem.getChildren().length);
        if (groupItem.isStacked())
          stackedGroupsCount++;
      }
    });
    function addTelemetryValue(aId, aValue) {
      Services.telemetry.getHistogramById("PANORAMA_" + aId).add(aValue);
    }
    function median(aChildCounts) {
      aChildCounts.sort(function(x, y) { return x - y; });
      let middle = Math.floor(aChildCounts.length / 2);
      return aChildCounts[middle];
    }
    addTelemetryValue("GROUPS_COUNT", GroupItems.groupItems.length);
    addTelemetryValue("STACKED_GROUPS_COUNT", stackedGroupsCount);
    addTelemetryValue("MEDIAN_TABS_IN_GROUPS_COUNT", median(childCounts));
  }
function Telemetry_collect ( ) { let stackedGroupsCount = 0 ; let childCounts = [ ] ; GroupItems . groupItems . forEach ( function ( groupItem ) { if ( ! groupItem . isEmpty ( ) ) { childCounts . push ( groupItem . getChildren ( ) . length ) ; if ( groupItem . isStacked ( ) ) stackedGroupsCount ++ ; } } ) ; function addTelemetryValue ( aId , aValue ) { Services . telemetry . getHistogramById ( "PANORAMA_" + aId ) . add ( aValue ) ; } function median ( aChildCounts ) { aChildCounts . sort ( function ( x , y ) { return x - y ; } ) ; let middle = Math . floor ( aChildCounts . length / 2 ) ; return aChildCounts [ middle ] ; } addTelemetryValue ( "GROUPS_COUNT" , GroupItems . groupItems . length ) ; addTelemetryValue ( "STACKED_GROUPS_COUNT" , stackedGroupsCount ) ; addTelemetryValue ( "MEDIAN_TABS_IN_GROUPS_COUNT" , median ( childCounts ) ) ; }
Adds telemetry values to gather usage statistics.
Adds telemetry values to gather usage statistics .