Home | History | Annotate | Download | only in hostmetric
      1 /*
      2  * Copyright (C) 2015 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 package com.android.tradefed.util.hostmetric;
     17 
     18 /**
     19  * Interface to dispatch host data
     20  */
     21 public interface IHostMonitor {
     22 
     23     public enum HostMetricType {
     24         NONE,
     25         INVOCATION_STRAY_THREAD,
     26     }
     27 
     28     /**
     29      * A method that will be called after all of the Monitor's @Option fields have been set.
     30      */
     31     public void start();
     32 
     33     /** A method that will be called to add a special event to be sent. */
     34     public void addHostEvent(HostMetricType tag, HostDataPoint event);
     35 
     36     /**
     37      * A method that will be called to stop the Host Monitor.
     38      */
     39     public void terminate();
     40 
     41     /** Generic class for data to be reported. */
     42     public static class HostDataPoint {
     43         public String name;
     44         public int value;
     45         public String additionalInfo = null;
     46 
     47         public HostDataPoint(String name, int value) {
     48             this.name = name;
     49             this.value = value;
     50         }
     51 
     52         public HostDataPoint(String name, int value, String additionalInfo) {
     53             this.name = name;
     54             this.value = value;
     55             this.additionalInfo = additionalInfo;
     56         }
     57 
     58         @Override
     59         public String toString() {
     60             return "dataPoint [name=" + name + ", value=" + value + "]";
     61         }
     62     }
     63 }
     64