Home | History | Annotate | Download | only in wifi
      1 /*
      2  * Copyright 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.server.wifi;
     18 
     19 import java.util.Arrays;
     20 
     21 /**
     22  * A class representing link layer statistics collected over a Wifi Interface.
     23  */
     24 
     25 /**
     26  * {@hide}
     27  */
     28 public class WifiLinkLayerStats {
     29 
     30     /** Number of beacons received from our own AP */
     31     public int beacon_rx;
     32 
     33     /** RSSI of management frames */
     34     public int rssi_mgmt;
     35 
     36     /* Packet counters */
     37 
     38     /** WME Best Effort Access Category received mpdu */
     39     public long rxmpdu_be;
     40     /** WME Best Effort Access Category transmitted mpdu */
     41     public long txmpdu_be;
     42     /** WME Best Effort Access Category lost mpdu */
     43     public long lostmpdu_be;
     44     /** WME Best Effort Access Category number of transmission retries */
     45     public long retries_be;
     46 
     47     /** WME Background Access Category received mpdu */
     48     public long rxmpdu_bk;
     49     /** WME Background Access Category transmitted mpdu */
     50     public long txmpdu_bk;
     51     /** WME Background Access Category lost mpdu */
     52     public long lostmpdu_bk;
     53     /** WME Background Access Category number of transmission retries */
     54     public long retries_bk;
     55 
     56     /** WME Video Access Category received mpdu */
     57     public long rxmpdu_vi;
     58     /** WME Video Access Category transmitted mpdu */
     59     public long txmpdu_vi;
     60     /** WME Video Access Category lost mpdu */
     61     public long lostmpdu_vi;
     62     /** WME Video Access Category number of transmission retries */
     63     public long retries_vi;
     64 
     65     /** WME Voice Access Category received mpdu */
     66     public long rxmpdu_vo;
     67     /** WME Voice Access Category transmitted mpdu */
     68     public long txmpdu_vo;
     69     /** WME Voice Access Category lost mpdu */
     70     public long lostmpdu_vo;
     71     /** WME Voice Access Category number of transmission retries */
     72     public long retries_vo;
     73 
     74     /**
     75      * Cumulative milliseconds when radio is awake
     76      */
     77     public int on_time;
     78     /**
     79      * Cumulative milliseconds of active transmission
     80      */
     81     public int tx_time;
     82     /**
     83      * Cumulative milliseconds per level of active transmission
     84      */
     85     public int[] tx_time_per_level;
     86     /**
     87      * Cumulative milliseconds of active receive
     88      */
     89     public int rx_time;
     90     /**
     91      * Cumulative milliseconds when radio is awake due to scan
     92      */
     93     public int on_time_scan;
     94 
     95     /**
     96      * TimeStamp - absolute milliseconds from boot when these stats were sampled.
     97      */
     98     public long timeStampInMs;
     99 
    100     @Override
    101     public String toString() {
    102         StringBuilder sbuf = new StringBuilder();
    103         sbuf.append(" WifiLinkLayerStats: ").append('\n');
    104 
    105         sbuf.append(" my bss beacon rx: ").append(Integer.toString(this.beacon_rx)).append('\n');
    106         sbuf.append(" RSSI mgmt: ").append(Integer.toString(this.rssi_mgmt)).append('\n');
    107         sbuf.append(" BE : ").append(" rx=").append(Long.toString(this.rxmpdu_be))
    108                 .append(" tx=").append(Long.toString(this.txmpdu_be))
    109                 .append(" lost=").append(Long.toString(this.lostmpdu_be))
    110                 .append(" retries=").append(Long.toString(this.retries_be)).append('\n');
    111         sbuf.append(" BK : ").append(" rx=").append(Long.toString(this.rxmpdu_bk))
    112                 .append(" tx=").append(Long.toString(this.txmpdu_bk))
    113                 .append(" lost=").append(Long.toString(this.lostmpdu_bk))
    114                 .append(" retries=").append(Long.toString(this.retries_bk)).append('\n');
    115         sbuf.append(" VI : ").append(" rx=").append(Long.toString(this.rxmpdu_vi))
    116                 .append(" tx=").append(Long.toString(this.txmpdu_vi))
    117                 .append(" lost=").append(Long.toString(this.lostmpdu_vi))
    118                 .append(" retries=").append(Long.toString(this.retries_vi)).append('\n');
    119         sbuf.append(" VO : ").append(" rx=").append(Long.toString(this.rxmpdu_vo))
    120                 .append(" tx=").append(Long.toString(this.txmpdu_vo))
    121                 .append(" lost=").append(Long.toString(this.lostmpdu_vo))
    122                 .append(" retries=").append(Long.toString(this.retries_vo)).append('\n');
    123         sbuf.append(" on_time : ").append(Integer.toString(this.on_time))
    124                 .append(" rx_time=").append(Integer.toString(this.rx_time))
    125                 .append(" scan_time=").append(Integer.toString(this.on_time_scan)).append('\n')
    126                 .append(" tx_time=").append(Integer.toString(this.tx_time))
    127                 .append(" tx_time_per_level=" + Arrays.toString(tx_time_per_level));
    128         sbuf.append(" ts=" + timeStampInMs);
    129         return sbuf.toString();
    130     }
    131 
    132 }
    133