RaftLib  0.3a
C++ Stream Processing Template Library
Public Member Functions | List of all members
ratesample Class Reference

#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 ()
 

Detailed Description

ratesample.hpp - this class encapsulates the logic for arrival and departure rate sampling.

Author
: Jonathan Beard
Version
: Fri Mar 6 11:37:08 2015

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

Constructor & Destructor Documentation

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 -

Author
: Jonathan Beard
Version
: Fri Mar 6 11:37:08 2015

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.

ratesample::~ratesample ( )
virtual

destructor

nothing to do here

Member Function Documentation

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.

Parameters
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.

Returns
float

The documentation for this class was generated from the following files: