binderThroughputTest: gather servers right away
Start gathering servers upon worker creation. Don't wait until signaled
by test. This should allow all clients to start transactions at a better
coordinated time.
Change-Id: I4568eb55fc9ce18839c1e5592a722a0284987745
Test: Ran a benchmark on cuttlefish, and it did not get stuck
Signed-off-by: Carlos Llamas <cmllamas@google.com>
Co-developed-by: Alice Ryhl <aliceryhl@google.com>
Signed-off-by: Alice Ryhl <aliceryhl@google.com>
diff --git a/libs/binder/tests/binderThroughputTest.cpp b/libs/binder/tests/binderThroughputTest.cpp
index d7f6318..b899c34 100644
--- a/libs/binder/tests/binderThroughputTest.cpp
+++ b/libs/binder/tests/binderThroughputTest.cpp
@@ -220,6 +220,9 @@
workers.push_back(serviceMgr->waitForService(generateServiceName(i)));
}
+ p.signal();
+ p.wait();
+
// Run the benchmark if client
ProcResults results(iterations);
@@ -300,8 +303,15 @@
pipes.push_back(make_worker(i, iterations, workers, payload_size, cs_pair));
}
wait_all(pipes);
+ // All workers have now been spawned and added themselves to service
+ // manager. Signal each worker to obtain a handle to the server workers from
+ // servicemanager.
+ signal_all(pipes);
+ // Wait for each worker to finish obtaining a handle to all server workers
+ // from servicemanager.
+ wait_all(pipes);
- // Run the workers and wait for completion.
+ // Run the benchmark and wait for completion.
chrono::time_point<chrono::high_resolution_clock> start, end;
cout << "waiting for workers to complete" << endl;
start = chrono::high_resolution_clock::now();