-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/50380/
-----------------------------------------------------------
(Updated 十月 12, 2016, 3:13 a.m.)
Review request for mesos, Benjamin Mahler, Klaus Ma, and Jiang Yan Xu.
Bugs: MESOS-5898
https://issues.apache.org/jira/browse/MESOS-5898
Repository: mesos
Description (updated)
-------
When run benchmark test for `ports` resources, the `-=` and `-` only
consumed about 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`.
The fix is adding a new benchmark test for ports resources, using
a initial and a different delta resource to make sure the ports
resources will never be subtracted to 0.
Diffs (updated)
-----
src/tests/resources_tests.cpp 6a12783c26f359dda835b4866b299a8fcfb3f972
Diff: https://reviews.apache.org/r/50380/diff/
Testing (updated)
-------
make
make check
```
./bin/mesos-tests.sh --benchmark
--gtest_filter="Resources_Ports_BENCHMARK_Test.Arithmetic"
[==========] Running 1 test from 1 test case.
[----------] Global test environment set-up.
[----------] 1 test from Resources_Ports_BENCHMARK_Test
[ RUN ] Resources_Ports_BENCHMARK_Test.Arithmetic
Took 1.251298secs to perform 2000 'total += r' operations on ports(*):[1-1,
3-3, 5-5, 7-7, 9-9, 11-11, 13-13... with initial resources ports(*):[3001-4000]
Took 2.559662secs to perform 2000 'total -= r' operations on ports(*):[1-1,
3-3, 5-5, 7-7, 9-9, 11-11, 13-13... with initial resources ports(*):[3001-4000]
Took 1.470526secs to perform 2000 'total = total + r' operations on
ports(*):[1-1, 3-3, 5-5, 7-7, 9-9, 11-11, 13-13... with initial resources
ports(*):[3001-4000]
Took 2.459164secs to perform 2000 'total = total - r' operations on
ports(*):[1-1, 3-3, 5-5, 7-7, 9-9, 11-11, 13-13... with initial resources
ports(*):[3001-4000]
[ OK ] Resources_Ports_BENCHMARK_Test.Arithmetic (7747 ms)
[----------] 1 test from Resources_Ports_BENCHMARK_Test (7747 ms total)
[----------] Global test environment tear-down
[==========] 1 test from 1 test case ran. (7759 ms total)
[ PASSED ] 1 test.
```
Thanks,
Guangya Liu