Guangya Liu created MESOS-5898: ---------------------------------- Summary: Make resources benchmark test for ports -=/- more accurate Key: MESOS-5898 URL: https://issues.apache.org/jira/browse/MESOS-5898 Project: Mesos Issue Type: Bug Reporter: Guangya Liu Assignee: Guangya Liu
When I run benchmark test for port resources, I can get the following result, the `-=` and `-` only consumed 10ms, this cannot reflect the real time of operating 1000 ports with `-=` and `-`. The root cause is that the current calculation is always using same port range, with port, the formula for `+` is {a+a+a+a+...+a==a}; for `-`, it will be {a-a=0} and {0-a=0}. With {0-a=0}, the code here https://github.com/apache/mesos/blob/master/src/common/values.cpp#L544 will cause there is no validation as the {{left}} is empty. {code} ./bin/mesos-tests.sh --benchmark --gtest_filter="*Resources_BENCHMARK_Test.Arithmetic/2" [==========] Running 1 test from 1 test case. [----------] Global test environment set-up. [----------] 1 test from ResourcesOperators/Resources_BENCHMARK_Test [ RUN ] ResourcesOperators/Resources_BENCHMARK_Test.Arithmetic/2 Took 3.219217secs to perform 1000 'total += r' operations on ports(*):[1-2, 4-5, 7-8, 10-11, 13-14, 16-17, 1... Took 10207us to perform 1000 'total -= r' operations on ports(*):[1-2, 4-5, 7-8, 10-11, 13-14, 16-17, 1... Took 3.515383secs to perform 1000 'total = total + r' operations on ports(*):[1-2, 4-5, 7-8, 10-11, 13-14, 16-17, 1... Took 10208us to perform 1000 'total = total - r' operations on ports(*):[1-2, 4-5, 7-8, 10-11, 13-14, 16-17, 1... [ OK ] ResourcesOperators/Resources_BENCHMARK_Test.Arithmetic/2 (6759 ms) [----------] 1 test from ResourcesOperators/Resources_BENCHMARK_Test (6759 ms total) [----------] Global test environment tear-down [==========] 1 test from 1 test case ran. (6801 ms total) [ PASSED ] 1 test. {code} -- This message was sent by Atlassian JIRA (v6.3.4#6332)