1 /* 2 * Copyright (C) 2019 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.loganalysis.item; 18 19 import java.util.Arrays; 20 import java.util.HashSet; 21 import java.util.Set; 22 23 /** 24 * An {@link IItem} used to store timing information for system services like System Server, Zygote, 25 * System UI, BootAnimation e.t.c. 26 */ 27 public class SystemServicesTimingItem extends GenericItem { 28 /** Constant for JSON output */ 29 public static final String COMPONENT = "COMPONENT"; 30 /** Constant for JSON output */ 31 public static final String SUBCOMPONENT = "SUBCOMPONENT"; 32 /** Constant for JSON output */ 33 public static final String DURATION = "DURATION"; 34 /** Constant for JSON output */ 35 public static final String START_TIME = "START_TIME"; 36 37 private static final Set<String> ATTRIBUTES = 38 new HashSet<>(Arrays.asList(COMPONENT, SUBCOMPONENT, DURATION, START_TIME)); 39 40 /** Constructor for {@link SystemServicesTimingItem} */ SystemServicesTimingItem()41 public SystemServicesTimingItem() { 42 super(ATTRIBUTES); 43 } 44 45 /** Get the component name for system services timing */ getComponent()46 public String getComponent() { 47 return (String) getAttribute(COMPONENT); 48 } 49 50 /** Set the component name for system service timing */ setComponent(String component)51 public void setComponent(String component) { 52 setAttribute(COMPONENT, component); 53 } 54 55 /** Get the sub-component name for system service timing */ getSubcomponent()56 public String getSubcomponent() { 57 return (String) getAttribute(SUBCOMPONENT); 58 } 59 60 /** Set the sub-component name for system service timing */ setSubcomponent(String subcomponent)61 public void setSubcomponent(String subcomponent) { 62 setAttribute(SUBCOMPONENT, subcomponent); 63 } 64 65 /** Get the duration value for system service timing */ getDuration()66 public Double getDuration() { 67 return (Double) getAttribute(DURATION); 68 } 69 70 /** Set the duration value for system service timing */ setDuration(double duration)71 public void setDuration(double duration) { 72 setAttribute(DURATION, duration); 73 } 74 75 /** Get the start time value for system service timing */ getStartTime()76 public Double getStartTime() { 77 return (Double) getAttribute(START_TIME); 78 } 79 80 /** Set the start time value for system service timing */ setStartTime(double startTime)81 public void setStartTime(double startTime) { 82 setAttribute(START_TIME, startTime); 83 } 84 } 85