summaryrefslogtreecommitdiffstats
path: root/chrome/browser/resources/hotword/metrics.js
blob: 6adccb4a234f10a17a9418c72cc3fb5870d6b4e0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
// Copyright 2014 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

cr.define('hotword.metrics', function() {
  'use strict';

  /**
   * Helper function to record enum values in UMA.
   * @param {!string} name
   * @param {!number} value
   * @param {!number} maxValue
   */
  function recordEnum(name, value, maxValue) {
    var metricDesc = {
      'metricName': name,
      'type': 'histogram-linear',
      'min': 1,
      'max': maxValue,
      'buckets': maxValue + 1
    };
    chrome.metricsPrivate.recordValue(metricDesc, value);
  }

  return {
    recordEnum: recordEnum
  };
});