• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // Copyright 2013 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 package org.chromium.chrome.browser;
6 
7 import org.chromium.base.CalledByNative;
8 
9 /**
10  * Utilities to support startup metrics - Android version.
11  */
12 public class UmaUtils {
13 
14     private static long sApplicationStartWallClockMs;
15 
16     /**
17      * Record the time at which the activity started. This should be called asap after
18      * the start of the activity's onCreate function.
19      */
recordMainEntryPointTime()20     public static void recordMainEntryPointTime() {
21         // We can't simply pass this down through a JNI call, since the JNI for chrome
22         // isn't initialized until we start the native content browser component, and we
23         // then need the start time in the C++ side before we return to Java. As such we
24         // save it in a static that the C++ can fetch once it has initialized the JNI.
25         sApplicationStartWallClockMs = System.currentTimeMillis();
26     }
27 
28     @CalledByNative
getMainEntryPointTime()29     private static long getMainEntryPointTime() {
30         return sApplicationStartWallClockMs;
31     }
32 
33 }
34