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

Side by Side Diff: base/android/record_histogram.cc

Issue 2930553002: Add UMA metric to track the time elapsed since a WebAPK was last launched (Closed)
Patch Set: Merge branch 'master' into last_launched2 Created 3 years, 5 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
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "base/android/record_histogram.h" 5 #include "base/android/record_histogram.h"
6 6
7 #include <stdint.h> 7 #include <stdint.h>
8 8
9 #include <map> 9 #include <map>
10 #include <string> 10 #include <string>
(...skipping 297 matching lines...) Expand 10 before | Expand all | Expand 10 after
308 android::ConvertJavaStringToUTF8(env, histogram_name)); 308 android::ConvertJavaStringToUTF8(env, histogram_name));
309 if (histogram == nullptr) { 309 if (histogram == nullptr) {
310 // No samples have been recorded for this histogram (yet?). 310 // No samples have been recorded for this histogram (yet?).
311 return 0; 311 return 0;
312 } 312 }
313 313
314 std::unique_ptr<HistogramSamples> samples = histogram->SnapshotSamples(); 314 std::unique_ptr<HistogramSamples> samples = histogram->SnapshotSamples();
315 return samples->GetCount(static_cast<int>(sample)); 315 return samples->GetCount(static_cast<int>(sample));
316 } 316 }
317 317
318 jint GetHistogramTotalCountForTesting(
319 JNIEnv* env,
320 const JavaParamRef<jclass>& clazz,
321 const JavaParamRef<jstring>& histogram_name) {
322 HistogramBase* histogram = StatisticsRecorder::FindHistogram(
323 android::ConvertJavaStringToUTF8(env, histogram_name));
324 if (histogram == nullptr) {
325 // No samples have been recorded for this histogram.
326 return 0;
327 }
328
329 return histogram->SnapshotSamples()->TotalCount();
330 }
331
318 bool RegisterRecordHistogram(JNIEnv* env) { 332 bool RegisterRecordHistogram(JNIEnv* env) {
319 return RegisterNativesImpl(env); 333 return RegisterNativesImpl(env);
320 } 334 }
321 335
322 } // namespace android 336 } // namespace android
323 } // namespace base 337 } // namespace base
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698