1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. 2 // Use of this source code is governed by a BSD-style license that can be 3 // found in the LICENSE file. 4 5 #include "net/ftp/ftp_server_type_histograms.h" 6 7 #include "base/metrics/histogram.h" 8 9 namespace net { 10 11 // We're using a histogram as a group of counters, with one bucket for each 12 // enumeration value. We're only interested in the values of the counters. 13 // Ignore the shape, average, and standard deviation of the histograms because 14 // they are meaningless. 15 // 16 // We use two histograms. In the first histogram we tally whether the user has 17 // seen an FTP server of a given type during that session. In the second 18 // histogram we tally the number of transactions with FTP server of a given type 19 // the user has made during that session. 20 void UpdateFtpServerTypeHistograms(FtpServerType type) { 21 static bool had_server_type[NUM_OF_SERVER_TYPES]; 22 if (type >= 0 && type < NUM_OF_SERVER_TYPES) { 23 if (!had_server_type[type]) { 24 had_server_type[type] = true; 25 UMA_HISTOGRAM_ENUMERATION("Net.HadFtpServerType2", 26 type, NUM_OF_SERVER_TYPES); 27 } 28 } 29 UMA_HISTOGRAM_ENUMERATION("Net.FtpServerTypeCount2", 30 type, NUM_OF_SERVER_TYPES); 31 } 32 33 } // namespace net 34