1 // Copyright 2014 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 // This file contains a set of histogram support functions for logging behavior
6 // seen while loading NaCl plugins.
7 
8 #ifndef COMPONENTS_NACL_RENDERER_HISTOGRAM_H_
9 #define COMPONENTS_NACL_RENDERER_HISTOGRAM_H_
10 
11 #include <stdint.h>
12 
13 #include <string>
14 #include "base/time/time.h"
15 #include "components/nacl/renderer/ppb_nacl_private.h"
16 
17 namespace nacl {
18 
19 void HistogramCustomCounts(const std::string& name,
20                            int32_t sample,
21                            int32_t min,
22                            int32_t max,
23                            uint32_t bucket_count);
24 
25 void HistogramEnumerate(const std::string& name,
26                         int32_t sample,
27                         int32_t boundary_value);
28 
29 void HistogramEnumerateLoadStatus(PP_NaClError error_code,
30                                   bool is_installed);
31 
32 void HistogramEnumerateOsArch(const std::string& sandbox_isa);
33 
34 // Records values up to 20 seconds.
35 void HistogramTimeSmall(const std::string& name, int64_t sample);
36 // Records values up to 3 minutes, 20 seconds.
37 void HistogramTimeMedium(const std::string& name, int64_t sample);
38 // Records values up to 33 minutes.
39 void HistogramTimeLarge(const std::string& name, int64_t sample);
40 // Records values up to 12 minutes.
41 void HistogramTimeTranslation(const std::string& name, int64_t sample_ms);
42 
43 void HistogramStartupTimeSmall(const std::string& name,
44                                base::TimeDelta td,
45                                int64_t nexe_size);
46 void HistogramStartupTimeMedium(const std::string& name,
47                                 base::TimeDelta td,
48                                 int64_t nexe_size);
49 void HistogramSizeKB(const std::string& name, int32_t sample);
50 void HistogramHTTPStatusCode(const std::string& name, int32_t status);
51 void HistogramEnumerateManifestIsDataURI(bool is_data_uri);
52 void HistogramKBPerSec(const std::string& name, int64_t kb, int64_t us);
53 void HistogramRatio(const std::string& name,
54                     int64_t numerator,
55                     int64_t denominator);
56 
57 }  // namespace nacl
58 
59 #endif  // COMPONENTS_NACL_RENDERER_HISTOGRAM_H_
60