Loading cmds/statsd/tools/loadtest/AndroidManifest.xml +1 −0 Original line number Diff line number Diff line Loading @@ -39,5 +39,6 @@ </activity> <receiver android:name=".LoadtestActivity$PusherAlarmReceiver" /> <receiver android:name=".LoadtestActivity$StopperAlarmReceiver"/> <receiver android:name=".PerfData$PerfAlarmReceiver"/> </application> </manifest> cmds/statsd/tools/loadtest/res/layout/activity_loadtest.xml +1 −6 Original line number Diff line number Diff line Loading @@ -166,12 +166,6 @@ android:layout_height="wrap_content" android:text="@string/display_output" android:textSize="30dp"/> <Button android:id="@+id/display_perf" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="@string/display_perf" android:textSize="30dp"/> <Space android:layout_width="1dp" Loading @@ -179,6 +173,7 @@ <TextView android:id="@+id/report_text" android:gravity="center" android:layout_width="match_parent" android:layout_height="wrap_content" /> Loading cmds/statsd/tools/loadtest/res/values/strings.xml +0 −1 Original line number Diff line number Diff line Loading @@ -21,7 +21,6 @@ <string name="bucket_label">bucket size (mins): </string> <string name="burst_label">burst: </string> <string name="display_output">Show metrics data</string> <string name="display_perf">Show perf data</string> <string name="placebo">placebo</string> <string name="period_label">logging period (secs): </string> <string name="replication_label">metric replication: </string> Loading cmds/statsd/tools/loadtest/src/com/android/statsd/loadtest/BatteryDataRecorder.java 0 → 100644 +53 −0 Original line number Diff line number Diff line /* * Copyright (C) 2017 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.android.statsd.loadtest; import android.annotation.Nullable; import android.content.Context; import android.util.Log; import java.text.ParseException; import java.util.regex.Matcher; import java.util.regex.Pattern; public class BatteryDataRecorder extends PerfDataRecorder { private static final String TAG = "loadtest.BatteryDataRecorder"; private static final String DUMP_FILENAME = TAG + "_dump.tmp"; public BatteryDataRecorder(boolean placebo, int replication, long bucketMins, long periodSecs, int burst) { super(placebo, replication, bucketMins, periodSecs, burst); } @Override public void startRecording(Context context) { // Reset batterystats. runDumpsysStats(context, DUMP_FILENAME, "batterystats", "--reset"); } @Override public void onAlarm(Context context) { // Nothing to do as for battery, the whole data is in the final dumpsys call. } @Override public void stopRecording(Context context) { StringBuilder sb = new StringBuilder(); // Don't use --checkin. runDumpsysStats(context, DUMP_FILENAME, "batterystats"); readDumpData(context, DUMP_FILENAME, new BatteryStatsParser(), sb); writeData(context, "battery_", "time,battery_level", sb); } } cmds/statsd/tools/loadtest/src/com/android/statsd/loadtest/BatteryStatsParser.java +3 −2 Original line number Diff line number Diff line Loading @@ -21,13 +21,13 @@ import java.text.ParseException; import java.util.regex.Matcher; import java.util.regex.Pattern; public class BatteryStatsParser { public class BatteryStatsParser implements PerfParser { private static final Pattern LINE_PATTERN = Pattern.compile("\\s*\\+*(\\S*)\\s\\(\\d+\\)\\s(\\d\\d\\d)\\s.*"); private static final Pattern TIME_PATTERN = Pattern.compile("(\\d+)?(h)?(\\d+)?(m)?(\\d+)?(s)?(\\d+)?(ms)?"); private static final String TAG = "BatteryStatsParser"; private static final String TAG = "loadtest.BatteryStatsParser"; private boolean mHistoryStarted; private boolean mHistoryEnded; Loading @@ -35,6 +35,7 @@ public class BatteryStatsParser { public BatteryStatsParser() { } @Override @Nullable public String parseLine(String line) { if (mHistoryEnded) { Loading Loading
cmds/statsd/tools/loadtest/AndroidManifest.xml +1 −0 Original line number Diff line number Diff line Loading @@ -39,5 +39,6 @@ </activity> <receiver android:name=".LoadtestActivity$PusherAlarmReceiver" /> <receiver android:name=".LoadtestActivity$StopperAlarmReceiver"/> <receiver android:name=".PerfData$PerfAlarmReceiver"/> </application> </manifest>
cmds/statsd/tools/loadtest/res/layout/activity_loadtest.xml +1 −6 Original line number Diff line number Diff line Loading @@ -166,12 +166,6 @@ android:layout_height="wrap_content" android:text="@string/display_output" android:textSize="30dp"/> <Button android:id="@+id/display_perf" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="@string/display_perf" android:textSize="30dp"/> <Space android:layout_width="1dp" Loading @@ -179,6 +173,7 @@ <TextView android:id="@+id/report_text" android:gravity="center" android:layout_width="match_parent" android:layout_height="wrap_content" /> Loading
cmds/statsd/tools/loadtest/res/values/strings.xml +0 −1 Original line number Diff line number Diff line Loading @@ -21,7 +21,6 @@ <string name="bucket_label">bucket size (mins): </string> <string name="burst_label">burst: </string> <string name="display_output">Show metrics data</string> <string name="display_perf">Show perf data</string> <string name="placebo">placebo</string> <string name="period_label">logging period (secs): </string> <string name="replication_label">metric replication: </string> Loading
cmds/statsd/tools/loadtest/src/com/android/statsd/loadtest/BatteryDataRecorder.java 0 → 100644 +53 −0 Original line number Diff line number Diff line /* * Copyright (C) 2017 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.android.statsd.loadtest; import android.annotation.Nullable; import android.content.Context; import android.util.Log; import java.text.ParseException; import java.util.regex.Matcher; import java.util.regex.Pattern; public class BatteryDataRecorder extends PerfDataRecorder { private static final String TAG = "loadtest.BatteryDataRecorder"; private static final String DUMP_FILENAME = TAG + "_dump.tmp"; public BatteryDataRecorder(boolean placebo, int replication, long bucketMins, long periodSecs, int burst) { super(placebo, replication, bucketMins, periodSecs, burst); } @Override public void startRecording(Context context) { // Reset batterystats. runDumpsysStats(context, DUMP_FILENAME, "batterystats", "--reset"); } @Override public void onAlarm(Context context) { // Nothing to do as for battery, the whole data is in the final dumpsys call. } @Override public void stopRecording(Context context) { StringBuilder sb = new StringBuilder(); // Don't use --checkin. runDumpsysStats(context, DUMP_FILENAME, "batterystats"); readDumpData(context, DUMP_FILENAME, new BatteryStatsParser(), sb); writeData(context, "battery_", "time,battery_level", sb); } }
cmds/statsd/tools/loadtest/src/com/android/statsd/loadtest/BatteryStatsParser.java +3 −2 Original line number Diff line number Diff line Loading @@ -21,13 +21,13 @@ import java.text.ParseException; import java.util.regex.Matcher; import java.util.regex.Pattern; public class BatteryStatsParser { public class BatteryStatsParser implements PerfParser { private static final Pattern LINE_PATTERN = Pattern.compile("\\s*\\+*(\\S*)\\s\\(\\d+\\)\\s(\\d\\d\\d)\\s.*"); private static final Pattern TIME_PATTERN = Pattern.compile("(\\d+)?(h)?(\\d+)?(m)?(\\d+)?(s)?(\\d+)?(ms)?"); private static final String TAG = "BatteryStatsParser"; private static final String TAG = "loadtest.BatteryStatsParser"; private boolean mHistoryStarted; private boolean mHistoryEnded; Loading @@ -35,6 +35,7 @@ public class BatteryStatsParser { public BatteryStatsParser() { } @Override @Nullable public String parseLine(String line) { if (mHistoryEnded) { Loading