From 5837d037a08390bd6c2101c9158790152da86c9d Mon Sep 17 00:00:00 2001 From: Carlos Llamas Date: Sat, 23 Sep 2023 20:14:41 +0000 Subject: binderThroughputTest: drop useless arguments read These reads were likely added at a point where the arguments were not being used yes to suppress compiler warnings. Either way they are no longer needed here so remove them. Change-Id: I152bd77902626f7e9a63ec185d1ee29d637f2261 Signed-off-by: Carlos Llamas --- libs/binder/tests/binderThroughputTest.cpp | 2 -- 1 file changed, 2 deletions(-) diff --git a/libs/binder/tests/binderThroughputTest.cpp b/libs/binder/tests/binderThroughputTest.cpp index 0ea4a3faaa..f93a19d226 100644 --- a/libs/binder/tests/binderThroughputTest.cpp +++ b/libs/binder/tests/binderThroughputTest.cpp @@ -340,8 +340,6 @@ int main(int argc, char *argv[]) int payload_size = 0; bool cs_pair = false; bool training_round = false; - (void)argc; - (void)argv; // Parse arguments. for (int i = 1; i < argc; i++) { -- cgit v1.2.3-59-g8ed1b From 8c5135222b5bef532ecbbce5d501bd37cb93dad9 Mon Sep 17 00:00:00 2001 From: Carlos Llamas Date: Sat, 23 Sep 2023 20:24:20 +0000 Subject: binderThroughputTest: replace getService with waitForService The getService() method is now deprecated, replace with waitForService() which waits indefinitely instead of timing out. This should fix the following compilation warning: binderThroughputTest.cpp:207:39: warning: 'getService' is deprecated: this polls for 5s, prefer waitForService or checkService [-Wdeprecated-declarations] workers.push_back(serviceMgr->getService(generateServiceName(i))); ^ frameworks/native/libs/binder/include/binder/IServiceManager.h:70:7: note: 'getService' has been explicitly marked deprecated here [[deprecated("this polls for 5s, prefer waitForService or checkService")]] ^ 1 warning generated. Change-Id: Ib6721b355a5fe7e79d9b8c6949b54e3eb49f237f Signed-off-by: Carlos Llamas [ Alice: Fix conflict with commit bb07b9837531 ("Fix or silence binder build warnings on clang"). ] Signed-off-by: Alice Ryhl --- libs/binder/tests/binderThroughputTest.cpp | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/libs/binder/tests/binderThroughputTest.cpp b/libs/binder/tests/binderThroughputTest.cpp index f93a19d226..1242092fe6 100644 --- a/libs/binder/tests/binderThroughputTest.cpp +++ b/libs/binder/tests/binderThroughputTest.cpp @@ -204,10 +204,7 @@ void worker_fx(int num, for (int i = 0; i < server_count; i++) { if (num == i) continue; -#pragma clang diagnostic push -#pragma clang diagnostic ignored "-Wdeprecated-declarations" - workers.push_back(serviceMgr->getService(generateServiceName(i))); -#pragma clang diagnostic pop + workers.push_back(serviceMgr->waitForService(generateServiceName(i))); } // Run the benchmark if client -- cgit v1.2.3-59-g8ed1b From 71686da5fc18d4ffbae6e30ad9c7a6d21e3da984 Mon Sep 17 00:00:00 2001 From: Carlos Llamas Date: Sat, 23 Sep 2023 20:34:58 +0000 Subject: binderThroughputTest: match argv parsing with early continue Some argv[] parsing options use continue and others don't. Lets match all of them with the same early "skip loop" behavior. Change-Id: Iafbfb65d908c5163697d42b63d4f18b9be520fd8 Signed-off-by: Carlos Llamas --- libs/binder/tests/binderThroughputTest.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/libs/binder/tests/binderThroughputTest.cpp b/libs/binder/tests/binderThroughputTest.cpp index 1242092fe6..248e1e5e38 100644 --- a/libs/binder/tests/binderThroughputTest.cpp +++ b/libs/binder/tests/binderThroughputTest.cpp @@ -363,17 +363,20 @@ int main(int argc, char *argv[]) if (string(argv[i]) == "-s") { payload_size = atoi(argv[i+1]); i++; + continue; } if (string(argv[i]) == "-p") { // client/server pairs instead of spreading // requests to all workers. If true, half // the workers become clients and half servers cs_pair = true; + continue; } if (string(argv[i]) == "-t") { // Run one training round before actually collecting data // to get an approximation of max latency. training_round = true; + continue; } if (string(argv[i]) == "-m") { // Caller specified the max latency in microseconds. @@ -386,6 +389,7 @@ int main(int argc, char *argv[]) cout << "Max latency -m must be positive." << endl; exit(EXIT_FAILURE); } + continue; } } -- cgit v1.2.3-59-g8ed1b From b21d7fdac110502e77e6e9e6f7c7681fc991d784 Mon Sep 17 00:00:00 2001 From: Carlos Llamas Date: Sat, 23 Sep 2023 21:20:51 +0000 Subject: binderThroughputTest: training option shouldn't have a payload The training round doesn't have an argument payload so remove this from the help menu. Change-Id: I4e7f40727baba92c54fb66541b4068d5c33c1138 Signed-off-by: Carlos Llamas --- libs/binder/tests/binderThroughputTest.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libs/binder/tests/binderThroughputTest.cpp b/libs/binder/tests/binderThroughputTest.cpp index 248e1e5e38..0a5518e2cd 100644 --- a/libs/binder/tests/binderThroughputTest.cpp +++ b/libs/binder/tests/binderThroughputTest.cpp @@ -346,7 +346,7 @@ int main(int argc, char *argv[]) cout << "\t-m N : Specify expected max latency in microseconds." << endl; cout << "\t-p : Split workers into client/server pairs." << endl; cout << "\t-s N : Specify payload size." << endl; - cout << "\t-t N : Run training round." << endl; + cout << "\t-t : Run training round." << endl; cout << "\t-w N : Specify total number of workers." << endl; return 0; } -- cgit v1.2.3-59-g8ed1b From 9a85d30228b2752f08887d5f40f7c18c25af959d Mon Sep 17 00:00:00 2001 From: Carlos Llamas Date: Sat, 23 Sep 2023 22:41:22 +0000 Subject: binderThroughputTest: only parse user latency once The latency seems already capped by atoi() so there is no need of doing a reparse via strtoull(). Besides any values above INT_MAX microseconds don't really make sense for this test. The conversion into nanoseconds doesn't overflow this way either: INT_MAX * 1000ull < UINT64_MAX. Change-Id: I603bbeee2e94c9975e502c1af1c1c2bbcc82f79a Signed-off-by: Carlos Llamas --- libs/binder/tests/binderThroughputTest.cpp | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/libs/binder/tests/binderThroughputTest.cpp b/libs/binder/tests/binderThroughputTest.cpp index 0a5518e2cd..e4c6fa406e 100644 --- a/libs/binder/tests/binderThroughputTest.cpp +++ b/libs/binder/tests/binderThroughputTest.cpp @@ -337,6 +337,7 @@ int main(int argc, char *argv[]) int payload_size = 0; bool cs_pair = false; bool training_round = false; + int max_time_us; // Parse arguments. for (int i = 1; i < argc; i++) { @@ -381,14 +382,14 @@ int main(int argc, char *argv[]) if (string(argv[i]) == "-m") { // Caller specified the max latency in microseconds. // No need to run training round in this case. - if (atoi(argv[i+1]) > 0) { - max_time_bucket = strtoull(argv[i+1], (char **)nullptr, 10) * 1000; - time_per_bucket = max_time_bucket / num_buckets; - i++; - } else { + max_time_us = atoi(argv[i+1]); + if (max_time_us <= 0) { cout << "Max latency -m must be positive." << endl; exit(EXIT_FAILURE); } + max_time_bucket = max_time_us * 1000ull; + time_per_bucket = max_time_bucket / num_buckets; + i++; continue; } } -- cgit v1.2.3-59-g8ed1b