mirror of
https://github.com/boostorg/interprocess.git
synced 2026-01-19 04:12:13 +00:00
Remove config_begin/config_end include pairs in tests to better emulate what warnings users will see.
This commit is contained in:
@@ -8,7 +8,6 @@
|
||||
//
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include <boost/interprocess/detail/config_begin.hpp>
|
||||
#include <boost/interprocess/offset_ptr.hpp>
|
||||
#include <boost/interprocess/detail/type_traits.hpp>
|
||||
#include <boost/intrusive/pointer_traits.hpp>
|
||||
@@ -291,62 +290,3 @@ int main()
|
||||
test_pointer_plus_bits();
|
||||
return ::boost::report_errors();
|
||||
}
|
||||
|
||||
#include <boost/interprocess/detail/config_end.hpp>
|
||||
|
||||
/*
|
||||
//Offset ptr benchmark
|
||||
#include <vector>
|
||||
#include <iostream>
|
||||
#include <boost/interprocess/managed_shared_memory.hpp>
|
||||
#include <boost/interprocess/containers/vector.hpp>
|
||||
#include <boost/interprocess/allocators/allocator.hpp>
|
||||
#include <boost/timer.hpp>
|
||||
#include <cstddef>
|
||||
|
||||
template<class InIt,
|
||||
class Ty> inline
|
||||
Ty accumulate2(InIt First, InIt Last, Ty Val)
|
||||
{ // return sum of Val and all in [First, Last)
|
||||
for (; First != Last; ++First) //First = First + 1)
|
||||
Val = Val + *First;
|
||||
return (Val);
|
||||
}
|
||||
|
||||
template <typename Vector>
|
||||
void time_test(const Vector& vec, std::size_t iterations, const char* label) {
|
||||
// assert(!vec.empty())
|
||||
boost::timer t;
|
||||
typename Vector::const_iterator first = vec.begin();
|
||||
typename Vector::value_type result(0);
|
||||
while (iterations != 0) {
|
||||
result = accumulate2(first, first + vec.size(), result);
|
||||
--iterations;
|
||||
}
|
||||
std::cout << label << t.elapsed() << " " << result << std::endl;
|
||||
}
|
||||
|
||||
int main()
|
||||
{
|
||||
using namespace boost::interprocess;
|
||||
typedef allocator<double, managed_shared_memory::segment_manager> alloc_t;
|
||||
|
||||
std::size_t n = 0x1 << 26;
|
||||
std::size_t file_size = n * sizeof(double) + 1000000;
|
||||
|
||||
{
|
||||
shared_memory_object::remove("MyMappedFile");
|
||||
managed_shared_memory segment(open_or_create, "MyMappedFile", file_size);
|
||||
shared_memory_object::remove("MyMappedFile");
|
||||
alloc_t alloc_inst(segment.get_segment_manager());
|
||||
vector<double, alloc_t> v0(n, double(42.42), alloc_inst);
|
||||
time_test(v0, 10, "iterator shared: ");
|
||||
}
|
||||
{
|
||||
std::vector<double> v1(n, double(42.42));
|
||||
time_test(v1, 10, "iterator non-shared: ");
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user