-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/59858/#review177101
-----------------------------------------------------------



I do not understand why we need to make this change to `Gauge`. It should 
already now be possible to `defer` to the current thread, i.e., with no 
additional `dispatch` cost, by using `process::defer(F&&)`.

If the test code you added would use a definition like

      Gauge gaugeConst("test/gauge_const", process::defer([]() { return 99.; 
}));

no other changes, e.g., to `Gauge`, would be required to make the tests pass. 
This code does not involve runtime-dispatches, but instead creates a 
`_Deferred` which is implicitly converted a `Deferred` in the construction of 
the `Gauge`, 
https://github.com/apache/mesos/blob/79daf9769d28317a7314b8c6e75cf18c0c293683/3rdparty/libprocess/include/process/deferred.hpp#L76-L78.

- Benjamin Bannier


On June 6, 2017, 11:16 p.m., James Peach wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/59858/
> -----------------------------------------------------------
> 
> (Updated June 6, 2017, 11:16 p.m.)
> 
> 
> Review request for mesos, Benjamin Bannier and Benjamin Mahler.
> 
> 
> Repository: mesos
> 
> 
> Description
> -------
> 
> A `Deferred` function object is always defined to be a
> `std::function`, so when we are constructing a `Gauge` metrics
> is it not strictly required for the callback to be a `Deferred`
> object. In cases where the value is a constant or can be calculated
> by reading constant data, a metrics producer can emit a `Gauge`
> without the taking the additional dispatch cost.
> 
> 
> Diffs
> -----
> 
>   3rdparty/libprocess/include/process/metrics/gauge.hpp 
> c5bbeaf5d53c60f3636d1778db47cdb6cdda34e8 
>   3rdparty/libprocess/src/tests/metrics_tests.cpp 
> c13520d23ca17144f553fb4588fb8a747ea46e72 
> 
> 
> Diff: https://reviews.apache.org/r/59858/diff/2/
> 
> 
> Testing
> -------
> 
> make check (Fedora 25)
> 
> 
> Thanks,
> 
> James Peach
> 
>

Reply via email to