/*
This file is a part of libcds - Concurrent Data Structures library
- (C) Copyright Maxim Khizhinsky (libcds.dev@gmail.com) 2006-2016
+ (C) Copyright Maxim Khizhinsky (libcds.dev@gmail.com) 2006-2017
Source code repo: http://github.com/khizmax/libcds/
Download: http://sourceforge.net/projects/libcds/files/
-
+
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
#include <cds/container/moir_queue.h>
#include <cds/container/rwqueue.h>
#include <cds/container/optimistic_queue.h>
-#include <cds/container/tsigas_cycle_queue.h>
#include <cds/container/vyukov_mpmc_cycle_queue.h>
#include <cds/container/basket_queue.h>
#include <cds/container/fcqueue.h>
#include "std_queue.h"
#include "lock/win32_lock.h"
-#include "framework/michael_alloc.h"
#include <boost/container/deque.hpp>
typedef cds::container::MoirQueue<cds::gc::HP, Value > MoirQueue_HP;
typedef cds::container::MoirQueue<cds::gc::DHP, Value > MoirQueue_DHP;
- struct traits_MSQueue_michaelAlloc : public cds::container::msqueue::traits
- {
- typedef memory::MichaelAllocator<int> allocator;
- };
- typedef cds::container::MSQueue<cds::gc::HP, Value, traits_MSQueue_michaelAlloc > MSQueue_HP_michaelAlloc;
- typedef cds::container::MSQueue<cds::gc::DHP, Value, traits_MSQueue_michaelAlloc > MSQueue_DHP_michaelAlloc;
- typedef cds::container::MoirQueue<cds::gc::HP, Value, traits_MSQueue_michaelAlloc > MoirQueue_HP_michaelAlloc;
- typedef cds::container::MoirQueue<cds::gc::DHP, Value, traits_MSQueue_michaelAlloc > MoirQueue_DHP_michaelAlloc;
-
struct traits_MSQueue_seqcst : public
cds::container::msqueue::make_traits <
cds::opt::memory_model < cds::opt::v::sequential_consistent >
typedef cds::container::OptimisticQueue< cds::gc::HP, Value > OptimisticQueue_HP;
typedef cds::container::OptimisticQueue< cds::gc::DHP, Value > OptimisticQueue_DHP;
- struct traits_OptimisticQueue_michaelAlloc : public cds::container::optimistic_queue::traits
- {
- typedef memory::MichaelAllocator<int> allocator;
- };
- typedef cds::container::OptimisticQueue< cds::gc::HP, Value, traits_OptimisticQueue_michaelAlloc > OptimisticQueue_HP_michaelAlloc;
- typedef cds::container::OptimisticQueue< cds::gc::DHP, Value, traits_OptimisticQueue_michaelAlloc > OptimisticQueue_DHP_michaelAlloc;
-
struct traits_OptimisticQueue_seqcst : public cds::container::optimistic_queue::traits
{
typedef cds::opt::v::sequential_consistent memory_model;
typedef cds::container::OptimisticQueue< cds::gc::DHP, Value, traits_OptimisticQueue_stat > OptimisticQueue_DHP_stat;
- // TsigasCycleQueue
-
- class TsigasCycleQueue_dyn
- : public cds::container::TsigasCycleQueue< Value,
- typename cds::container::tsigas_queue::make_traits<
- cds::opt::buffer< cds::opt::v::initialized_dynamic_buffer< int > >
- >::type
- >
- {
- typedef cds::container::TsigasCycleQueue< Value,
- typename cds::container::tsigas_queue::make_traits<
- cds::opt::buffer< cds::opt::v::initialized_dynamic_buffer< int > >
- >::type
- > base_class;
- public:
- TsigasCycleQueue_dyn()
- : base_class( 1024 * 64 )
- {}
-
- TsigasCycleQueue_dyn( size_t nCapacity )
- : base_class( nCapacity )
- {}
-
- cds::opt::none statistics() const
- {
- return cds::opt::none();
- }
- };
-
- class TsigasCycleQueue_dyn_michaelAlloc
- : public cds::container::TsigasCycleQueue< Value,
- typename cds::container::tsigas_queue::make_traits<
- cds::opt::buffer< cds::opt::v::initialized_dynamic_buffer< int > >
- ,cds::opt::allocator< memory::MichaelAllocator<int> >
- >::type
- >
- {
- typedef cds::container::TsigasCycleQueue< Value,
- typename cds::container::tsigas_queue::make_traits<
- cds::opt::buffer< cds::opt::v::initialized_dynamic_buffer< int > >
- , cds::opt::allocator< memory::MichaelAllocator<int> >
- >::type
- > base_class;
- public:
- TsigasCycleQueue_dyn_michaelAlloc()
- : base_class( 1024 * 64 )
- {}
-
- TsigasCycleQueue_dyn_michaelAlloc( size_t nCapacity )
- : base_class( nCapacity )
- {}
-
- cds::opt::none statistics() const
- {
- return cds::opt::none();
- }
- };
-
- class TsigasCycleQueue_dyn_ic
- : public cds::container::TsigasCycleQueue< Value,
- typename cds::container::tsigas_queue::make_traits<
- cds::opt::buffer< cds::opt::v::initialized_dynamic_buffer< int > >
- ,cds::opt::item_counter< cds::atomicity::item_counter >
- >::type
- >
- {
- typedef cds::container::TsigasCycleQueue< Value,
- typename cds::container::tsigas_queue::make_traits<
- cds::opt::buffer< cds::opt::v::initialized_dynamic_buffer< int > >
- ,cds::opt::item_counter< cds::atomicity::item_counter >
- >::type
- > base_class;
- public:
- TsigasCycleQueue_dyn_ic()
- : base_class( 1024 * 64 )
- {}
- TsigasCycleQueue_dyn_ic( size_t nCapacity )
- : base_class( nCapacity )
- {}
-
- cds::opt::none statistics() const
- {
- return cds::opt::none();
- }
- };
-
// VyukovMPMCCycleQueue
struct traits_VyukovMPMCCycleQueue_dyn : public cds::container::vyukov_queue::traits
{
}
};
- struct traits_VyukovMPMCCycleQueue_dyn_michaelAlloc : public cds::container::vyukov_queue::traits
- {
- typedef cds::opt::v::uninitialized_dynamic_buffer< int, memory::MichaelAllocator<int> > buffer;
- };
- class VyukovMPMCCycleQueue_dyn_michaelAlloc
- : public cds::container::VyukovMPMCCycleQueue< Value, traits_VyukovMPMCCycleQueue_dyn_michaelAlloc >
- {
- typedef cds::container::VyukovMPMCCycleQueue< Value, traits_VyukovMPMCCycleQueue_dyn_michaelAlloc > base_class;
- public:
- VyukovMPMCCycleQueue_dyn_michaelAlloc()
- : base_class( 1024 * 64 )
- {}
- VyukovMPMCCycleQueue_dyn_michaelAlloc( size_t nCapacity )
- : base_class( nCapacity )
- {}
-
- cds::opt::none statistics() const
- {
- return cds::opt::none();
- }
- };
-
struct traits_VyukovMPMCCycleQueue_dyn_ic : public traits_VyukovMPMCCycleQueue_dyn
{
typedef cds::atomicity::item_counter item_counter;
typedef cds::container::BasketQueue< cds::gc::HP , Value > BasketQueue_HP;
typedef cds::container::BasketQueue< cds::gc::DHP, Value > BasketQueue_DHP;
- struct traits_BasketQueue_michaelAlloc : public cds::container::basket_queue::traits
- {
- typedef memory::MichaelAllocator<int> allocator;
- };
- typedef cds::container::BasketQueue< cds::gc::HP, Value, traits_BasketQueue_michaelAlloc > BasketQueue_HP_michaelAlloc;
- typedef cds::container::BasketQueue< cds::gc::DHP, Value, traits_BasketQueue_michaelAlloc > BasketQueue_DHP_michaelAlloc;
-
struct traits_BasketQueue_seqcst : public cds::container::basket_queue::traits
{
typedef cds::opt::v::sequential_consistent mamory_model;
#define CDSSTRESS_MSQueue( test_fixture ) \
CDSSTRESS_Queue_F( test_fixture, MSQueue_HP, 0 ) \
- CDSSTRESS_Queue_F( test_fixture, MSQueue_HP_michaelAlloc, 0 ) \
CDSSTRESS_Queue_F( test_fixture, MSQueue_HP_seqcst, 2 ) \
CDSSTRESS_Queue_F( test_fixture, MSQueue_HP_ic, 1 ) \
CDSSTRESS_Queue_F( test_fixture, MSQueue_HP_stat, 0 ) \
CDSSTRESS_Queue_F( test_fixture, MSQueue_DHP, 0 ) \
- CDSSTRESS_Queue_F( test_fixture, MSQueue_DHP_michaelAlloc, 0 ) \
CDSSTRESS_Queue_F( test_fixture, MSQueue_DHP_seqcst, 2 ) \
CDSSTRESS_Queue_F( test_fixture, MSQueue_DHP_ic, 1 ) \
CDSSTRESS_Queue_F( test_fixture, MSQueue_DHP_stat, 0 )
#define CDSSTRESS_MoirQueue( test_fixture ) \
CDSSTRESS_Queue_F( test_fixture, MoirQueue_HP, 0 ) \
- CDSSTRESS_Queue_F( test_fixture, MoirQueue_HP_michaelAlloc, 0 ) \
CDSSTRESS_Queue_F( test_fixture, MoirQueue_HP_seqcst, 2 ) \
CDSSTRESS_Queue_F( test_fixture, MoirQueue_HP_ic, 1 ) \
CDSSTRESS_Queue_F( test_fixture, MoirQueue_HP_stat, 0 ) \
CDSSTRESS_Queue_F( test_fixture, MoirQueue_DHP, 0 ) \
- CDSSTRESS_Queue_F( test_fixture, MoirQueue_DHP_michaelAlloc,0 ) \
CDSSTRESS_Queue_F( test_fixture, MoirQueue_DHP_seqcst, 2 ) \
CDSSTRESS_Queue_F( test_fixture, MoirQueue_DHP_ic, 1 ) \
CDSSTRESS_Queue_F( test_fixture, MoirQueue_DHP_stat, 0 )
#define CDSSTRESS_OptimsticQueue( test_fixture ) \
CDSSTRESS_Queue_F( test_fixture, OptimisticQueue_HP, 0 ) \
- CDSSTRESS_Queue_F( test_fixture, OptimisticQueue_HP_michaelAlloc, 0 ) \
CDSSTRESS_Queue_F( test_fixture, OptimisticQueue_HP_seqcst, 2 ) \
CDSSTRESS_Queue_F( test_fixture, OptimisticQueue_HP_ic, 1 ) \
CDSSTRESS_Queue_F( test_fixture, OptimisticQueue_HP_stat, 0 ) \
CDSSTRESS_Queue_F( test_fixture, OptimisticQueue_DHP, 0 ) \
- CDSSTRESS_Queue_F( test_fixture, OptimisticQueue_DHP_michaelAlloc, 0 ) \
CDSSTRESS_Queue_F( test_fixture, OptimisticQueue_DHP_seqcst, 2 ) \
CDSSTRESS_Queue_F( test_fixture, OptimisticQueue_DHP_ic, 1 ) \
CDSSTRESS_Queue_F( test_fixture, OptimisticQueue_DHP_stat, 0 )
#define CDSSTRESS_BasketQueue( test_fixture ) \
CDSSTRESS_Queue_F( test_fixture, BasketQueue_HP, 0 ) \
- CDSSTRESS_Queue_F( test_fixture, BasketQueue_HP_michaelAlloc, 0 ) \
CDSSTRESS_Queue_F( test_fixture, BasketQueue_HP_seqcst, 2 ) \
CDSSTRESS_Queue_F( test_fixture, BasketQueue_HP_ic, 1 ) \
CDSSTRESS_Queue_F( test_fixture, BasketQueue_HP_stat, 0 ) \
CDSSTRESS_Queue_F( test_fixture, BasketQueue_DHP, 0 ) \
- CDSSTRESS_Queue_F( test_fixture, BasketQueue_DHP_michaelAlloc, 0 ) \
CDSSTRESS_Queue_F( test_fixture, BasketQueue_DHP_seqcst, 2 ) \
CDSSTRESS_Queue_F( test_fixture, BasketQueue_DHP_ic, 1 ) \
CDSSTRESS_Queue_F( test_fixture, BasketQueue_DHP_stat, 0 )
CDSSTRESS_Queue_F( test_fixture, SegmentedQueue_DHP_mutex_stat, 0 )
-#define CDSSTRESS_TsigasQueue( test_fixture ) \
- CDSSTRESS_Queue_F( test_fixture, TsigasCycleQueue_dyn, 0 ) \
- CDSSTRESS_Queue_F( test_fixture, TsigasCycleQueue_dyn_michaelAlloc, 0 ) \
- CDSSTRESS_Queue_F( test_fixture, TsigasCycleQueue_dyn_ic, 1 )
-
#define CDSSTRESS_VyukovQueue( test_fixture ) \
CDSSTRESS_Queue_F( test_fixture, VyukovMPMCCycleQueue_dyn, 0 ) \
- CDSSTRESS_Queue_F( test_fixture, VyukovMPMCCycleQueue_dyn_michaelAlloc, 0 ) \
CDSSTRESS_Queue_F( test_fixture, VyukovMPMCCycleQueue_dyn_ic, 1 )
#define CDSSTRESS_StdQueue( test_fixture ) \