Skip to content

Commit

Permalink
Add extra logging to caliper to help users understand when waiting go…
Browse files Browse the repository at this point in the history
…es wrong

When port forwarding ADB, it's unclear that caliper is also opening another
port unless that's logged. I got an error message about the service not
starting up, and had to do a lot of reverse engineering work to figure out what
my problem was I didn't forward the other port.

RELNOTES=More logging when running android benchmarks
PiperOrigin-RevId: 621393652
  • Loading branch information
java-team-github-bot authored and Caliper Team committed Apr 3, 2024
1 parent ac24ac5 commit 6fbb717
Showing 1 changed file with 5 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,7 @@ protected void startUp() throws Exception {
"com.google.caliper.proxy_id",
proxyConnection.proxyId().toString()));

stdout.println("waiting for proxy on port " + port);
try {
proxyConnection.startAsync().awaitRunning(30, SECONDS);
} catch (TimeoutException e) {
Expand Down Expand Up @@ -191,6 +192,7 @@ private void checkDeviceApiLevel(int apiLevel) {
* computer.
*/
private void setReversePortForwarding() {
stdout.println("adb: reverse forwarding port " + port);
String tcpPort = "tcp:" + port;
shell.execute(adbCommand("reverse", tcpPort, tcpPort)).orThrow();
}
Expand Down Expand Up @@ -230,7 +232,6 @@ private void forceStop(String packageName) {
* activity.
*/
private void startActivity(String intent, Map<String, String> extras) {
stdout.println("adb: starting proxy activity");
ImmutableList.Builder<String> builder =
ImmutableList.<String>builder()
.add("shell")
Expand All @@ -241,7 +242,9 @@ private void startActivity(String intent, Map<String, String> extras) {
for (Map.Entry<String, String> entry : extras.entrySet()) {
builder.add("-e", entry.getKey(), entry.getValue());
}
shell.execute(adbCommand(builder.build())).orThrow("failed to start activity");
ImmutableList<String> args = builder.build();
stdout.println("adb: starting proxy activity: " + String.join(" ", args));
shell.execute(adbCommand(args)).orThrow("failed to start activity");
}

private File getWorkerApk() {
Expand Down

0 comments on commit 6fbb717

Please sign in to comment.