-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/50569/
-----------------------------------------------------------
(Updated 七月 30, 2016, 8:36 a.m.)
Review request for mesos, Benjamin Mahler, Joris Van Remoortere, and Klaus Ma.
Summary (updated)
-----------------
Checked if resource is negative scalar directly in subtract.
Bugs: MESOS-5921
https://issues.apache.org/jira/browse/MESOS-5921
Repository: mesos
Description (updated)
-------
When subtract resources finished, we need to call `validate` to
check if the scalar resource is negative so as to remove this
resource if it is negative. This is a bit heavy as the `validate`
did many stuffs.
This patch is simpilfying the logic by checking if the resource
is negative scalar directly.
Diffs (updated)
-----
src/common/resources.cpp 468581da550bcabf44fbaba8897d5fbbc330c2cb
src/v1/resources.cpp 230d55b099511499eef111bddd1c552df0093b82
Diff: https://reviews.apache.org/r/50569/diff/
Testing (updated)
-------
make
make check
```
[==========] Running 3 tests from 1 test case.
[----------] Global test environment set-up.
[----------] 3 tests from ResourcesOperators/Resources_BENCHMARK_Test
[ RUN ] ResourcesOperators/Resources_BENCHMARK_Test.Arithmetic/0
Took 222763us to perform 50000 'total += r' operations on cpus(*):1; gpus(*):1;
mem(*):128; disk(*):256
Took 231983us to perform 50000 'total -= r' operations on cpus(*):1; gpus(*):1;
mem(*):128; disk(*):256
Took 679121us to perform 50000 'total = total + r' operations on cpus(*):1;
gpus(*):1; mem(*):128; disk(*):256
Took 698024us to perform 50000 'total = total - r' operations on cpus(*):1;
gpus(*):1; mem(*):128; disk(*):256
[ OK ] ResourcesOperators/Resources_BENCHMARK_Test.Arithmetic/0 (1832 ms)
[ RUN ] ResourcesOperators/Resources_BENCHMARK_Test.Arithmetic/1
Took 22.630349secs to perform 10 'total += r' operations on cpus(0,
principal_0, {key_0: value_0}):1; gpus(...
Took 22.499543secs to perform 10 'total -= r' operations on cpus(0,
principal_0, {key_0: value_0}):1; gpus(...
Took 22.566697secs to perform 10 'total = total + r' operations on cpus(0,
principal_0, {key_0: value_0}):1; gpus(...
Took 22.798371secs to perform 10 'total = total - r' operations on cpus(0,
principal_0, {key_0: value_0}):1; gpus(...
[ OK ] ResourcesOperators/Resources_BENCHMARK_Test.Arithmetic/1 (90621 ms)
[ RUN ] ResourcesOperators/Resources_BENCHMARK_Test.Arithmetic/2
Took 2.831782secs to perform 1000 'total += r' operations on ports(*):[1-2,
4-5, 7-8, 10-11, 13-14, 16-17, 1...
Took 8935us to perform 1000 'total -= r' operations on ports(*):[1-2, 4-5, 7-8,
10-11, 13-14, 16-17, 1...
Took 2.96492secs to perform 1000 'total = total + r' operations on
ports(*):[1-2, 4-5, 7-8, 10-11, 13-14, 16-17, 1...
Took 9220us 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 (5817 ms)
[----------] 3 tests from ResourcesOperators/Resources_BENCHMARK_Test (98270 ms
total)
```
Thanks,
Guangya Liu