• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2006 The Android Open Source Project
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *      http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 package com.android.traceview;
18 
19 interface TimeBase {
20     public static final TimeBase CPU_TIME = new CpuTimeBase();
21     public static final TimeBase REAL_TIME = new RealTimeBase();
22 
getTime(ThreadData threadData)23     public long getTime(ThreadData threadData);
getElapsedInclusiveTime(MethodData methodData)24     public long getElapsedInclusiveTime(MethodData methodData);
getElapsedExclusiveTime(MethodData methodData)25     public long getElapsedExclusiveTime(MethodData methodData);
getElapsedInclusiveTime(ProfileData profileData)26     public long getElapsedInclusiveTime(ProfileData profileData);
27 
28     public static final class CpuTimeBase implements TimeBase {
getTime(ThreadData threadData)29         public long getTime(ThreadData threadData) {
30             return threadData.getCpuTime();
31         }
32 
getElapsedInclusiveTime(MethodData methodData)33         public long getElapsedInclusiveTime(MethodData methodData) {
34             return methodData.getElapsedInclusiveCpuTime();
35         }
36 
getElapsedExclusiveTime(MethodData methodData)37         public long getElapsedExclusiveTime(MethodData methodData) {
38             return methodData.getElapsedExclusiveCpuTime();
39         }
40 
getElapsedInclusiveTime(ProfileData profileData)41         public long getElapsedInclusiveTime(ProfileData profileData) {
42             return profileData.getElapsedInclusiveCpuTime();
43         }
44     }
45 
46     public static final class RealTimeBase implements TimeBase {
getTime(ThreadData threadData)47         public long getTime(ThreadData threadData) {
48             return threadData.getRealTime();
49         }
50 
getElapsedInclusiveTime(MethodData methodData)51         public long getElapsedInclusiveTime(MethodData methodData) {
52             return methodData.getElapsedInclusiveRealTime();
53         }
54 
getElapsedExclusiveTime(MethodData methodData)55         public long getElapsedExclusiveTime(MethodData methodData) {
56             return methodData.getElapsedExclusiveRealTime();
57         }
58 
getElapsedInclusiveTime(ProfileData profileData)59         public long getElapsedInclusiveTime(ProfileData profileData) {
60             return profileData.getElapsedInclusiveRealTime();
61         }
62     }
63 }
64