Merge "Trim throttle logs." into froyo
This commit is contained in:
committed by
Android (Google) Code Review
commit
05fa2144e4
@@ -112,8 +112,8 @@ public class SntpClient
|
|||||||
// = (transit + skew - transit + skew)/2
|
// = (transit + skew - transit + skew)/2
|
||||||
// = (2 * skew)/2 = skew
|
// = (2 * skew)/2 = skew
|
||||||
long clockOffset = ((receiveTime - originateTime) + (transmitTime - responseTime))/2;
|
long clockOffset = ((receiveTime - originateTime) + (transmitTime - responseTime))/2;
|
||||||
if (Config.LOGD) Log.d(TAG, "round trip: " + roundTripTime + " ms");
|
// if (Config.LOGD) Log.d(TAG, "round trip: " + roundTripTime + " ms");
|
||||||
if (Config.LOGD) Log.d(TAG, "clock offset: " + clockOffset + " ms");
|
// if (Config.LOGD) Log.d(TAG, "clock offset: " + clockOffset + " ms");
|
||||||
|
|
||||||
// save our results - use the times on this side of the network latency
|
// save our results - use the times on this side of the network latency
|
||||||
// (response rather than request time)
|
// (response rather than request time)
|
||||||
|
|||||||
@@ -68,7 +68,8 @@ public class ThrottleService extends IThrottleManager.Stub {
|
|||||||
private static final String TESTING_ENABLED_PROPERTY = "persist.throttle.testing";
|
private static final String TESTING_ENABLED_PROPERTY = "persist.throttle.testing";
|
||||||
|
|
||||||
private static final String TAG = "ThrottleService";
|
private static final String TAG = "ThrottleService";
|
||||||
private static boolean DBG = true;
|
private static final boolean DBG = true;
|
||||||
|
private static final boolean VDBG = false;
|
||||||
private Handler mHandler;
|
private Handler mHandler;
|
||||||
private HandlerThread mThread;
|
private HandlerThread mThread;
|
||||||
|
|
||||||
@@ -424,7 +425,7 @@ public class ThrottleService extends IThrottleManager.Stub {
|
|||||||
long periodTx = mRecorder.getPeriodTx(0);
|
long periodTx = mRecorder.getPeriodTx(0);
|
||||||
long total = periodRx + periodTx;
|
long total = periodRx + periodTx;
|
||||||
if (DBG) {
|
if (DBG) {
|
||||||
Slog.d(TAG, "onPollAlarm - now =" + now + ", roaming =" + roaming +
|
Slog.d(TAG, "onPollAlarm - roaming =" + roaming +
|
||||||
", read =" + incRead + ", written =" + incWrite + ", new total =" + total);
|
", read =" + incRead + ", written =" + incWrite + ", new total =" + total);
|
||||||
}
|
}
|
||||||
mLastRead += incRead;
|
mLastRead += incRead;
|
||||||
@@ -653,6 +654,7 @@ public class ThrottleService extends IThrottleManager.Stub {
|
|||||||
if (mNtpActive) {
|
if (mNtpActive) {
|
||||||
long ntpAge = SystemClock.elapsedRealtime() - cachedNtpTimestamp;
|
long ntpAge = SystemClock.elapsedRealtime() - cachedNtpTimestamp;
|
||||||
if (ntpAge < MAX_NTP_CACHE_AGE) {
|
if (ntpAge < MAX_NTP_CACHE_AGE) {
|
||||||
|
if (VDBG) Slog.v(TAG, "using cached time");
|
||||||
return cachedNtp + ntpAge;
|
return cachedNtp + ntpAge;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -665,12 +667,12 @@ public class ThrottleService extends IThrottleManager.Stub {
|
|||||||
if (DBG) Slog.d(TAG, "found Authoritative time - reseting alarm");
|
if (DBG) Slog.d(TAG, "found Authoritative time - reseting alarm");
|
||||||
mHandler.obtainMessage(EVENT_RESET_ALARM).sendToTarget();
|
mHandler.obtainMessage(EVENT_RESET_ALARM).sendToTarget();
|
||||||
}
|
}
|
||||||
if (DBG) Slog.d(TAG, "using Authoritative time: " + cachedNtp);
|
if (VDBG) Slog.v(TAG, "using Authoritative time: " + cachedNtp);
|
||||||
return cachedNtp;
|
return cachedNtp;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
long time = System.currentTimeMillis();
|
long time = System.currentTimeMillis();
|
||||||
if (DBG) Slog.d(TAG, "using User time: " + time);
|
if (VDBG) Slog.v(TAG, "using User time: " + time);
|
||||||
mNtpActive = false;
|
mNtpActive = false;
|
||||||
return time;
|
return time;
|
||||||
}
|
}
|
||||||
@@ -718,15 +720,14 @@ public class ThrottleService extends IThrottleManager.Stub {
|
|||||||
// TODO - how would we deal with a dual-IMSI device?
|
// TODO - how would we deal with a dual-IMSI device?
|
||||||
checkForSubscriberId();
|
checkForSubscriberId();
|
||||||
boolean startNewPeriod = true;
|
boolean startNewPeriod = true;
|
||||||
if (DBG) {
|
|
||||||
Slog.d(TAG, "setting next period to " + start.getTimeInMillis() +
|
|
||||||
" --until-- " + end.getTimeInMillis());
|
|
||||||
}
|
|
||||||
// if we rolled back in time, toss out
|
// if we rolled back in time, toss out
|
||||||
// if we rolled foward, advance to the next
|
// if we rolled foward, advance to the next
|
||||||
if (end.before(mPeriodStart)) {
|
if (end.before(mPeriodStart)) {
|
||||||
if (DBG) {
|
if (DBG) {
|
||||||
Slog.d(TAG, " old start was " + mPeriodStart.getTimeInMillis() + ", wiping");
|
Slog.d(TAG, "next period (" + start.getTimeInMillis() + "," +
|
||||||
|
end.getTimeInMillis() + ") - old start was " +
|
||||||
|
mPeriodStart.getTimeInMillis() + ", wiping");
|
||||||
}
|
}
|
||||||
synchronized (mParent) {
|
synchronized (mParent) {
|
||||||
mPeriodRxData[mCurrentPeriod] = 0;
|
mPeriodRxData[mCurrentPeriod] = 0;
|
||||||
@@ -734,7 +735,9 @@ public class ThrottleService extends IThrottleManager.Stub {
|
|||||||
}
|
}
|
||||||
} else if(start.after(mPeriodEnd)) {
|
} else if(start.after(mPeriodEnd)) {
|
||||||
if (DBG) {
|
if (DBG) {
|
||||||
Slog.d(TAG, " old end was " + mPeriodEnd.getTimeInMillis() + ", following");
|
Slog.d(TAG, "next period (" + start.getTimeInMillis() + "," +
|
||||||
|
end.getTimeInMillis() + ") - old end was " +
|
||||||
|
mPeriodEnd.getTimeInMillis() + ", following");
|
||||||
}
|
}
|
||||||
synchronized (mParent) {
|
synchronized (mParent) {
|
||||||
++mCurrentPeriod;
|
++mCurrentPeriod;
|
||||||
@@ -744,7 +747,10 @@ public class ThrottleService extends IThrottleManager.Stub {
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
startNewPeriod = false;
|
startNewPeriod = false;
|
||||||
if (DBG) Slog.d(TAG, " we fit - ammending to last period");
|
if (DBG) {
|
||||||
|
Slog.d(TAG, "next period (" + start.getTimeInMillis() + "," +
|
||||||
|
end.getTimeInMillis() + ") - we fit - ammending to last period");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
setPeriodStart(start);
|
setPeriodStart(start);
|
||||||
setPeriodEnd(end);
|
setPeriodEnd(end);
|
||||||
@@ -813,7 +819,7 @@ public class ThrottleService extends IThrottleManager.Stub {
|
|||||||
File dataFile;
|
File dataFile;
|
||||||
if (mImsi == null) {
|
if (mImsi == null) {
|
||||||
dataFile = useMRUFile(throttleDir);
|
dataFile = useMRUFile(throttleDir);
|
||||||
Slog.d(TAG, "imsi not available yet, using " + dataFile);
|
if (VDBG) Slog.v(TAG, "imsi not available yet, using " + dataFile);
|
||||||
} else {
|
} else {
|
||||||
String imsiHash = Integer.toString(mImsi.hashCode());
|
String imsiHash = Integer.toString(mImsi.hashCode());
|
||||||
dataFile = new File(throttleDir, imsiHash);
|
dataFile = new File(throttleDir, imsiHash);
|
||||||
@@ -831,7 +837,7 @@ public class ThrottleService extends IThrottleManager.Stub {
|
|||||||
mImsi = mTelephonyManager.getSubscriberId();
|
mImsi = mTelephonyManager.getSubscriberId();
|
||||||
if (mImsi == null) return;
|
if (mImsi == null) return;
|
||||||
|
|
||||||
Slog.d(TAG, "finally have imsi - retreiving data");
|
if (DBG) Slog.d(TAG, "finally have imsi - retreiving data");
|
||||||
retrieve();
|
retrieve();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -841,7 +847,7 @@ public class ThrottleService extends IThrottleManager.Stub {
|
|||||||
File[] files = dir.listFiles();
|
File[] files = dir.listFiles();
|
||||||
|
|
||||||
if (files.length <= MAX_SIMS_SUPPORTED) return;
|
if (files.length <= MAX_SIMS_SUPPORTED) return;
|
||||||
Slog.d(TAG, "Too many data files");
|
if (DBG) Slog.d(TAG, "Too many data files");
|
||||||
do {
|
do {
|
||||||
File oldest = null;
|
File oldest = null;
|
||||||
for (File f : files) {
|
for (File f : files) {
|
||||||
@@ -850,7 +856,7 @@ public class ThrottleService extends IThrottleManager.Stub {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (oldest == null) return;
|
if (oldest == null) return;
|
||||||
Slog.d(TAG, " deleting " + oldest);
|
if (DBG) Slog.d(TAG, " deleting " + oldest);
|
||||||
oldest.delete();
|
oldest.delete();
|
||||||
files = dir.listFiles();
|
files = dir.listFiles();
|
||||||
} while (files.length > MAX_SIMS_SUPPORTED);
|
} while (files.length > MAX_SIMS_SUPPORTED);
|
||||||
|
|||||||
Reference in New Issue
Block a user