MADARA  3.1.8
madara::transport::PacketScheduler Class Reference

Provides scheduler for dropping packets. More...

#include <PacketScheduler.h>

Collaboration diagram for madara::transport::PacketScheduler:

Public Member Functions

 PacketScheduler (const QoSTransportSettings *settings=0)
 Default constructor. More...
 
 PacketScheduler (const PacketScheduler &rhs)
 Copy constructor. More...
 
virtual ~PacketScheduler ()
 Destructor. More...
 
bool add (void)
 Adds a message to the monitor. More...
 
void attach (const QoSTransportSettings *settings)
 Attaches settings. More...
 
void clear (void)
 Clears the packet scheduler. More...
 
uint64_t get_dropped (void)
 Queries the monitor for the current dropped messages. More...
 
uint64_t get_sent (void)
 Queries the monitor for the current sent messages per second over the past window. More...
 
void operator= (const PacketScheduler &rhs)
 Assignment operator. More...
 
void print_status (unsigned int log_level=0, const char *prefix="PacketScheduler")
 Prints the number of status of the packet scheduler. More...
 
void reset (void)
 Resets the packet scheduler to current settings. More...
 

Protected Attributes

uint64_t consecutive_drops_
 Consecutive dropped messages. More...
 
uint64_t dropped_messages_
 Number of dropped messages. More...
 
MADARA_LOCK_TYPE mutex_
 Mutex for supporting multithreaded monitor calls. More...
 
std::priority_queue< StrideTask, std::vector< StrideTask > > queue_
 queue used by stride scheduling algorithm More...
 
uint64_t sent_messages_
 Number of sent messages. More...
 
const QoSTransportSettingssettings_
 Transport settings. More...
 

Detailed Description

Provides scheduler for dropping packets.

Definition at line 36 of file PacketScheduler.h.

Constructor & Destructor Documentation

madara::transport::PacketScheduler::PacketScheduler ( const QoSTransportSettings settings = 0)

Default constructor.

Definition at line 90 of file PacketScheduler.cpp.

madara::transport::PacketScheduler::PacketScheduler ( const PacketScheduler rhs)

Copy constructor.

Parameters
rhsthe value to be copied into this class

Definition at line 99 of file PacketScheduler.cpp.

madara::transport::PacketScheduler::~PacketScheduler ( )
virtual

Destructor.

Definition at line 108 of file PacketScheduler.cpp.

Member Function Documentation

bool madara::transport::PacketScheduler::add ( void  )

Adds a message to the monitor.

Returns
false if the packet should be dropped, true otherwise

call the accessor functions only once

if the drop rate is greater than 100% or drop burst is greater than 1 and we do not have that many consecutive drops

Definition at line 127 of file PacketScheduler.cpp.

void madara::transport::PacketScheduler::attach ( const QoSTransportSettings settings)

Attaches settings.

Parameters
settingsSettings to attach to this scheduler

Definition at line 215 of file PacketScheduler.cpp.

void madara::transport::PacketScheduler::clear ( void  )

Clears the packet scheduler.

Definition at line 222 of file PacketScheduler.cpp.

uint64_t madara::transport::PacketScheduler::get_dropped ( void  )

Queries the monitor for the current dropped messages.

Returns
current bandwidth utilization in bytes over the entire window (this is not bytes/s)

Definition at line 276 of file PacketScheduler.cpp.

uint64_t madara::transport::PacketScheduler::get_sent ( void  )

Queries the monitor for the current sent messages per second over the past window.

Returns
current bandwidth utilization in bytes/s

Definition at line 283 of file PacketScheduler.cpp.

void madara::transport::PacketScheduler::operator= ( const PacketScheduler rhs)

Assignment operator.

Parameters
rhsthe value to be copied into this class

Definition at line 113 of file PacketScheduler.cpp.

void madara::transport::PacketScheduler::print_status ( unsigned int  log_level = 0,
const char *  prefix = "PacketScheduler" 
)

Prints the number of status of the packet scheduler.

Parameters
log_levelthe log level to print status at
prefixthe prefix of the calling function to allow for more descriptive and relevant status

Definition at line 264 of file PacketScheduler.cpp.

void madara::transport::PacketScheduler::reset ( void  )

Resets the packet scheduler to current settings.

Definition at line 234 of file PacketScheduler.cpp.

Member Data Documentation

uint64_t madara::transport::PacketScheduler::consecutive_drops_
protected

Consecutive dropped messages.

Definition at line 132 of file PacketScheduler.h.

uint64_t madara::transport::PacketScheduler::dropped_messages_
protected

Number of dropped messages.

Definition at line 127 of file PacketScheduler.h.

MADARA_LOCK_TYPE madara::transport::PacketScheduler::mutex_
mutableprotected

Mutex for supporting multithreaded monitor calls.

Definition at line 112 of file PacketScheduler.h.

std::priority_queue<StrideTask, std::vector <StrideTask> > madara::transport::PacketScheduler::queue_
protected

queue used by stride scheduling algorithm

Definition at line 137 of file PacketScheduler.h.

uint64_t madara::transport::PacketScheduler::sent_messages_
protected

Number of sent messages.

Definition at line 122 of file PacketScheduler.h.

const QoSTransportSettings* madara::transport::PacketScheduler::settings_
protected

Transport settings.

Definition at line 117 of file PacketScheduler.h.


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