Commit c5555259 authored by Kirk Shoop's avatar Kirk Shoop Committed by Facebook Github Bot

add benchmarks for flow and many

fbshipit-source-id: 46b51ab9bbfb6903a07cd0e5ed006a8dd081975f
parent f5ee09a3
...@@ -9,12 +9,18 @@ ...@@ -9,12 +9,18 @@
#include "pushmi/trampoline.h" #include "pushmi/trampoline.h"
#include "pushmi/new_thread.h" #include "pushmi/new_thread.h"
#include "pushmi/none.h"
#include "pushmi/flow_single.h"
#include "pushmi/flow_single_deferred.h"
#include "pushmi/entangle.h"
#include "pool.h" #include "pool.h"
using namespace pushmi::aliases; using namespace pushmi::aliases;
struct countdownsingle { template<class R>
countdownsingle(int& c) struct countdown {
countdown(int& c)
: counter(&c) {} : counter(&c) {}
int* counter; int* counter;
...@@ -23,14 +29,18 @@ struct countdownsingle { ...@@ -23,14 +29,18 @@ struct countdownsingle {
void operator()(ExecutorRef exec) const; void operator()(ExecutorRef exec) const;
}; };
template<class R>
template <class ExecutorRef> template <class ExecutorRef>
void countdownsingle::operator()(ExecutorRef exec) const { void countdown<R>::operator()(ExecutorRef exec) const {
if (--*counter > 0) { if (--*counter > 0) {
//exec | op::submit(mi::make_single(*this)); exec | op::submit(R{}(*this));
exec | op::submit(mi::single<countdownsingle, mi::abortEF, mi::ignoreDF>{*this});
} }
} }
using countdownsingle = countdown<mi::make_single_fn>;
using countdownflowsingle = countdown<mi::make_flow_single_fn>;
using countdownmany = countdown<mi::make_many_fn>;
struct inline_executor { struct inline_executor {
using properties = mi::property_set<mi::is_sender<>, mi::is_single<>>; using properties = mi::property_set<mi::is_sender<>, mi::is_single<>>;
template<class Out> template<class Out>
...@@ -39,11 +49,62 @@ struct inline_executor { ...@@ -39,11 +49,62 @@ struct inline_executor {
} }
}; };
struct inline_executor_flow_single {
using properties = mi::property_set<mi::is_sender<>, mi::is_flow<>, mi::is_single<>>;
template<class Out>
void submit(Out out) {
// boolean cancellation
bool stop = false;
auto set_stop = [](auto& e) {
auto stop = e.lockPointerToDual();
if (!!stop) {
*stop = true;
}
e.unlockPointerToDual();
};
auto tokens = mi::entangle(stop, set_stop);
using Stopper = decltype(tokens.second);
struct Data : mi::none<> {
explicit Data(Stopper stopper) : stopper(std::move(stopper)) {}
Stopper stopper;
};
auto up = mi::MAKE(none)(
Data{std::move(tokens.second)},
[](auto& data, auto e) noexcept {
data.stopper.t(data.stopper);
},
[](auto& data) {
data.stopper.t(data.stopper);
});
// pass reference for cancellation.
::mi::set_starting(out, std::move(up));
if (!tokens.first.t) {
::mi::set_value(out, *this);
} else {
// cancellation is not an error
::mi::set_done(out);
}
}
};
struct inline_executor_many {
using properties = mi::property_set<mi::is_sender<>, mi::is_many<>>;
template<class Out>
void submit(Out out) {
::mi::set_next(out, *this);
::mi::set_done(out);
}
};
#define concept Concept #define concept Concept
#include <nonius/nonius.h++> #include <nonius/nonius.h++>
NONIUS_BENCHMARK("inline 10", [](nonius::chronometer meter){ NONIUS_BENCHMARK("inline 10 single", [](nonius::chronometer meter){
int counter = 0; int counter = 0;
auto ie = inline_executor{}; auto ie = inline_executor{};
using IE = decltype(ie); using IE = decltype(ie);
...@@ -55,6 +116,30 @@ NONIUS_BENCHMARK("inline 10", [](nonius::chronometer meter){ ...@@ -55,6 +116,30 @@ NONIUS_BENCHMARK("inline 10", [](nonius::chronometer meter){
}); });
}) })
NONIUS_BENCHMARK("inline 10 flow_single", [](nonius::chronometer meter){
int counter = 0;
auto ie = inline_executor_flow_single{};
using IE = decltype(ie);
countdownflowsingle flowsingle{counter};
meter.measure([&]{
counter = 10;
ie | op::submit(mi::make_flow_single(on_value(flowsingle)));
return counter;
});
})
NONIUS_BENCHMARK("inline 10 many", [](nonius::chronometer meter){
int counter = 0;
auto ie = inline_executor_many{};
using IE = decltype(ie);
countdownmany many{counter};
meter.measure([&]{
counter = 10;
ie | op::submit(mi::make_many(many));
return counter;
});
})
NONIUS_BENCHMARK("trampoline static derecursion 10", [](nonius::chronometer meter){ NONIUS_BENCHMARK("trampoline static derecursion 10", [](nonius::chronometer meter){
int counter = 0; int counter = 0;
auto tr = mi::trampoline(); auto tr = mi::trampoline();
......
...@@ -175,38 +175,52 @@ e.exports=function(t,e,n){function l(n,r){return o.coerce(t,e,i,n,r)}for(var s=! ...@@ -175,38 +175,52 @@ e.exports=function(t,e,n){function l(n,r){return o.coerce(t,e,i,n,r)}for(var s=!
benchmarks: [ benchmarks: [
{ {
name: 'new thread blocking_submit 10', name: 'new thread blocking_submit 10',
mean: 38604.332999999999, mean: 41950.620000000003,
stddev: 22014.93, stddev: 47113.856,
samples: [ samples: [
91324.332999999999, 122991, 100324.333, 124657.666, 112991, 134657.666, 75324.332999999999, 86657.665999999997, 30991, 36657.665999999997, 28324.332999999999, 80991, 64991, 46324.332999999999, 32657.666000000001, 28991, 28991, 28324.332999999999, 28657.666000000001, 32324.332999999999, 55324.332999999999, 42657.665999999997, 33657.665999999997, 38991, 31991, 28657.666000000001, 38991, 38657.665999999997, 56324.332999999999, 37991, 33991, 29991, 29657.666000000001, 29324.332999999999, 29324.332999999999, 29324.332999999999, 31657.666000000001, 30324.332999999999, 33991, 29657.666000000001, 32657.666000000001, 29324.332999999999, 29991, 30991, 29324.332999999999, 29657.666000000001, 29324.332999999999, 29657.666000000001, 29657.666000000001, 29657.666000000001, 29657.666000000001, 28991, 29324.332999999999, 29324.332999999999, 35657.665999999997, 46657.665999999997, 29991, 30324.332999999999, 29657.666000000001, 29991, 29324.332999999999, 29991, 29657.666000000001, 33657.665999999997, 29657.666000000001, 31324.332999999999, 36324.332999999999, 31324.332999999999, 31324.332999999999, 31657.666000000001, 29657.666000000001, 32991, 30324.332999999999, 29657.666000000001, 29657.666000000001, 33657.665999999997, 30657.666000000001, 29657.666000000001, 30324.332999999999, 30324.332999999999, 30991, 29991, 28991, 29657.666000000001, 30324.332999999999, 29324.332999999999, 28657.666000000001, 32991, 28324.332999999999, 28657.666000000001, 29324.332999999999, 29657.666000000001, 28657.666000000001, 29324.332999999999, 32657.666000000001, 28991, 28991, 28657.666000000001, 28991, 28657.666000000001, 139691, 66908, 66432, 77340, 38217, 51630, 34841, 85470, 81088, 77075, 53620, 40476, 43976, 81751, 44387, 39213, 37124, 33799, 37112, 43155, 37421, 30750.999, 40176, 26308, 33884, 25613, 26864, 22244, 21986, 37198, 27540, 40234, 36338, 38681, 36105, 36074, 23527, 42063, 29473, 30126, 39732, 31549, 84830, 38757, 34331, 37009, 37816, 470245, 62514, 57324, 48505, 31738, 32462, 22896, 30137, 19840, 29977, 28052, 28866, 21823, 23766, 21991, 32277, 27847, 24110, 29642, 35014, 36026, 33363, 20536, 26386, 24390, 28553, 26083, 28375, 24594, 27910, 96643, 43013, 35731, 26485, 43665, 23507, 27981, 24164, 33195, 21049, 25267, 20162, 28982, 19755, 25616, 20618, 28839, 22405, 33266, 21226, 30451, 19998, 47867,
], ],
},{ },{
name: 'pool 1 blocking_submit 10', name: 'inline 10 single',
mean: 26328.599999999999, mean: 119.027,
stddev: 8171.0240000000003, stddev: 32.542999999999999,
samples: [ samples: [
70794.600000000006, 62394.599999999999, 59794.599999999999, 51794.599999999999, 45794.599999999999, 47594.599999999999, 38194.599999999999, 22194.599999999999, 24994.599999999999, 22594.599999999999, 26394.599999999999, 24394.599999999999, 26394.599999999999, 24194.599999999999, 23994.599999999999, 22794.599999999999, 23994.599999999999, 25994.599999999999, 23394.599999999999, 23994.599999999999, 25994.599999999999, 23794.599999999999, 23794.599999999999, 23794.599999999999, 23794.599999999999, 24394.599999999999, 23994.599999999999, 23794.599999999999, 25994.599999999999, 24394.599999999999, 23794.599999999999, 26394.599999999999, 23994.599999999999, 23394.599999999999, 22794.599999999999, 30394.599999999999, 24194.599999999999, 25994.599999999999, 23594.599999999999, 25594.599999999999, 23994.599999999999, 24194.599999999999, 25594.599999999999, 22594.599999999999, 24194.599999999999, 23994.599999999999, 22994.599999999999, 24194.599999999999, 24794.599999999999, 22794.599999999999, 23594.599999999999, 25594.599999999999, 23994.599999999999, 25994.599999999999, 21994.599999999999, 24594.599999999999, 22594.599999999999, 23794.599999999999, 23794.599999999999, 23994.599999999999, 23994.599999999999, 23994.599999999999, 23994.599999999999, 22794.599999999999, 22594.599999999999, 23194.599999999999, 22994.599999999999, 25994.599999999999, 24594.599999999999, 22394.599999999999, 25994.599999999999, 23594.599999999999, 22394.599999999999, 23794.599999999999, 22594.599999999999, 24194.599999999999, 23794.599999999999, 22594.599999999999, 22394.599999999999, 24594.599999999999, 22994.599999999999, 24394.599999999999, 23994.599999999999, 23794.599999999999, 28994.599999999999, 32394.598999999998, 23994.599999999999, 22794.599999999999, 23394.599999999999, 25794.599999999999, 24994.599999999999, 22194.599999999999, 22994.599999999999, 22394.599999999999, 22794.599999999999, 24794.599999999999, 28194.599999999999, 25794.599999999999, 23594.599999999999, 25194.599999999999, 119.264, 183.441, 112.809, 112.744, 112.839, 112.831, 189.26400000000001, 105.94799999999999, 105.904, 105.961, 106.017, 105.952, 105.926, 105.965, 105.961, 105.965, 105.961, 105.93899999999999, 105.965, 269.31099999999998, 120.623, 120.584, 120.649, 120.51000000000001, 120.584, 120.61, 120.58799999999999, 120.601, 120.51000000000001, 252.32400000000001, 106.012, 122.87, 105.961, 106.021, 105.956, 105.90000000000001, 105.952, 105.961, 105.961, 105.956, 105.965, 106.03400000000001, 105.904, 106.008, 105.956, 105.952, 105.96899999999999, 105.904, 105.952, 105.965, 105.952, 105.956, 105.90900000000001, 105.956, 106.017, 191.05600000000001, 187.43199999999999, 116.584, 116.56699999999999, 116.58799999999999, 116.58, 116.489, 116.575, 116.584, 116.614, 116.506, 245.90899999999999, 105.965, 120.89100000000001, 106.017, 105.961, 106.419, 106.45399999999999, 106.419, 106.44499999999999, 106.307, 106.45399999999999, 106.46299999999999, 106.354, 106.476, 106.29000000000001, 106.428, 106.45, 106.471, 106.298, 106.437, 106.46299999999999, 106.38500000000001, 106.441, 106.38500000000001, 106.45399999999999, 106.441, 106.44499999999999, 260.69200000000001, 116.878, 116.73999999999999, 116.86499999999999, 116.813, 116.94799999999999, 116.8,
], ],
},{ },{
name: 'inline 10', name: 'inline 10 many',
mean: 1555.8440000000001, mean: 120.89100000000001,
stddev: 88.382999999999996, stddev: 4.0199999999999996,
samples: [ samples: [
1643.8440000000001, 1554.9549999999999, 1554.9549999999999, 1554.9549999999999, 1554.9549999999999, 1554.9549999999999, 1532.7329999999999, 1532.7329999999999, 1532.7329999999999, 1554.9549999999999, 1554.9549999999999, 1554.9549999999999, 1554.9549999999999, 1532.7329999999999, 1532.7329999999999, 1554.9549999999999, 1554.9549999999999, 1532.7329999999999, 1532.7329999999999, 1532.7329999999999, 1532.7329999999999, 1554.9549999999999, 1554.9549999999999, 1554.9549999999999, 1554.9549999999999, 1532.7329999999999, 1532.7329999999999, 1532.7329999999999, 1532.7329999999999, 1554.9549999999999, 2421.6219999999998, 1554.9549999999999, 1554.9549999999999, 1554.9549999999999, 1554.9549999999999, 1532.7329999999999, 1532.7329999999999, 1532.7329999999999, 1554.9549999999999, 1554.9549999999999, 1554.9549999999999, 1554.9549999999999, 1554.9549999999999, 1532.7329999999999, 1554.9549999999999, 1554.9549999999999, 1532.7329999999999, 1532.7329999999999, 1554.9549999999999, 1554.9549999999999, 1532.7329999999999, 1532.7329999999999, 1554.9549999999999, 1554.9549999999999, 1554.9549999999999, 1532.7329999999999, 1532.7329999999999, 1554.9549999999999, 1554.9549999999999, 1554.9549999999999, 1554.9549999999999, 1554.9549999999999, 1554.9549999999999, 1554.9549999999999, 1532.7329999999999, 1532.7329999999999, 1554.9549999999999, 1554.9549999999999, 1532.7329999999999, 1532.7329999999999, 1554.9549999999999, 1554.9549999999999, 1532.7329999999999, 1532.7329999999999, 1532.7329999999999, 1554.9549999999999, 1554.9549999999999, 1554.9549999999999, 1554.9549999999999, 1554.9549999999999, 1554.9549999999999, 1532.7329999999999, 1532.7329999999999, 1554.9549999999999, 1532.7329999999999, 1532.7329999999999, 1554.9549999999999, 1554.9549999999999, 1599.4000000000001, 1554.9549999999999, 1532.7329999999999, 1532.7329999999999, 1532.7329999999999, 1532.7329999999999, 1532.7329999999999, 1554.9549999999999, 1554.9549999999999, 1532.7329999999999, 1532.7329999999999, 1554.9549999999999, 125.845, 119.92, 119.854, 119.92, 119.916, 119.938, 119.828, 119.929, 119.973, 119.84099999999999, 119.95999999999999, 119.96899999999999, 119.872, 119.95999999999999, 119.977, 119.929, 119.854, 119.947, 119.977, 119.837, 138.792, 119.95099999999999, 119.95099999999999, 119.81399999999999, 119.938, 119.955, 119.929, 120.348, 119.929, 119.93300000000001, 119.854, 119.907, 141.31700000000001, 119.955, 119.94199999999999, 119.83199999999999, 119.938, 119.929, 119.929, 119.84999999999999, 119.947, 119.911, 119.863, 119.929, 119.938, 119.881, 119.93300000000001, 119.92, 119.929, 119.83199999999999, 119.964, 119.94199999999999, 119.85899999999999, 119.916, 119.955, 119.90300000000001, 137.96000000000001, 119.911, 120.444, 119.863, 119.929, 119.92, 119.93300000000001, 119.845, 119.94199999999999, 119.96899999999999, 120.048, 119.845, 138.29499999999999, 119.867, 119.938, 119.876, 119.94199999999999, 119.925, 119.916, 119.83199999999999, 119.907, 119.916, 119.863, 119.93300000000001, 119.93300000000001, 119.876, 119.964, 119.955, 119.92, 119.83199999999999, 119.938, 119.95999999999999, 119.85899999999999, 119.925, 119.95999999999999, 119.89400000000001, 134.00399999999999, 119.863, 119.986, 119.863, 119.929, 119.986, 119.85899999999999, 119.95999999999999,
], ],
},{ },{
name: 'trampoline virtual derecursion 10', name: 'inline 10 flow_single',
mean: 6289.3630000000003, mean: 11906.663,
stddev: 1155.604, stddev: 3605.8760000000002,
samples: [ samples: [
7361.1809999999996, 5906.6360000000004, 5906.6360000000004, 5906.6360000000004, 5906.6360000000004, 5906.6360000000004, 5906.6360000000004, 5906.6360000000004, 5906.6360000000004, 12452.09, 14815.727000000001, 7270.2719999999999, 6179.3630000000003, 6088.4539999999997, 6088.4539999999997, 6088.4539999999997, 5997.5450000000001, 6088.4539999999997, 6088.4539999999997, 6088.4539999999997, 8452.0900000000001, 7543, 6088.4539999999997, 6088.4539999999997, 6088.4539999999997, 6088.4539999999997, 6088.4539999999997, 6088.4539999999997, 6088.4539999999997, 6088.4539999999997, 6088.4539999999997, 6088.4539999999997, 5997.5450000000001, 6088.4539999999997, 5997.5450000000001, 5997.5450000000001, 5997.5450000000001, 6088.4539999999997, 5997.5450000000001, 5997.5450000000001, 5997.5450000000001, 6088.4539999999997, 6088.4539999999997, 6088.4539999999997, 5997.5450000000001, 5997.5450000000001, 5997.5450000000001, 5997.5450000000001, 5997.5450000000001, 5997.5450000000001, 6088.4539999999997, 6088.4539999999997, 5997.5450000000001, 6088.4539999999997, 6088.4539999999997, 6088.4539999999997, 5997.5450000000001, 6088.4539999999997, 5997.5450000000001, 5997.5450000000001, 6088.4539999999997, 6088.4539999999997, 6088.4539999999997, 6088.4539999999997, 6088.4539999999997, 6088.4539999999997, 6088.4539999999997, 6088.4539999999997, 5997.5450000000001, 5997.5450000000001, 5997.5450000000001, 5997.5450000000001, 5997.5450000000001, 5997.5450000000001, 5997.5450000000001, 5997.5450000000001, 8906.6360000000004, 7361.1809999999996, 6088.4539999999997, 5997.5450000000001, 5997.5450000000001, 5997.5450000000001, 5997.5450000000001, 5997.5450000000001, 5997.5450000000001, 6088.4539999999997, 6088.4539999999997, 5997.5450000000001, 5997.5450000000001, 5997.5450000000001, 5997.5450000000001, 5997.5450000000001, 5997.5450000000001, 5997.5450000000001, 5997.5450000000001, 5997.5450000000001, 5997.5450000000001, 5997.5450000000001, 5997.5450000000001, 6088.4539999999997, 10694, 17237.666000000001, 10633, 10665.333000000001, 10649, 10646, 10658.333000000001, 10660.665999999999, 10663.665999999999, 10639, 20705.666000000001, 17289.332999999999, 10665.333000000001, 10638.665999999999, 10660.665999999999, 10649, 10644.333000000001, 10669.665999999999, 10650, 10673.665999999999, 22802.332999999999, 9346.6659999999993, 21020.666000000001, 10304.665999999999, 10284, 10302.665999999999, 10305, 10300, 17196, 10636.333000000001, 10654.665999999999, 10648.333000000001, 10661, 10646, 10661.333000000001, 10639.665999999999, 10677.333000000001, 21191, 16121.665999999999, 11677.333000000001, 10660.333000000001, 10648, 10644.665999999999, 10667.665999999999, 10652, 10664.333000000001, 10669.333000000001, 15052.333000000001, 9364, 9347, 9371.3330000000005, 9363, 9345.3330000000005, 9372.6659999999993, 9363.6659999999993, 9350.6659999999993, 9366.6659999999993, 9362.6659999999993, 24218.332999999999, 10634.665999999999, 10655.665999999999, 10646.665999999999, 10660.333000000001, 10659.333000000001, 10638.333000000001, 10657.333000000001, 10659, 21167.332999999999, 17888, 10621.665999999999, 10663.665999999999, 10648.665999999999, 10641.665999999999, 10667.665999999999, 10662.665999999999, 10655, 21857.332999999999, 9343.6659999999993, 9357.3330000000005, 9347.6659999999993, 9362.3330000000005, 9346, 9356, 9351, 9357, 9346.3330000000005, 16150.333000000001, 17112.332999999999, 10636.665999999999, 10668.333000000001, 10639, 10664, 10645, 10660.333000000001, 10645.333000000001, 16486.666000000001, 23127.332999999999, 17084.666000000001, 10692, 10648.333000000001,
], ],
},{ },{
name: 'trampoline static derecursion 10', name: 'trampoline static derecursion 10',
mean: 3332.047, mean: 854.25599999999997,
stddev: 463.839, stddev: 38.640000000000001,
samples: [
1006.125, 844.84299999999996, 844.09299999999996, 844.625, 844.75, 843.875, 844.59299999999996, 843.96799999999996, 844.68700000000001, 969.74900000000002, 846.18700000000001, 844.09299999999996, 844.75, 844.56200000000001, 844.06200000000001, 844.93700000000001, 844.15599999999995, 844.875, 843.93700000000001, 844.875, 844.71799999999996, 1017.812, 847.75, 844.15599999999995, 844.59299999999996, 845.125, 844.21799999999996, 844.65599999999995, 844.34299999999996, 844.375, 844.34299999999996, 844.5, 844.21799999999996, 844.65599999999995, 845.06200000000001, 844.34299999999996, 844.59299999999996, 844.34299999999996, 844.75, 844.18700000000001, 844.71799999999996, 844.34299999999996, 844.625, 845.09299999999996, 844.15599999999995, 844.71799999999996, 973.43700000000001, 844.18700000000001, 844.56200000000001, 844.43700000000001, 844.125, 844.93700000000001, 843.96799999999996, 845, 843.96799999999996, 844.68700000000001, 844.28099999999995, 844.53099999999995, 1019.2809999999999, 844.31200000000001, 845.75, 844, 844.81200000000001, 844.31200000000001, 844.75, 844.93700000000001, 844.46799999999996, 844.65599999999995, 844.125, 844.56200000000001, 844.31200000000001, 844.59299999999996, 844.18700000000001, 844.56200000000001, 845.03099999999995, 844.40599999999995, 844.65599999999995, 844.18700000000001, 844.5, 844.31200000000001, 844.65599999999995, 844.25, 961.18700000000001, 840.06200000000001, 840.18700000000001, 840.56200000000001, 839.90599999999995, 840.125, 839.93700000000001, 840.71799999999996, 839.90599999999995, 839.81200000000001, 840, 840.15599999999995, 840.40599999999995, 1005.2809999999999, 839.875, 839.75, 839.625, 840.21799999999996,
],
},{
name: 'trampoline virtual derecursion 10',
mean: 1424.287,
stddev: 66.509,
samples: [
1745.45, 1404.1500000000001, 1405.25, 1404.45, 1404.25, 1404.25, 1404.6500000000001, 1404.6500000000001, 1404.0999999999999, 1411.7, 1404.25, 1403.75, 1404.45, 1404.2, 1404.0999999999999, 1403.5999999999999, 1404, 1409.95, 1404.7, 1404.5, 1404.3499999999999, 1695.95, 1405.05, 1405, 1404.5999999999999, 1405.05, 1405.5, 1411.8, 1404.75, 1404.3, 1404.25, 1404.7, 1404.3499999999999, 1702.9000000000001, 1405.4000000000001, 1405.45, 1405, 1409.4000000000001, 1405.0999999999999, 1410.9000000000001, 1404.8499999999999, 1404.7, 1406.05, 1405.25, 1404.95, 1405, 1405.3, 1414.5999999999999, 1403.5999999999999, 1404.8499999999999, 1404.95, 1404.3, 1404.9000000000001, 1424.05, 1403.7, 1410.2, 1662.7, 1404.95, 1404.55, 1413.4000000000001, 1405.1500000000001, 1404.6500000000001, 1426.95, 1413.75, 1403.7, 1404.05, 1413.3, 1416.3499999999999, 1631.6500000000001, 1417.6500000000001, 1412.5, 1413.05, 1405.75, 1405.3499999999999, 1405.75, 1418.4000000000001, 1403.5999999999999, 1403.75, 1419.7, 1404.8, 1410.5, 1435.3, 1404.6500000000001, 1422.05, 1404.7, 1415.75, 1404.6500000000001, 1405, 1404.5999999999999, 1405, 1408.45, 1666.8499999999999, 1405, 1404.8499999999999, 1405.3, 1420.3499999999999, 1412.25, 1405.05, 1413.5, 1404.0999999999999,
],
},{
name: 'pool{1} blocking_submit 10',
mean: 23878.110000000001,
stddev: 9592.1610000000001,
samples: [ samples: [
3855.857, 3284.4279999999999, 3284.4279999999999, 3284.4279999999999, 3284.4279999999999, 3284.4279999999999, 3284.4279999999999, 3284.4279999999999, 3236.8090000000002, 3236.8090000000002, 3284.4279999999999, 3284.4279999999999, 3284.4279999999999, 3284.4279999999999, 3236.8090000000002, 3236.8090000000002, 3236.8090000000002, 3284.4279999999999, 3236.8090000000002, 3236.8090000000002, 3236.8090000000002, 3284.4279999999999, 3284.4279999999999, 3236.8090000000002, 3236.8090000000002, 3236.8090000000002, 3236.8090000000002, 3236.8090000000002, 3284.4279999999999, 3236.8090000000002, 3236.8090000000002, 3284.4279999999999, 3236.8090000000002, 3236.8090000000002, 3236.8090000000002, 3236.8090000000002, 3284.4279999999999, 3236.8090000000002, 3236.8090000000002, 3284.4279999999999, 3284.4279999999999, 3236.8090000000002, 3236.8090000000002, 6617.7610000000004, 3284.4279999999999, 3236.8090000000002, 3284.4279999999999, 3284.4279999999999, 3236.8090000000002, 3236.8090000000002, 3284.4279999999999, 3284.4279999999999, 3236.8090000000002, 3236.8090000000002, 3284.4279999999999, 3236.8090000000002, 3284.4279999999999, 3284.4279999999999, 3284.4279999999999, 3236.8090000000002, 3236.8090000000002, 3284.4279999999999, 3284.4279999999999, 3284.4279999999999, 3284.4279999999999, 3236.8090000000002, 6474.9040000000005, 3236.8090000000002, 3236.8090000000002, 3284.4279999999999, 3284.4279999999999, 3236.8090000000002, 3284.4279999999999, 3284.4279999999999, 3284.4279999999999, 3236.8090000000002, 3284.4279999999999, 3284.4279999999999, 3236.8090000000002, 3236.8090000000002, 3236.8090000000002, 3236.8090000000002, 3284.4279999999999, 3284.4279999999999, 3236.8090000000002, 3236.8090000000002, 3284.4279999999999, 3236.8090000000002, 3236.8090000000002, 3236.8090000000002, 3236.8090000000002, 3236.8090000000002, 3284.4279999999999, 3284.4279999999999, 3236.8090000000002, 3284.4279999999999, 3236.8090000000002, 3379.6660000000002, 3236.8090000000002, 3236.8090000000002, 43292, 32468.999, 59278, 35715, 25987, 19009, 33574, 22071, 15125, 21647, 18637, 14917, 21132, 30685, 14496, 48447, 21778, 24365, 17789, 30367, 23436, 24111, 16068, 15466, 28135, 23343, 14859, 48080, 27307, 15798.999, 28949, 31785, 15900, 29703, 14946, 20313, 12288, 13257, 29274, 13341, 13446, 19128, 12773, 31385, 22403, 16313, 21323, 24013, 21459, 60090, 21727, 28448, 25288, 23874, 21680, 18167, 21093, 14091, 36172, 16602, 15857, 14807, 38121, 22478, 15413, 16908, 15271.999, 18019, 31831, 25481, 13980, 22450, 14307, 15318, 14278, 31167.999, 30228, 22838, 24759, 24781, 21422, 31260, 20382, 32196.999, 25165, 45181, 22920, 17351, 15951.999, 17963, 35925, 14489, 13290, 31853, 12557, 26278, 32999, 31699.999, 27198, 16820,
], ],
}, },
] ]
......
...@@ -3,29 +3,40 @@ target_include_directories(catch PUBLIC ...@@ -3,29 +3,40 @@ target_include_directories(catch PUBLIC
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/../external/Catch2/single_include> $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/../external/Catch2/single_include>
$<INSTALL_INTERFACE:$<INSTALL_PREFIX>/include/Catch2>) $<INSTALL_INTERFACE:$<INSTALL_PREFIX>/include/Catch2>)
include(../external/Catch2/contrib/Catch.cmake)
if(NOT ${CMAKE_VERSION} VERSION_LESS "3.10.0")
add_executable(FlowTest FlowTest.cpp) add_executable(FlowTest FlowTest.cpp)
target_link_libraries(FlowTest pushmi catch Threads::Threads) target_link_libraries(FlowTest pushmi catch Threads::Threads)
catch_discover_tests(FlowTest)
add_executable(CompileTest CompileTest.cpp) add_executable(CompileTest CompileTest.cpp)
target_link_libraries(CompileTest pushmi catch Threads::Threads) target_link_libraries(CompileTest pushmi catch Threads::Threads)
# catch_discover_tests(CompileTest)
add_executable(NewThreadTest NewThreadTest.cpp) add_executable(NewThreadTest NewThreadTest.cpp)
target_link_libraries(NewThreadTest pushmi catch Threads::Threads) target_link_libraries(NewThreadTest pushmi catch Threads::Threads)
catch_discover_tests(NewThreadTest)
add_executable(TrampolineTest TrampolineTest.cpp) add_executable(TrampolineTest TrampolineTest.cpp)
target_link_libraries(TrampolineTest pushmi catch Threads::Threads) target_link_libraries(TrampolineTest pushmi catch Threads::Threads)
catch_discover_tests(TrampolineTest)
add_executable(PushmiTest PushmiTest.cpp) add_executable(PushmiTest PushmiTest.cpp)
target_link_libraries(PushmiTest pushmi catch Threads::Threads) target_link_libraries(PushmiTest pushmi catch Threads::Threads)
catch_discover_tests(PushmiTest)
if(NOT ${CMAKE_VERSION} VERSION_LESS "3.10.0") else()
include(../external/Catch2/contrib/Catch.cmake) add_executable(PushmiTest PushmiTest.cpp
catch_discover_tests(FlowTest) CompileTest.cpp
# catch_discover_tests(CompileTest) TrampolineTest.cpp
catch_discover_tests(NewThreadTest) NewThreadTest.cpp
catch_discover_tests(TrampolineTest) FlowTest.cpp)
target_link_libraries(PushmiTest pushmi catch Threads::Threads)
catch_discover_tests(PushmiTest) catch_discover_tests(PushmiTest)
endif() endif()
...@@ -273,6 +273,7 @@ SCENARIO("flow single cancellation new thread", "[flow][deferred]") { ...@@ -273,6 +273,7 @@ SCENARIO("flow single cancellation new thread", "[flow][deferred]") {
}); });
WHEN("submit is applied and cancels the producer early") { WHEN("submit is applied and cancels the producer early") {
{
f | f |
op::blocking_submit( op::blocking_submit(
mi::on_value([&](int) { signals += 100; }), mi::on_value([&](int) { signals += 100; }),
...@@ -287,6 +288,10 @@ SCENARIO("flow single cancellation new thread", "[flow][deferred]") { ...@@ -287,6 +288,10 @@ SCENARIO("flow single cancellation new thread", "[flow][deferred]") {
::mi::set_done(up); ::mi::set_done(up);
}); });
})); }));
}
// make sure that the completion signal arrives
std::this_thread::sleep_for(100ms);
THEN( THEN(
"the starting, up.done and out.done signals are each recorded once") { "the starting, up.done and out.done signals are each recorded once") {
...@@ -295,6 +300,7 @@ SCENARIO("flow single cancellation new thread", "[flow][deferred]") { ...@@ -295,6 +300,7 @@ SCENARIO("flow single cancellation new thread", "[flow][deferred]") {
} }
WHEN("submit is applied and cancels the producer late") { WHEN("submit is applied and cancels the producer late") {
{
f | f |
op::blocking_submit( op::blocking_submit(
mi::on_value([&](int) { signals += 100; }), mi::on_value([&](int) { signals += 100; }),
...@@ -309,6 +315,7 @@ SCENARIO("flow single cancellation new thread", "[flow][deferred]") { ...@@ -309,6 +315,7 @@ SCENARIO("flow single cancellation new thread", "[flow][deferred]") {
::mi::set_done(up); ::mi::set_done(up);
}); });
})); }));
}
std::this_thread::sleep_for(100ms); std::this_thread::sleep_for(100ms);
...@@ -328,6 +335,7 @@ SCENARIO("flow single cancellation new thread", "[flow][deferred]") { ...@@ -328,6 +335,7 @@ SCENARIO("flow single cancellation new thread", "[flow][deferred]") {
signals = 0; signals = 0;
// set completion time to be in 100ms // set completion time to be in 100ms
at = nt.now() + 100ms; at = nt.now() + 100ms;
{
f | f |
op::blocking_submit( op::blocking_submit(
mi::on_value([&](int) { signals += 100; }), mi::on_value([&](int) { signals += 100; }),
...@@ -340,6 +348,7 @@ SCENARIO("flow single cancellation new thread", "[flow][deferred]") { ...@@ -340,6 +348,7 @@ SCENARIO("flow single cancellation new thread", "[flow][deferred]") {
::mi::set_done(up); ::mi::set_done(up);
}); });
})); }));
}
// make sure any cancellation signal has completed // make sure any cancellation signal has completed
std::this_thread::sleep_for(10ms); std::this_thread::sleep_for(10ms);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment