1 /* 2 * Copyright (C) 2014 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.compatibility.common.util; 18 19 /** 20 * Enum for representing the unit of results. 21 */ 22 public enum ResultUnit { 23 /** for value with no unit */ 24 NONE, 25 /** milli-seconds */ 26 MS, 27 /** frames per second */ 28 FPS, 29 /** operations per second */ 30 OPS, 31 /** kilo-bytes-per-second, not bits-per-second */ 32 KBPS, 33 /** mega-bytes-per-second */ 34 MBPS, 35 /** amount of data, bytes */ 36 BYTE, 37 /** tell how many times it did happen. */ 38 COUNT, 39 /** unit for benchmarking with generic score. */ 40 SCORE, 41 /** radian */ 42 RADIAN, 43 /** Audio or Video frames count, dropped, repeated, etc... */ 44 FRAMES; 45 46 /** 47 * @return a string to be used in the report. 48 */ toReportString()49 public String toReportString() { 50 return name().toLowerCase(); 51 } 52 53 /** 54 * Returns a {@link ResultUnit} given a string from the report. 55 */ parseReportString(String value)56 public static ResultUnit parseReportString(String value) { 57 return ResultUnit.valueOf(value.toUpperCase()); 58 } 59 } 60