Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 625212e1 authored by Carlos Llamas's avatar Carlos Llamas Committed by Alice Ryhl
Browse files

binderThroughputTest: skip benchmark loop for servers



Skip the entire benchmarking loop if this is a server worker instead of
asking the same fixed question on every single iteration.

Change-Id: I66d1578132099ea1cb4a3b5a10a830bb11b579a2
Test: Ran a benchmark on cuttlefish, and it did not get stuck
Signed-off-by: default avatarCarlos Llamas <cmllamas@google.com>
Co-developed-by: default avatarAlice Ryhl <aliceryhl@google.com>
Signed-off-by: default avatarAlice Ryhl <aliceryhl@google.com>
parent 60a90519
Loading
Loading
Loading
Loading
+21 −19
Original line number Diff line number Diff line
@@ -223,11 +223,12 @@ void worker_fx(int num,
    p.signal();
    p.wait();

    // Run the benchmark if client
    ProcResults results(iterations);

    chrono::time_point<chrono::high_resolution_clock> start, end;
    for (int i = 0; (!cs_pair || num >= server_count) && i < iterations; i++) {

    // Skip the benchmark if server of a cs_pair.
    if (!(cs_pair && num < server_count)) {
        for (int i = 0; i < iterations; i++) {
            Parcel data, reply;
            int target = cs_pair ? num % server_count : rand() % workers.size();
            int sz = payload_size;
@@ -248,6 +249,7 @@ void worker_fx(int num,
               exit(EXIT_FAILURE);
            }
        }
    }

    // Signal completion to master and wait.
    p.signal();