Search in sources :

Example 1 with TelephonyHistogram

use of android.telephony.TelephonyHistogram in project platform_frameworks_base by android.

the class ClientRequestStats method updateRequestHistograms.

public void updateRequestHistograms(int requestId, int time) {
    synchronized (mRequestHistograms) {
        TelephonyHistogram entry = mRequestHistograms.get(requestId);
        if (entry == null) {
            entry = new TelephonyHistogram(TelephonyHistogram.TELEPHONY_CATEGORY_RIL, requestId, REQUEST_HISTOGRAM_BUCKET_COUNT);
            mRequestHistograms.put(requestId, entry);
        }
        entry.addTimeTaken(time);
    }
}
Also used : TelephonyHistogram(android.telephony.TelephonyHistogram)

Example 2 with TelephonyHistogram

use of android.telephony.TelephonyHistogram in project platform_frameworks_base by android.

the class ClientRequestStats method readFromParcel.

public void readFromParcel(Parcel in) {
    mCallingPackage = in.readString();
    mCompletedRequestsWakelockTime = in.readLong();
    mCompletedRequestsCount = in.readLong();
    mPendingRequestsWakelockTime = in.readLong();
    mPendingRequestsCount = in.readLong();
    ArrayList<TelephonyHistogram> requestHistograms = new ArrayList<TelephonyHistogram>();
    in.readTypedList(requestHistograms, TelephonyHistogram.CREATOR);
    for (TelephonyHistogram h : requestHistograms) {
        mRequestHistograms.put(h.getId(), h);
    }
}
Also used : TelephonyHistogram(android.telephony.TelephonyHistogram) ArrayList(java.util.ArrayList)

Example 3 with TelephonyHistogram

use of android.telephony.TelephonyHistogram in project platform_frameworks_base by android.

the class ClientRequestStats method getRequestHistograms.

public List<TelephonyHistogram> getRequestHistograms() {
    List<TelephonyHistogram> list;
    synchronized (mRequestHistograms) {
        list = new ArrayList<>(mRequestHistograms.size());
        for (int i = 0; i < mRequestHistograms.size(); i++) {
            TelephonyHistogram entry = new TelephonyHistogram(mRequestHistograms.valueAt(i));
            list.add(entry);
        }
    }
    return list;
}
Also used : TelephonyHistogram(android.telephony.TelephonyHistogram)

Example 4 with TelephonyHistogram

use of android.telephony.TelephonyHistogram in project android_frameworks_opt_telephony by LineageOS.

the class TelephonyHistogramTest method testTelephonyHistogramConstructor.

@Test
@SmallTest
public void testTelephonyHistogramConstructor() {
    assertEquals(TelephonyHistogram.TELEPHONY_CATEGORY_RIL, mHistogram.getCategory());
    assertEquals(1, mHistogram.getId());
    assertEquals(Integer.MAX_VALUE, mHistogram.getMinTime());
    assertEquals(0, mHistogram.getMaxTime());
    assertEquals(0, mHistogram.getAverageTime());
    assertEquals(0, mHistogram.getSampleCount());
    assertEquals(3, mHistogram.getBucketCount());
    // Test to verify that an exception is thrown when bucketCount <= 1
    mHistogram = null;
    try {
        mHistogram = new TelephonyHistogram(TelephonyHistogram.TELEPHONY_CATEGORY_RIL, 1, 1);
        Assert.fail("TelephonyHistogram should throw exception for bucketCount <= 1");
    } catch (IllegalArgumentException ex) {
        mHistogram = new TelephonyHistogram(TelephonyHistogram.TELEPHONY_CATEGORY_RIL, 1, 3);
    }
}
Also used : TelephonyHistogram(android.telephony.TelephonyHistogram) SmallTest(android.test.suitebuilder.annotation.SmallTest) Test(org.junit.Test) SmallTest(android.test.suitebuilder.annotation.SmallTest)

Example 5 with TelephonyHistogram

use of android.telephony.TelephonyHistogram in project android_frameworks_opt_telephony by LineageOS.

the class RIL method addToRilHistogram.

private void addToRilHistogram(RILRequest rr) {
    long endTime = SystemClock.elapsedRealtime();
    int totalTime = (int) (endTime - rr.mStartTimeMs);
    synchronized (mRilTimeHistograms) {
        TelephonyHistogram entry = mRilTimeHistograms.get(rr.mRequest);
        if (entry == null) {
            // We would have total #RIL_HISTOGRAM_BUCKET_COUNT range buckets for RIL commands
            entry = new TelephonyHistogram(TelephonyHistogram.TELEPHONY_CATEGORY_RIL, rr.mRequest, RIL_HISTOGRAM_BUCKET_COUNT);
            mRilTimeHistograms.put(rr.mRequest, entry);
        }
        entry.addTimeTaken(totalTime);
    }
}
Also used : TelephonyHistogram(android.telephony.TelephonyHistogram)

Aggregations

TelephonyHistogram (android.telephony.TelephonyHistogram)7 BatteryStatsManager (android.os.BatteryStatsManager)1 SmallTest (android.test.suitebuilder.annotation.SmallTest)1 TelephonyProto (com.android.internal.telephony.nano.TelephonyProto)1 ActiveSubscriptionInfo (com.android.internal.telephony.nano.TelephonyProto.ActiveSubscriptionInfo)1 TelephonyLog (com.android.internal.telephony.nano.TelephonyProto.TelephonyLog)1 ArrayList (java.util.ArrayList)1 Test (org.junit.Test)1