RaftLib
0.3a
C++ Stream Processing Template Library
|
#include <ratesample.hpp>
Public Member Functions | |
ratesample (const sclock_t frame_width, const std::size_t ele_size) | |
virtual | ~ratesample () |
void | addCount (const std::uint32_t value) |
float | getRate () |
ratesample.hpp - this class encapsulates the logic for arrival and departure rate sampling.
Copyright 2015 Jonathan Beard
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at:
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.for mean / std-dev for system clock
ratesample::ratesample | ( | const sclock_t | frame_width, |
const std::size_t | ele_size | ||
) |
ratesample - instantiate a rate sample. the only parameter is that of the frame width which is needed to calculate the rate. @
ratesample.cpp -
Copyright 2015 Jonathan Beard
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at:
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
|
virtual |
destructor
nothing to do here
void ratesample::addCount | ( | const std::uint32_t | value | ) |
addCount- adds a new count to the window, function discards previous observation over the window size. This also has the consequence of applying the filter and updating the current estimate of the rate.
value | - const std::uint32_t |
update rate
float ratesample::getRate | ( | ) |
getRate - returns the current estimate of the rate. Might change precision in the future, but it seems the accuracy of the method isn't nearly precise enough to benefit from double precision.