Merge "[AF08] Fill useFastDataInput metrics" into main
This commit is contained in:
commit
9d962db18b
3 changed files with 27 additions and 13 deletions
|
|
@ -22,6 +22,7 @@ import static android.net.netstats.NetworkStatsDataMigrationUtils.PREFIX_XT;
|
|||
|
||||
import static com.android.server.ConnectivityStatsLog.NETWORK_STATS_RECORDER_FILE_OPERATED;
|
||||
import static com.android.server.ConnectivityStatsLog.NETWORK_STATS_RECORDER_FILE_OPERATED__FAST_DATA_INPUT_STATE__FDIS_DISABLED;
|
||||
import static com.android.server.ConnectivityStatsLog.NETWORK_STATS_RECORDER_FILE_OPERATED__FAST_DATA_INPUT_STATE__FDIS_ENABLED;
|
||||
import static com.android.server.ConnectivityStatsLog.NETWORK_STATS_RECORDER_FILE_OPERATED__OPERATION_TYPE__ROT_READ;
|
||||
import static com.android.server.ConnectivityStatsLog.NETWORK_STATS_RECORDER_FILE_OPERATED__RECORDER_PREFIX__PREFIX_UID;
|
||||
import static com.android.server.ConnectivityStatsLog.NETWORK_STATS_RECORDER_FILE_OPERATED__RECORDER_PREFIX__PREFIX_UIDTAG;
|
||||
|
|
@ -61,7 +62,8 @@ public class NetworkStatsMetricsLogger {
|
|||
public void writeRecorderFileReadingStats(int recorderType, int readIndex,
|
||||
int readLatencyMillis,
|
||||
int fileCount, int totalFileSize,
|
||||
int keys, int uids, int totalHistorySize) {
|
||||
int keys, int uids, int totalHistorySize,
|
||||
boolean useFastDataInput) {
|
||||
ConnectivityStatsLog.write(NETWORK_STATS_RECORDER_FILE_OPERATED,
|
||||
NETWORK_STATS_RECORDER_FILE_OPERATED__OPERATION_TYPE__ROT_READ,
|
||||
recorderType,
|
||||
|
|
@ -72,7 +74,9 @@ public class NetworkStatsMetricsLogger {
|
|||
keys,
|
||||
uids,
|
||||
totalHistorySize,
|
||||
NETWORK_STATS_RECORDER_FILE_OPERATED__FAST_DATA_INPUT_STATE__FDIS_DISABLED);
|
||||
useFastDataInput
|
||||
? NETWORK_STATS_RECORDER_FILE_OPERATED__FAST_DATA_INPUT_STATE__FDIS_ENABLED
|
||||
: NETWORK_STATS_RECORDER_FILE_OPERATED__FAST_DATA_INPUT_STATE__FDIS_DISABLED);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -138,7 +142,8 @@ public class NetworkStatsMetricsLogger {
|
|||
* Log statistics from the NetworkStatsRecorder file reading process into statsd.
|
||||
*/
|
||||
public void logRecorderFileReading(@NonNull String prefix, int readLatencyMillis,
|
||||
@Nullable File statsDir, @NonNull NetworkStatsCollection collection) {
|
||||
@Nullable File statsDir, @NonNull NetworkStatsCollection collection,
|
||||
boolean useFastDataInput) {
|
||||
final Set<Integer> uids = new HashSet<>();
|
||||
final Map<NetworkStatsCollection.Key, NetworkStatsHistory> entries =
|
||||
collection.getEntries();
|
||||
|
|
@ -160,6 +165,7 @@ public class NetworkStatsMetricsLogger {
|
|||
fileAttributes.second /* totalFileSize */,
|
||||
entries.size(),
|
||||
uids.size(),
|
||||
totalHistorySize);
|
||||
totalHistorySize,
|
||||
useFastDataInput);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -199,7 +199,7 @@ public class NetworkStatsRecorder {
|
|||
// have wipeOnError flag unset, skip reporting metrics.
|
||||
if (mWipeOnError) {
|
||||
mMetricsLogger.logRecorderFileReading(mCookie, (int) (readEnd - readStart),
|
||||
mStatsDir, res);
|
||||
mStatsDir, res, mUseFastDataInput);
|
||||
}
|
||||
}
|
||||
return res;
|
||||
|
|
|
|||
|
|
@ -114,7 +114,8 @@ public final class NetworkStatsRecorderTest {
|
|||
final NetworkStatsMetricsLogger.Dependencies deps =
|
||||
mock(NetworkStatsMetricsLogger.Dependencies.class);
|
||||
final NetworkStatsMetricsLogger logger = new NetworkStatsMetricsLogger(deps);
|
||||
logger.logRecorderFileReading(PREFIX_XT, 888, null /* statsDir */, collection);
|
||||
logger.logRecorderFileReading(PREFIX_XT, 888, null /* statsDir */, collection,
|
||||
false /* useFastDataInput */);
|
||||
verify(deps).writeRecorderFileReadingStats(
|
||||
NETWORK_STATS_RECORDER_FILE_OPERATED__RECORDER_PREFIX__PREFIX_XT,
|
||||
1 /* readIndex */,
|
||||
|
|
@ -123,11 +124,13 @@ public final class NetworkStatsRecorderTest {
|
|||
0 /* totalFileSize */,
|
||||
0 /* keys */,
|
||||
0 /* uids */,
|
||||
0 /* totalHistorySize */
|
||||
0 /* totalHistorySize */,
|
||||
false /* useFastDataInput */
|
||||
);
|
||||
|
||||
// Write second time, verify the index increases.
|
||||
logger.logRecorderFileReading(PREFIX_XT, 567, null /* statsDir */, collection);
|
||||
logger.logRecorderFileReading(PREFIX_XT, 567, null /* statsDir */, collection,
|
||||
true /* useFastDataInput */);
|
||||
verify(deps).writeRecorderFileReadingStats(
|
||||
NETWORK_STATS_RECORDER_FILE_OPERATED__RECORDER_PREFIX__PREFIX_XT,
|
||||
2 /* readIndex */,
|
||||
|
|
@ -136,7 +139,8 @@ public final class NetworkStatsRecorderTest {
|
|||
0 /* totalFileSize */,
|
||||
0 /* keys */,
|
||||
0 /* uids */,
|
||||
0 /* totalHistorySize */
|
||||
0 /* totalHistorySize */,
|
||||
true /* useFastDataInput */
|
||||
);
|
||||
}
|
||||
|
||||
|
|
@ -156,7 +160,8 @@ public final class NetworkStatsRecorderTest {
|
|||
final NetworkStatsMetricsLogger.Dependencies deps =
|
||||
mock(NetworkStatsMetricsLogger.Dependencies.class);
|
||||
final NetworkStatsMetricsLogger logger = new NetworkStatsMetricsLogger(deps);
|
||||
logger.logRecorderFileReading(PREFIX_UID, 123, null /* statsDir */, collection);
|
||||
logger.logRecorderFileReading(PREFIX_UID, 123, null /* statsDir */, collection,
|
||||
false /* useFastDataInput */);
|
||||
verify(deps).writeRecorderFileReadingStats(
|
||||
NETWORK_STATS_RECORDER_FILE_OPERATED__RECORDER_PREFIX__PREFIX_UID,
|
||||
1 /* readIndex */,
|
||||
|
|
@ -165,7 +170,8 @@ public final class NetworkStatsRecorderTest {
|
|||
0 /* totalFileSize */,
|
||||
3 /* keys */,
|
||||
2 /* uids */,
|
||||
5 /* totalHistorySize */
|
||||
5 /* totalHistorySize */,
|
||||
false /* useFastDataInput */
|
||||
);
|
||||
}
|
||||
|
||||
|
|
@ -185,7 +191,8 @@ public final class NetworkStatsRecorderTest {
|
|||
final NetworkStatsMetricsLogger.Dependencies deps =
|
||||
mock(NetworkStatsMetricsLogger.Dependencies.class);
|
||||
final NetworkStatsMetricsLogger logger = new NetworkStatsMetricsLogger(deps);
|
||||
logger.logRecorderFileReading(PREFIX_UID_TAG, 678, statsDir, collection);
|
||||
logger.logRecorderFileReading(PREFIX_UID_TAG, 678, statsDir, collection,
|
||||
false /* useFastDataInput */);
|
||||
verify(deps).writeRecorderFileReadingStats(
|
||||
NETWORK_STATS_RECORDER_FILE_OPERATED__RECORDER_PREFIX__PREFIX_UIDTAG,
|
||||
1 /* readIndex */,
|
||||
|
|
@ -194,7 +201,8 @@ public final class NetworkStatsRecorderTest {
|
|||
26 /* totalFileSize */,
|
||||
0 /* keys */,
|
||||
0 /* uids */,
|
||||
0 /* totalHistorySize */
|
||||
0 /* totalHistorySize */,
|
||||
false /* useFastDataInput */
|
||||
);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue