Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(293)

Side by Side Diff: webkit/plugins/ppapi/ppb_uma_private_impl.cc

Issue 6903084: Add UMA private PPAPI interface for UMA logging from NaCl plugin (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 9 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « webkit/plugins/ppapi/ppb_uma_private_impl.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Property Changes:
Added: svn:executable
+ *
Added: svn:eol-style
+ LF
OLDNEW
(Empty)
1 // Copyright (c) 2011 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 "webkit/plugins/ppapi/ppb_uma_private_impl.h"
6
7 #include "base/metrics/histogram.h"
8 #include "ppapi/c/pp_var.h"
9 #include "ppapi/c/private/ppb_uma_private.h"
10 #include "webkit/glue/webkit_glue.h"
11 #include "webkit/plugins/ppapi/var.h"
12
13 namespace webkit {
14 namespace ppapi {
15
16 namespace {
17
18 void HistogramCustomTimes(PP_Var name, int64_t sample,
19 int64_t min, int64_t max, uint32_t bucket_count) {
bbudge-google 2011/04/27 23:03:54 I think the parameter formatting rule is all on on
elijahtaylor (use chromium) 2011/04/28 19:14:47 Done.
20 scoped_refptr<StringVar> name_string(StringVar::FromPPVar(name));
21 base::Histogram* counter =
22 base::Histogram::FactoryTimeGet(name_string->value(),
23 base::TimeDelta::FromMilliseconds(min),
24 base::TimeDelta::FromMilliseconds(max),
25 bucket_count,
26 base::Histogram::kUmaTargetedHistogramFlag);
27 counter->AddTime(base::TimeDelta::FromMilliseconds(sample));
28 }
29
30 void HistogramCustomCounts(PP_Var name, int32_t sample,
31 int32_t min, int32_t max, uint32_t bucket_count) {
32 scoped_refptr<StringVar> name_string(StringVar::FromPPVar(name));
33 base::Histogram* counter =
34 base::Histogram::FactoryGet(name_string->value(),min, max, bucket_count,
35 base::Histogram::kUmaTargetedHistogramFlag);
36 counter->Add(sample);
37 }
38
39 void HistogramEnumeration(PP_Var name, int32_t sample, int32_t boundary_value) {
40 scoped_refptr<StringVar> name_string(StringVar::FromPPVar(name));
41 base::Histogram* counter =
42 base::LinearHistogram::FactoryGet(name_string->value(), 1, boundary_value,
43 boundary_value + 1, base::Histogram::kUmaTargetedHistogramFlag);
44 counter->Add(sample);
45 }
46
47 } // namespace
48
49 const PPB_UMA_Private ppb_uma = {
50 &HistogramCustomTimes,
51 &HistogramCustomCounts,
52 &HistogramEnumeration,
53 };
54
55 // static
56 const PPB_UMA_Private* PPB_UMA_Private_Impl::GetInterface() {
57 return &ppb_uma;
58 }
59
60 } // namespace ppapi
61 } // namespace webkit
OLDNEW
« no previous file with comments | « webkit/plugins/ppapi/ppb_uma_private_impl.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698