Chops Net IP
Loading...
Searching...
No Matches
output_queue_stats.hpp File Reference

Functions that collect and deliver output_queue_stats from a sequence. More...

#include <cstddef>
#include <numeric>
#include "net_ip/queue_stats.hpp"
#include "net_ip/basic_io_output.hpp"
Include dependency graph for output_queue_stats.hpp:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

template<typename Iter >
output_queue_stats chops::net::accumulate_output_queue_stats (Iter beg, Iter end)
 Accumulate output_queue_stats given a sequence of basic_io_output objects.
 
template<typename Iter , typename Cond >
void chops::net::accumulate_output_queue_stats_until (Iter beg, Iter end, Cond &&cond)
 Accumulate output_queue_stats on a sequence of basic_io_output objects until a condition is satisfied.
 
template<typename IOT , typename Iter >
output_queue_stats chops::net::accumulate_net_entity_output_queue_stats (Iter beg, Iter end)
 Accumulate output_queue_stats given a sequence of net_entity objects, using the visit_io_output method on each net_entity.
 
template<typename IOT , typename Iter , typename Cond >
void chops::net::accumulate_net_entity_output_queue_stats_until (Iter beg, Iter end, Cond &&cond)
 Accumulate output_queue_stats on a sequence of net_entity objects until a condition is satisfied.
 

Detailed Description

Functions that collect and deliver output_queue_stats from a sequence.

Author
Cliff Green

Copyright (c) 2019 by Cliff Green

Distributed under the Boost Software License, Version 1.0. (See accompanying file LICENSE.txt or copy at http://www.boost.org/LICENSE_1_0.txt)

Function Documentation

◆ accumulate_net_entity_output_queue_stats()

template<typename IOT , typename Iter >
output_queue_stats chops::net::accumulate_net_entity_output_queue_stats ( Iter beg,
Iter end )

Accumulate output_queue_stats given a sequence of net_entity objects, using the visit_io_output method on each net_entity.

Template Parameters
IOTEither chops::net::tcp_io or chops::net::udp_io.
Parameters
begBeginning iterator of sequence of net_entity objects.
endEnding iterator of sequence.
Returns
output_queue_stats containing accumulated statistics.

◆ accumulate_net_entity_output_queue_stats_until()

template<typename IOT , typename Iter , typename Cond >
void chops::net::accumulate_net_entity_output_queue_stats_until ( Iter beg,
Iter end,
Cond && cond )

Accumulate output_queue_stats on a sequence of net_entity objects until a condition is satisfied.

Given a sequence of net_entity objects, accumulate statistics until a supplied condition function object is satisfied.

Parameters
begBeginning iterator of sequence of net_entity objects.
endEnding iterator of sequence.
condCondition function object invoked after each accumulation, returning true causes accumulation loop to finish.

◆ accumulate_output_queue_stats()

template<typename Iter >
output_queue_stats chops::net::accumulate_output_queue_stats ( Iter beg,
Iter end )

Accumulate output_queue_stats given a sequence of basic_io_output objects.

The basic_io_output object can be of either tcp_io_output or udp_io_output types.

Note
If multiple basic_io_output objects are associated with the same IO handler, the accumulated counts may be inflated. This does not matter if comparing against counts of 0.
Parameters
begBeginning iterator of sequence of basic_io_output objects.
endEnding iterator of sequence.
Returns
output_queue_stats containing accumulated statistics.

◆ accumulate_output_queue_stats_until()

template<typename Iter , typename Cond >
void chops::net::accumulate_output_queue_stats_until ( Iter beg,
Iter end,
Cond && cond )

Accumulate output_queue_stats on a sequence of basic_io_output objects until a condition is satisfied.

Given a sequence of basic_io_output objects, accumulate statistics until a supplied condition function object is satisfied.

The condition object typically checks for a specific count of 0 or similar. It must have a signature of:

output_queue_stats provides information on the internal output queue.
Definition queue_stats.hpp:29

It is highly recommended that a sleep or other blocking operation is performed when the condition returns false, otherwise a tight processing loop will occur.

For example:

bool check_stats (const chops::net::output_queue_stats& st) {
if (st.output_queue_size == 0u) {
return true;
}
std::this_thread::sleep_for(std::chrono::milliseconds(200));
return false;
}
// above code could also be in a lambda
accumulate_output_queue_stats_until (io_vec.cbegin(), io_vec.cend(),
check_stats);
void accumulate_output_queue_stats_until(Iter beg, Iter end, Cond &&cond)
Accumulate output_queue_stats on a sequence of basic_io_output objects until a condition is satisfied...
Definition output_queue_stats.hpp:100
Parameters
begBeginning iterator of sequence of basic_io_output objects.
endEnding iterator of sequence.
condCondition function object invoked after each accumulation, returning true causes accumulation loop to finish.