15821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// Copyright (c) 2009 The Chromium Authors. All rights reserved. 25821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// Use of this source code is governed by a BSD-style license that can be 35821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// found in the LICENSE file. 45821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 55821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#include "net/ftp/ftp_server_type_histograms.h" 65821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 75821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#include "base/metrics/histogram.h" 85821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 95821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)namespace net { 105821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 115821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// We're using a histogram as a group of counters, with one bucket for each 125821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// enumeration value. We're only interested in the values of the counters. 135821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// Ignore the shape, average, and standard deviation of the histograms because 145821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// they are meaningless. 155821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// 165821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// We use two histograms. In the first histogram we tally whether the user has 175821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// seen an FTP server of a given type during that session. In the second 185821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// histogram we tally the number of transactions with FTP server of a given type 195821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// the user has made during that session. 205821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)void UpdateFtpServerTypeHistograms(FtpServerType type) { 215821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) static bool had_server_type[NUM_OF_SERVER_TYPES]; 225821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) if (type >= 0 && type < NUM_OF_SERVER_TYPES) { 235821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) if (!had_server_type[type]) { 245821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) had_server_type[type] = true; 252a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) UMA_HISTOGRAM_ENUMERATION("Net.HadFtpServerType2", 265821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) type, NUM_OF_SERVER_TYPES); 275821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) } 285821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) } 292a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) UMA_HISTOGRAM_ENUMERATION("Net.FtpServerTypeCount2", 305821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) type, NUM_OF_SERVER_TYPES); 315821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)} 325821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 335821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)} // namespace net 34