summaryrefslogtreecommitdiffstats
path: root/net/ftp/ftp_server_type_histograms.cc
blob: 759ceaea7fe22754de5b07372ff6e75eb12660d8 (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
29
30
31
32
33
// Copyright (c) 2009 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.

#include "net/ftp/ftp_server_type_histograms.h"

#include "base/metrics/histogram_macros.h"

namespace net {

// We're using a histogram as a group of counters, with one bucket for each
// enumeration value.  We're only interested in the values of the counters.
// Ignore the shape, average, and standard deviation of the histograms because
// they are meaningless.
//
// We use two histograms.  In the first histogram we tally whether the user has
// seen an FTP server of a given type during that session.  In the second
// histogram we tally the number of transactions with FTP server of a given type
// the user has made during that session.
void UpdateFtpServerTypeHistograms(FtpServerType type) {
  static bool had_server_type[NUM_OF_SERVER_TYPES];
  if (type >= 0 && type < NUM_OF_SERVER_TYPES) {
    if (!had_server_type[type]) {
      had_server_type[type] = true;
      UMA_HISTOGRAM_ENUMERATION("Net.HadFtpServerType2",
                                type, NUM_OF_SERVER_TYPES);
    }
  }
  UMA_HISTOGRAM_ENUMERATION("Net.FtpServerTypeCount2",
                            type, NUM_OF_SERVER_TYPES);
}

}  // namespace net