in serializers/src/main/java/com/facebook/battery/serializer/healthstats/HealthStatsMetricsSerializer.java [104:162]
public boolean deserializeContents(HealthStatsMetrics metrics, DataInput input)
throws IOException {
metrics.dataType = readString(input);
int measurementLength = input.readInt();
for (int i = 0; i < measurementLength; i++) {
metrics.measurement.put(input.readInt(), input.readLong());
}
int timerLength = input.readInt();
for (int i = 0; i < timerLength; i++) {
metrics.timer.put(input.readInt(), readTimer(input));
}
int measurementsLength = input.readInt();
for (int i = 0; i < measurementsLength; i++) {
int currentMeasurementKey = input.readInt();
int currentMeasurementLength = input.readInt();
ArrayMap<String, Long> currentMeasurement = new ArrayMap<>(currentMeasurementLength);
for (int j = 0; j < currentMeasurementLength; j++) {
currentMeasurement.put(readString(input), input.readLong());
}
metrics.measurements.put(currentMeasurementKey, currentMeasurement);
}
int timersLength = input.readInt();
for (int i = 0; i < timersLength; i++) {
int currentTimerKey = input.readInt();
int currentTimerLength = input.readInt();
ArrayMap<String, TimerMetrics> currentTimer = new ArrayMap<>(currentTimerLength);
for (int j = 0; j < currentTimerLength; j++) {
int length = input.readInt();
byte[] bytes = new byte[length];
input.readFully(bytes, 0, length);
String key = new String(bytes);
currentTimer.put(key, readTimer(input));
}
metrics.timers.put(currentTimerKey, currentTimer);
}
int statsLength = input.readInt();
for (int i = 0; i < statsLength; i++) {
int currentStatsKey = input.readInt();
int currentStatsLength = input.readInt();
ArrayMap<String, HealthStatsMetrics> currentStats = new ArrayMap<>(currentStatsLength);
for (int j = 0; j < currentStatsLength; j++) {
String key = readString(input);
HealthStatsMetrics healthStatsMetrics = new HealthStatsMetrics();
deserializeContents(healthStatsMetrics, input);
currentStats.put(key, healthStatsMetrics);
}
metrics.stats.put(currentStatsKey, currentStats);
}
return true;
}