openbox lab initialized
This commit is contained in:
272
openflow/usr/include/c++/5/profile/array
Normal file
272
openflow/usr/include/c++/5/profile/array
Normal file
@@ -0,0 +1,272 @@
|
||||
// Profile array implementation -*- C++ -*-
|
||||
|
||||
// Copyright (C) 2012-2015 Free Software Foundation, Inc.
|
||||
//
|
||||
// This file is part of the GNU ISO C++ Library. This library is free
|
||||
// software; you can redistribute it and/or modify it under the
|
||||
// terms of the GNU General Public License as published by the
|
||||
// Free Software Foundation; either version 3, or (at your option)
|
||||
// any later version.
|
||||
|
||||
// This library is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
|
||||
// Under Section 7 of GPL version 3, you are granted additional
|
||||
// permissions described in the GCC Runtime Library Exception, version
|
||||
// 3.1, as published by the Free Software Foundation.
|
||||
|
||||
// You should have received a copy of the GNU General Public License and
|
||||
// a copy of the GCC Runtime Library Exception along with this program;
|
||||
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
|
||||
// <http://www.gnu.org/licenses/>.
|
||||
|
||||
/** @file profile/array
|
||||
* This is a Standard C++ Library header.
|
||||
*/
|
||||
|
||||
#ifndef _GLIBCXX_PROFILE_ARRAY
|
||||
#define _GLIBCXX_PROFILE_ARRAY 1
|
||||
|
||||
#pragma GCC system_header
|
||||
|
||||
namespace std _GLIBCXX_VISIBILITY(default)
|
||||
{
|
||||
namespace __profile
|
||||
{
|
||||
template<typename _Tp, std::size_t _Nm>
|
||||
struct array
|
||||
{
|
||||
typedef _Tp value_type;
|
||||
typedef value_type* pointer;
|
||||
typedef const value_type* const_pointer;
|
||||
typedef value_type& reference;
|
||||
typedef const value_type& const_reference;
|
||||
typedef value_type* iterator;
|
||||
typedef const value_type* const_iterator;
|
||||
typedef std::size_t size_type;
|
||||
typedef std::ptrdiff_t difference_type;
|
||||
typedef std::reverse_iterator<iterator> reverse_iterator;
|
||||
typedef std::reverse_iterator<const_iterator> const_reverse_iterator;
|
||||
|
||||
// Support for zero-sized arrays mandatory.
|
||||
typedef _GLIBCXX_STD_C::__array_traits<_Tp, _Nm> _AT_Type;
|
||||
typename _AT_Type::_Type _M_elems;
|
||||
|
||||
// No explicit construct/copy/destroy for aggregate type.
|
||||
|
||||
// DR 776.
|
||||
void
|
||||
fill(const value_type& __u)
|
||||
{ std::fill_n(begin(), size(), __u); }
|
||||
|
||||
void
|
||||
swap(array& __other)
|
||||
noexcept(noexcept(swap(std::declval<_Tp&>(), std::declval<_Tp&>())))
|
||||
{ std::swap_ranges(begin(), end(), __other.begin()); }
|
||||
|
||||
// Iterators.
|
||||
iterator
|
||||
begin() noexcept
|
||||
{ return iterator(data()); }
|
||||
|
||||
const_iterator
|
||||
begin() const noexcept
|
||||
{ return const_iterator(data()); }
|
||||
|
||||
iterator
|
||||
end() noexcept
|
||||
{ return iterator(data() + _Nm); }
|
||||
|
||||
const_iterator
|
||||
end() const noexcept
|
||||
{ return const_iterator(data() + _Nm); }
|
||||
|
||||
reverse_iterator
|
||||
rbegin() noexcept
|
||||
{ return reverse_iterator(end()); }
|
||||
|
||||
const_reverse_iterator
|
||||
rbegin() const noexcept
|
||||
{ return const_reverse_iterator(end()); }
|
||||
|
||||
reverse_iterator
|
||||
rend() noexcept
|
||||
{ return reverse_iterator(begin()); }
|
||||
|
||||
const_reverse_iterator
|
||||
rend() const noexcept
|
||||
{ return const_reverse_iterator(begin()); }
|
||||
|
||||
const_iterator
|
||||
cbegin() const noexcept
|
||||
{ return const_iterator(data()); }
|
||||
|
||||
const_iterator
|
||||
cend() const noexcept
|
||||
{ return const_iterator(data() + _Nm); }
|
||||
|
||||
const_reverse_iterator
|
||||
crbegin() const noexcept
|
||||
{ return const_reverse_iterator(end()); }
|
||||
|
||||
const_reverse_iterator
|
||||
crend() const noexcept
|
||||
{ return const_reverse_iterator(begin()); }
|
||||
|
||||
// Capacity.
|
||||
constexpr size_type
|
||||
size() const noexcept { return _Nm; }
|
||||
|
||||
constexpr size_type
|
||||
max_size() const noexcept { return _Nm; }
|
||||
|
||||
constexpr bool
|
||||
empty() const noexcept { return size() == 0; }
|
||||
|
||||
// Element access.
|
||||
reference
|
||||
operator[](size_type __n) noexcept
|
||||
{ return _AT_Type::_S_ref(_M_elems, __n); }
|
||||
|
||||
constexpr const_reference
|
||||
operator[](size_type __n) const noexcept
|
||||
{ return _AT_Type::_S_ref(_M_elems, __n); }
|
||||
|
||||
reference
|
||||
at(size_type __n)
|
||||
{
|
||||
if (__n >= _Nm)
|
||||
std::__throw_out_of_range_fmt(__N("array::at: __n "
|
||||
"(which is %zu) >= _Nm "
|
||||
"(which is %zu)"),
|
||||
__n, _Nm);
|
||||
return _AT_Type::_S_ref(_M_elems, __n);
|
||||
}
|
||||
|
||||
constexpr const_reference
|
||||
at(size_type __n) const
|
||||
{
|
||||
// Result of conditional expression must be an lvalue so use
|
||||
// boolean ? lvalue : (throw-expr, lvalue)
|
||||
return __n < _Nm ? _AT_Type::_S_ref(_M_elems, __n)
|
||||
: (std::__throw_out_of_range_fmt(__N("array::at: __n (which is %zu) "
|
||||
">= _Nm (which is %zu)"),
|
||||
__n, _Nm),
|
||||
_AT_Type::_S_ref(_M_elems, 0));
|
||||
}
|
||||
|
||||
reference
|
||||
front() noexcept
|
||||
{ return *begin(); }
|
||||
|
||||
constexpr const_reference
|
||||
front() const noexcept
|
||||
{ return _AT_Type::_S_ref(_M_elems, 0); }
|
||||
|
||||
reference
|
||||
back() noexcept
|
||||
{ return _Nm ? *(end() - 1) : *end(); }
|
||||
|
||||
constexpr const_reference
|
||||
back() const noexcept
|
||||
{
|
||||
return _Nm ? _AT_Type::_S_ref(_M_elems, _Nm - 1)
|
||||
: _AT_Type::_S_ref(_M_elems, 0);
|
||||
}
|
||||
|
||||
pointer
|
||||
data() noexcept
|
||||
{ return _AT_Type::_S_ptr(_M_elems); }
|
||||
|
||||
const_pointer
|
||||
data() const noexcept
|
||||
{ return _AT_Type::_S_ptr(_M_elems); }
|
||||
};
|
||||
|
||||
// Array comparisons.
|
||||
template<typename _Tp, std::size_t _Nm>
|
||||
inline bool
|
||||
operator==(const array<_Tp, _Nm>& __one, const array<_Tp, _Nm>& __two)
|
||||
{ return std::equal(__one.begin(), __one.end(), __two.begin()); }
|
||||
|
||||
template<typename _Tp, std::size_t _Nm>
|
||||
inline bool
|
||||
operator!=(const array<_Tp, _Nm>& __one, const array<_Tp, _Nm>& __two)
|
||||
{ return !(__one == __two); }
|
||||
|
||||
template<typename _Tp, std::size_t _Nm>
|
||||
inline bool
|
||||
operator<(const array<_Tp, _Nm>& __a, const array<_Tp, _Nm>& __b)
|
||||
{
|
||||
return std::lexicographical_compare(__a.begin(), __a.end(),
|
||||
__b.begin(), __b.end());
|
||||
}
|
||||
|
||||
template<typename _Tp, std::size_t _Nm>
|
||||
inline bool
|
||||
operator>(const array<_Tp, _Nm>& __one, const array<_Tp, _Nm>& __two)
|
||||
{ return __two < __one; }
|
||||
|
||||
template<typename _Tp, std::size_t _Nm>
|
||||
inline bool
|
||||
operator<=(const array<_Tp, _Nm>& __one, const array<_Tp, _Nm>& __two)
|
||||
{ return !(__one > __two); }
|
||||
|
||||
template<typename _Tp, std::size_t _Nm>
|
||||
inline bool
|
||||
operator>=(const array<_Tp, _Nm>& __one, const array<_Tp, _Nm>& __two)
|
||||
{ return !(__one < __two); }
|
||||
|
||||
// Specialized algorithms.
|
||||
template<typename _Tp, std::size_t _Nm>
|
||||
inline void
|
||||
swap(array<_Tp, _Nm>& __one, array<_Tp, _Nm>& __two)
|
||||
noexcept(noexcept(__one.swap(__two)))
|
||||
{ __one.swap(__two); }
|
||||
|
||||
template<std::size_t _Int, typename _Tp, std::size_t _Nm>
|
||||
constexpr _Tp&
|
||||
get(array<_Tp, _Nm>& __arr) noexcept
|
||||
{
|
||||
static_assert(_Int < _Nm, "index is out of bounds");
|
||||
return _GLIBCXX_STD_C::__array_traits<_Tp, _Nm>::
|
||||
_S_ref(__arr._M_elems, _Int);
|
||||
}
|
||||
|
||||
template<std::size_t _Int, typename _Tp, std::size_t _Nm>
|
||||
constexpr _Tp&&
|
||||
get(array<_Tp, _Nm>&& __arr) noexcept
|
||||
{
|
||||
static_assert(_Int < _Nm, "index is out of bounds");
|
||||
return std::move(__profile::get<_Int>(__arr));
|
||||
}
|
||||
|
||||
template<std::size_t _Int, typename _Tp, std::size_t _Nm>
|
||||
constexpr const _Tp&
|
||||
get(const array<_Tp, _Nm>& __arr) noexcept
|
||||
{
|
||||
static_assert(_Int < _Nm, "index is out of bounds");
|
||||
return _GLIBCXX_STD_C::__array_traits<_Tp, _Nm>::
|
||||
_S_ref(__arr._M_elems, _Int);
|
||||
}
|
||||
} // namespace __profile
|
||||
|
||||
// Tuple interface to class template array.
|
||||
|
||||
/// tuple_size
|
||||
template<typename _Tp, std::size_t _Nm>
|
||||
struct tuple_size<__profile::array<_Tp, _Nm>>
|
||||
: public integral_constant<std::size_t, _Nm> { };
|
||||
|
||||
/// tuple_element
|
||||
template<std::size_t _Int, typename _Tp, std::size_t _Nm>
|
||||
struct tuple_element<_Int, __profile::array<_Tp, _Nm>>
|
||||
{
|
||||
static_assert(_Int < _Nm, "index is out of bounds");
|
||||
typedef _Tp type;
|
||||
};
|
||||
} // namespace std
|
||||
|
||||
#endif // _GLIBCXX_PROFILE_ARRAY
|
||||
59
openflow/usr/include/c++/5/profile/base.h
Normal file
59
openflow/usr/include/c++/5/profile/base.h
Normal file
@@ -0,0 +1,59 @@
|
||||
// -*- C++ -*-
|
||||
|
||||
// Copyright (C) 2009-2015 Free Software Foundation, Inc.
|
||||
//
|
||||
// This file is part of the GNU ISO C++ Library. This library is free
|
||||
// software; you can redistribute it and/or modify it under the
|
||||
// terms of the GNU General Public License as published by the
|
||||
// Free Software Foundation; either version 3, or (at your option)
|
||||
// any later version.
|
||||
//
|
||||
// This library is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
|
||||
// Under Section 7 of GPL version 3, you are granted additional
|
||||
// permissions described in the GCC Runtime Library Exception, version
|
||||
// 3.1, as published by the Free Software Foundation.
|
||||
|
||||
// You should have received a copy of the GNU General Public License along
|
||||
// with this library; see the file COPYING3. If not see
|
||||
// <http://www.gnu.org/licenses/>.
|
||||
|
||||
/** @file profile/base.h
|
||||
* @brief Sequential helper functions.
|
||||
* This file is a GNU profile extension to the Standard C++ Library.
|
||||
*/
|
||||
|
||||
// Written by Lixia Liu
|
||||
|
||||
#ifndef _GLIBCXX_PROFILE_BASE_H
|
||||
#define _GLIBCXX_PROFILE_BASE_H 1
|
||||
|
||||
#include <functional>
|
||||
#include <profile/impl/profiler.h>
|
||||
|
||||
// Profiling mode namespaces.
|
||||
|
||||
/**
|
||||
* @namespace std::__profile
|
||||
* @brief GNU profile code, replaces standard behavior with profile behavior.
|
||||
*/
|
||||
namespace std _GLIBCXX_VISIBILITY(default)
|
||||
{
|
||||
namespace __profile { }
|
||||
}
|
||||
|
||||
/**
|
||||
* @namespace __gnu_profile
|
||||
* @brief GNU profile code for public use.
|
||||
*/
|
||||
namespace __gnu_profile
|
||||
{
|
||||
// Import all the profile versions of components in namespace std.
|
||||
using namespace std::__profile;
|
||||
}
|
||||
|
||||
|
||||
#endif /* _GLIBCXX_PROFILE_BASE_H */
|
||||
245
openflow/usr/include/c++/5/profile/bitset
Normal file
245
openflow/usr/include/c++/5/profile/bitset
Normal file
@@ -0,0 +1,245 @@
|
||||
// Profiling bitset implementation -*- C++ -*-
|
||||
|
||||
// Copyright (C) 2009-2015 Free Software Foundation, Inc.
|
||||
//
|
||||
// This file is part of the GNU ISO C++ Library. This library is free
|
||||
// software; you can redistribute it and/or modify it under the
|
||||
// terms of the GNU General Public License as published by the
|
||||
// Free Software Foundation; either version 3, or (at your option)
|
||||
// any later version.
|
||||
|
||||
// This library is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
|
||||
// Under Section 7 of GPL version 3, you are granted additional
|
||||
// permissions described in the GCC Runtime Library Exception, version
|
||||
// 3.1, as published by the Free Software Foundation.
|
||||
|
||||
// You should have received a copy of the GNU General Public License and
|
||||
// a copy of the GCC Runtime Library Exception along with this program;
|
||||
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
|
||||
// <http://www.gnu.org/licenses/>.
|
||||
|
||||
/** @file profile/bitset
|
||||
* This file is a GNU profile extension to the Standard C++ Library.
|
||||
*/
|
||||
|
||||
#ifndef _GLIBCXX_PROFILE_BITSET
|
||||
#define _GLIBCXX_PROFILE_BITSET
|
||||
|
||||
#include <bitset>
|
||||
|
||||
namespace std _GLIBCXX_VISIBILITY(default)
|
||||
{
|
||||
namespace __profile
|
||||
{
|
||||
/// Class std::bitset wrapper with performance instrumentation, none at the
|
||||
/// moment.
|
||||
template<size_t _Nb>
|
||||
class bitset
|
||||
: public _GLIBCXX_STD_C::bitset<_Nb>
|
||||
{
|
||||
typedef _GLIBCXX_STD_C::bitset<_Nb> _Base;
|
||||
|
||||
public:
|
||||
// 23.3.5.1 constructors:
|
||||
#if __cplusplus < 201103L
|
||||
bitset()
|
||||
: _Base() { }
|
||||
#else
|
||||
constexpr bitset() = default;
|
||||
#endif
|
||||
|
||||
#if __cplusplus >= 201103L
|
||||
constexpr bitset(unsigned long long __val) noexcept
|
||||
#else
|
||||
bitset(unsigned long __val)
|
||||
#endif
|
||||
: _Base(__val) { }
|
||||
|
||||
template<typename _CharT, typename _Traits, typename _Alloc>
|
||||
explicit
|
||||
bitset(const std::basic_string<_CharT, _Traits, _Alloc>& __str,
|
||||
typename std::basic_string<_CharT, _Traits, _Alloc>::size_type
|
||||
__pos = 0,
|
||||
typename std::basic_string<_CharT, _Traits, _Alloc>::size_type
|
||||
__n = (std::basic_string<_CharT, _Traits, _Alloc>::npos))
|
||||
: _Base(__str, __pos, __n) { }
|
||||
|
||||
// _GLIBCXX_RESOLVE_LIB_DEFECTS
|
||||
// 396. what are characters zero and one.
|
||||
template<class _CharT, class _Traits, class _Alloc>
|
||||
bitset(const std::basic_string<_CharT, _Traits, _Alloc>& __str,
|
||||
typename std::basic_string<_CharT, _Traits, _Alloc>::size_type
|
||||
__pos,
|
||||
typename std::basic_string<_CharT, _Traits, _Alloc>::size_type
|
||||
__n,
|
||||
_CharT __zero, _CharT __one = _CharT('1'))
|
||||
: _Base(__str, __pos, __n, __zero, __one) { }
|
||||
|
||||
bitset(const _Base& __x) : _Base(__x) { }
|
||||
|
||||
#if __cplusplus >= 201103L
|
||||
template<typename _CharT>
|
||||
explicit
|
||||
bitset(const _CharT* __str,
|
||||
typename std::basic_string<_CharT>::size_type __n
|
||||
= std::basic_string<_CharT>::npos,
|
||||
_CharT __zero = _CharT('0'), _CharT __one = _CharT('1'))
|
||||
: _Base(__str, __n, __zero, __one) { }
|
||||
#endif
|
||||
|
||||
// 23.3.5.2 bitset operations:
|
||||
bitset<_Nb>&
|
||||
operator&=(const bitset<_Nb>& __rhs) _GLIBCXX_NOEXCEPT
|
||||
{
|
||||
_M_base() &= __rhs;
|
||||
return *this;
|
||||
}
|
||||
|
||||
bitset<_Nb>&
|
||||
operator|=(const bitset<_Nb>& __rhs) _GLIBCXX_NOEXCEPT
|
||||
{
|
||||
_M_base() |= __rhs;
|
||||
return *this;
|
||||
}
|
||||
|
||||
bitset<_Nb>&
|
||||
operator^=(const bitset<_Nb>& __rhs) _GLIBCXX_NOEXCEPT
|
||||
{
|
||||
_M_base() ^= __rhs;
|
||||
return *this;
|
||||
}
|
||||
|
||||
bitset<_Nb>&
|
||||
operator<<=(size_t __pos) _GLIBCXX_NOEXCEPT
|
||||
{
|
||||
_M_base() <<= __pos;
|
||||
return *this;
|
||||
}
|
||||
|
||||
bitset<_Nb>&
|
||||
operator>>=(size_t __pos) _GLIBCXX_NOEXCEPT
|
||||
{
|
||||
_M_base() >>= __pos;
|
||||
return *this;
|
||||
}
|
||||
|
||||
bitset<_Nb>&
|
||||
set() _GLIBCXX_NOEXCEPT
|
||||
{
|
||||
_Base::set();
|
||||
return *this;
|
||||
}
|
||||
|
||||
// _GLIBCXX_RESOLVE_LIB_DEFECTS
|
||||
// 186. bitset::set() second parameter should be bool
|
||||
bitset<_Nb>&
|
||||
set(size_t __pos, bool __val = true)
|
||||
{
|
||||
_Base::set(__pos, __val);
|
||||
return *this;
|
||||
}
|
||||
|
||||
bitset<_Nb>&
|
||||
reset() _GLIBCXX_NOEXCEPT
|
||||
{
|
||||
_Base::reset();
|
||||
return *this;
|
||||
}
|
||||
|
||||
bitset<_Nb>&
|
||||
reset(size_t __pos)
|
||||
{
|
||||
_Base::reset(__pos);
|
||||
return *this;
|
||||
}
|
||||
|
||||
bitset<_Nb>
|
||||
operator~() const _GLIBCXX_NOEXCEPT
|
||||
{ return bitset(~_M_base()); }
|
||||
|
||||
bitset<_Nb>&
|
||||
flip() _GLIBCXX_NOEXCEPT
|
||||
{
|
||||
_Base::flip();
|
||||
return *this;
|
||||
}
|
||||
|
||||
bitset<_Nb>&
|
||||
flip(size_t __pos)
|
||||
{
|
||||
_Base::flip(__pos);
|
||||
return *this;
|
||||
}
|
||||
|
||||
bool
|
||||
operator==(const bitset<_Nb>& __rhs) const _GLIBCXX_NOEXCEPT
|
||||
{ return _M_base() == __rhs; }
|
||||
|
||||
bool
|
||||
operator!=(const bitset<_Nb>& __rhs) const _GLIBCXX_NOEXCEPT
|
||||
{ return _M_base() != __rhs; }
|
||||
|
||||
bitset<_Nb>
|
||||
operator<<(size_t __pos) const _GLIBCXX_NOEXCEPT
|
||||
{ return bitset<_Nb>(_M_base() << __pos); }
|
||||
|
||||
bitset<_Nb>
|
||||
operator>>(size_t __pos) const _GLIBCXX_NOEXCEPT
|
||||
{ return bitset<_Nb>(_M_base() >> __pos); }
|
||||
|
||||
_Base&
|
||||
_M_base() _GLIBCXX_NOEXCEPT
|
||||
{ return *this; }
|
||||
|
||||
const _Base&
|
||||
_M_base() const _GLIBCXX_NOEXCEPT
|
||||
{ return *this; }
|
||||
};
|
||||
|
||||
template<size_t _Nb>
|
||||
bitset<_Nb>
|
||||
operator&(const bitset<_Nb>& __x, const bitset<_Nb>& __y) _GLIBCXX_NOEXCEPT
|
||||
{ return bitset<_Nb>(__x) &= __y; }
|
||||
|
||||
template<size_t _Nb>
|
||||
bitset<_Nb>
|
||||
operator|(const bitset<_Nb>& __x, const bitset<_Nb>& __y) _GLIBCXX_NOEXCEPT
|
||||
{ return bitset<_Nb>(__x) |= __y; }
|
||||
|
||||
template<size_t _Nb>
|
||||
bitset<_Nb>
|
||||
operator^(const bitset<_Nb>& __x, const bitset<_Nb>& __y) _GLIBCXX_NOEXCEPT
|
||||
{ return bitset<_Nb>(__x) ^= __y; }
|
||||
|
||||
template<typename _CharT, typename _Traits, size_t _Nb>
|
||||
std::basic_istream<_CharT, _Traits>&
|
||||
operator>>(std::basic_istream<_CharT, _Traits>& __is, bitset<_Nb>& __x)
|
||||
{ return __is >> __x._M_base(); }
|
||||
|
||||
template<typename _CharT, typename _Traits, size_t _Nb>
|
||||
std::basic_ostream<_CharT, _Traits>&
|
||||
operator<<(std::basic_ostream<_CharT, _Traits>& __os,
|
||||
const bitset<_Nb>& __x)
|
||||
{ return __os << __x._M_base(); }
|
||||
} // namespace __profile
|
||||
|
||||
#if __cplusplus >= 201103L
|
||||
// DR 1182.
|
||||
/// std::hash specialization for bitset.
|
||||
template<size_t _Nb>
|
||||
struct hash<__profile::bitset<_Nb>>
|
||||
: public __hash_base<size_t, __profile::bitset<_Nb>>
|
||||
{
|
||||
size_t
|
||||
operator()(const __profile::bitset<_Nb>& __b) const noexcept
|
||||
{ return std::hash<_GLIBCXX_STD_C::bitset<_Nb>>()(__b._M_base()); }
|
||||
};
|
||||
#endif
|
||||
|
||||
} // namespace std
|
||||
|
||||
#endif
|
||||
189
openflow/usr/include/c++/5/profile/deque
Normal file
189
openflow/usr/include/c++/5/profile/deque
Normal file
@@ -0,0 +1,189 @@
|
||||
// Profiling deque implementation -*- C++ -*-
|
||||
|
||||
// Copyright (C) 2009-2015 Free Software Foundation, Inc.
|
||||
//
|
||||
// This file is part of the GNU ISO C++ Library. This library is free
|
||||
// software; you can redistribute it and/or modify it under the
|
||||
// terms of the GNU General Public License as published by the
|
||||
// Free Software Foundation; either version 3, or (at your option)
|
||||
// any later version.
|
||||
|
||||
// This library is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
|
||||
// Under Section 7 of GPL version 3, you are granted additional
|
||||
// permissions described in the GCC Runtime Library Exception, version
|
||||
// 3.1, as published by the Free Software Foundation.
|
||||
|
||||
// You should have received a copy of the GNU General Public License and
|
||||
// a copy of the GCC Runtime Library Exception along with this program;
|
||||
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
|
||||
// <http://www.gnu.org/licenses/>.
|
||||
|
||||
/** @file profile/deque
|
||||
* This file is a GNU profile extension to the Standard C++ Library.
|
||||
*/
|
||||
|
||||
#ifndef _GLIBCXX_PROFILE_DEQUE
|
||||
#define _GLIBCXX_PROFILE_DEQUE 1
|
||||
|
||||
#include <deque>
|
||||
|
||||
namespace std _GLIBCXX_VISIBILITY(default)
|
||||
{
|
||||
namespace __profile
|
||||
{
|
||||
/// Class std::deque wrapper with performance instrumentation.
|
||||
template<typename _Tp, typename _Allocator = std::allocator<_Tp> >
|
||||
class deque
|
||||
: public _GLIBCXX_STD_C::deque<_Tp, _Allocator>
|
||||
{
|
||||
typedef _GLIBCXX_STD_C::deque<_Tp, _Allocator> _Base;
|
||||
|
||||
public:
|
||||
typedef typename _Base::size_type size_type;
|
||||
typedef typename _Base::value_type value_type;
|
||||
|
||||
// 23.2.1.1 construct/copy/destroy:
|
||||
|
||||
#if __cplusplus < 201103L
|
||||
deque()
|
||||
: _Base() { }
|
||||
deque(const deque& __x)
|
||||
: _Base(__x) { }
|
||||
|
||||
~deque() { }
|
||||
#else
|
||||
deque() = default;
|
||||
deque(const deque&) = default;
|
||||
deque(deque&&) = default;
|
||||
|
||||
deque(const deque& __d, const _Allocator& __a)
|
||||
: _Base(__d, __a) { }
|
||||
|
||||
deque(deque&& __d, const _Allocator& __a)
|
||||
: _Base(std::move(__d), __a) { }
|
||||
|
||||
~deque() = default;
|
||||
|
||||
deque(initializer_list<value_type> __l,
|
||||
const _Allocator& __a = _Allocator())
|
||||
: _Base(__l, __a) { }
|
||||
#endif
|
||||
|
||||
explicit
|
||||
deque(const _Allocator& __a)
|
||||
: _Base(__a) { }
|
||||
|
||||
#if __cplusplus >= 201103L
|
||||
explicit
|
||||
deque(size_type __n, const _Allocator& __a = _Allocator())
|
||||
: _Base(__n, __a) { }
|
||||
|
||||
deque(size_type __n, const _Tp& __value,
|
||||
const _Allocator& __a = _Allocator())
|
||||
: _Base(__n, __value, __a) { }
|
||||
#else
|
||||
explicit
|
||||
deque(size_type __n, const _Tp& __value = _Tp(),
|
||||
const _Allocator& __a = _Allocator())
|
||||
: _Base(__n, __value, __a) { }
|
||||
#endif
|
||||
|
||||
#if __cplusplus >= 201103L
|
||||
template<typename _InputIterator,
|
||||
typename = std::_RequireInputIter<_InputIterator>>
|
||||
#else
|
||||
template<typename _InputIterator>
|
||||
#endif
|
||||
deque(_InputIterator __first, _InputIterator __last,
|
||||
const _Allocator& __a = _Allocator())
|
||||
: _Base(__first, __last, __a)
|
||||
{ }
|
||||
|
||||
deque(const _Base& __x)
|
||||
: _Base(__x) { }
|
||||
|
||||
#if __cplusplus < 201103L
|
||||
deque&
|
||||
operator=(const deque& __x)
|
||||
{
|
||||
_M_base() = __x;
|
||||
return *this;
|
||||
}
|
||||
#else
|
||||
deque&
|
||||
operator=(const deque&) = default;
|
||||
|
||||
deque&
|
||||
operator=(deque&&) = default;
|
||||
|
||||
deque&
|
||||
operator=(initializer_list<value_type> __l)
|
||||
{
|
||||
_M_base() = __l;
|
||||
return *this;
|
||||
}
|
||||
#endif
|
||||
|
||||
void
|
||||
swap(deque& __x)
|
||||
#if __cplusplus >= 201103L
|
||||
noexcept( noexcept(declval<_Base>().swap(__x)) )
|
||||
#endif
|
||||
{ _Base::swap(__x); }
|
||||
|
||||
_Base&
|
||||
_M_base() _GLIBCXX_NOEXCEPT { return *this; }
|
||||
|
||||
const _Base&
|
||||
_M_base() const _GLIBCXX_NOEXCEPT { return *this; }
|
||||
};
|
||||
|
||||
template<typename _Tp, typename _Alloc>
|
||||
inline bool
|
||||
operator==(const deque<_Tp, _Alloc>& __lhs,
|
||||
const deque<_Tp, _Alloc>& __rhs)
|
||||
{ return __lhs._M_base() == __rhs._M_base(); }
|
||||
|
||||
template<typename _Tp, typename _Alloc>
|
||||
inline bool
|
||||
operator!=(const deque<_Tp, _Alloc>& __lhs,
|
||||
const deque<_Tp, _Alloc>& __rhs)
|
||||
{ return __lhs._M_base() != __rhs._M_base(); }
|
||||
|
||||
template<typename _Tp, typename _Alloc>
|
||||
inline bool
|
||||
operator<(const deque<_Tp, _Alloc>& __lhs,
|
||||
const deque<_Tp, _Alloc>& __rhs)
|
||||
{ return __lhs._M_base() < __rhs._M_base(); }
|
||||
|
||||
template<typename _Tp, typename _Alloc>
|
||||
inline bool
|
||||
operator<=(const deque<_Tp, _Alloc>& __lhs,
|
||||
const deque<_Tp, _Alloc>& __rhs)
|
||||
{ return __lhs._M_base() <= __rhs._M_base(); }
|
||||
|
||||
template<typename _Tp, typename _Alloc>
|
||||
inline bool
|
||||
operator>=(const deque<_Tp, _Alloc>& __lhs,
|
||||
const deque<_Tp, _Alloc>& __rhs)
|
||||
{ return __lhs._M_base() >= __rhs._M_base(); }
|
||||
|
||||
template<typename _Tp, typename _Alloc>
|
||||
inline bool
|
||||
operator>(const deque<_Tp, _Alloc>& __lhs,
|
||||
const deque<_Tp, _Alloc>& __rhs)
|
||||
{ return __lhs._M_base() > __rhs._M_base(); }
|
||||
|
||||
template<typename _Tp, typename _Alloc>
|
||||
inline void
|
||||
swap(deque<_Tp, _Alloc>& __lhs, deque<_Tp, _Alloc>& __rhs)
|
||||
{ __lhs.swap(__rhs); }
|
||||
|
||||
} // namespace __profile
|
||||
} // namespace std
|
||||
|
||||
#endif
|
||||
215
openflow/usr/include/c++/5/profile/forward_list
Normal file
215
openflow/usr/include/c++/5/profile/forward_list
Normal file
@@ -0,0 +1,215 @@
|
||||
// <forward_list> -*- C++ -*-
|
||||
|
||||
// Copyright (C) 2010-2015 Free Software Foundation, Inc.
|
||||
//
|
||||
// This file is part of the GNU ISO C++ Library. This library is free
|
||||
// software; you can redistribute it and/or modify it under the
|
||||
// terms of the GNU General Public License as published by the
|
||||
// Free Software Foundation; either version 3, or (at your option)
|
||||
// any later version.
|
||||
|
||||
// This library is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
|
||||
// Under Section 7 of GPL version 3, you are granted additional
|
||||
// permissions described in the GCC Runtime Library Exception, version
|
||||
// 3.1, as published by the Free Software Foundation.
|
||||
|
||||
// You should have received a copy of the GNU General Public License and
|
||||
// a copy of the GCC Runtime Library Exception along with this program;
|
||||
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
|
||||
// <http://www.gnu.org/licenses/>.
|
||||
|
||||
/** @file profile/forward_list
|
||||
* This file is a GNU debug extension to the Standard C++ Library.
|
||||
*/
|
||||
|
||||
#ifndef _GLIBCXX_PROFILE_FORWARD_LIST
|
||||
#define _GLIBCXX_PROFILE_FORWARD_LIST 1
|
||||
|
||||
#if __cplusplus < 201103L
|
||||
# include <bits/c++0x_warning.h>
|
||||
#else
|
||||
|
||||
#include <forward_list>
|
||||
|
||||
namespace std _GLIBCXX_VISIBILITY(default)
|
||||
{
|
||||
namespace __profile
|
||||
{
|
||||
/// Class std::forward_list wrapper with performance instrumentation.
|
||||
template<typename _Tp, typename _Alloc = std::allocator<_Tp> >
|
||||
class forward_list
|
||||
: public _GLIBCXX_STD_C::forward_list<_Tp, _Alloc>
|
||||
{
|
||||
typedef _GLIBCXX_STD_C::forward_list<_Tp, _Alloc> _Base;
|
||||
|
||||
public:
|
||||
typedef typename _Base::size_type size_type;
|
||||
typedef typename _Base::const_iterator const_iterator;
|
||||
|
||||
// 23.2.3.1 construct/copy/destroy:
|
||||
explicit
|
||||
forward_list(const _Alloc& __al = _Alloc())
|
||||
: _Base(__al) { }
|
||||
|
||||
forward_list(const forward_list& __list, const _Alloc& __al)
|
||||
: _Base(__list, __al)
|
||||
{ }
|
||||
|
||||
forward_list(forward_list&& __list, const _Alloc& __al)
|
||||
: _Base(std::move(__list), __al)
|
||||
{ }
|
||||
|
||||
explicit
|
||||
forward_list(size_type __n, const _Alloc& __al = _Alloc())
|
||||
: _Base(__n, __al)
|
||||
{ }
|
||||
|
||||
forward_list(size_type __n, const _Tp& __value,
|
||||
const _Alloc& __al = _Alloc())
|
||||
: _Base(__n, __value, __al)
|
||||
{ }
|
||||
|
||||
template<typename _InputIterator,
|
||||
typename = std::_RequireInputIter<_InputIterator>>
|
||||
forward_list(_InputIterator __first, _InputIterator __last,
|
||||
const _Alloc& __al = _Alloc())
|
||||
: _Base(__first, __last, __al)
|
||||
{ }
|
||||
|
||||
forward_list(const forward_list&) = default;
|
||||
forward_list(forward_list&&) = default;
|
||||
|
||||
forward_list(std::initializer_list<_Tp> __il,
|
||||
const _Alloc& __al = _Alloc())
|
||||
: _Base(__il, __al)
|
||||
{ }
|
||||
|
||||
~forward_list() = default;
|
||||
|
||||
forward_list&
|
||||
operator=(const forward_list&) = default;
|
||||
|
||||
forward_list&
|
||||
operator=(forward_list&&) = default;
|
||||
|
||||
forward_list&
|
||||
operator=(std::initializer_list<_Tp> __il)
|
||||
{
|
||||
_M_base() = __il;
|
||||
return *this;
|
||||
}
|
||||
|
||||
void
|
||||
swap(forward_list& __fl)
|
||||
noexcept( noexcept(declval<_Base>().swap(__fl)) )
|
||||
{ _Base::swap(__fl); }
|
||||
|
||||
void
|
||||
splice_after(const_iterator __pos, forward_list&& __fl)
|
||||
{ _Base::splice_after(__pos, std::move(__fl)); }
|
||||
|
||||
void
|
||||
splice_after(const_iterator __pos, forward_list& __list)
|
||||
{ _Base::splice_after(__pos, __list); }
|
||||
|
||||
void
|
||||
splice_after(const_iterator __pos, forward_list&& __list,
|
||||
const_iterator __i)
|
||||
{ _Base::splice_after(__pos, std::move(__list), __i); }
|
||||
|
||||
void
|
||||
splice_after(const_iterator __pos, forward_list& __list,
|
||||
const_iterator __i)
|
||||
{ _Base::splice_after(__pos, __list, __i); }
|
||||
|
||||
void
|
||||
splice_after(const_iterator __pos, forward_list&& __list,
|
||||
const_iterator __before, const_iterator __last)
|
||||
{ _Base::splice_after(__pos, std::move(__list), __before, __last); }
|
||||
|
||||
void
|
||||
splice_after(const_iterator __pos, forward_list& __list,
|
||||
const_iterator __before, const_iterator __last)
|
||||
{ _Base::splice_after(__pos, __list, __before, __last); }
|
||||
|
||||
void
|
||||
merge(forward_list&& __list)
|
||||
{ _Base::merge(std::move(__list)); }
|
||||
|
||||
void
|
||||
merge(forward_list& __list)
|
||||
{ _Base::merge(__list); }
|
||||
|
||||
template<typename _Comp>
|
||||
void
|
||||
merge(forward_list&& __list, _Comp __comp)
|
||||
{ _Base::merge(std::move(__list), __comp); }
|
||||
|
||||
template<typename _Comp>
|
||||
void
|
||||
merge(forward_list& __list, _Comp __comp)
|
||||
{ _Base::merge(__list, __comp); }
|
||||
|
||||
_Base&
|
||||
_M_base() noexcept { return *this; }
|
||||
|
||||
const _Base&
|
||||
_M_base() const noexcept { return *this; }
|
||||
};
|
||||
|
||||
template<typename _Tp, typename _Alloc>
|
||||
inline bool
|
||||
operator==(const forward_list<_Tp, _Alloc>& __lx,
|
||||
const forward_list<_Tp, _Alloc>& __ly)
|
||||
{ return __lx._M_base() == __ly._M_base(); }
|
||||
|
||||
template<typename _Tp, typename _Alloc>
|
||||
inline bool
|
||||
operator<(const forward_list<_Tp, _Alloc>& __lx,
|
||||
const forward_list<_Tp, _Alloc>& __ly)
|
||||
{ return __lx._M_base() < __ly._M_base(); }
|
||||
|
||||
template<typename _Tp, typename _Alloc>
|
||||
inline bool
|
||||
operator!=(const forward_list<_Tp, _Alloc>& __lx,
|
||||
const forward_list<_Tp, _Alloc>& __ly)
|
||||
{ return !(__lx == __ly); }
|
||||
|
||||
/// Based on operator<
|
||||
template<typename _Tp, typename _Alloc>
|
||||
inline bool
|
||||
operator>(const forward_list<_Tp, _Alloc>& __lx,
|
||||
const forward_list<_Tp, _Alloc>& __ly)
|
||||
{ return (__ly < __lx); }
|
||||
|
||||
/// Based on operator<
|
||||
template<typename _Tp, typename _Alloc>
|
||||
inline bool
|
||||
operator>=(const forward_list<_Tp, _Alloc>& __lx,
|
||||
const forward_list<_Tp, _Alloc>& __ly)
|
||||
{ return !(__lx < __ly); }
|
||||
|
||||
/// Based on operator<
|
||||
template<typename _Tp, typename _Alloc>
|
||||
inline bool
|
||||
operator<=(const forward_list<_Tp, _Alloc>& __lx,
|
||||
const forward_list<_Tp, _Alloc>& __ly)
|
||||
{ return !(__ly < __lx); }
|
||||
|
||||
/// See std::forward_list::swap().
|
||||
template<typename _Tp, typename _Alloc>
|
||||
inline void
|
||||
swap(forward_list<_Tp, _Alloc>& __lx,
|
||||
forward_list<_Tp, _Alloc>& __ly)
|
||||
{ __lx.swap(__ly); }
|
||||
|
||||
} // namespace __profile
|
||||
} // namespace std
|
||||
|
||||
#endif // C++11
|
||||
|
||||
#endif
|
||||
370
openflow/usr/include/c++/5/profile/impl/profiler.h
Normal file
370
openflow/usr/include/c++/5/profile/impl/profiler.h
Normal file
@@ -0,0 +1,370 @@
|
||||
// -*- C++ -*-
|
||||
//
|
||||
// Copyright (C) 2009-2015 Free Software Foundation, Inc.
|
||||
//
|
||||
// This file is part of the GNU ISO C++ Library. This library is free
|
||||
// software; you can redistribute it and/or modify it under the
|
||||
// terms of the GNU General Public License as published by the
|
||||
// Free Software Foundation; either version 3, or (at your option)
|
||||
// any later version.
|
||||
//
|
||||
// This library is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
|
||||
// Under Section 7 of GPL version 3, you are granted additional
|
||||
// permissions described in the GCC Runtime Library Exception, version
|
||||
// 3.1, as published by the Free Software Foundation.
|
||||
|
||||
// You should have received a copy of the GNU General Public License along
|
||||
// with this library; see the file COPYING3. If not see
|
||||
// <http://www.gnu.org/licenses/>.
|
||||
|
||||
/** @file profile/impl/profiler.h
|
||||
* @brief Interface of the profiling runtime library.
|
||||
*/
|
||||
|
||||
// Written by Lixia Liu and Silvius Rus.
|
||||
|
||||
#ifndef _GLIBCXX_PROFILE_PROFILER_H
|
||||
#define _GLIBCXX_PROFILE_PROFILER_H 1
|
||||
|
||||
#include <bits/c++config.h>
|
||||
|
||||
// Mechanism to define data with inline linkage.
|
||||
#define _GLIBCXX_PROFILE_DEFINE_UNINIT_DATA(__type, __name) \
|
||||
inline __type& \
|
||||
__get_##__name() \
|
||||
{ \
|
||||
static __type __name; \
|
||||
return __name; \
|
||||
}
|
||||
#define _GLIBCXX_PROFILE_DEFINE_DATA(__type, __name, __initial_value...) \
|
||||
inline __type& __get_##__name() { \
|
||||
static __type __name(__initial_value); \
|
||||
return __name; \
|
||||
}
|
||||
#define _GLIBCXX_PROFILE_DATA(__name) \
|
||||
__get_##__name()
|
||||
|
||||
namespace __gnu_profile
|
||||
{
|
||||
/** @brief Reentrance guard.
|
||||
*
|
||||
* Mechanism to protect all __gnu_profile operations against recursion,
|
||||
* multithreaded and exception reentrance.
|
||||
*/
|
||||
struct __reentrance_guard
|
||||
{
|
||||
static bool
|
||||
__get_in()
|
||||
{
|
||||
if (__inside() == true)
|
||||
return false;
|
||||
else
|
||||
{
|
||||
__inside() = true;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
static bool&
|
||||
__inside()
|
||||
{
|
||||
static __thread bool _S_inside(false);
|
||||
return _S_inside;
|
||||
}
|
||||
|
||||
__reentrance_guard() { }
|
||||
~__reentrance_guard() { __inside() = false; }
|
||||
};
|
||||
|
||||
// Forward declarations of implementation functions.
|
||||
// Don't use any __gnu_profile:: in user code.
|
||||
// Instead, use the __profcxx... macros, which offer guarded access.
|
||||
class __container_size_info;
|
||||
class __hashfunc_info;
|
||||
class __map2umap_info;
|
||||
class __vector2list_info;
|
||||
class __list2slist_info;
|
||||
class __list2vector_info;
|
||||
|
||||
bool __turn_on();
|
||||
bool __turn_off();
|
||||
bool __is_invalid();
|
||||
bool __is_on();
|
||||
bool __is_off();
|
||||
void __report();
|
||||
|
||||
__container_size_info*
|
||||
__trace_hashtable_size_construct(std::size_t);
|
||||
void __trace_hashtable_size_resize(__container_size_info*,
|
||||
std::size_t, std::size_t);
|
||||
void __trace_hashtable_size_destruct(__container_size_info*,
|
||||
std::size_t, std::size_t);
|
||||
|
||||
__hashfunc_info*
|
||||
__trace_hash_func_construct();
|
||||
void __trace_hash_func_destruct(__hashfunc_info*,
|
||||
std::size_t, std::size_t, std::size_t);
|
||||
|
||||
__container_size_info*
|
||||
__trace_vector_size_construct(std::size_t);
|
||||
void __trace_vector_size_resize(__container_size_info*,
|
||||
std::size_t, std::size_t);
|
||||
void __trace_vector_size_destruct(__container_size_info*,
|
||||
std::size_t, std::size_t);
|
||||
|
||||
__vector2list_info*
|
||||
__trace_vector_to_list_construct();
|
||||
void __trace_vector_to_list_insert(__vector2list_info*,
|
||||
std::size_t, std::size_t);
|
||||
void __trace_vector_to_list_iterate(__vector2list_info*, int);
|
||||
void __trace_vector_to_list_invalid_operator(__vector2list_info*);
|
||||
void __trace_vector_to_list_resize(__vector2list_info*,
|
||||
std::size_t, std::size_t);
|
||||
void __trace_vector_to_list_destruct(__vector2list_info*);
|
||||
|
||||
__list2slist_info*
|
||||
__trace_list_to_slist_construct();
|
||||
void __trace_list_to_slist_rewind(__list2slist_info*);
|
||||
void __trace_list_to_slist_operation(__list2slist_info*);
|
||||
void __trace_list_to_slist_destruct(__list2slist_info*);
|
||||
|
||||
__list2vector_info*
|
||||
__trace_list_to_vector_construct();
|
||||
void __trace_list_to_vector_insert(__list2vector_info*,
|
||||
std::size_t, std::size_t);
|
||||
void __trace_list_to_vector_iterate(__list2vector_info*, int);
|
||||
void __trace_list_to_vector_invalid_operator(__list2vector_info*);
|
||||
void __trace_list_to_vector_resize(__list2vector_info*,
|
||||
std::size_t, std::size_t);
|
||||
void __trace_list_to_vector_destruct(__list2vector_info*);
|
||||
|
||||
__map2umap_info*
|
||||
__trace_map_to_unordered_map_construct();
|
||||
void __trace_map_to_unordered_map_invalidate(__map2umap_info*);
|
||||
void __trace_map_to_unordered_map_insert(__map2umap_info*, std::size_t,
|
||||
std::size_t);
|
||||
void __trace_map_to_unordered_map_erase(__map2umap_info*, std::size_t,
|
||||
std::size_t);
|
||||
void __trace_map_to_unordered_map_iterate(__map2umap_info*, std::size_t);
|
||||
void __trace_map_to_unordered_map_find(__map2umap_info*, std::size_t);
|
||||
void __trace_map_to_unordered_map_destruct(__map2umap_info*);
|
||||
} // namespace __gnu_profile
|
||||
|
||||
// Master switch turns on all diagnostics that are not explicitly turned off.
|
||||
#ifdef _GLIBCXX_PROFILE
|
||||
#ifndef _GLIBCXX_PROFILE_NO_HASHTABLE_TOO_SMALL
|
||||
#define _GLIBCXX_PROFILE_HASHTABLE_TOO_SMALL
|
||||
#endif
|
||||
#ifndef _GLIBCXX_PROFILE_NO_HASHTABLE_TOO_LARGE
|
||||
#define _GLIBCXX_PROFILE_HASHTABLE_TOO_LARGE
|
||||
#endif
|
||||
#ifndef _GLIBCXX_PROFILE_NO_VECTOR_TOO_SMALL
|
||||
#define _GLIBCXX_PROFILE_VECTOR_TOO_SMALL
|
||||
#endif
|
||||
#ifndef _GLIBCXX_PROFILE_NO_VECTOR_TOO_LARGE
|
||||
#define _GLIBCXX_PROFILE_VECTOR_TOO_LARGE
|
||||
#endif
|
||||
#ifndef _GLIBCXX_PROFILE_NO_INEFFICIENT_HASH
|
||||
#define _GLIBCXX_PROFILE_INEFFICIENT_HASH
|
||||
#endif
|
||||
#ifndef _GLIBCXX_PROFILE_NO_VECTOR_TO_LIST
|
||||
#define _GLIBCXX_PROFILE_VECTOR_TO_LIST
|
||||
#endif
|
||||
#ifndef _GLIBCXX_PROFILE_NO_LIST_TO_SLIST
|
||||
#define _GLIBCXX_PROFILE_LIST_TO_SLIST
|
||||
#endif
|
||||
#ifndef _GLIBCXX_PROFILE_NO_LIST_TO_VECTOR
|
||||
#define _GLIBCXX_PROFILE_LIST_TO_VECTOR
|
||||
#endif
|
||||
#ifndef _GLIBCXX_PROFILE_NO_MAP_TO_UNORDERED_MAP
|
||||
#define _GLIBCXX_PROFILE_MAP_TO_UNORDERED_MAP
|
||||
#endif
|
||||
#endif
|
||||
|
||||
// Expose global management routines to user code.
|
||||
#ifdef _GLIBCXX_PROFILE
|
||||
#define __profcxx_report() __gnu_profile::__report()
|
||||
#define __profcxx_turn_on() __gnu_profile::__turn_on()
|
||||
#define __profcxx_turn_off() __gnu_profile::__turn_off()
|
||||
#define __profcxx_is_invalid() __gnu_profile::__is_invalid()
|
||||
#define __profcxx_is_on() __gnu_profile::__is_on()
|
||||
#define __profcxx_is_off() __gnu_profile::__is_off()
|
||||
#else
|
||||
#define __profcxx_report()
|
||||
#define __profcxx_turn_on()
|
||||
#define __profcxx_turn_off()
|
||||
#define __profcxx_is_invalid()
|
||||
#define __profcxx_is_on()
|
||||
#define __profcxx_is_off()
|
||||
#endif
|
||||
|
||||
// Turn on/off instrumentation for HASHTABLE_TOO_SMALL and HASHTABLE_TOO_LARGE.
|
||||
#if (defined(_GLIBCXX_PROFILE_HASHTABLE_TOO_SMALL) \
|
||||
|| defined(_GLIBCXX_PROFILE_HASHTABLE_TOO_LARGE))
|
||||
#define __profcxx_hashtable_size_construct(__x...) \
|
||||
__gnu_profile::__trace_hashtable_size_construct(__x)
|
||||
#define __profcxx_hashtable_size_resize(__x...) \
|
||||
__gnu_profile::__trace_hashtable_size_resize(__x)
|
||||
#define __profcxx_hashtable_size_destruct(__x...) \
|
||||
__gnu_profile::__trace_hashtable_size_destruct(__x)
|
||||
#else
|
||||
#define __profcxx_hashtable_size_construct(__x...) 0
|
||||
#define __profcxx_hashtable_size_resize(__x...)
|
||||
#define __profcxx_hashtable_size_destruct(__x...)
|
||||
#endif
|
||||
|
||||
// Turn on/off instrumentation for VECTOR_TOO_SMALL and VECTOR_TOO_LARGE.
|
||||
#if (defined(_GLIBCXX_PROFILE_VECTOR_TOO_SMALL) \
|
||||
|| defined(_GLIBCXX_PROFILE_VECTOR_TOO_LARGE))
|
||||
#define __profcxx_vector_size_construct(__x...) \
|
||||
__gnu_profile::__trace_vector_size_construct(__x)
|
||||
#define __profcxx_vector_size_resize(__x...) \
|
||||
__gnu_profile::__trace_vector_size_resize(__x)
|
||||
#define __profcxx_vector_size_destruct(__x...) \
|
||||
__gnu_profile::__trace_vector_size_destruct(__x)
|
||||
#else
|
||||
#define __profcxx_vector_size_construct(__x...) 0
|
||||
#define __profcxx_vector_size_resize(__x...)
|
||||
#define __profcxx_vector_size_destruct(__x...)
|
||||
#endif
|
||||
|
||||
// Turn on/off instrumentation for INEFFICIENT_HASH.
|
||||
#if defined(_GLIBCXX_PROFILE_INEFFICIENT_HASH)
|
||||
#define __profcxx_hash_func_construct(__x...) \
|
||||
__gnu_profile::__trace_hash_func_construct(__x)
|
||||
#define __profcxx_hash_func_destruct(__x...) \
|
||||
__gnu_profile::__trace_hash_func_destruct(__x)
|
||||
#else
|
||||
#define __profcxx_hash_func_construct(__x...) 0
|
||||
#define __profcxx_hash_func_destruct(__x...)
|
||||
#endif
|
||||
|
||||
// Turn on/off instrumentation for VECTOR_TO_LIST.
|
||||
#if defined(_GLIBCXX_PROFILE_VECTOR_TO_LIST)
|
||||
#define __profcxx_vector2list_construct(__x...) \
|
||||
__gnu_profile::__trace_vector_to_list_construct(__x)
|
||||
#define __profcxx_vector2list_insert(__x...) \
|
||||
__gnu_profile::__trace_vector_to_list_insert(__x)
|
||||
#define __profcxx_vector2list_iterate(__x...) \
|
||||
__gnu_profile::__trace_vector_to_list_iterate(__x)
|
||||
#define __profcxx_vector2list_invalid_operator(__x...) \
|
||||
__gnu_profile::__trace_vector_to_list_invalid_operator(__x)
|
||||
#define __profcxx_vector2list_resize(__x...) \
|
||||
__gnu_profile::__trace_vector_to_list_resize(__x)
|
||||
#define __profcxx_vector2list_destruct(__x...) \
|
||||
__gnu_profile::__trace_vector_to_list_destruct(__x)
|
||||
#else
|
||||
#define __profcxx_vector2list_construct(__x...) 0
|
||||
#define __profcxx_vector2list_insert(__x...)
|
||||
#define __profcxx_vector2list_iterate(__x...)
|
||||
#define __profcxx_vector2list_invalid_operator(__x...)
|
||||
#define __profcxx_vector2list_resize(__x...)
|
||||
#define __profcxx_vector2list_destruct(__x...)
|
||||
#endif
|
||||
|
||||
// Turn on/off instrumentation for LIST_TO_VECTOR.
|
||||
#if defined(_GLIBCXX_PROFILE_LIST_TO_VECTOR)
|
||||
#define __profcxx_list2vector_construct(__x...) \
|
||||
__gnu_profile::__trace_list_to_vector_construct(__x)
|
||||
#define __profcxx_list2vector_insert(__x...) \
|
||||
__gnu_profile::__trace_list_to_vector_insert(__x)
|
||||
#define __profcxx_list2vector_iterate(__x...) \
|
||||
__gnu_profile::__trace_list_to_vector_iterate(__x)
|
||||
#define __profcxx_list2vector_invalid_operator(__x...) \
|
||||
__gnu_profile::__trace_list_to_vector_invalid_operator(__x)
|
||||
#define __profcxx_list2vector_destruct(__x...) \
|
||||
__gnu_profile::__trace_list_to_vector_destruct(__x)
|
||||
#else
|
||||
#define __profcxx_list2vector_construct(__x...) 0
|
||||
#define __profcxx_list2vector_insert(__x...)
|
||||
#define __profcxx_list2vector_iterate(__x...)
|
||||
#define __profcxx_list2vector_invalid_operator(__x...)
|
||||
#define __profcxx_list2vector_destruct(__x...)
|
||||
#endif
|
||||
|
||||
// Turn on/off instrumentation for LIST_TO_SLIST.
|
||||
#if defined(_GLIBCXX_PROFILE_LIST_TO_SLIST)
|
||||
#define __profcxx_list2slist_construct(__x...) \
|
||||
__gnu_profile::__trace_list_to_slist_construct(__x)
|
||||
#define __profcxx_list2slist_rewind(__x...) \
|
||||
__gnu_profile::__trace_list_to_slist_rewind(__x)
|
||||
#define __profcxx_list2slist_operation(__x...) \
|
||||
__gnu_profile::__trace_list_to_slist_operation(__x)
|
||||
#define __profcxx_list2slist_destruct(__x...) \
|
||||
__gnu_profile::__trace_list_to_slist_destruct(__x)
|
||||
#else
|
||||
#define __profcxx_list2slist_construct(__x...) 0
|
||||
#define __profcxx_list2slist_rewind(__x...)
|
||||
#define __profcxx_list2slist_operation(__x...)
|
||||
#define __profcxx_list2slist_destruct(__x...)
|
||||
#endif
|
||||
|
||||
// Turn on/off instrumentation for MAP_TO_UNORDERED_MAP.
|
||||
#if defined(_GLIBCXX_PROFILE_MAP_TO_UNORDERED_MAP)
|
||||
#define __profcxx_map2umap_construct(__x...) \
|
||||
__gnu_profile::__trace_map_to_unordered_map_construct(__x)
|
||||
#define __profcxx_map2umap_insert(__x...) \
|
||||
__gnu_profile::__trace_map_to_unordered_map_insert(__x)
|
||||
#define __profcxx_map2umap_erase(__x...) \
|
||||
__gnu_profile::__trace_map_to_unordered_map_erase(__x)
|
||||
#define __profcxx_map2umap_iterate(__x...) \
|
||||
__gnu_profile::__trace_map_to_unordered_map_iterate(__x)
|
||||
#define __profcxx_map2umap_invalidate(__x...) \
|
||||
__gnu_profile::__trace_map_to_unordered_map_invalidate(__x)
|
||||
#define __profcxx_map2umap_find(__x...) \
|
||||
__gnu_profile::__trace_map_to_unordered_map_find(__x)
|
||||
#define __profcxx_map2umap_destruct(__x...) \
|
||||
__gnu_profile::__trace_map_to_unordered_map_destruct(__x)
|
||||
#else
|
||||
#define __profcxx_map2umap_construct(__x...) 0
|
||||
#define __profcxx_map2umap_insert(__x...)
|
||||
#define __profcxx_map2umap_erase(__x...)
|
||||
#define __profcxx_map2umap_iterate(__x...)
|
||||
#define __profcxx_map2umap_invalidate(__x...)
|
||||
#define __profcxx_map2umap_find(__x...)
|
||||
#define __profcxx_map2umap_destruct(__x...)
|
||||
#endif
|
||||
|
||||
// Set default values for compile-time customizable variables.
|
||||
#ifndef _GLIBCXX_PROFILE_TRACE_PATH_ROOT
|
||||
#define _GLIBCXX_PROFILE_TRACE_PATH_ROOT "libstdcxx-profile"
|
||||
#endif
|
||||
#ifndef _GLIBCXX_PROFILE_TRACE_ENV_VAR
|
||||
#define _GLIBCXX_PROFILE_TRACE_ENV_VAR "_GLIBCXX_PROFILE_TRACE_PATH_ROOT"
|
||||
#endif
|
||||
#ifndef _GLIBCXX_PROFILE_MAX_WARN_COUNT_ENV_VAR
|
||||
#define _GLIBCXX_PROFILE_MAX_WARN_COUNT_ENV_VAR \
|
||||
"_GLIBCXX_PROFILE_MAX_WARN_COUNT"
|
||||
#endif
|
||||
#ifndef _GLIBCXX_PROFILE_MAX_WARN_COUNT
|
||||
#define _GLIBCXX_PROFILE_MAX_WARN_COUNT 10
|
||||
#endif
|
||||
#ifndef _GLIBCXX_PROFILE_MAX_STACK_DEPTH
|
||||
#define _GLIBCXX_PROFILE_MAX_STACK_DEPTH 32
|
||||
#endif
|
||||
#ifndef _GLIBCXX_PROFILE_MAX_STACK_DEPTH_ENV_VAR
|
||||
#define _GLIBCXX_PROFILE_MAX_STACK_DEPTH_ENV_VAR \
|
||||
"_GLIBCXX_PROFILE_MAX_STACK_DEPTH"
|
||||
#endif
|
||||
#ifndef _GLIBCXX_PROFILE_MEM_PER_DIAGNOSTIC
|
||||
#define _GLIBCXX_PROFILE_MEM_PER_DIAGNOSTIC (1 << 28)
|
||||
#endif
|
||||
#ifndef _GLIBCXX_PROFILE_MEM_PER_DIAGNOSTIC_ENV_VAR
|
||||
#define _GLIBCXX_PROFILE_MEM_PER_DIAGNOSTIC_ENV_VAR \
|
||||
"_GLIBCXX_PROFILE_MEM_PER_DIAGNOSTIC"
|
||||
#endif
|
||||
|
||||
// Instrumentation hook implementations.
|
||||
#include "profile/impl/profiler_hash_func.h"
|
||||
#include "profile/impl/profiler_hashtable_size.h"
|
||||
#include "profile/impl/profiler_map_to_unordered_map.h"
|
||||
#include "profile/impl/profiler_vector_size.h"
|
||||
#include "profile/impl/profiler_vector_to_list.h"
|
||||
#include "profile/impl/profiler_list_to_slist.h"
|
||||
#include "profile/impl/profiler_list_to_vector.h"
|
||||
|
||||
#endif // _GLIBCXX_PROFILE_PROFILER_H
|
||||
111
openflow/usr/include/c++/5/profile/impl/profiler_algos.h
Normal file
111
openflow/usr/include/c++/5/profile/impl/profiler_algos.h
Normal file
@@ -0,0 +1,111 @@
|
||||
// -*- C++ -*-
|
||||
//
|
||||
// Copyright (C) 2010-2015 Free Software Foundation, Inc.
|
||||
//
|
||||
// This file is part of the GNU ISO C++ Library. This library is free
|
||||
// software; you can redistribute it and/or modify it under the
|
||||
// terms of the GNU General Public License as published by the
|
||||
// Free Software Foundation; either version 3, or (at your option)
|
||||
// any later version.
|
||||
//
|
||||
// This library is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
|
||||
// Under Section 7 of GPL version 3, you are granted additional
|
||||
// permissions described in the GCC Runtime Library Exception, version
|
||||
// 3.1, as published by the Free Software Foundation.
|
||||
|
||||
// You should have received a copy of the GNU General Public License along
|
||||
// with this library; see the file COPYING3. If not see
|
||||
// <http://www.gnu.org/licenses/>.
|
||||
|
||||
/** @file profile/impl/profiler_algos.h
|
||||
* @brief Algorithms used by the profile extension.
|
||||
*
|
||||
* This file is needed to avoid including \<algorithm\> or \<bits/stl_algo.h\>.
|
||||
* Including those files would result in recursive includes.
|
||||
* These implementations are oversimplified. In general, efficiency may be
|
||||
* sacrificed to minimize maintenance overhead.
|
||||
*/
|
||||
|
||||
#ifndef _GLIBCXX_PROFILE_PROFILER_ALGOS_H
|
||||
#define _GLIBCXX_PROFILE_PROFILER_ALGOS_H 1
|
||||
|
||||
namespace __gnu_profile
|
||||
{
|
||||
/* Helper for __top_n. Insert in sorted vector, but not beyond Nth elem. */
|
||||
template<typename _Container>
|
||||
void
|
||||
__insert_top_n(_Container& __output,
|
||||
const typename _Container::value_type& __value,
|
||||
typename _Container::size_type __n)
|
||||
{
|
||||
typename _Container::iterator __it = __output.begin();
|
||||
typename _Container::size_type __count = 0;
|
||||
|
||||
// Skip up to N - 1 elements larger than VALUE.
|
||||
// XXX: Could do binary search for random iterators.
|
||||
while (true)
|
||||
{
|
||||
if (__count >= __n)
|
||||
// VALUE is not in top N.
|
||||
return;
|
||||
|
||||
if (__it == __output.end())
|
||||
break;
|
||||
|
||||
if (*__it < __value)
|
||||
break;
|
||||
|
||||
++__it;
|
||||
++__count;
|
||||
}
|
||||
|
||||
__output.insert(__it, __value);
|
||||
}
|
||||
|
||||
/* Copy the top N elements in INPUT, sorted in reverse order, to OUTPUT. */
|
||||
template<typename _Container>
|
||||
void
|
||||
__top_n(const _Container& __input, _Container& __output,
|
||||
typename _Container::size_type __n)
|
||||
{
|
||||
__output.clear();
|
||||
typename _Container::const_iterator __it;
|
||||
for (__it = __input.begin(); __it != __input.end(); ++__it)
|
||||
__insert_top_n(__output, *__it, __n);
|
||||
}
|
||||
|
||||
/* Simplified clone of std::for_each. */
|
||||
template<typename _InputIterator, typename _Function>
|
||||
_Function
|
||||
__for_each(_InputIterator __first, _InputIterator __last, _Function __f)
|
||||
{
|
||||
for (; __first != __last; ++__first)
|
||||
__f(*__first);
|
||||
return __f;
|
||||
}
|
||||
|
||||
/* Simplified clone of std::remove. */
|
||||
template<typename _ForwardIterator, typename _Tp>
|
||||
_ForwardIterator
|
||||
__remove(_ForwardIterator __first, _ForwardIterator __last,
|
||||
const _Tp& __value)
|
||||
{
|
||||
if(__first == __last)
|
||||
return __first;
|
||||
_ForwardIterator __result = __first;
|
||||
++__first;
|
||||
for(; __first != __last; ++__first)
|
||||
if(!(*__first == __value))
|
||||
{
|
||||
*__result = *__first;
|
||||
++__result;
|
||||
}
|
||||
return __result;
|
||||
}
|
||||
} // namespace __gnu_profile
|
||||
|
||||
#endif /* _GLIBCXX_PROFILE_PROFILER_ALGOS_H */
|
||||
@@ -0,0 +1,186 @@
|
||||
// -*- C++ -*-
|
||||
//
|
||||
// Copyright (C) 2009-2015 Free Software Foundation, Inc.
|
||||
//
|
||||
// This file is part of the GNU ISO C++ Library. This library is free
|
||||
// software; you can redistribute it and/or modify it under the
|
||||
// terms of the GNU General Public License as published by the
|
||||
// Free Software Foundation; either version 3, or (at your option)
|
||||
// any later version.
|
||||
//
|
||||
// This library is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
|
||||
// Under Section 7 of GPL version 3, you are granted additional
|
||||
// permissions described in the GCC Runtime Library Exception, version
|
||||
// 3.1, as published by the Free Software Foundation.
|
||||
|
||||
// You should have received a copy of the GNU General Public License along
|
||||
// with this library; see the file COPYING3. If not see
|
||||
// <http://www.gnu.org/licenses/>.
|
||||
|
||||
/** @file profile/impl/profiler_container_size.h
|
||||
* @brief Diagnostics for container sizes.
|
||||
*/
|
||||
|
||||
// Written by Lixia Liu and Silvius Rus.
|
||||
|
||||
#ifndef _GLIBCXX_PROFILE_PROFILER_CONTAINER_SIZE_H
|
||||
#define _GLIBCXX_PROFILE_PROFILER_CONTAINER_SIZE_H 1
|
||||
|
||||
#include <sstream>
|
||||
|
||||
#include "profile/impl/profiler.h"
|
||||
#include "profile/impl/profiler_node.h"
|
||||
#include "profile/impl/profiler_trace.h"
|
||||
|
||||
namespace __gnu_profile
|
||||
{
|
||||
/** @brief A container size instrumentation line in the object table. */
|
||||
class __container_size_info
|
||||
: public __object_info_base
|
||||
{
|
||||
public:
|
||||
__container_size_info(__stack_t __stack)
|
||||
: __object_info_base(__stack), _M_init(0), _M_max(0),
|
||||
_M_min(0), _M_total(0), _M_item_min(0), _M_item_max(0),
|
||||
_M_item_total(0), _M_count(0), _M_resize(0), _M_cost(0)
|
||||
{ }
|
||||
|
||||
void
|
||||
__write(FILE* __f) const
|
||||
{
|
||||
std::fprintf(__f, "%Zu %Zu %Zu %Zu %Zu %Zu %Zu %Zu %Zu %Zu\n",
|
||||
_M_init, _M_count, _M_cost, _M_resize, _M_min, _M_max,
|
||||
_M_total, _M_item_min, _M_item_max, _M_item_total);
|
||||
}
|
||||
|
||||
float
|
||||
__magnitude() const
|
||||
{ return static_cast<float>(_M_cost); }
|
||||
|
||||
std::string
|
||||
__advice() const
|
||||
{
|
||||
std::stringstream __message;
|
||||
if (_M_init < _M_item_max)
|
||||
__message << "change initial container size from " << _M_init
|
||||
<< " to " << _M_item_max;
|
||||
return __message.str();
|
||||
}
|
||||
|
||||
void
|
||||
__init(std::size_t __num)
|
||||
{
|
||||
_M_init = __num;
|
||||
_M_max = __num;
|
||||
}
|
||||
|
||||
void
|
||||
__merge(const __container_size_info& __o)
|
||||
{
|
||||
__object_info_base::__merge(__o);
|
||||
_M_init = std::max(_M_init, __o._M_init);
|
||||
_M_max = std::max(_M_max, __o._M_max);
|
||||
_M_item_max = std::max(_M_item_max, __o._M_item_max);
|
||||
_M_min = std::min(_M_min, __o._M_min);
|
||||
_M_item_min = std::min(_M_item_min, __o._M_item_min);
|
||||
_M_total += __o._M_total;
|
||||
_M_item_total += __o._M_item_total;
|
||||
_M_count += __o._M_count;
|
||||
_M_cost += __o._M_cost;
|
||||
_M_resize += __o._M_resize;
|
||||
}
|
||||
|
||||
// Call if a container is destructed or cleaned.
|
||||
void
|
||||
__destruct(std::size_t __num, std::size_t __inum)
|
||||
{
|
||||
_M_max = std::max(_M_max, __num);
|
||||
_M_item_max = std::max(_M_item_max, __inum);
|
||||
if (_M_min == 0)
|
||||
{
|
||||
_M_min = __num;
|
||||
_M_item_min = __inum;
|
||||
}
|
||||
else
|
||||
{
|
||||
_M_min = std::min(_M_min, __num);
|
||||
_M_item_min = std::min(_M_item_min, __inum);
|
||||
}
|
||||
|
||||
_M_total += __num;
|
||||
_M_item_total += __inum;
|
||||
_M_count += 1;
|
||||
}
|
||||
|
||||
// Estimate the cost of resize/rehash.
|
||||
float
|
||||
__resize_cost(std::size_t __from, std::size_t)
|
||||
{ return __from; }
|
||||
|
||||
// Call if container is resized.
|
||||
void
|
||||
__resize(std::size_t __from, std::size_t __to)
|
||||
{
|
||||
_M_cost += this->__resize_cost(__from, __to);
|
||||
_M_resize += 1;
|
||||
_M_max = std::max(_M_max, __to);
|
||||
}
|
||||
|
||||
private:
|
||||
std::size_t _M_init;
|
||||
std::size_t _M_max; // range of # buckets
|
||||
std::size_t _M_min;
|
||||
std::size_t _M_total;
|
||||
std::size_t _M_item_min; // range of # items
|
||||
std::size_t _M_item_max;
|
||||
std::size_t _M_item_total;
|
||||
std::size_t _M_count;
|
||||
std::size_t _M_resize;
|
||||
std::size_t _M_cost;
|
||||
};
|
||||
|
||||
/** @brief A container size instrumentation line in the stack table. */
|
||||
class __container_size_stack_info
|
||||
: public __container_size_info
|
||||
{
|
||||
public:
|
||||
__container_size_stack_info(const __container_size_info& __o)
|
||||
: __container_size_info(__o) { }
|
||||
};
|
||||
|
||||
/** @brief Container size instrumentation trace producer. */
|
||||
class __trace_container_size
|
||||
: public __trace_base<__container_size_info, __container_size_stack_info>
|
||||
{
|
||||
public:
|
||||
~__trace_container_size() { }
|
||||
|
||||
__trace_container_size()
|
||||
: __trace_base<__container_size_info, __container_size_stack_info>() { };
|
||||
|
||||
// Insert a new node at construct with object, callstack and initial size.
|
||||
__container_size_info*
|
||||
__insert(__stack_t __stack, std::size_t __num)
|
||||
{
|
||||
__container_size_info* __ret = __add_object(__stack);
|
||||
if (__ret)
|
||||
__ret->__init(__num);
|
||||
return __ret;
|
||||
}
|
||||
|
||||
// Call at destruction/clean to set container final size.
|
||||
void
|
||||
__destruct(__container_size_info* __obj_info,
|
||||
std::size_t __num, std::size_t __inum)
|
||||
{
|
||||
__obj_info->__destruct(__num, __inum);
|
||||
__retire_object(__obj_info);
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace __gnu_profile
|
||||
#endif /* _GLIBCXX_PROFILE_PROFILER_CONTAINER_SIZE_H */
|
||||
153
openflow/usr/include/c++/5/profile/impl/profiler_hash_func.h
Normal file
153
openflow/usr/include/c++/5/profile/impl/profiler_hash_func.h
Normal file
@@ -0,0 +1,153 @@
|
||||
// -*- C++ -*-
|
||||
//
|
||||
// Copyright (C) 2009-2015 Free Software Foundation, Inc.
|
||||
//
|
||||
// This file is part of the GNU ISO C++ Library. This library is free
|
||||
// software; you can redistribute it and/or modify it under the
|
||||
// terms of the GNU General Public License as published by the
|
||||
// Free Software Foundation; either version 3, or (at your option)
|
||||
// any later version.
|
||||
//
|
||||
// This library is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
|
||||
// Under Section 7 of GPL version 3, you are granted additional
|
||||
// permissions described in the GCC Runtime Library Exception, version
|
||||
// 3.1, as published by the Free Software Foundation.
|
||||
|
||||
// You should have received a copy of the GNU General Public License along
|
||||
// with this library; see the file COPYING3. If not see
|
||||
// <http://www.gnu.org/licenses/>.
|
||||
|
||||
/** @file profile/impl/profiler_hash_func.h
|
||||
* @brief Data structures to represent profiling traces.
|
||||
*/
|
||||
|
||||
// Written by Lixia Liu and Silvius Rus.
|
||||
|
||||
#ifndef _GLIBCXX_PROFILE_PROFILER_HASH_FUNC_H
|
||||
#define _GLIBCXX_PROFILE_PROFILER_HASH_FUNC_H 1
|
||||
|
||||
#include "profile/impl/profiler.h"
|
||||
#include "profile/impl/profiler_node.h"
|
||||
#include "profile/impl/profiler_trace.h"
|
||||
|
||||
namespace __gnu_profile
|
||||
{
|
||||
/** @brief A hash performance instrumentation line in the object table. */
|
||||
class __hashfunc_info
|
||||
: public __object_info_base
|
||||
{
|
||||
public:
|
||||
__hashfunc_info(__stack_t __stack)
|
||||
: __object_info_base(__stack), _M_longest_chain(0),
|
||||
_M_accesses(0), _M_hops(0) { }
|
||||
|
||||
void
|
||||
__merge(const __hashfunc_info& __o)
|
||||
{
|
||||
__object_info_base::__merge(__o);
|
||||
_M_longest_chain = std::max(_M_longest_chain, __o._M_longest_chain);
|
||||
_M_accesses += __o._M_accesses;
|
||||
_M_hops += __o._M_hops;
|
||||
}
|
||||
|
||||
void
|
||||
__destruct(std::size_t __chain, std::size_t __accesses,
|
||||
std::size_t __hops)
|
||||
{
|
||||
_M_longest_chain = std::max(_M_longest_chain, __chain);
|
||||
_M_accesses += __accesses;
|
||||
_M_hops += __hops;
|
||||
}
|
||||
|
||||
void
|
||||
__write(FILE* __f) const
|
||||
{ std::fprintf(__f, "%Zu %Zu %Zu\n", _M_hops,
|
||||
_M_accesses, _M_longest_chain); }
|
||||
|
||||
float
|
||||
__magnitude() const
|
||||
{ return static_cast<float>(_M_hops); }
|
||||
|
||||
std::string
|
||||
__advice() const
|
||||
{ return "change hash function"; }
|
||||
|
||||
private:
|
||||
std::size_t _M_longest_chain;
|
||||
std::size_t _M_accesses;
|
||||
std::size_t _M_hops;
|
||||
};
|
||||
|
||||
/** @brief A hash performance instrumentation line in the stack table. */
|
||||
class __hashfunc_stack_info
|
||||
: public __hashfunc_info
|
||||
{
|
||||
public:
|
||||
__hashfunc_stack_info(const __hashfunc_info& __o)
|
||||
: __hashfunc_info(__o) { }
|
||||
};
|
||||
|
||||
/** @brief Hash performance instrumentation producer. */
|
||||
class __trace_hash_func
|
||||
: public __trace_base<__hashfunc_info, __hashfunc_stack_info>
|
||||
{
|
||||
public:
|
||||
__trace_hash_func()
|
||||
: __trace_base<__hashfunc_info, __hashfunc_stack_info>()
|
||||
{ __id = "hash-distr"; }
|
||||
|
||||
~__trace_hash_func() {}
|
||||
|
||||
// Call at destruction/clean to set container final size.
|
||||
void
|
||||
__destruct(__hashfunc_info* __obj_info,
|
||||
std::size_t __chain, std::size_t __accesses, std::size_t __hops)
|
||||
{
|
||||
if (!__obj_info)
|
||||
return;
|
||||
|
||||
__obj_info->__destruct(__chain, __accesses, __hops);
|
||||
__retire_object(__obj_info);
|
||||
}
|
||||
};
|
||||
|
||||
inline void
|
||||
__trace_hash_func_init()
|
||||
{ _GLIBCXX_PROFILE_DATA(_S_hash_func) = new __trace_hash_func(); }
|
||||
|
||||
inline void
|
||||
__trace_hash_func_free()
|
||||
{ delete _GLIBCXX_PROFILE_DATA(_S_hash_func); }
|
||||
|
||||
inline void
|
||||
__trace_hash_func_report(FILE* __f, __warning_vector_t& __warnings)
|
||||
{ __trace_report(_GLIBCXX_PROFILE_DATA(_S_hash_func), __f, __warnings); }
|
||||
|
||||
inline __hashfunc_info*
|
||||
__trace_hash_func_construct()
|
||||
{
|
||||
if (!__profcxx_init())
|
||||
return 0;
|
||||
|
||||
if (!__reentrance_guard::__get_in())
|
||||
return 0;
|
||||
|
||||
__reentrance_guard __get_out;
|
||||
return _GLIBCXX_PROFILE_DATA(_S_hash_func)->__add_object(__get_stack());
|
||||
}
|
||||
|
||||
inline void
|
||||
__trace_hash_func_destruct(__hashfunc_info* __obj_info,
|
||||
std::size_t __chain, std::size_t __accesses,
|
||||
std::size_t __hops)
|
||||
{
|
||||
_GLIBCXX_PROFILE_DATA(_S_hash_func)->__destruct(__obj_info, __chain,
|
||||
__accesses, __hops);
|
||||
}
|
||||
|
||||
} // namespace __gnu_profile
|
||||
#endif /* _GLIBCXX_PROFILE_PROFILER_HASH_FUNC_H */
|
||||
@@ -0,0 +1,100 @@
|
||||
// -*- C++ -*-
|
||||
//
|
||||
// Copyright (C) 2009-2015 Free Software Foundation, Inc.
|
||||
//
|
||||
// This file is part of the GNU ISO C++ Library. This library is free
|
||||
// software; you can redistribute it and/or modify it under the
|
||||
// terms of the GNU General Public License as published by the
|
||||
// Free Software Foundation; either version 3, or (at your option)
|
||||
// any later version.
|
||||
//
|
||||
// This library is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
|
||||
// Under Section 7 of GPL version 3, you are granted additional
|
||||
// permissions described in the GCC Runtime Library Exception, version
|
||||
// 3.1, as published by the Free Software Foundation.
|
||||
|
||||
// You should have received a copy of the GNU General Public License along
|
||||
// with this library; see the file COPYING3. If not see
|
||||
// <http://www.gnu.org/licenses/>.
|
||||
|
||||
/** @file profile/impl/profiler_hashtable_size.h
|
||||
* @brief Collection of hashtable size traces.
|
||||
*/
|
||||
|
||||
// Written by Lixia Liu and Silvius Rus.
|
||||
|
||||
#ifndef _GLIBCXX_PROFILE_PROFILER_HASHTABLE_SIZE_H
|
||||
#define _GLIBCXX_PROFILE_PROFILER_HASHTABLE_SIZE_H 1
|
||||
|
||||
#include "profile/impl/profiler.h"
|
||||
#include "profile/impl/profiler_node.h"
|
||||
#include "profile/impl/profiler_trace.h"
|
||||
#include "profile/impl/profiler_state.h"
|
||||
#include "profile/impl/profiler_container_size.h"
|
||||
|
||||
namespace __gnu_profile
|
||||
{
|
||||
/** @brief Hashtable size instrumentation trace producer. */
|
||||
class __trace_hashtable_size
|
||||
: public __trace_container_size
|
||||
{
|
||||
public:
|
||||
__trace_hashtable_size()
|
||||
: __trace_container_size()
|
||||
{ __id = "hashtable-size"; }
|
||||
};
|
||||
|
||||
inline void
|
||||
__trace_hashtable_size_init()
|
||||
{ _GLIBCXX_PROFILE_DATA(_S_hashtable_size) = new __trace_hashtable_size(); }
|
||||
|
||||
inline void
|
||||
__trace_hashtable_size_free()
|
||||
{ delete _GLIBCXX_PROFILE_DATA(_S_hashtable_size); }
|
||||
|
||||
inline void
|
||||
__trace_hashtable_size_report(FILE* __f, __warning_vector_t& __warnings)
|
||||
{ __trace_report(_GLIBCXX_PROFILE_DATA(_S_hashtable_size), __f, __warnings); }
|
||||
|
||||
inline __container_size_info*
|
||||
__trace_hashtable_size_construct(std::size_t __num)
|
||||
{
|
||||
if (!__profcxx_init())
|
||||
return 0;
|
||||
|
||||
if (!__reentrance_guard::__get_in())
|
||||
return 0;
|
||||
|
||||
__reentrance_guard __get_out;
|
||||
return _GLIBCXX_PROFILE_DATA(_S_hashtable_size)->
|
||||
__insert(__get_stack(), __num);
|
||||
}
|
||||
|
||||
inline void
|
||||
__trace_hashtable_size_resize(__container_size_info* __obj_info,
|
||||
std::size_t __from, std::size_t __to)
|
||||
{
|
||||
if (!__obj_info)
|
||||
return;
|
||||
|
||||
__obj_info->__resize(__from, __to);
|
||||
}
|
||||
|
||||
inline void
|
||||
__trace_hashtable_size_destruct(__container_size_info* __obj_info,
|
||||
std::size_t __num, std::size_t __inum)
|
||||
{
|
||||
if (!__obj_info)
|
||||
return;
|
||||
|
||||
_GLIBCXX_PROFILE_DATA(_S_hashtable_size)->
|
||||
__destruct(__obj_info, __num, __inum);
|
||||
}
|
||||
|
||||
} // namespace __gnu_profile
|
||||
|
||||
#endif /* _GLIBCXX_PROFILE_PROFILER_HASHTABLE_SIZE_H */
|
||||
168
openflow/usr/include/c++/5/profile/impl/profiler_list_to_slist.h
Normal file
168
openflow/usr/include/c++/5/profile/impl/profiler_list_to_slist.h
Normal file
@@ -0,0 +1,168 @@
|
||||
// -*- C++ -*-
|
||||
//
|
||||
// Copyright (C) 2009-2015 Free Software Foundation, Inc.
|
||||
//
|
||||
// This file is part of the GNU ISO C++ Library. This library is free
|
||||
// software; you can redistribute it and/or modify it under the
|
||||
// terms of the GNU General Public License as published by the
|
||||
// Free Software Foundation; either version 3, or (at your option)
|
||||
// any later version.
|
||||
//
|
||||
// This library is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
|
||||
// Under Section 7 of GPL version 3, you are granted additional
|
||||
// permissions described in the GCC Runtime Library Exception, version
|
||||
// 3.1, as published by the Free Software Foundation.
|
||||
|
||||
// You should have received a copy of the GNU General Public License along
|
||||
// with this library; see the file COPYING3. If not see
|
||||
// <http://www.gnu.org/licenses/>.
|
||||
|
||||
/** @file profile/impl/profiler_list_to_slist.h
|
||||
* @brief Diagnostics for list to slist.
|
||||
*/
|
||||
|
||||
// Written by Changhee Jung.
|
||||
|
||||
#ifndef _GLIBCXX_PROFILE_PROFILER_LIST_TO_SLIST_H
|
||||
#define _GLIBCXX_PROFILE_PROFILER_LIST_TO_SLIST_H 1
|
||||
|
||||
#include "profile/impl/profiler.h"
|
||||
#include "profile/impl/profiler_node.h"
|
||||
#include "profile/impl/profiler_trace.h"
|
||||
|
||||
namespace __gnu_profile
|
||||
{
|
||||
class __list2slist_info
|
||||
: public __object_info_base
|
||||
{
|
||||
public:
|
||||
__list2slist_info(__stack_t __stack)
|
||||
: __object_info_base(__stack), _M_rewind(false), _M_operations(0) { }
|
||||
|
||||
// XXX: the magnitude should be multiplied with a constant factor F,
|
||||
// where F is 1 when the malloc size class of list nodes is different
|
||||
// from the malloc size class of slist nodes. When they fall into the same
|
||||
// class, the only slist benefit is from having to set fewer links, so
|
||||
// the factor F should be much smaller, closer to 0 than to 1.
|
||||
// This could be implemented by passing the size classes in the config
|
||||
// file. For now, we always assume F to be 1.
|
||||
|
||||
float
|
||||
__magnitude() const
|
||||
{
|
||||
if (!_M_rewind)
|
||||
return _M_operations;
|
||||
else
|
||||
return 0;
|
||||
}
|
||||
|
||||
void
|
||||
__write(FILE* __f) const
|
||||
{ std::fprintf(__f, "%s\n", _M_rewind ? "invalid" : "valid"); }
|
||||
|
||||
std::string
|
||||
__advice() const
|
||||
{ return "change std::list to std::forward_list"; }
|
||||
|
||||
void
|
||||
__opr_rewind()
|
||||
{
|
||||
_M_rewind = true;
|
||||
__set_invalid();
|
||||
}
|
||||
|
||||
void
|
||||
__record_operation()
|
||||
{ ++_M_operations; }
|
||||
|
||||
bool
|
||||
__has_rewind()
|
||||
{ return _M_rewind; }
|
||||
|
||||
private:
|
||||
bool _M_rewind;
|
||||
std::size_t _M_operations;
|
||||
};
|
||||
|
||||
class __list2slist_stack_info
|
||||
: public __list2slist_info
|
||||
{
|
||||
public:
|
||||
__list2slist_stack_info(const __list2slist_info& __o)
|
||||
: __list2slist_info(__o) { }
|
||||
};
|
||||
|
||||
class __trace_list_to_slist
|
||||
: public __trace_base<__list2slist_info, __list2slist_stack_info>
|
||||
{
|
||||
public:
|
||||
~__trace_list_to_slist() { }
|
||||
|
||||
__trace_list_to_slist()
|
||||
: __trace_base<__list2slist_info, __list2slist_stack_info>()
|
||||
{ __id = "list-to-slist"; }
|
||||
|
||||
void
|
||||
__destruct(__list2slist_info* __obj_info)
|
||||
{ __retire_object(__obj_info); }
|
||||
};
|
||||
|
||||
|
||||
inline void
|
||||
__trace_list_to_slist_init()
|
||||
{ _GLIBCXX_PROFILE_DATA(_S_list_to_slist) = new __trace_list_to_slist(); }
|
||||
|
||||
inline void
|
||||
__trace_list_to_slist_free()
|
||||
{ delete _GLIBCXX_PROFILE_DATA(_S_list_to_slist); }
|
||||
|
||||
inline void
|
||||
__trace_list_to_slist_report(FILE* __f, __warning_vector_t& __warnings)
|
||||
{ __trace_report(_GLIBCXX_PROFILE_DATA(_S_list_to_slist), __f, __warnings); }
|
||||
|
||||
inline __list2slist_info*
|
||||
__trace_list_to_slist_construct()
|
||||
{
|
||||
if (!__profcxx_init())
|
||||
return 0;
|
||||
|
||||
if (!__reentrance_guard::__get_in())
|
||||
return 0;
|
||||
|
||||
__reentrance_guard __get_out;
|
||||
return _GLIBCXX_PROFILE_DATA(_S_list_to_slist)->__add_object(__get_stack());
|
||||
}
|
||||
|
||||
inline void
|
||||
__trace_list_to_slist_rewind(__list2slist_info* __obj_info)
|
||||
{
|
||||
if (!__obj_info)
|
||||
return;
|
||||
|
||||
__obj_info->__opr_rewind();
|
||||
}
|
||||
|
||||
inline void
|
||||
__trace_list_to_slist_operation(__list2slist_info* __obj_info)
|
||||
{
|
||||
if (!__obj_info)
|
||||
return;
|
||||
|
||||
__obj_info->__record_operation();
|
||||
}
|
||||
|
||||
inline void
|
||||
__trace_list_to_slist_destruct(__list2slist_info* __obj_info)
|
||||
{
|
||||
if (!__obj_info)
|
||||
return;
|
||||
|
||||
_GLIBCXX_PROFILE_DATA(_S_list_to_slist)->__destruct(__obj_info);
|
||||
}
|
||||
|
||||
} // namespace __gnu_profile
|
||||
#endif /* _GLIBCXX_PROFILE_PROFILER_LIST_TO_SLIST_H */
|
||||
@@ -0,0 +1,261 @@
|
||||
// -*- C++ -*-
|
||||
//
|
||||
// Copyright (C) 2009-2015 Free Software Foundation, Inc.
|
||||
//
|
||||
// This file is part of the GNU ISO C++ Library. This library is free
|
||||
// software; you can redistribute it and/or modify it under the
|
||||
// terms of the GNU General Public License as published by the
|
||||
// Free Software Foundation; either version 3, or (at your option)
|
||||
// any later version.
|
||||
//
|
||||
// This library is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
|
||||
// Under Section 7 of GPL version 3, you are granted additional
|
||||
// permissions described in the GCC Runtime Library Exception, version
|
||||
// 3.1, as published by the Free Software Foundation.
|
||||
|
||||
// You should have received a copy of the GNU General Public License along
|
||||
// with this library; see the file COPYING3. If not see
|
||||
// <http://www.gnu.org/licenses/>.
|
||||
|
||||
/** @file profile/impl/profiler_list_to_vector.h
|
||||
* @brief diagnostics for list to vector.
|
||||
*/
|
||||
|
||||
// Written by Changhee Jung.
|
||||
|
||||
#ifndef _GLIBCXX_PROFILE_PROFILER_LIST_TO_VECTOR_H
|
||||
#define _GLIBCXX_PROFILE_PROFILER_LIST_TO_VECTOR_H 1
|
||||
|
||||
#include <sstream>
|
||||
|
||||
#include "profile/impl/profiler.h"
|
||||
#include "profile/impl/profiler_node.h"
|
||||
#include "profile/impl/profiler_trace.h"
|
||||
|
||||
namespace __gnu_profile
|
||||
{
|
||||
/** @brief A list-to-vector instrumentation line in the object table. */
|
||||
class __list2vector_info
|
||||
: public __object_info_base
|
||||
{
|
||||
public:
|
||||
__list2vector_info(__stack_t __stack)
|
||||
: __object_info_base(__stack), _M_shift_count(0), _M_iterate(0),
|
||||
_M_resize(0), _M_list_cost(0), _M_vector_cost(0),
|
||||
_M_max_size(0) { }
|
||||
|
||||
void
|
||||
__merge(const __list2vector_info& __o)
|
||||
{
|
||||
__object_info_base::__merge(__o);
|
||||
_M_shift_count += __o._M_shift_count;
|
||||
_M_iterate += __o._M_iterate;
|
||||
_M_vector_cost += __o._M_vector_cost;
|
||||
_M_list_cost += __o._M_list_cost;
|
||||
_M_resize += __o._M_resize;
|
||||
_M_max_size = std::max( _M_max_size, __o._M_max_size);
|
||||
}
|
||||
|
||||
void
|
||||
__write(FILE* __f) const
|
||||
{
|
||||
std::fprintf(__f, "%Zu %Zu %Zu %.0f %.0f\n", _M_shift_count,
|
||||
_M_resize, _M_iterate, _M_vector_cost, _M_list_cost);
|
||||
}
|
||||
|
||||
float
|
||||
__magnitude() const
|
||||
{ return _M_list_cost - _M_vector_cost; }
|
||||
|
||||
std::string
|
||||
__advice() const
|
||||
{
|
||||
std::stringstream __sstream;
|
||||
__sstream
|
||||
<< "change std::list to std::vector and its initial size from 0 to "
|
||||
<< _M_max_size;
|
||||
return __sstream.str();
|
||||
}
|
||||
|
||||
std::size_t
|
||||
__shift_count()
|
||||
{ return _M_shift_count; }
|
||||
|
||||
std::size_t
|
||||
__iterate()
|
||||
{ return _M_iterate; }
|
||||
|
||||
float
|
||||
__list_cost()
|
||||
{ return _M_list_cost; }
|
||||
|
||||
std::size_t
|
||||
__resize()
|
||||
{ return _M_resize; }
|
||||
|
||||
void
|
||||
__set_list_cost(float __lc)
|
||||
{ _M_list_cost = __lc; }
|
||||
|
||||
void
|
||||
__set_vector_cost(float __vc)
|
||||
{ _M_vector_cost = __vc; }
|
||||
|
||||
void
|
||||
__opr_insert(std::size_t __shift, std::size_t __size)
|
||||
{
|
||||
_M_shift_count += __shift;
|
||||
_M_max_size = std::max(_M_max_size, __size);
|
||||
}
|
||||
|
||||
void
|
||||
__opr_iterate(int __num)
|
||||
{ __gnu_cxx::__atomic_add(&_M_iterate, __num); }
|
||||
|
||||
void
|
||||
__resize(std::size_t __from, std::size_t)
|
||||
{ _M_resize += __from; }
|
||||
|
||||
private:
|
||||
std::size_t _M_shift_count;
|
||||
mutable _Atomic_word _M_iterate;
|
||||
std::size_t _M_resize;
|
||||
float _M_list_cost;
|
||||
float _M_vector_cost;
|
||||
std::size_t _M_max_size;
|
||||
};
|
||||
|
||||
class __list2vector_stack_info
|
||||
: public __list2vector_info
|
||||
{
|
||||
public:
|
||||
__list2vector_stack_info(const __list2vector_info& __o)
|
||||
: __list2vector_info(__o) {}
|
||||
};
|
||||
|
||||
class __trace_list_to_vector
|
||||
: public __trace_base<__list2vector_info, __list2vector_stack_info>
|
||||
{
|
||||
public:
|
||||
__trace_list_to_vector()
|
||||
: __trace_base<__list2vector_info, __list2vector_stack_info>()
|
||||
{ __id = "list-to-vector"; }
|
||||
|
||||
~__trace_list_to_vector() { }
|
||||
|
||||
// Call at destruction/clean to set container final size.
|
||||
void
|
||||
__destruct(__list2vector_info* __obj_info)
|
||||
{
|
||||
float __vc = __vector_cost(__obj_info->__shift_count(),
|
||||
__obj_info->__iterate());
|
||||
float __lc = __list_cost(__obj_info->__shift_count(),
|
||||
__obj_info->__iterate());
|
||||
__obj_info->__set_vector_cost(__vc);
|
||||
__obj_info->__set_list_cost(__lc);
|
||||
__retire_object(__obj_info);
|
||||
}
|
||||
|
||||
// Collect cost of operations.
|
||||
float
|
||||
__vector_cost(std::size_t __shift, std::size_t __iterate)
|
||||
{
|
||||
// The resulting vector will use a 'reserve' method.
|
||||
return (__shift
|
||||
* _GLIBCXX_PROFILE_DATA(__vector_shift_cost_factor).__value
|
||||
+ __iterate
|
||||
* _GLIBCXX_PROFILE_DATA(__vector_iterate_cost_factor).__value);
|
||||
}
|
||||
|
||||
float
|
||||
__list_cost(std::size_t __shift, std::size_t __iterate)
|
||||
{
|
||||
return (__shift
|
||||
* _GLIBCXX_PROFILE_DATA(__list_shift_cost_factor).__value
|
||||
+ __iterate
|
||||
* _GLIBCXX_PROFILE_DATA(__list_iterate_cost_factor).__value);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
inline void
|
||||
__trace_list_to_vector_init()
|
||||
{ _GLIBCXX_PROFILE_DATA(_S_list_to_vector) = new __trace_list_to_vector(); }
|
||||
|
||||
inline void
|
||||
__trace_list_to_vector_free()
|
||||
{ delete _GLIBCXX_PROFILE_DATA(_S_list_to_vector); }
|
||||
|
||||
inline void
|
||||
__trace_list_to_vector_report(FILE* __f, __warning_vector_t& __warnings)
|
||||
{ __trace_report(_GLIBCXX_PROFILE_DATA(_S_list_to_vector), __f, __warnings); }
|
||||
|
||||
inline __list2vector_info*
|
||||
__trace_list_to_vector_construct()
|
||||
{
|
||||
if (!__profcxx_init())
|
||||
return 0;
|
||||
|
||||
if (!__reentrance_guard::__get_in())
|
||||
return 0;
|
||||
|
||||
__reentrance_guard __get_out;
|
||||
return _GLIBCXX_PROFILE_DATA(_S_list_to_vector)
|
||||
->__add_object(__get_stack());
|
||||
}
|
||||
|
||||
inline void
|
||||
__trace_list_to_vector_insert(__list2vector_info* __obj_info,
|
||||
std::size_t __shift, std::size_t __size)
|
||||
{
|
||||
if (!__obj_info)
|
||||
return;
|
||||
|
||||
__obj_info->__opr_insert(__shift, __size);
|
||||
}
|
||||
|
||||
inline void
|
||||
__trace_list_to_vector_iterate(__list2vector_info* __obj_info,
|
||||
int)
|
||||
{
|
||||
if (!__obj_info)
|
||||
return;
|
||||
|
||||
// We only collect if an iteration took place no matter in what side.
|
||||
__obj_info->__opr_iterate(1);
|
||||
}
|
||||
|
||||
inline void
|
||||
__trace_list_to_vector_invalid_operator(__list2vector_info* __obj_info)
|
||||
{
|
||||
if (!__obj_info)
|
||||
return;
|
||||
|
||||
__obj_info->__set_invalid();
|
||||
}
|
||||
|
||||
inline void
|
||||
__trace_list_to_vector_resize(__list2vector_info* __obj_info,
|
||||
std::size_t __from, std::size_t __to)
|
||||
{
|
||||
if (!__obj_info)
|
||||
return;
|
||||
|
||||
__obj_info->__resize(__from, __to);
|
||||
}
|
||||
|
||||
inline void
|
||||
__trace_list_to_vector_destruct(__list2vector_info* __obj_info)
|
||||
{
|
||||
if (!__obj_info)
|
||||
return;
|
||||
|
||||
_GLIBCXX_PROFILE_DATA(_S_list_to_vector)->__destruct(__obj_info);
|
||||
}
|
||||
|
||||
} // namespace __gnu_profile
|
||||
#endif /* _GLIBCXX_PROFILE_PROFILER_LIST_TO_VECTOR_H__ */
|
||||
@@ -0,0 +1,275 @@
|
||||
// -*- C++ -*-
|
||||
//
|
||||
// Copyright (C) 2009-2015 Free Software Foundation, Inc.
|
||||
//
|
||||
// This file is part of the GNU ISO C++ Library. This library is free
|
||||
// software; you can redistribute it and/or modify it under the
|
||||
// terms of the GNU General Public License as published by the
|
||||
// Free Software Foundation; either version 3, or (at your option)
|
||||
// any later version.
|
||||
//
|
||||
// This library is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
|
||||
// Under Section 7 of GPL version 3, you are granted additional
|
||||
// permissions described in the GCC Runtime Library Exception, version
|
||||
// 3.1, as published by the Free Software Foundation.
|
||||
|
||||
// You should have received a copy of the GNU General Public License along
|
||||
// with this library; see the file COPYING3. If not see
|
||||
// <http://www.gnu.org/licenses/>.
|
||||
|
||||
/** @file profile/impl/profiler_map_to_unordered_map.h
|
||||
* @brief Diagnostics for map to unordered_map.
|
||||
*/
|
||||
|
||||
// Written by Silvius Rus.
|
||||
|
||||
#ifndef _GLIBCXX_PROFILE_PROFILER_MAP_TO_UNORDERED_MAP_H
|
||||
#define _GLIBCXX_PROFILE_PROFILER_MAP_TO_UNORDERED_MAP_H 1
|
||||
|
||||
#include "profile/impl/profiler.h"
|
||||
#include "profile/impl/profiler_node.h"
|
||||
#include "profile/impl/profiler_trace.h"
|
||||
|
||||
namespace __gnu_profile
|
||||
{
|
||||
inline int
|
||||
__log2(std::size_t __size)
|
||||
{
|
||||
for (int __bit_count = sizeof(std::size_t) - 1; __bit_count >= 0;
|
||||
-- __bit_count)
|
||||
if ((2 << __bit_count) & __size)
|
||||
return __bit_count;
|
||||
return 0;
|
||||
}
|
||||
|
||||
inline float
|
||||
__map_insert_cost(std::size_t __size)
|
||||
{ return (_GLIBCXX_PROFILE_DATA(__map_insert_cost_factor).__value
|
||||
* static_cast<float>(__log2(__size))); }
|
||||
|
||||
inline float
|
||||
__map_erase_cost(std::size_t __size)
|
||||
{ return (_GLIBCXX_PROFILE_DATA(__map_erase_cost_factor).__value
|
||||
* static_cast<float>(__log2(__size))); }
|
||||
|
||||
inline float
|
||||
__map_find_cost(std::size_t __size)
|
||||
{ return (_GLIBCXX_PROFILE_DATA(__map_find_cost_factor).__value
|
||||
* static_cast<float>(__log2(__size))); }
|
||||
|
||||
/** @brief A map-to-unordered_map instrumentation line in the
|
||||
object table. */
|
||||
class __map2umap_info
|
||||
: public __object_info_base
|
||||
{
|
||||
public:
|
||||
__map2umap_info(__stack_t __stack)
|
||||
: __object_info_base(__stack), _M_insert(0), _M_erase(0), _M_find(0),
|
||||
_M_iterate(0), _M_umap_cost(0.0), _M_map_cost(0.0)
|
||||
{ }
|
||||
|
||||
void
|
||||
__merge(const __map2umap_info& __o)
|
||||
{
|
||||
__object_info_base::__merge(__o);
|
||||
_M_insert += __o._M_insert;
|
||||
_M_erase += __o._M_erase;
|
||||
_M_find += __o._M_find;
|
||||
_M_iterate += __o._M_iterate;
|
||||
_M_umap_cost += __o._M_umap_cost;
|
||||
_M_map_cost += __o._M_map_cost;
|
||||
}
|
||||
|
||||
void
|
||||
__write(FILE* __f) const
|
||||
{
|
||||
std::fprintf(__f, "%Zu %Zu %Zu %Zu %.0f %.0f\n",
|
||||
_M_insert, _M_erase, _M_find, _M_iterate, _M_map_cost,
|
||||
_M_umap_cost);
|
||||
}
|
||||
|
||||
float
|
||||
__magnitude() const
|
||||
{ return _M_map_cost - _M_umap_cost; }
|
||||
|
||||
std::string
|
||||
__advice() const
|
||||
{ return "prefer an unordered container"; }
|
||||
|
||||
void
|
||||
__record_insert(std::size_t __size, std::size_t __count)
|
||||
{
|
||||
++_M_insert;
|
||||
if (__count)
|
||||
{
|
||||
_M_map_cost += __count * __map_insert_cost(__size);
|
||||
_M_umap_cost
|
||||
+= (__count
|
||||
* _GLIBCXX_PROFILE_DATA(__umap_insert_cost_factor).__value);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
__record_erase(std::size_t __size, std::size_t __count)
|
||||
{
|
||||
++_M_erase;
|
||||
if (__count)
|
||||
{
|
||||
_M_map_cost += __count * __map_erase_cost(__size);
|
||||
_M_umap_cost
|
||||
+= (__count
|
||||
* _GLIBCXX_PROFILE_DATA(__umap_erase_cost_factor).__value);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
__record_find(std::size_t __size)
|
||||
{
|
||||
++_M_find;
|
||||
_M_map_cost += __map_find_cost(__size);
|
||||
_M_umap_cost += _GLIBCXX_PROFILE_DATA(__umap_find_cost_factor).__value;
|
||||
}
|
||||
|
||||
void
|
||||
__record_iterate(int __count)
|
||||
{ __gnu_cxx::__atomic_add(&_M_iterate, __count); }
|
||||
|
||||
void
|
||||
__set_iterate_costs()
|
||||
{
|
||||
_M_umap_cost
|
||||
+= (_M_iterate
|
||||
* _GLIBCXX_PROFILE_DATA(__umap_iterate_cost_factor).__value);
|
||||
_M_map_cost
|
||||
+= (_M_iterate
|
||||
* _GLIBCXX_PROFILE_DATA(__map_iterate_cost_factor).__value);
|
||||
}
|
||||
|
||||
private:
|
||||
std::size_t _M_insert;
|
||||
std::size_t _M_erase;
|
||||
std::size_t _M_find;
|
||||
mutable _Atomic_word _M_iterate;
|
||||
float _M_umap_cost;
|
||||
float _M_map_cost;
|
||||
};
|
||||
|
||||
|
||||
/** @brief A map-to-unordered_map instrumentation line in the
|
||||
stack table. */
|
||||
class __map2umap_stack_info
|
||||
: public __map2umap_info
|
||||
{
|
||||
public:
|
||||
__map2umap_stack_info(const __map2umap_info& __o)
|
||||
: __map2umap_info(__o) { }
|
||||
};
|
||||
|
||||
/** @brief Map-to-unordered_map instrumentation producer. */
|
||||
class __trace_map2umap
|
||||
: public __trace_base<__map2umap_info, __map2umap_stack_info>
|
||||
{
|
||||
public:
|
||||
__trace_map2umap()
|
||||
: __trace_base<__map2umap_info, __map2umap_stack_info>()
|
||||
{ __id = "ordered-to-unordered"; }
|
||||
|
||||
// Call at destruction/clean to set container final size.
|
||||
void
|
||||
__destruct(__map2umap_info* __obj_info)
|
||||
{
|
||||
__obj_info->__set_iterate_costs();
|
||||
__retire_object(__obj_info);
|
||||
}
|
||||
};
|
||||
|
||||
inline void
|
||||
__trace_map_to_unordered_map_init()
|
||||
{ _GLIBCXX_PROFILE_DATA(_S_map2umap) = new __trace_map2umap(); }
|
||||
|
||||
inline void
|
||||
__trace_map_to_unordered_map_free()
|
||||
{ delete _GLIBCXX_PROFILE_DATA(_S_map2umap); }
|
||||
|
||||
inline void
|
||||
__trace_map_to_unordered_map_report(FILE* __f,
|
||||
__warning_vector_t& __warnings)
|
||||
{ __trace_report(_GLIBCXX_PROFILE_DATA(_S_map2umap), __f, __warnings); }
|
||||
|
||||
inline __map2umap_info*
|
||||
__trace_map_to_unordered_map_construct()
|
||||
{
|
||||
if (!__profcxx_init())
|
||||
return 0;
|
||||
|
||||
if (!__reentrance_guard::__get_in())
|
||||
return 0;
|
||||
|
||||
__reentrance_guard __get_out;
|
||||
return _GLIBCXX_PROFILE_DATA(_S_map2umap)->__add_object(__get_stack());
|
||||
}
|
||||
|
||||
inline void
|
||||
__trace_map_to_unordered_map_insert(__map2umap_info* __info,
|
||||
std::size_t __size, std::size_t __count)
|
||||
{
|
||||
if (!__info)
|
||||
return;
|
||||
|
||||
__info->__record_insert(__size, __count);
|
||||
}
|
||||
|
||||
inline void
|
||||
__trace_map_to_unordered_map_erase(__map2umap_info* __info,
|
||||
std::size_t __size, std::size_t __count)
|
||||
{
|
||||
if (!__info)
|
||||
return;
|
||||
|
||||
__info->__record_erase(__size, __count);
|
||||
}
|
||||
|
||||
inline void
|
||||
__trace_map_to_unordered_map_find(__map2umap_info* __info,
|
||||
std::size_t __size)
|
||||
{
|
||||
if (!__info)
|
||||
return;
|
||||
|
||||
__info->__record_find(__size);
|
||||
}
|
||||
|
||||
inline void
|
||||
__trace_map_to_unordered_map_iterate(__map2umap_info* __info,
|
||||
int)
|
||||
{
|
||||
if (!__info)
|
||||
return;
|
||||
|
||||
// We only collect if an iteration took place no matter in what side.
|
||||
__info->__record_iterate(1);
|
||||
}
|
||||
|
||||
inline void
|
||||
__trace_map_to_unordered_map_invalidate(__map2umap_info* __info)
|
||||
{
|
||||
if (!__info)
|
||||
return;
|
||||
|
||||
__info->__set_invalid();
|
||||
}
|
||||
|
||||
inline void
|
||||
__trace_map_to_unordered_map_destruct(__map2umap_info* __info)
|
||||
{
|
||||
if (!__info)
|
||||
return;
|
||||
|
||||
_GLIBCXX_PROFILE_DATA(_S_map2umap)->__destruct(__info);
|
||||
}
|
||||
} // namespace __gnu_profile
|
||||
#endif /* _GLIBCXX_PROFILE_PROFILER_MAP_TO_UNORDERED_MAP_H */
|
||||
155
openflow/usr/include/c++/5/profile/impl/profiler_node.h
Normal file
155
openflow/usr/include/c++/5/profile/impl/profiler_node.h
Normal file
@@ -0,0 +1,155 @@
|
||||
// -*- C++ -*-
|
||||
//
|
||||
// Copyright (C) 2009-2015 Free Software Foundation, Inc.
|
||||
//
|
||||
// This file is part of the GNU ISO C++ Library. This library is free
|
||||
// software; you can redistribute it and/or modify it under the
|
||||
// terms of the GNU General Public License as published by the
|
||||
// Free Software Foundation; either version 3, or (at your option)
|
||||
// any later version.
|
||||
//
|
||||
// This library is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
|
||||
// Under Section 7 of GPL version 3, you are granted additional
|
||||
// permissions described in the GCC Runtime Library Exception, version
|
||||
// 3.1, as published by the Free Software Foundation.
|
||||
|
||||
// You should have received a copy of the GNU General Public License along
|
||||
// with this library; see the file COPYING3. If not see
|
||||
// <http://www.gnu.org/licenses/>.
|
||||
|
||||
/** @file profile/impl/profiler_node.h
|
||||
* @brief Data structures to represent a single profiling event.
|
||||
*/
|
||||
|
||||
// Written by Lixia Liu and Silvius Rus.
|
||||
|
||||
#ifndef _GLIBCXX_PROFILE_PROFILER_NODE_H
|
||||
#define _GLIBCXX_PROFILE_PROFILER_NODE_H 1
|
||||
|
||||
#include <cstdio> // FILE, fprintf
|
||||
|
||||
#include <vector>
|
||||
#if defined _GLIBCXX_HAVE_EXECINFO_H
|
||||
#include <execinfo.h>
|
||||
#endif
|
||||
|
||||
namespace __gnu_profile
|
||||
{
|
||||
typedef void* __instruction_address_t;
|
||||
typedef std::_GLIBCXX_STD_C::vector<__instruction_address_t> __stack_npt;
|
||||
typedef __stack_npt* __stack_t;
|
||||
|
||||
std::size_t __stack_max_depth();
|
||||
|
||||
inline __stack_t
|
||||
__get_stack()
|
||||
{
|
||||
#if defined _GLIBCXX_HAVE_EXECINFO_H
|
||||
__try
|
||||
{
|
||||
std::size_t __max_depth = __stack_max_depth();
|
||||
if (__max_depth == 0)
|
||||
return 0;
|
||||
__stack_npt __buffer(__max_depth);
|
||||
int __depth = backtrace(&__buffer[0], __max_depth);
|
||||
return new(std::nothrow) __stack_npt(__buffer.begin(),
|
||||
__buffer.begin() + __depth);
|
||||
}
|
||||
__catch(...)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
#else
|
||||
return 0;
|
||||
#endif
|
||||
}
|
||||
|
||||
inline std::size_t
|
||||
__size(__stack_t __stack)
|
||||
{
|
||||
if (!__stack)
|
||||
return 0;
|
||||
else
|
||||
return __stack->size();
|
||||
}
|
||||
|
||||
// XXX
|
||||
inline void
|
||||
__write(FILE* __f, __stack_t __stack)
|
||||
{
|
||||
if (!__stack)
|
||||
return;
|
||||
|
||||
__stack_npt::const_iterator __it;
|
||||
for (__it = __stack->begin(); __it != __stack->end(); ++__it)
|
||||
std::fprintf(__f, "%p ", *__it);
|
||||
}
|
||||
|
||||
/** @brief Hash function for summary trace using call stack as index. */
|
||||
class __stack_hash
|
||||
{
|
||||
public:
|
||||
std::size_t
|
||||
operator()(__stack_t __s) const
|
||||
{
|
||||
if (!__s)
|
||||
return 0;
|
||||
|
||||
std::size_t __index = 0;
|
||||
__stack_npt::const_iterator __it;
|
||||
for (__it = __s->begin(); __it != __s->end(); ++__it)
|
||||
__index += reinterpret_cast<std::size_t>(*__it);
|
||||
return __index;
|
||||
}
|
||||
|
||||
bool operator() (__stack_t __stack1, __stack_t __stack2) const
|
||||
{
|
||||
if (!__stack1 && !__stack2)
|
||||
return true;
|
||||
if (!__stack1 || !__stack2)
|
||||
return false;
|
||||
if (__stack1->size() != __stack2->size())
|
||||
return false;
|
||||
|
||||
std::size_t __byte_size
|
||||
= __stack1->size() * sizeof(__stack_npt::value_type);
|
||||
return __builtin_memcmp(&(*__stack1)[0], &(*__stack2)[0],
|
||||
__byte_size) == 0;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
/** @brief Base class for a line in the object table. */
|
||||
class __object_info_base
|
||||
{
|
||||
public:
|
||||
__object_info_base(__stack_t __stack)
|
||||
: _M_stack(__stack), _M_valid(true) { }
|
||||
|
||||
bool
|
||||
__is_valid() const
|
||||
{ return _M_valid; }
|
||||
|
||||
void
|
||||
__set_invalid()
|
||||
{ _M_valid = false; }
|
||||
|
||||
void
|
||||
__merge(const __object_info_base& __o)
|
||||
{ _M_valid &= __o._M_valid; }
|
||||
|
||||
__stack_t
|
||||
__stack() const
|
||||
{ return _M_stack; }
|
||||
|
||||
protected:
|
||||
__stack_t _M_stack;
|
||||
bool _M_valid;
|
||||
};
|
||||
|
||||
} // namespace __gnu_profile
|
||||
#endif /* _GLIBCXX_PROFILE_PROFILER_NODE_H */
|
||||
69
openflow/usr/include/c++/5/profile/impl/profiler_state.h
Normal file
69
openflow/usr/include/c++/5/profile/impl/profiler_state.h
Normal file
@@ -0,0 +1,69 @@
|
||||
// -*- C++ -*-
|
||||
//
|
||||
// Copyright (C) 2009-2015 Free Software Foundation, Inc.
|
||||
//
|
||||
// This file is part of the GNU ISO C++ Library. This library is free
|
||||
// software; you can redistribute it and/or modify it under the
|
||||
// terms of the GNU General Public License as published by the
|
||||
// Free Software Foundation; either version 3, or (at your option)
|
||||
// any later version.
|
||||
//
|
||||
// This library is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
|
||||
// Under Section 7 of GPL version 3, you are granted additional
|
||||
// permissions described in the GCC Runtime Library Exception, version
|
||||
// 3.1, as published by the Free Software Foundation.
|
||||
|
||||
// You should have received a copy of the GNU General Public License along
|
||||
// with this library; see the file COPYING3. If not see
|
||||
// <http://www.gnu.org/licenses/>.
|
||||
|
||||
/** @file profile/impl/profiler_state.h
|
||||
* @brief Global profiler state.
|
||||
*/
|
||||
|
||||
// Written by Lixia Liu and Silvius Rus.
|
||||
|
||||
#ifndef _GLIBCXX_PROFILE_PROFILER_STATE_H
|
||||
#define _GLIBCXX_PROFILE_PROFILER_STATE_H 1
|
||||
|
||||
namespace __gnu_profile
|
||||
{
|
||||
enum __state_type { __ON, __OFF, __INVALID };
|
||||
|
||||
_GLIBCXX_PROFILE_DEFINE_DATA(__state_type, __state, __INVALID);
|
||||
|
||||
inline bool
|
||||
__turn(__state_type __s)
|
||||
{
|
||||
__state_type inv(__INVALID);
|
||||
return __atomic_compare_exchange_n(&_GLIBCXX_PROFILE_DATA(__state),
|
||||
&inv, __s, false, __ATOMIC_ACQ_REL,
|
||||
__ATOMIC_RELAXED);
|
||||
}
|
||||
|
||||
inline bool
|
||||
__turn_on()
|
||||
{ return __turn(__ON); }
|
||||
|
||||
inline bool
|
||||
__turn_off()
|
||||
{ return __turn(__OFF); }
|
||||
|
||||
inline bool
|
||||
__is_on()
|
||||
{ return _GLIBCXX_PROFILE_DATA(__state) == __ON; }
|
||||
|
||||
inline bool
|
||||
__is_off()
|
||||
{ return _GLIBCXX_PROFILE_DATA(__state) == __OFF; }
|
||||
|
||||
inline bool
|
||||
__is_invalid()
|
||||
{ return _GLIBCXX_PROFILE_DATA(__state) == __INVALID; }
|
||||
|
||||
} // end namespace __gnu_profile
|
||||
#endif /* _GLIBCXX_PROFILE_PROFILER_STATE_H */
|
||||
663
openflow/usr/include/c++/5/profile/impl/profiler_trace.h
Normal file
663
openflow/usr/include/c++/5/profile/impl/profiler_trace.h
Normal file
@@ -0,0 +1,663 @@
|
||||
// -*- C++ -*-
|
||||
//
|
||||
// Copyright (C) 2009-2015 Free Software Foundation, Inc.
|
||||
//
|
||||
// This file is part of the GNU ISO C++ Library. This library is free
|
||||
// software; you can redistribute it and/or modify it under the
|
||||
// terms of the GNU General Public License as published by the
|
||||
// Free Software Foundation; either version 3, or (at your option)
|
||||
// any later version.
|
||||
//
|
||||
// This library is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
|
||||
// Under Section 7 of GPL version 3, you are granted additional
|
||||
// permissions described in the GCC Runtime Library Exception, version
|
||||
// 3.1, as published by the Free Software Foundation.
|
||||
|
||||
// You should have received a copy of the GNU General Public License along
|
||||
// with this library; see the file COPYING3. If not see
|
||||
// <http://www.gnu.org/licenses/>.
|
||||
|
||||
/** @file profile/impl/profiler_trace.h
|
||||
* @brief Data structures to represent profiling traces.
|
||||
*/
|
||||
|
||||
// Written by Lixia Liu and Silvius Rus.
|
||||
|
||||
#ifndef _GLIBCXX_PROFILE_PROFILER_TRACE_H
|
||||
#define _GLIBCXX_PROFILE_PROFILER_TRACE_H 1
|
||||
|
||||
#include <cstdio> // fopen, fclose, fprintf, FILE
|
||||
#include <cerrno>
|
||||
#include <cstdlib> // atof, atoi, strtol, getenv, atexit, abort
|
||||
|
||||
#if __cplusplus >= 201103L
|
||||
#include <unordered_map>
|
||||
#define _GLIBCXX_IMPL_UNORDERED_MAP std::_GLIBCXX_STD_C::unordered_map
|
||||
#else
|
||||
#include <tr1/unordered_map>
|
||||
#define _GLIBCXX_IMPL_UNORDERED_MAP std::tr1::unordered_map
|
||||
#endif
|
||||
|
||||
#include <ext/concurrence.h>
|
||||
#include <fstream>
|
||||
#include <string>
|
||||
#include <utility>
|
||||
#include <vector>
|
||||
|
||||
#include "profile/impl/profiler_algos.h"
|
||||
#include "profile/impl/profiler_state.h"
|
||||
#include "profile/impl/profiler_node.h"
|
||||
|
||||
namespace __gnu_profile
|
||||
{
|
||||
/** @brief Internal environment. Values can be set one of two ways:
|
||||
1. In config file "var = value". The default config file path is
|
||||
libstdcxx-profile.conf.
|
||||
2. By setting process environment variables. For instance, in a Bash
|
||||
shell you can set the unit cost of iterating through a map like this:
|
||||
export __map_iterate_cost_factor=5.0.
|
||||
If a value is set both in the input file and through an environment
|
||||
variable, the environment value takes precedence. */
|
||||
typedef _GLIBCXX_IMPL_UNORDERED_MAP<std::string, std::string> __env_t;
|
||||
|
||||
_GLIBCXX_PROFILE_DEFINE_UNINIT_DATA(__env_t, __env);
|
||||
|
||||
/** @brief Master lock. */
|
||||
_GLIBCXX_PROFILE_DEFINE_UNINIT_DATA(__gnu_cxx::__mutex, __global_mutex);
|
||||
|
||||
/** @brief Representation of a warning. */
|
||||
struct __warning_data
|
||||
{
|
||||
float __magnitude;
|
||||
__stack_t __context;
|
||||
const char* __warning_id;
|
||||
std::string __warning_message;
|
||||
|
||||
__warning_data()
|
||||
: __magnitude(0.0), __context(0), __warning_id(0) { }
|
||||
|
||||
__warning_data(float __m, __stack_t __c, const char* __id,
|
||||
const std::string& __msg)
|
||||
: __magnitude(__m), __context(__c), __warning_id(__id),
|
||||
__warning_message(__msg) { }
|
||||
|
||||
bool
|
||||
operator<(const __warning_data& __other) const
|
||||
{ return __magnitude < __other.__magnitude; }
|
||||
};
|
||||
|
||||
typedef std::_GLIBCXX_STD_C::vector<__warning_data> __warning_vector_t;
|
||||
|
||||
// Defined in profiler_<diagnostic name>.h.
|
||||
class __trace_hash_func;
|
||||
class __trace_hashtable_size;
|
||||
class __trace_map2umap;
|
||||
class __trace_vector_size;
|
||||
class __trace_vector_to_list;
|
||||
class __trace_list_to_slist;
|
||||
class __trace_list_to_vector;
|
||||
void __trace_vector_size_init();
|
||||
void __trace_hashtable_size_init();
|
||||
void __trace_hash_func_init();
|
||||
void __trace_vector_to_list_init();
|
||||
void __trace_list_to_slist_init();
|
||||
void __trace_list_to_vector_init();
|
||||
void __trace_map_to_unordered_map_init();
|
||||
void __trace_vector_size_report(FILE*, __warning_vector_t&);
|
||||
void __trace_hashtable_size_report(FILE*, __warning_vector_t&);
|
||||
void __trace_hash_func_report(FILE*, __warning_vector_t&);
|
||||
void __trace_vector_to_list_report(FILE*, __warning_vector_t&);
|
||||
void __trace_list_to_slist_report(FILE*, __warning_vector_t&);
|
||||
void __trace_list_to_vector_report(FILE*, __warning_vector_t&);
|
||||
void __trace_map_to_unordered_map_report(FILE*, __warning_vector_t&);
|
||||
void __trace_vector_size_free();
|
||||
void __trace_hashtable_size_free();
|
||||
void __trace_hash_func_free();
|
||||
void __trace_vector_to_list_free();
|
||||
void __trace_list_to_slist_free();
|
||||
void __trace_list_to_vector_free();
|
||||
void __trace_map_to_unordered_map_free();
|
||||
|
||||
struct __cost_factor
|
||||
{
|
||||
const char* __env_var;
|
||||
float __value;
|
||||
};
|
||||
|
||||
typedef std::_GLIBCXX_STD_C::vector<__cost_factor*> __cost_factor_vector;
|
||||
|
||||
_GLIBCXX_PROFILE_DEFINE_DATA(__trace_hash_func*, _S_hash_func, 0);
|
||||
_GLIBCXX_PROFILE_DEFINE_DATA(__trace_hashtable_size*, _S_hashtable_size, 0);
|
||||
_GLIBCXX_PROFILE_DEFINE_DATA(__trace_map2umap*, _S_map2umap, 0);
|
||||
_GLIBCXX_PROFILE_DEFINE_DATA(__trace_vector_size*, _S_vector_size, 0);
|
||||
_GLIBCXX_PROFILE_DEFINE_DATA(__trace_vector_to_list*, _S_vector_to_list, 0);
|
||||
_GLIBCXX_PROFILE_DEFINE_DATA(__trace_list_to_slist*, _S_list_to_slist, 0);
|
||||
_GLIBCXX_PROFILE_DEFINE_DATA(__trace_list_to_vector*, _S_list_to_vector, 0);
|
||||
|
||||
_GLIBCXX_PROFILE_DEFINE_DATA(__cost_factor, __vector_shift_cost_factor,
|
||||
{"__vector_shift_cost_factor", 1.0});
|
||||
_GLIBCXX_PROFILE_DEFINE_DATA(__cost_factor, __vector_iterate_cost_factor,
|
||||
{"__vector_iterate_cost_factor", 1.0});
|
||||
_GLIBCXX_PROFILE_DEFINE_DATA(__cost_factor, __vector_resize_cost_factor,
|
||||
{"__vector_resize_cost_factor", 1.0});
|
||||
_GLIBCXX_PROFILE_DEFINE_DATA(__cost_factor, __list_shift_cost_factor,
|
||||
{"__list_shift_cost_factor", 0.0});
|
||||
_GLIBCXX_PROFILE_DEFINE_DATA(__cost_factor, __list_iterate_cost_factor,
|
||||
{"__list_iterate_cost_factor", 10.0});
|
||||
_GLIBCXX_PROFILE_DEFINE_DATA(__cost_factor, __list_resize_cost_factor,
|
||||
{"__list_resize_cost_factor", 0.0});
|
||||
_GLIBCXX_PROFILE_DEFINE_DATA(__cost_factor, __map_insert_cost_factor,
|
||||
{"__map_insert_cost_factor", 1.5});
|
||||
_GLIBCXX_PROFILE_DEFINE_DATA(__cost_factor, __map_erase_cost_factor,
|
||||
{"__map_erase_cost_factor", 1.5});
|
||||
_GLIBCXX_PROFILE_DEFINE_DATA(__cost_factor, __map_find_cost_factor,
|
||||
{"__map_find_cost_factor", 1});
|
||||
_GLIBCXX_PROFILE_DEFINE_DATA(__cost_factor, __map_iterate_cost_factor,
|
||||
{"__map_iterate_cost_factor", 2.3});
|
||||
_GLIBCXX_PROFILE_DEFINE_DATA(__cost_factor, __umap_insert_cost_factor,
|
||||
{"__umap_insert_cost_factor", 12.0});
|
||||
_GLIBCXX_PROFILE_DEFINE_DATA(__cost_factor, __umap_erase_cost_factor,
|
||||
{"__umap_erase_cost_factor", 12.0});
|
||||
_GLIBCXX_PROFILE_DEFINE_DATA(__cost_factor, __umap_find_cost_factor,
|
||||
{"__umap_find_cost_factor", 10.0});
|
||||
_GLIBCXX_PROFILE_DEFINE_DATA(__cost_factor, __umap_iterate_cost_factor,
|
||||
{"__umap_iterate_cost_factor", 1.7});
|
||||
_GLIBCXX_PROFILE_DEFINE_DATA(__cost_factor_vector*, __cost_factors, 0);
|
||||
|
||||
_GLIBCXX_PROFILE_DEFINE_DATA(const char*, _S_trace_file_name,
|
||||
_GLIBCXX_PROFILE_TRACE_PATH_ROOT);
|
||||
_GLIBCXX_PROFILE_DEFINE_DATA(std::size_t, _S_max_warn_count,
|
||||
_GLIBCXX_PROFILE_MAX_WARN_COUNT);
|
||||
_GLIBCXX_PROFILE_DEFINE_DATA(std::size_t, _S_max_stack_depth,
|
||||
_GLIBCXX_PROFILE_MAX_STACK_DEPTH);
|
||||
_GLIBCXX_PROFILE_DEFINE_DATA(std::size_t, _S_max_mem,
|
||||
_GLIBCXX_PROFILE_MEM_PER_DIAGNOSTIC);
|
||||
|
||||
inline std::size_t
|
||||
__stack_max_depth()
|
||||
{ return _GLIBCXX_PROFILE_DATA(_S_max_stack_depth); }
|
||||
|
||||
inline std::size_t
|
||||
__max_mem()
|
||||
{ return _GLIBCXX_PROFILE_DATA(_S_max_mem); }
|
||||
|
||||
/** @brief Base class for all trace producers. */
|
||||
template<typename __object_info, typename __stack_info>
|
||||
class __trace_base
|
||||
{
|
||||
public:
|
||||
// Do not pick the initial size too large, as we don't know which
|
||||
// diagnostics are more active.
|
||||
__trace_base()
|
||||
: __objects_byte_size(0), __stack_table(10000),
|
||||
__stack_table_byte_size(0), __id(0) { }
|
||||
|
||||
~__trace_base()
|
||||
{
|
||||
for (typename __stack_table_t::iterator __it
|
||||
= __stack_table.begin(); __it != __stack_table.end(); ++__it)
|
||||
delete __it->first;
|
||||
}
|
||||
|
||||
__object_info* __add_object(__stack_t __stack);
|
||||
void __retire_object(__object_info* __info);
|
||||
void __write(FILE* __f);
|
||||
void __collect_warnings(__warning_vector_t& __warnings);
|
||||
void __free();
|
||||
|
||||
private:
|
||||
__gnu_cxx::__mutex __trace_mutex;
|
||||
typedef _GLIBCXX_IMPL_UNORDERED_MAP<__stack_t, __stack_info,
|
||||
__stack_hash,
|
||||
__stack_hash> __stack_table_t;
|
||||
std::size_t __objects_byte_size;
|
||||
__stack_table_t __stack_table;
|
||||
std::size_t __stack_table_byte_size;
|
||||
|
||||
protected:
|
||||
const char* __id;
|
||||
};
|
||||
|
||||
template<typename __object_info, typename __stack_info>
|
||||
__object_info*
|
||||
__trace_base<__object_info, __stack_info>::
|
||||
__add_object(__stack_t __stack)
|
||||
{
|
||||
// If we have no backtrace information no need to collect data.
|
||||
if (!__stack)
|
||||
return 0;
|
||||
|
||||
__gnu_cxx::__scoped_lock __lock(this->__trace_mutex);
|
||||
|
||||
if (__max_mem() != 0 && __objects_byte_size >= __max_mem())
|
||||
{
|
||||
delete __stack;
|
||||
return 0;
|
||||
}
|
||||
|
||||
__object_info* __ret = new(std::nothrow) __object_info(__stack);
|
||||
if (!__ret)
|
||||
{
|
||||
delete __stack;
|
||||
return 0;
|
||||
}
|
||||
|
||||
__objects_byte_size += sizeof(__object_info);
|
||||
return __ret;
|
||||
}
|
||||
|
||||
template<typename __object_info, typename __stack_info>
|
||||
void
|
||||
__trace_base<__object_info, __stack_info>::
|
||||
__retire_object(__object_info* __obj_info)
|
||||
{
|
||||
if (!__obj_info)
|
||||
return;
|
||||
|
||||
__gnu_cxx::__scoped_lock __lock(this->__trace_mutex);
|
||||
|
||||
const __object_info& __info = *__obj_info;
|
||||
__stack_t __stack = __info.__stack();
|
||||
typename __stack_table_t::iterator __stack_it
|
||||
= __stack_table.find(__stack);
|
||||
|
||||
if (__stack_it == __stack_table.end())
|
||||
{
|
||||
// First occurrence of this call context.
|
||||
if (__max_mem() == 0 || __stack_table_byte_size < __max_mem())
|
||||
{
|
||||
__stack_table_byte_size
|
||||
+= (sizeof(__instruction_address_t) * __size(__stack)
|
||||
+ sizeof(__stack) + sizeof(__stack_info));
|
||||
__stack_table.insert(make_pair(__stack,
|
||||
__stack_info(__info)));
|
||||
}
|
||||
else
|
||||
delete __stack;
|
||||
}
|
||||
else
|
||||
{
|
||||
// Merge object info into info summary for this call context.
|
||||
__stack_it->second.__merge(__info);
|
||||
delete __stack;
|
||||
}
|
||||
|
||||
delete __obj_info;
|
||||
__objects_byte_size -= sizeof(__object_info);
|
||||
}
|
||||
|
||||
template<typename __object_info, typename __stack_info>
|
||||
void
|
||||
__trace_base<__object_info, __stack_info>::
|
||||
__write(FILE* __f)
|
||||
{
|
||||
for (typename __stack_table_t::iterator __it
|
||||
= __stack_table.begin(); __it != __stack_table.end(); ++__it)
|
||||
if (__it->second.__is_valid())
|
||||
{
|
||||
std::fprintf(__f, __id);
|
||||
std::fprintf(__f, "|");
|
||||
__gnu_profile::__write(__f, __it->first);
|
||||
std::fprintf(__f, "|");
|
||||
__it->second.__write(__f);
|
||||
}
|
||||
}
|
||||
|
||||
template<typename __object_info, typename __stack_info>
|
||||
void
|
||||
__trace_base<__object_info, __stack_info>::
|
||||
__collect_warnings(__warning_vector_t& __warnings)
|
||||
{
|
||||
for (typename __stack_table_t::iterator __it
|
||||
= __stack_table.begin(); __it != __stack_table.end(); ++__it)
|
||||
__warnings.push_back(__warning_data(__it->second.__magnitude(),
|
||||
__it->first, __id,
|
||||
__it->second.__advice()));
|
||||
}
|
||||
|
||||
template<typename __object_info, typename __stack_info>
|
||||
inline void
|
||||
__trace_report(__trace_base<__object_info, __stack_info>* __cont,
|
||||
FILE* __f, __warning_vector_t& __warnings)
|
||||
{
|
||||
if (__cont)
|
||||
{
|
||||
__cont->__collect_warnings(__warnings);
|
||||
__cont->__write(__f);
|
||||
}
|
||||
}
|
||||
|
||||
inline std::size_t
|
||||
__env_to_size_t(const char* __env_var, std::size_t __default_value)
|
||||
{
|
||||
char* __env_value = std::getenv(__env_var);
|
||||
if (__env_value)
|
||||
{
|
||||
errno = 0;
|
||||
long __converted_value = std::strtol(__env_value, 0, 10);
|
||||
if (errno || __converted_value < 0)
|
||||
{
|
||||
std::fprintf(stderr,
|
||||
"Bad value for environment variable '%s'.\n",
|
||||
__env_var);
|
||||
std::abort();
|
||||
}
|
||||
else
|
||||
return static_cast<std::size_t>(__converted_value);
|
||||
}
|
||||
else
|
||||
return __default_value;
|
||||
}
|
||||
|
||||
inline void
|
||||
__set_max_stack_trace_depth()
|
||||
{
|
||||
_GLIBCXX_PROFILE_DATA(_S_max_stack_depth)
|
||||
= __env_to_size_t(_GLIBCXX_PROFILE_MAX_STACK_DEPTH_ENV_VAR,
|
||||
_GLIBCXX_PROFILE_DATA(_S_max_stack_depth));
|
||||
}
|
||||
|
||||
inline void
|
||||
__set_max_mem()
|
||||
{
|
||||
_GLIBCXX_PROFILE_DATA(_S_max_mem)
|
||||
= __env_to_size_t(_GLIBCXX_PROFILE_MEM_PER_DIAGNOSTIC_ENV_VAR,
|
||||
_GLIBCXX_PROFILE_DATA(_S_max_mem));
|
||||
}
|
||||
|
||||
inline int
|
||||
__log_magnitude(float __f)
|
||||
{
|
||||
const float __log_base = 10.0;
|
||||
int __result = 0;
|
||||
int __sign = 1;
|
||||
|
||||
if (__f < 0)
|
||||
{
|
||||
__f = -__f;
|
||||
__sign = -1;
|
||||
}
|
||||
|
||||
while (__f > __log_base)
|
||||
{
|
||||
++__result;
|
||||
__f /= 10.0;
|
||||
}
|
||||
return __sign * __result;
|
||||
}
|
||||
|
||||
inline FILE*
|
||||
__open_output_file(const char* __extension)
|
||||
{
|
||||
// The path is made of _S_trace_file_name + "." + extension.
|
||||
std::size_t __root_len
|
||||
= __builtin_strlen(_GLIBCXX_PROFILE_DATA(_S_trace_file_name));
|
||||
std::size_t __ext_len = __builtin_strlen(__extension);
|
||||
char* __file_name = new char[__root_len + 1 + __ext_len + 1];
|
||||
__builtin_memcpy(__file_name,
|
||||
_GLIBCXX_PROFILE_DATA(_S_trace_file_name),
|
||||
__root_len);
|
||||
*(__file_name + __root_len) = '.';
|
||||
__builtin_memcpy(__file_name + __root_len + 1,
|
||||
__extension, __ext_len + 1);
|
||||
|
||||
FILE* __out_file = std::fopen(__file_name, "w");
|
||||
if (!__out_file)
|
||||
{
|
||||
std::fprintf(stderr, "Could not open trace file '%s'.\n",
|
||||
__file_name);
|
||||
std::abort();
|
||||
}
|
||||
|
||||
delete[] __file_name;
|
||||
return __out_file;
|
||||
}
|
||||
|
||||
struct __warn
|
||||
{
|
||||
FILE* __file;
|
||||
|
||||
__warn(FILE* __f)
|
||||
{ __file = __f; }
|
||||
|
||||
void
|
||||
operator()(const __warning_data& __info)
|
||||
{
|
||||
std::fprintf(__file, __info.__warning_id);
|
||||
std::fprintf(__file, ": improvement = %d",
|
||||
__log_magnitude(__info.__magnitude));
|
||||
std::fprintf(__file, ": call stack = ");
|
||||
__gnu_profile::__write(__file, __info.__context);
|
||||
std::fprintf(__file, ": advice = %s\n",
|
||||
__info.__warning_message.c_str());
|
||||
}
|
||||
};
|
||||
|
||||
/** @brief Final report method, registered with @b atexit.
|
||||
*
|
||||
* This can also be called directly by user code, including signal handlers.
|
||||
* It is protected against deadlocks by the reentrance guard in profiler.h.
|
||||
* However, when called from a signal handler that triggers while within
|
||||
* __gnu_profile (under the guarded zone), no output will be produced.
|
||||
*/
|
||||
inline void
|
||||
__report()
|
||||
{
|
||||
__gnu_cxx::__scoped_lock __lock(_GLIBCXX_PROFILE_DATA(__global_mutex));
|
||||
|
||||
__warning_vector_t __warnings, __top_warnings;
|
||||
|
||||
FILE* __raw_file = __open_output_file("raw");
|
||||
__trace_vector_size_report(__raw_file, __warnings);
|
||||
__trace_hashtable_size_report(__raw_file, __warnings);
|
||||
__trace_hash_func_report(__raw_file, __warnings);
|
||||
__trace_vector_to_list_report(__raw_file, __warnings);
|
||||
__trace_list_to_slist_report(__raw_file, __warnings);
|
||||
__trace_list_to_vector_report(__raw_file, __warnings);
|
||||
__trace_map_to_unordered_map_report(__raw_file, __warnings);
|
||||
std::fclose(__raw_file);
|
||||
|
||||
// Sort data by magnitude, keeping just top N.
|
||||
std::size_t __cutoff = std::min(_GLIBCXX_PROFILE_DATA(_S_max_warn_count),
|
||||
__warnings.size());
|
||||
__top_n(__warnings, __top_warnings, __cutoff);
|
||||
|
||||
FILE* __warn_file = __open_output_file("txt");
|
||||
__for_each(__top_warnings.begin(), __top_warnings.end(),
|
||||
__warn(__warn_file));
|
||||
std::fclose(__warn_file);
|
||||
}
|
||||
|
||||
inline void
|
||||
__report_and_free()
|
||||
{
|
||||
__report();
|
||||
|
||||
__trace_map_to_unordered_map_free();
|
||||
__trace_list_to_vector_free();
|
||||
__trace_list_to_slist_free();
|
||||
__trace_vector_to_list_free();
|
||||
__trace_hash_func_free();
|
||||
__trace_hashtable_size_free();
|
||||
__trace_vector_size_free();
|
||||
delete _GLIBCXX_PROFILE_DATA(__cost_factors);
|
||||
}
|
||||
|
||||
inline void
|
||||
__set_trace_path()
|
||||
{
|
||||
char* __env_trace_file_name = std::getenv(_GLIBCXX_PROFILE_TRACE_ENV_VAR);
|
||||
|
||||
if (__env_trace_file_name)
|
||||
_GLIBCXX_PROFILE_DATA(_S_trace_file_name) = __env_trace_file_name;
|
||||
|
||||
// Make sure early that we can create the trace file.
|
||||
std::fclose(__open_output_file("txt"));
|
||||
}
|
||||
|
||||
inline void
|
||||
__set_max_warn_count()
|
||||
{
|
||||
char* __env_max_warn_count_str
|
||||
= std::getenv(_GLIBCXX_PROFILE_MAX_WARN_COUNT_ENV_VAR);
|
||||
|
||||
if (__env_max_warn_count_str)
|
||||
_GLIBCXX_PROFILE_DATA(_S_max_warn_count)
|
||||
= static_cast<std::size_t>(std::atoi(__env_max_warn_count_str));
|
||||
}
|
||||
|
||||
inline void
|
||||
__read_cost_factors()
|
||||
{
|
||||
std::string __conf_file_name(_GLIBCXX_PROFILE_DATA(_S_trace_file_name));
|
||||
__conf_file_name += ".conf";
|
||||
|
||||
std::ifstream __conf_file(__conf_file_name.c_str());
|
||||
|
||||
if (__conf_file.is_open())
|
||||
{
|
||||
std::string __line;
|
||||
|
||||
while (std::getline(__conf_file, __line))
|
||||
{
|
||||
std::string::size_type __i = __line.find_first_not_of(" \t\n\v");
|
||||
|
||||
if (__line.length() <= 0 || __line[__i] == '#')
|
||||
// Skip empty lines or comments.
|
||||
continue;
|
||||
}
|
||||
|
||||
// Trim.
|
||||
__line.erase(__remove(__line.begin(), __line.end(), ' '),
|
||||
__line.end());
|
||||
std::string::size_type __pos = __line.find("=");
|
||||
std::string __factor_name = __line.substr(0, __pos);
|
||||
std::string::size_type __end = __line.find_first_of(";\n");
|
||||
std::string __factor_value = __line.substr(__pos + 1, __end - __pos);
|
||||
|
||||
_GLIBCXX_PROFILE_DATA(__env)[__factor_name] = __factor_value;
|
||||
}
|
||||
}
|
||||
|
||||
struct __cost_factor_writer
|
||||
{
|
||||
FILE* __file;
|
||||
|
||||
__cost_factor_writer(FILE* __f)
|
||||
: __file(__f) { }
|
||||
|
||||
void
|
||||
operator() (const __cost_factor* __factor)
|
||||
{ std::fprintf(__file, "%s = %f\n", __factor->__env_var,
|
||||
__factor->__value); }
|
||||
};
|
||||
|
||||
inline void
|
||||
__write_cost_factors()
|
||||
{
|
||||
FILE* __file = __open_output_file("conf.out");
|
||||
__for_each(_GLIBCXX_PROFILE_DATA(__cost_factors)->begin(),
|
||||
_GLIBCXX_PROFILE_DATA(__cost_factors)->end(),
|
||||
__cost_factor_writer(__file));
|
||||
std::fclose(__file);
|
||||
}
|
||||
|
||||
struct __cost_factor_setter
|
||||
{
|
||||
void
|
||||
operator()(__cost_factor* __factor)
|
||||
{
|
||||
// Look it up in the process environment first.
|
||||
const char* __env_value = std::getenv(__factor->__env_var);
|
||||
|
||||
if (!__env_value)
|
||||
{
|
||||
// Look it up in the config file.
|
||||
__env_t::iterator __it
|
||||
= _GLIBCXX_PROFILE_DATA(__env).find(__factor->__env_var);
|
||||
if (__it != _GLIBCXX_PROFILE_DATA(__env).end())
|
||||
__env_value = __it->second.c_str();
|
||||
}
|
||||
|
||||
if (__env_value)
|
||||
__factor->__value = std::atof(__env_value);
|
||||
}
|
||||
};
|
||||
|
||||
inline void
|
||||
__set_cost_factors()
|
||||
{
|
||||
__cost_factor_vector* __factors = new __cost_factor_vector;
|
||||
_GLIBCXX_PROFILE_DATA(__cost_factors) = __factors;
|
||||
__factors->push_back(&_GLIBCXX_PROFILE_DATA(__vector_shift_cost_factor));
|
||||
__factors->push_back(&_GLIBCXX_PROFILE_DATA(__vector_iterate_cost_factor));
|
||||
__factors->push_back(&_GLIBCXX_PROFILE_DATA(__vector_resize_cost_factor));
|
||||
__factors->push_back(&_GLIBCXX_PROFILE_DATA(__list_shift_cost_factor));
|
||||
__factors->push_back(&_GLIBCXX_PROFILE_DATA(__list_iterate_cost_factor));
|
||||
__factors->push_back(&_GLIBCXX_PROFILE_DATA(__list_resize_cost_factor));
|
||||
__factors->push_back(&_GLIBCXX_PROFILE_DATA(__map_insert_cost_factor));
|
||||
__factors->push_back(&_GLIBCXX_PROFILE_DATA(__map_erase_cost_factor));
|
||||
__factors->push_back(&_GLIBCXX_PROFILE_DATA(__map_find_cost_factor));
|
||||
__factors->push_back(&_GLIBCXX_PROFILE_DATA(__map_iterate_cost_factor));
|
||||
__factors->push_back(&_GLIBCXX_PROFILE_DATA(__umap_insert_cost_factor));
|
||||
__factors->push_back(&_GLIBCXX_PROFILE_DATA(__umap_erase_cost_factor));
|
||||
__factors->push_back(&_GLIBCXX_PROFILE_DATA(__umap_find_cost_factor));
|
||||
__factors->push_back(&_GLIBCXX_PROFILE_DATA(__umap_iterate_cost_factor));
|
||||
__for_each(__factors->begin(), __factors->end(), __cost_factor_setter());
|
||||
}
|
||||
|
||||
inline void
|
||||
__profcxx_init_unconditional()
|
||||
{
|
||||
__gnu_cxx::__scoped_lock __lock(_GLIBCXX_PROFILE_DATA(__global_mutex));
|
||||
|
||||
if (__is_invalid())
|
||||
{
|
||||
__set_max_warn_count();
|
||||
|
||||
if (_GLIBCXX_PROFILE_DATA(_S_max_warn_count) == 0)
|
||||
__turn_off();
|
||||
else
|
||||
{
|
||||
__set_max_stack_trace_depth();
|
||||
__set_max_mem();
|
||||
__set_trace_path();
|
||||
__read_cost_factors();
|
||||
__set_cost_factors();
|
||||
__write_cost_factors();
|
||||
|
||||
__trace_vector_size_init();
|
||||
__trace_hashtable_size_init();
|
||||
__trace_hash_func_init();
|
||||
__trace_vector_to_list_init();
|
||||
__trace_list_to_slist_init();
|
||||
__trace_list_to_vector_init();
|
||||
__trace_map_to_unordered_map_init();
|
||||
|
||||
std::atexit(__report_and_free);
|
||||
|
||||
__turn_on();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/** @brief This function must be called by each instrumentation point.
|
||||
*
|
||||
* The common path is inlined fully.
|
||||
*/
|
||||
inline bool
|
||||
__profcxx_init()
|
||||
{
|
||||
if (__is_invalid())
|
||||
__profcxx_init_unconditional();
|
||||
|
||||
return __is_on();
|
||||
}
|
||||
|
||||
} // namespace __gnu_profile
|
||||
|
||||
#endif /* _GLIBCXX_PROFILE_PROFILER_TRACE_H */
|
||||
100
openflow/usr/include/c++/5/profile/impl/profiler_vector_size.h
Normal file
100
openflow/usr/include/c++/5/profile/impl/profiler_vector_size.h
Normal file
@@ -0,0 +1,100 @@
|
||||
// -*- C++ -*-
|
||||
//
|
||||
// Copyright (C) 2009-2015 Free Software Foundation, Inc.
|
||||
//
|
||||
// This file is part of the GNU ISO C++ Library. This library is free
|
||||
// software; you can redistribute it and/or modify it under the
|
||||
// terms of the GNU General Public License as published by the
|
||||
// Free Software Foundation; either version 3, or (at your option)
|
||||
// any later version.
|
||||
//
|
||||
// This library is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
|
||||
// Under Section 7 of GPL version 3, you are granted additional
|
||||
// permissions described in the GCC Runtime Library Exception, version
|
||||
// 3.1, as published by the Free Software Foundation.
|
||||
|
||||
// You should have received a copy of the GNU General Public License along
|
||||
// with this library; see the file COPYING3. If not see
|
||||
// <http://www.gnu.org/licenses/>.
|
||||
|
||||
/** @file profile/impl/profiler_vector_size.h
|
||||
* @brief Collection of vector size traces.
|
||||
*/
|
||||
|
||||
// Written by Lixia Liu and Silvius Rus.
|
||||
|
||||
#ifndef _GLIBCXX_PROFILE_PROFILER_VECTOR_SIZE_H
|
||||
#define _GLIBCXX_PROFILE_PROFILER_VECTOR_SIZE_H 1
|
||||
|
||||
#include "profile/impl/profiler.h"
|
||||
#include "profile/impl/profiler_node.h"
|
||||
#include "profile/impl/profiler_trace.h"
|
||||
#include "profile/impl/profiler_state.h"
|
||||
#include "profile/impl/profiler_container_size.h"
|
||||
|
||||
namespace __gnu_profile
|
||||
{
|
||||
/** @brief Hashtable size instrumentation trace producer. */
|
||||
class __trace_vector_size
|
||||
: public __trace_container_size
|
||||
{
|
||||
public:
|
||||
__trace_vector_size()
|
||||
: __trace_container_size()
|
||||
{ __id = "vector-size"; }
|
||||
};
|
||||
|
||||
inline void
|
||||
__trace_vector_size_init()
|
||||
{ _GLIBCXX_PROFILE_DATA(_S_vector_size) = new __trace_vector_size(); }
|
||||
|
||||
inline void
|
||||
__trace_vector_size_free()
|
||||
{ delete _GLIBCXX_PROFILE_DATA(_S_vector_size); }
|
||||
|
||||
inline void
|
||||
__trace_vector_size_report(FILE* __f, __warning_vector_t& __warnings)
|
||||
{ __trace_report(_GLIBCXX_PROFILE_DATA(_S_vector_size), __f, __warnings); }
|
||||
|
||||
inline __container_size_info*
|
||||
__trace_vector_size_construct(std::size_t __num)
|
||||
{
|
||||
if (!__profcxx_init())
|
||||
return 0;
|
||||
|
||||
if (!__reentrance_guard::__get_in())
|
||||
return 0;
|
||||
|
||||
__reentrance_guard __get_out;
|
||||
return _GLIBCXX_PROFILE_DATA(_S_vector_size)->
|
||||
__insert(__get_stack(), __num);
|
||||
}
|
||||
|
||||
inline void
|
||||
__trace_vector_size_resize(__container_size_info* __obj_info,
|
||||
std::size_t __from, std::size_t __to)
|
||||
{
|
||||
if (!__obj_info)
|
||||
return;
|
||||
|
||||
__obj_info->__resize(__from, __to);
|
||||
}
|
||||
|
||||
inline void
|
||||
__trace_vector_size_destruct(__container_size_info* __obj_info,
|
||||
std::size_t __num, std::size_t __inum)
|
||||
{
|
||||
if (!__obj_info)
|
||||
return;
|
||||
|
||||
_GLIBCXX_PROFILE_DATA(_S_vector_size)->
|
||||
__destruct(__obj_info, __num, __inum);
|
||||
}
|
||||
|
||||
} // namespace __gnu_profile
|
||||
|
||||
#endif /* _GLIBCXX_PROFILE_PROFILER_VECTOR_SIZE_H */
|
||||
@@ -0,0 +1,261 @@
|
||||
// -*- C++ -*-
|
||||
//
|
||||
// Copyright (C) 2009-2015 Free Software Foundation, Inc.
|
||||
//
|
||||
// This file is part of the GNU ISO C++ Library. This library is free
|
||||
// software; you can redistribute it and/or modify it under the
|
||||
// terms of the GNU General Public License as published by the
|
||||
// Free Software Foundation; either version 3, or (at your option)
|
||||
// any later version.
|
||||
//
|
||||
// This library is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
|
||||
// Under Section 7 of GPL version 3, you are granted additional
|
||||
// permissions described in the GCC Runtime Library Exception, version
|
||||
// 3.1, as published by the Free Software Foundation.
|
||||
|
||||
// You should have received a copy of the GNU General Public License along
|
||||
// with this library; see the file COPYING3. If not see
|
||||
// <http://www.gnu.org/licenses/>.
|
||||
|
||||
/** @file profile/impl/profiler_vector_to_list.h
|
||||
* @brief diagnostics for vector to list.
|
||||
*/
|
||||
|
||||
// Written by Lixia Liu and Silvius Rus.
|
||||
|
||||
#ifndef _GLIBCXX_PROFILE_PROFILER_VECTOR_TO_LIST_H
|
||||
#define _GLIBCXX_PROFILE_PROFILER_VECTOR_TO_LIST_H 1
|
||||
|
||||
#include "profile/impl/profiler.h"
|
||||
#include "profile/impl/profiler_node.h"
|
||||
#include "profile/impl/profiler_trace.h"
|
||||
|
||||
namespace __gnu_profile
|
||||
{
|
||||
/** @brief A vector-to-list instrumentation line in the object table. */
|
||||
class __vector2list_info
|
||||
: public __object_info_base
|
||||
{
|
||||
public:
|
||||
__vector2list_info(__stack_t __stack)
|
||||
: __object_info_base(__stack), _M_shift_count(0), _M_iterate(0),
|
||||
_M_resize(0), _M_list_cost(0), _M_vector_cost(0)
|
||||
{ }
|
||||
|
||||
void
|
||||
__merge(const __vector2list_info& __o)
|
||||
{
|
||||
__object_info_base::__merge(__o);
|
||||
_M_shift_count += __o._M_shift_count;
|
||||
_M_iterate += __o._M_iterate;
|
||||
_M_vector_cost += __o._M_vector_cost;
|
||||
_M_list_cost += __o._M_list_cost;
|
||||
_M_resize += __o._M_resize;
|
||||
}
|
||||
|
||||
void
|
||||
__write(FILE* __f) const
|
||||
{
|
||||
std::fprintf(__f, "%Zu %Zu %Zu %.0f %.0f\n", _M_shift_count,
|
||||
_M_resize, _M_iterate, _M_vector_cost, _M_list_cost);
|
||||
}
|
||||
|
||||
float
|
||||
__magnitude() const
|
||||
{ return _M_vector_cost - _M_list_cost; }
|
||||
|
||||
std::string
|
||||
__advice() const
|
||||
{ return "change std::vector to std::list"; }
|
||||
|
||||
std::size_t
|
||||
__shift_count()
|
||||
{ return _M_shift_count; }
|
||||
|
||||
std::size_t
|
||||
__iterate()
|
||||
{ return _M_iterate; }
|
||||
|
||||
float
|
||||
__list_cost()
|
||||
{ return _M_list_cost; }
|
||||
|
||||
std::size_t
|
||||
__resize()
|
||||
{ return _M_resize; }
|
||||
|
||||
void
|
||||
__set_list_cost(float __lc)
|
||||
{ _M_list_cost = __lc; }
|
||||
|
||||
void
|
||||
__set_vector_cost(float __vc)
|
||||
{ _M_vector_cost = __vc; }
|
||||
|
||||
void
|
||||
__opr_insert(std::size_t __pos, std::size_t __num)
|
||||
{ _M_shift_count += __num - __pos; }
|
||||
|
||||
void
|
||||
__opr_iterate(int __num)
|
||||
{ __gnu_cxx::__atomic_add(&_M_iterate, __num); }
|
||||
|
||||
void
|
||||
__resize(std::size_t __from, std::size_t)
|
||||
{ _M_resize += __from; }
|
||||
|
||||
private:
|
||||
std::size_t _M_shift_count;
|
||||
mutable _Atomic_word _M_iterate;
|
||||
std::size_t _M_resize;
|
||||
float _M_list_cost;
|
||||
float _M_vector_cost;
|
||||
};
|
||||
|
||||
|
||||
/** @brief A vector-to-list instrumentation line in the stack table. */
|
||||
class __vector2list_stack_info
|
||||
: public __vector2list_info
|
||||
{
|
||||
public:
|
||||
__vector2list_stack_info(const __vector2list_info& __o)
|
||||
: __vector2list_info(__o) { }
|
||||
};
|
||||
|
||||
|
||||
/** @brief Vector-to-list instrumentation producer. */
|
||||
class __trace_vector_to_list
|
||||
: public __trace_base<__vector2list_info, __vector2list_stack_info>
|
||||
{
|
||||
public:
|
||||
__trace_vector_to_list()
|
||||
: __trace_base<__vector2list_info, __vector2list_stack_info>()
|
||||
{ __id = "vector-to-list"; }
|
||||
|
||||
~__trace_vector_to_list() { }
|
||||
|
||||
// Call at destruction/clean to set container final size.
|
||||
void
|
||||
__destruct(__vector2list_info* __obj_info)
|
||||
{
|
||||
float __vc = __vector_cost(__obj_info->__shift_count(),
|
||||
__obj_info->__iterate(),
|
||||
__obj_info->__resize());
|
||||
float __lc = __list_cost(__obj_info->__shift_count(),
|
||||
__obj_info->__iterate(),
|
||||
__obj_info->__resize());
|
||||
__obj_info->__set_vector_cost(__vc);
|
||||
__obj_info->__set_list_cost(__lc);
|
||||
|
||||
__retire_object(__obj_info);
|
||||
}
|
||||
|
||||
// Collect cost of operations.
|
||||
float
|
||||
__vector_cost(std::size_t __shift, std::size_t __iterate,
|
||||
std::size_t __resize)
|
||||
{
|
||||
return (__shift
|
||||
* _GLIBCXX_PROFILE_DATA(__vector_shift_cost_factor).__value
|
||||
+ __iterate
|
||||
* _GLIBCXX_PROFILE_DATA(__vector_iterate_cost_factor).__value
|
||||
+ __resize
|
||||
* _GLIBCXX_PROFILE_DATA(__vector_resize_cost_factor).__value);
|
||||
}
|
||||
|
||||
float
|
||||
__list_cost(std::size_t __shift, std::size_t __iterate,
|
||||
std::size_t __resize)
|
||||
{
|
||||
return (__shift
|
||||
* _GLIBCXX_PROFILE_DATA(__list_shift_cost_factor).__value
|
||||
+ __iterate
|
||||
* _GLIBCXX_PROFILE_DATA(__list_iterate_cost_factor).__value
|
||||
+ __resize
|
||||
* _GLIBCXX_PROFILE_DATA(__list_resize_cost_factor).__value);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
inline void
|
||||
__trace_vector_to_list_init()
|
||||
{ _GLIBCXX_PROFILE_DATA(_S_vector_to_list) = new __trace_vector_to_list(); }
|
||||
|
||||
inline void
|
||||
__trace_vector_to_list_free()
|
||||
{ delete _GLIBCXX_PROFILE_DATA(_S_vector_to_list); }
|
||||
|
||||
inline void
|
||||
__trace_vector_to_list_report(FILE* __f, __warning_vector_t& __warnings)
|
||||
{ __trace_report(_GLIBCXX_PROFILE_DATA(_S_vector_to_list), __f, __warnings); }
|
||||
|
||||
inline __vector2list_info*
|
||||
__trace_vector_to_list_construct()
|
||||
{
|
||||
if (!__profcxx_init())
|
||||
return 0;
|
||||
|
||||
if (!__reentrance_guard::__get_in())
|
||||
return 0;
|
||||
|
||||
__reentrance_guard __get_out;
|
||||
return _GLIBCXX_PROFILE_DATA(_S_vector_to_list)
|
||||
->__add_object(__get_stack());
|
||||
}
|
||||
|
||||
inline void
|
||||
__trace_vector_to_list_insert(__vector2list_info* __obj_info,
|
||||
std::size_t __pos,
|
||||
std::size_t __num)
|
||||
{
|
||||
if (!__obj_info)
|
||||
return;
|
||||
|
||||
__obj_info->__opr_insert(__pos, __num);
|
||||
}
|
||||
|
||||
inline void
|
||||
__trace_vector_to_list_iterate(__vector2list_info* __obj_info, int)
|
||||
{
|
||||
if (!__obj_info)
|
||||
return;
|
||||
|
||||
// We only collect if an iteration took place no matter in what side.
|
||||
__obj_info->__opr_iterate(1);
|
||||
}
|
||||
|
||||
inline void
|
||||
__trace_vector_to_list_invalid_operator(__vector2list_info* __obj_info)
|
||||
{
|
||||
if (!__obj_info)
|
||||
return;
|
||||
|
||||
__obj_info->__set_invalid();
|
||||
}
|
||||
|
||||
inline void
|
||||
__trace_vector_to_list_resize(__vector2list_info* __obj_info,
|
||||
std::size_t __from,
|
||||
std::size_t __to)
|
||||
{
|
||||
if (!__obj_info)
|
||||
return;
|
||||
|
||||
__obj_info->__resize(__from, __to);
|
||||
}
|
||||
|
||||
inline void
|
||||
__trace_vector_to_list_destruct(__vector2list_info* __obj_info)
|
||||
{
|
||||
if (!__obj_info)
|
||||
return;
|
||||
|
||||
_GLIBCXX_PROFILE_DATA(_S_vector_to_list)->__destruct(__obj_info);
|
||||
}
|
||||
|
||||
} // namespace __gnu_profile
|
||||
#endif /* _GLIBCXX_PROFILE_PROFILER_VECTOR_TO_LIST_H */
|
||||
286
openflow/usr/include/c++/5/profile/iterator_tracker.h
Normal file
286
openflow/usr/include/c++/5/profile/iterator_tracker.h
Normal file
@@ -0,0 +1,286 @@
|
||||
// Profiling iterator implementation -*- C++ -*-
|
||||
|
||||
// Copyright (C) 2009-2015 Free Software Foundation, Inc.
|
||||
//
|
||||
// This file is part of the GNU ISO C++ Library. This library is free
|
||||
// software; you can redistribute it and/or modify it under the
|
||||
// terms of the GNU General Public License as published by the
|
||||
// Free Software Foundation; either version 3, or (at your option)
|
||||
// any later version.
|
||||
|
||||
// This library is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
|
||||
// Under Section 7 of GPL version 3, you are granted additional
|
||||
// permissions described in the GCC Runtime Library Exception, version
|
||||
// 3.1, as published by the Free Software Foundation.
|
||||
|
||||
// You should have received a copy of the GNU General Public License and
|
||||
// a copy of the GCC Runtime Library Exception along with this program;
|
||||
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
|
||||
// <http://www.gnu.org/licenses/>.
|
||||
|
||||
/** @file profile/iterator_tracker.h
|
||||
* This file is a GNU profile extension to the Standard C++ Library.
|
||||
*/
|
||||
|
||||
#ifndef _GLIBCXX_PROFILE_ITERATOR_TRACKER
|
||||
#define _GLIBCXX_PROFILE_ITERATOR_TRACKER 1
|
||||
|
||||
#include <ext/type_traits.h>
|
||||
|
||||
namespace std _GLIBCXX_VISIBILITY(default)
|
||||
{
|
||||
namespace __profile
|
||||
{
|
||||
template<typename _Iterator, typename _Sequence>
|
||||
class __iterator_tracker
|
||||
{
|
||||
typedef __iterator_tracker _Self;
|
||||
|
||||
// The underlying iterator
|
||||
_Iterator _M_current;
|
||||
|
||||
// The underlying data structure
|
||||
const _Sequence* _M_ds;
|
||||
typedef std::iterator_traits<_Iterator> _Traits;
|
||||
|
||||
public:
|
||||
typedef _Iterator _Base_iterator;
|
||||
typedef typename _Traits::iterator_category iterator_category;
|
||||
typedef typename _Traits::value_type value_type;
|
||||
typedef typename _Traits::difference_type difference_type;
|
||||
typedef typename _Traits::reference reference;
|
||||
typedef typename _Traits::pointer pointer;
|
||||
|
||||
__iterator_tracker() _GLIBCXX_NOEXCEPT
|
||||
: _M_current(), _M_ds(0) { }
|
||||
|
||||
__iterator_tracker(const _Iterator& __i, const _Sequence* __seq)
|
||||
_GLIBCXX_NOEXCEPT
|
||||
: _M_current(__i), _M_ds(__seq) { }
|
||||
|
||||
__iterator_tracker(const __iterator_tracker& __x) _GLIBCXX_NOEXCEPT
|
||||
: _M_current(__x._M_current), _M_ds(__x._M_ds) { }
|
||||
|
||||
template<typename _MutableIterator>
|
||||
__iterator_tracker(const __iterator_tracker<_MutableIterator,
|
||||
typename __gnu_cxx::__enable_if
|
||||
<(std::__are_same<_MutableIterator, typename
|
||||
_Sequence::iterator::_Base_iterator>::__value),
|
||||
_Sequence>::__type>& __x) _GLIBCXX_NOEXCEPT
|
||||
: _M_current(__x.base()), _M_ds(__x._M_get_sequence()) { }
|
||||
|
||||
_Iterator
|
||||
base() const _GLIBCXX_NOEXCEPT { return _M_current; }
|
||||
|
||||
/**
|
||||
* @brief Conversion to underlying non-debug iterator to allow
|
||||
* better interaction with non-profile containers.
|
||||
*/
|
||||
operator _Iterator() const _GLIBCXX_NOEXCEPT { return _M_current; }
|
||||
|
||||
pointer
|
||||
operator->() const _GLIBCXX_NOEXCEPT { return &*_M_current; }
|
||||
|
||||
__iterator_tracker&
|
||||
operator++() _GLIBCXX_NOEXCEPT
|
||||
{
|
||||
_M_ds->_M_profile_iterate();
|
||||
++_M_current;
|
||||
return *this;
|
||||
}
|
||||
|
||||
__iterator_tracker
|
||||
operator++(int) _GLIBCXX_NOEXCEPT
|
||||
{
|
||||
_M_ds->_M_profile_iterate();
|
||||
__iterator_tracker __tmp(*this);
|
||||
++_M_current;
|
||||
return __tmp;
|
||||
}
|
||||
|
||||
__iterator_tracker&
|
||||
operator--() _GLIBCXX_NOEXCEPT
|
||||
{
|
||||
_M_ds->_M_profile_iterate(1);
|
||||
--_M_current;
|
||||
return *this;
|
||||
}
|
||||
|
||||
__iterator_tracker
|
||||
operator--(int) _GLIBCXX_NOEXCEPT
|
||||
{
|
||||
_M_ds->_M_profile_iterate(1);
|
||||
__iterator_tracker __tmp(*this);
|
||||
--_M_current;
|
||||
return __tmp;
|
||||
}
|
||||
|
||||
__iterator_tracker&
|
||||
operator=(const __iterator_tracker& __x) _GLIBCXX_NOEXCEPT
|
||||
{
|
||||
_M_current = __x._M_current;
|
||||
_M_ds = __x._M_ds;
|
||||
return *this;
|
||||
}
|
||||
|
||||
reference
|
||||
operator*() const _GLIBCXX_NOEXCEPT
|
||||
{ return *_M_current; }
|
||||
|
||||
// ------ Random access iterator requirements ------
|
||||
reference
|
||||
operator[](const difference_type& __n) const _GLIBCXX_NOEXCEPT
|
||||
{ return _M_current[__n]; }
|
||||
|
||||
__iterator_tracker&
|
||||
operator+=(const difference_type& __n) _GLIBCXX_NOEXCEPT
|
||||
{
|
||||
_M_current += __n;
|
||||
return *this;
|
||||
}
|
||||
|
||||
__iterator_tracker
|
||||
operator+(const difference_type& __n) const _GLIBCXX_NOEXCEPT
|
||||
{
|
||||
__iterator_tracker __tmp(*this);
|
||||
__tmp += __n;
|
||||
return __tmp;
|
||||
}
|
||||
|
||||
__iterator_tracker&
|
||||
operator-=(const difference_type& __n) _GLIBCXX_NOEXCEPT
|
||||
{
|
||||
_M_current += -__n;
|
||||
return *this;
|
||||
}
|
||||
|
||||
__iterator_tracker
|
||||
operator-(const difference_type& __n) const _GLIBCXX_NOEXCEPT
|
||||
{
|
||||
__iterator_tracker __tmp(*this);
|
||||
__tmp -= __n;
|
||||
return __tmp;
|
||||
}
|
||||
|
||||
const _Sequence*
|
||||
_M_get_sequence() const
|
||||
{ return static_cast<const _Sequence*>(_M_ds); }
|
||||
};
|
||||
|
||||
template<typename _IteratorL, typename _IteratorR, typename _Sequence>
|
||||
inline bool
|
||||
operator==(const __iterator_tracker<_IteratorL, _Sequence>& __lhs,
|
||||
const __iterator_tracker<_IteratorR, _Sequence>& __rhs)
|
||||
_GLIBCXX_NOEXCEPT
|
||||
{ return __lhs.base() == __rhs.base(); }
|
||||
|
||||
template<typename _Iterator, typename _Sequence>
|
||||
inline bool
|
||||
operator==(const __iterator_tracker<_Iterator, _Sequence>& __lhs,
|
||||
const __iterator_tracker<_Iterator, _Sequence>& __rhs)
|
||||
_GLIBCXX_NOEXCEPT
|
||||
{ return __lhs.base() == __rhs.base(); }
|
||||
|
||||
template<typename _IteratorL, typename _IteratorR, typename _Sequence>
|
||||
inline bool
|
||||
operator!=(const __iterator_tracker<_IteratorL, _Sequence>& __lhs,
|
||||
const __iterator_tracker<_IteratorR, _Sequence>& __rhs)
|
||||
_GLIBCXX_NOEXCEPT
|
||||
{ return __lhs.base() != __rhs.base(); }
|
||||
|
||||
template<typename _Iterator, typename _Sequence>
|
||||
inline bool
|
||||
operator!=(const __iterator_tracker<_Iterator, _Sequence>& __lhs,
|
||||
const __iterator_tracker<_Iterator, _Sequence>& __rhs)
|
||||
_GLIBCXX_NOEXCEPT
|
||||
{ return __lhs.base() != __rhs.base(); }
|
||||
|
||||
template<typename _IteratorL, typename _IteratorR, typename _Sequence>
|
||||
inline bool
|
||||
operator<(const __iterator_tracker<_IteratorL, _Sequence>& __lhs,
|
||||
const __iterator_tracker<_IteratorR, _Sequence>& __rhs)
|
||||
_GLIBCXX_NOEXCEPT
|
||||
{ return __lhs.base() < __rhs.base(); }
|
||||
|
||||
template<typename _Iterator, typename _Sequence>
|
||||
inline bool
|
||||
operator<(const __iterator_tracker<_Iterator, _Sequence>& __lhs,
|
||||
const __iterator_tracker<_Iterator, _Sequence>& __rhs)
|
||||
_GLIBCXX_NOEXCEPT
|
||||
{ return __lhs.base() < __rhs.base(); }
|
||||
|
||||
template<typename _IteratorL, typename _IteratorR, typename _Sequence>
|
||||
inline bool
|
||||
operator<=(const __iterator_tracker<_IteratorL, _Sequence>& __lhs,
|
||||
const __iterator_tracker<_IteratorR, _Sequence>& __rhs)
|
||||
_GLIBCXX_NOEXCEPT
|
||||
{ return __lhs.base() <= __rhs.base(); }
|
||||
|
||||
template<typename _Iterator, typename _Sequence>
|
||||
inline bool
|
||||
operator<=(const __iterator_tracker<_Iterator, _Sequence>& __lhs,
|
||||
const __iterator_tracker<_Iterator, _Sequence>& __rhs)
|
||||
_GLIBCXX_NOEXCEPT
|
||||
{ return __lhs.base() <= __rhs.base(); }
|
||||
|
||||
template<typename _IteratorL, typename _IteratorR, typename _Sequence>
|
||||
inline bool
|
||||
operator>(const __iterator_tracker<_IteratorL, _Sequence>& __lhs,
|
||||
const __iterator_tracker<_IteratorR, _Sequence>& __rhs)
|
||||
_GLIBCXX_NOEXCEPT
|
||||
{ return __lhs.base() > __rhs.base(); }
|
||||
|
||||
template<typename _Iterator, typename _Sequence>
|
||||
inline bool
|
||||
operator>(const __iterator_tracker<_Iterator, _Sequence>& __lhs,
|
||||
const __iterator_tracker<_Iterator, _Sequence>& __rhs)
|
||||
_GLIBCXX_NOEXCEPT
|
||||
{ return __lhs.base() > __rhs.base(); }
|
||||
|
||||
template<typename _IteratorL, typename _IteratorR, typename _Sequence>
|
||||
inline bool
|
||||
operator>=(const __iterator_tracker<_IteratorL, _Sequence>& __lhs,
|
||||
const __iterator_tracker<_IteratorR, _Sequence>& __rhs)
|
||||
_GLIBCXX_NOEXCEPT
|
||||
{ return __lhs.base() >= __rhs.base(); }
|
||||
|
||||
template<typename _Iterator, typename _Sequence>
|
||||
inline bool
|
||||
operator>=(const __iterator_tracker<_Iterator, _Sequence>& __lhs,
|
||||
const __iterator_tracker<_Iterator, _Sequence>& __rhs)
|
||||
_GLIBCXX_NOEXCEPT
|
||||
{ return __lhs.base() >= __rhs.base(); }
|
||||
|
||||
// _GLIBCXX_RESOLVE_LIB_DEFECTS
|
||||
// According to the resolution of DR179 not only the various comparison
|
||||
// operators but also operator- must accept mixed iterator/const_iterator
|
||||
// parameters.
|
||||
template<typename _IteratorL, typename _IteratorR, typename _Sequence>
|
||||
inline typename __iterator_tracker<_IteratorL, _Sequence>::difference_type
|
||||
operator-(const __iterator_tracker<_IteratorL, _Sequence>& __lhs,
|
||||
const __iterator_tracker<_IteratorR, _Sequence>& __rhs)
|
||||
_GLIBCXX_NOEXCEPT
|
||||
{ return __lhs.base() - __rhs.base(); }
|
||||
|
||||
template<typename _Iterator, typename _Sequence>
|
||||
inline typename __iterator_tracker<_Iterator, _Sequence>::difference_type
|
||||
operator-(const __iterator_tracker<_Iterator, _Sequence>& __lhs,
|
||||
const __iterator_tracker<_Iterator, _Sequence>& __rhs)
|
||||
_GLIBCXX_NOEXCEPT
|
||||
{ return __lhs.base() - __rhs.base(); }
|
||||
|
||||
template<typename _Iterator, typename _Sequence>
|
||||
inline __iterator_tracker<_Iterator, _Sequence>
|
||||
operator+(typename __iterator_tracker<_Iterator,_Sequence>::difference_type
|
||||
__n,
|
||||
const __iterator_tracker<_Iterator, _Sequence>& __i)
|
||||
_GLIBCXX_NOEXCEPT
|
||||
{ return __i + __n; }
|
||||
|
||||
} // namespace __profile
|
||||
} // namespace std
|
||||
#endif
|
||||
645
openflow/usr/include/c++/5/profile/list
Normal file
645
openflow/usr/include/c++/5/profile/list
Normal file
@@ -0,0 +1,645 @@
|
||||
// Profiling list implementation -*- C++ -*-
|
||||
|
||||
// Copyright (C) 2009-2015 Free Software Foundation, Inc.
|
||||
//
|
||||
// This file is part of the GNU ISO C++ Library. This library is free
|
||||
// software; you can redistribute it and/or modify it under the
|
||||
// terms of the GNU General Public License as published by the
|
||||
// Free Software Foundation; either version 3, or (at your option)
|
||||
// any later version.
|
||||
|
||||
// This library is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
|
||||
// Under Section 7 of GPL version 3, you are granted additional
|
||||
// permissions described in the GCC Runtime Library Exception, version
|
||||
// 3.1, as published by the Free Software Foundation.
|
||||
|
||||
// You should have received a copy of the GNU General Public License and
|
||||
// a copy of the GCC Runtime Library Exception along with this program;
|
||||
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
|
||||
// <http://www.gnu.org/licenses/>.
|
||||
|
||||
/** @file profile/list
|
||||
* This file is a GNU profile extension to the Standard C++ Library.
|
||||
*/
|
||||
|
||||
#ifndef _GLIBCXX_PROFILE_LIST
|
||||
#define _GLIBCXX_PROFILE_LIST 1
|
||||
|
||||
#include <list>
|
||||
#include <profile/base.h>
|
||||
#include <profile/iterator_tracker.h>
|
||||
|
||||
namespace std _GLIBCXX_VISIBILITY(default)
|
||||
{
|
||||
namespace __profile
|
||||
{
|
||||
template<typename _List>
|
||||
class _List_profile
|
||||
{
|
||||
_List&
|
||||
_M_conjure()
|
||||
{ return *static_cast<_List*>(this); }
|
||||
|
||||
public:
|
||||
__gnu_profile::__list2slist_info* _M_list2slist_info;
|
||||
__gnu_profile::__list2vector_info* _M_list2vector_info;
|
||||
|
||||
_List_profile() _GLIBCXX_NOEXCEPT
|
||||
{ _M_profile_construct(); }
|
||||
|
||||
void
|
||||
_M_profile_construct() _GLIBCXX_NOEXCEPT
|
||||
{
|
||||
_M_list2slist_info = __profcxx_list2slist_construct();
|
||||
_M_list2vector_info = __profcxx_list2vector_construct();
|
||||
}
|
||||
|
||||
void
|
||||
_M_profile_destruct() _GLIBCXX_NOEXCEPT
|
||||
{
|
||||
__profcxx_list2vector_destruct(_M_list2vector_info);
|
||||
_M_list2vector_info = 0;
|
||||
__profcxx_list2slist_destruct(_M_list2slist_info);
|
||||
_M_list2slist_info = 0;
|
||||
}
|
||||
|
||||
void
|
||||
_M_swap(_List_profile& __other)
|
||||
{
|
||||
std::swap(_M_list2slist_info, __other._M_list2slist_info);
|
||||
std::swap(_M_list2vector_info, __other._M_list2vector_info);
|
||||
}
|
||||
|
||||
#if __cplusplus >= 201103L
|
||||
_List_profile(const _List_profile&) noexcept
|
||||
: _List_profile() { }
|
||||
_List_profile(_List_profile&& __other) noexcept
|
||||
: _List_profile()
|
||||
{ _M_swap(__other); }
|
||||
|
||||
_List_profile&
|
||||
operator=(const _List_profile&) noexcept
|
||||
{
|
||||
_M_profile_destruct();
|
||||
_M_profile_construct();
|
||||
}
|
||||
|
||||
_List_profile&
|
||||
operator=(_List_profile&& __other) noexcept
|
||||
{
|
||||
_M_swap(__other);
|
||||
__other._M_profile_destruct();
|
||||
__other._M_profile_construct();
|
||||
}
|
||||
#endif
|
||||
|
||||
~_List_profile()
|
||||
{ _M_profile_destruct(); }
|
||||
};
|
||||
|
||||
/** @brief List wrapper with performance instrumentation. */
|
||||
template<typename _Tp, typename _Allocator = std::allocator<_Tp> >
|
||||
class list
|
||||
: public _GLIBCXX_STD_C::list<_Tp, _Allocator>,
|
||||
public _List_profile<list<_Tp, _Allocator> >
|
||||
{
|
||||
typedef _GLIBCXX_STD_C::list<_Tp, _Allocator> _Base;
|
||||
|
||||
public:
|
||||
typedef typename _Base::reference reference;
|
||||
typedef typename _Base::const_reference const_reference;
|
||||
|
||||
typedef __iterator_tracker<typename _Base::iterator, list>
|
||||
iterator;
|
||||
typedef __iterator_tracker<typename _Base::const_iterator, list>
|
||||
const_iterator;
|
||||
|
||||
typedef typename _Base::size_type size_type;
|
||||
typedef typename _Base::difference_type difference_type;
|
||||
|
||||
typedef _Tp value_type;
|
||||
typedef _Allocator allocator_type;
|
||||
typedef typename _Base::pointer pointer;
|
||||
typedef typename _Base::const_pointer const_pointer;
|
||||
typedef std::reverse_iterator<iterator> reverse_iterator;
|
||||
typedef std::reverse_iterator<const_iterator> const_reverse_iterator;
|
||||
|
||||
// 23.2.2.1 construct/copy/destroy:
|
||||
|
||||
#if __cplusplus < 201103L
|
||||
list() { }
|
||||
list(const list& __x)
|
||||
: _Base(__x) { }
|
||||
|
||||
~list() { }
|
||||
#else
|
||||
list() = default;
|
||||
list(const list&) = default;
|
||||
list(list&&) = default;
|
||||
~list() = default;
|
||||
|
||||
list(initializer_list<value_type> __l,
|
||||
const allocator_type& __a = allocator_type())
|
||||
: _Base(__l, __a) { }
|
||||
#endif
|
||||
|
||||
explicit
|
||||
list(const _Allocator& __a) _GLIBCXX_NOEXCEPT
|
||||
: _Base(__a) { }
|
||||
|
||||
#if __cplusplus >= 201103L
|
||||
explicit
|
||||
list(size_type __n)
|
||||
: _Base(__n) { }
|
||||
|
||||
list(size_type __n, const _Tp& __value,
|
||||
const _Allocator& __a = _Allocator())
|
||||
: _Base(__n, __value, __a) { }
|
||||
#else
|
||||
explicit
|
||||
list(size_type __n, const _Tp& __value = _Tp(),
|
||||
const _Allocator& __a = _Allocator())
|
||||
: _Base(__n, __value, __a) { }
|
||||
#endif
|
||||
|
||||
#if __cplusplus >= 201103L
|
||||
template<typename _InputIterator,
|
||||
typename = std::_RequireInputIter<_InputIterator>>
|
||||
#else
|
||||
template<class _InputIterator>
|
||||
#endif
|
||||
list(_InputIterator __first, _InputIterator __last,
|
||||
const _Allocator& __a = _Allocator())
|
||||
: _Base(__first, __last, __a) { }
|
||||
|
||||
list(const _Base& __x)
|
||||
: _Base(__x) { }
|
||||
|
||||
#if __cplusplus < 201103L
|
||||
list&
|
||||
operator=(const list& __x)
|
||||
{
|
||||
this->_M_profile_destruct();
|
||||
_M_base() = __x;
|
||||
this->_M_profile_construct();
|
||||
return *this;
|
||||
}
|
||||
#else
|
||||
list&
|
||||
operator=(const list&) = default;
|
||||
|
||||
list&
|
||||
operator=(list&&) = default;
|
||||
|
||||
list&
|
||||
operator=(initializer_list<value_type> __l)
|
||||
{
|
||||
this->_M_profile_destruct();
|
||||
_M_base() = __l;
|
||||
this->_M_profile_construct();
|
||||
return *this;
|
||||
}
|
||||
#endif
|
||||
|
||||
// iterators:
|
||||
iterator
|
||||
begin() _GLIBCXX_NOEXCEPT
|
||||
{ return iterator(_Base::begin(), this); }
|
||||
|
||||
const_iterator
|
||||
begin() const _GLIBCXX_NOEXCEPT
|
||||
{ return const_iterator(_Base::begin(), this); }
|
||||
|
||||
iterator
|
||||
end() _GLIBCXX_NOEXCEPT
|
||||
{
|
||||
__profcxx_list2slist_rewind(this->_M_list2slist_info);
|
||||
return iterator(_Base::end(), this);
|
||||
}
|
||||
|
||||
const_iterator
|
||||
end() const _GLIBCXX_NOEXCEPT
|
||||
{
|
||||
__profcxx_list2slist_rewind(this->_M_list2slist_info);
|
||||
return const_iterator(_Base::end(), this);
|
||||
}
|
||||
|
||||
reverse_iterator
|
||||
rbegin() _GLIBCXX_NOEXCEPT
|
||||
{
|
||||
__profcxx_list2slist_rewind(this->_M_list2slist_info);
|
||||
return reverse_iterator(end());
|
||||
}
|
||||
|
||||
const_reverse_iterator
|
||||
rbegin() const _GLIBCXX_NOEXCEPT
|
||||
{
|
||||
__profcxx_list2slist_rewind(this->_M_list2slist_info);
|
||||
return const_reverse_iterator(end());
|
||||
}
|
||||
|
||||
reverse_iterator
|
||||
rend() _GLIBCXX_NOEXCEPT
|
||||
{ return reverse_iterator(begin()); }
|
||||
|
||||
const_reverse_iterator
|
||||
rend() const _GLIBCXX_NOEXCEPT
|
||||
{ return const_reverse_iterator(begin()); }
|
||||
|
||||
#if __cplusplus >= 201103L
|
||||
const_iterator
|
||||
cbegin() const noexcept
|
||||
{ return const_iterator(_Base::cbegin(), this); }
|
||||
|
||||
const_iterator
|
||||
cend() const noexcept
|
||||
{ return const_iterator(_Base::cend(), this); }
|
||||
|
||||
const_reverse_iterator
|
||||
crbegin() const noexcept
|
||||
{ return const_reverse_iterator(end()); }
|
||||
|
||||
const_reverse_iterator
|
||||
crend() const noexcept
|
||||
{ return const_reverse_iterator(begin()); }
|
||||
#endif
|
||||
|
||||
// 23.2.2.2 capacity:
|
||||
reference
|
||||
back() _GLIBCXX_NOEXCEPT
|
||||
{
|
||||
__profcxx_list2slist_rewind(this->_M_list2slist_info);
|
||||
return _Base::back();
|
||||
}
|
||||
|
||||
const_reference
|
||||
back() const _GLIBCXX_NOEXCEPT
|
||||
{
|
||||
__profcxx_list2slist_rewind(this->_M_list2slist_info);
|
||||
return _Base::back();
|
||||
}
|
||||
|
||||
// 23.2.2.3 modifiers:
|
||||
void
|
||||
push_front(const value_type& __x)
|
||||
{
|
||||
__profcxx_list2vector_invalid_operator(this->_M_list2vector_info);
|
||||
__profcxx_list2slist_operation(this->_M_list2slist_info);
|
||||
_Base::push_front(__x);
|
||||
}
|
||||
|
||||
void
|
||||
pop_front() _GLIBCXX_NOEXCEPT
|
||||
{
|
||||
__profcxx_list2slist_operation(this->_M_list2slist_info);
|
||||
_Base::pop_front();
|
||||
}
|
||||
|
||||
void
|
||||
pop_back() _GLIBCXX_NOEXCEPT
|
||||
{
|
||||
_Base::pop_back();
|
||||
__profcxx_list2slist_rewind(this->_M_list2slist_info);
|
||||
}
|
||||
|
||||
#if __cplusplus >= 201103L
|
||||
template<typename... _Args>
|
||||
iterator
|
||||
emplace(const_iterator __position, _Args&&... __args)
|
||||
{
|
||||
return iterator(_Base::emplace(__position.base(),
|
||||
std::forward<_Args>(__args)...),
|
||||
this);
|
||||
}
|
||||
#endif
|
||||
|
||||
iterator
|
||||
#if __cplusplus >= 201103L
|
||||
insert(const_iterator __pos, const _Tp& __x)
|
||||
#else
|
||||
insert(iterator __pos, const _Tp& __x)
|
||||
#endif
|
||||
{
|
||||
_M_profile_insert(__pos, this->size());
|
||||
return iterator(_Base::insert(__pos.base(), __x), this);
|
||||
}
|
||||
|
||||
#if __cplusplus >= 201103L
|
||||
iterator
|
||||
insert(const_iterator __pos, _Tp&& __x)
|
||||
{
|
||||
_M_profile_insert(__pos, this->size());
|
||||
return iterator(_Base::emplace(__pos.base(), std::move(__x)),
|
||||
this);
|
||||
}
|
||||
|
||||
iterator
|
||||
insert(const_iterator __pos, initializer_list<value_type> __l)
|
||||
{
|
||||
_M_profile_insert(__pos, this->size());
|
||||
return iterator(_Base::insert(__pos.base(), __l), this);
|
||||
}
|
||||
#endif
|
||||
|
||||
#if __cplusplus >= 201103L
|
||||
iterator
|
||||
insert(const_iterator __pos, size_type __n, const _Tp& __x)
|
||||
{
|
||||
_M_profile_insert(__pos, this->size());
|
||||
return iterator(_Base::insert(__pos.base(), __n, __x), this);
|
||||
}
|
||||
#else
|
||||
void
|
||||
insert(iterator __pos, size_type __n, const _Tp& __x)
|
||||
{
|
||||
_M_profile_insert(__pos, this->size());
|
||||
_Base::insert(__pos.base(), __n, __x);
|
||||
}
|
||||
#endif
|
||||
|
||||
#if __cplusplus >= 201103L
|
||||
template<typename _InputIterator,
|
||||
typename = std::_RequireInputIter<_InputIterator>>
|
||||
iterator
|
||||
insert(const_iterator __pos, _InputIterator __first,
|
||||
_InputIterator __last)
|
||||
{
|
||||
_M_profile_insert(__pos, this->size());
|
||||
return iterator(_Base::insert(__pos.base(), __first, __last),
|
||||
this);
|
||||
}
|
||||
#else
|
||||
template<class _InputIterator>
|
||||
void
|
||||
insert(iterator __pos, _InputIterator __first,
|
||||
_InputIterator __last)
|
||||
{
|
||||
_M_profile_insert(__pos, this->size());
|
||||
_Base::insert(__pos.base(), __first, __last);
|
||||
}
|
||||
#endif
|
||||
|
||||
iterator
|
||||
#if __cplusplus >= 201103L
|
||||
erase(const_iterator __pos) noexcept
|
||||
#else
|
||||
erase(iterator __pos)
|
||||
#endif
|
||||
{ return iterator(_Base::erase(__pos.base()), this); }
|
||||
|
||||
iterator
|
||||
#if __cplusplus >= 201103L
|
||||
erase(const_iterator __pos, const_iterator __last) noexcept
|
||||
#else
|
||||
erase(iterator __pos, iterator __last)
|
||||
#endif
|
||||
{
|
||||
// _GLIBCXX_RESOLVE_LIB_DEFECTS
|
||||
// 151. can't currently clear() empty container
|
||||
return iterator(_Base::erase(__pos.base(), __last.base()), this);
|
||||
}
|
||||
|
||||
void
|
||||
swap(list& __x)
|
||||
#if __cplusplus >= 201103L
|
||||
noexcept( noexcept(declval<_Base>().swap(__x)) )
|
||||
#endif
|
||||
{
|
||||
_Base::swap(__x);
|
||||
this->_M_swap(__x);
|
||||
}
|
||||
|
||||
void
|
||||
clear() _GLIBCXX_NOEXCEPT
|
||||
{
|
||||
this->_M_profile_destruct();
|
||||
_Base::clear();
|
||||
this->_M_profile_construct();
|
||||
}
|
||||
|
||||
// 23.2.2.4 list operations:
|
||||
void
|
||||
#if __cplusplus >= 201103L
|
||||
splice(const_iterator __pos, list&& __x) noexcept
|
||||
#else
|
||||
splice(iterator __pos, list& __x)
|
||||
#endif
|
||||
{ this->splice(__pos, _GLIBCXX_MOVE(__x), __x.begin(), __x.end()); }
|
||||
|
||||
#if __cplusplus >= 201103L
|
||||
void
|
||||
splice(const_iterator __pos, list& __x) noexcept
|
||||
{ this->splice(__pos, std::move(__x)); }
|
||||
|
||||
void
|
||||
splice(const_iterator __pos, list& __x, const_iterator __i)
|
||||
{ this->splice(__pos, std::move(__x), __i); }
|
||||
#endif
|
||||
|
||||
void
|
||||
#if __cplusplus >= 201103L
|
||||
splice(const_iterator __pos, list&& __x, const_iterator __i) noexcept
|
||||
#else
|
||||
splice(iterator __pos, list& __x, iterator __i)
|
||||
#endif
|
||||
{
|
||||
// We used to perform the splice_alloc check: not anymore, redundant
|
||||
// after implementing the relevant bits of N1599.
|
||||
|
||||
// _GLIBCXX_RESOLVE_LIB_DEFECTS
|
||||
_Base::splice(__pos.base(), _GLIBCXX_MOVE(__x._M_base()),
|
||||
__i.base());
|
||||
}
|
||||
|
||||
void
|
||||
#if __cplusplus >= 201103L
|
||||
splice(const_iterator __pos, list&& __x, const_iterator __first,
|
||||
const_iterator __last) noexcept
|
||||
#else
|
||||
splice(iterator __pos, list& __x, iterator __first,
|
||||
iterator __last)
|
||||
#endif
|
||||
{
|
||||
_Base::splice(__pos.base(), _GLIBCXX_MOVE(__x._M_base()),
|
||||
__first.base(), __last.base());
|
||||
}
|
||||
|
||||
#if __cplusplus >= 201103L
|
||||
void
|
||||
splice(const_iterator __pos, list& __x,
|
||||
const_iterator __first, const_iterator __last) noexcept
|
||||
{ this->splice(__pos, std::move(__x), __first, __last); }
|
||||
#endif
|
||||
|
||||
void
|
||||
remove(const _Tp& __value)
|
||||
{
|
||||
for (iterator __x = begin(); __x != end(); )
|
||||
{
|
||||
if (*__x == __value)
|
||||
__x = erase(__x);
|
||||
else
|
||||
++__x;
|
||||
}
|
||||
}
|
||||
|
||||
template<class _Predicate>
|
||||
void
|
||||
remove_if(_Predicate __pred)
|
||||
{
|
||||
for (iterator __x = begin(); __x != end(); )
|
||||
{
|
||||
__profcxx_list2slist_operation(this->_M_list2slist_info);
|
||||
if (__pred(*__x))
|
||||
__x = erase(__x);
|
||||
else
|
||||
++__x;
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
unique()
|
||||
{
|
||||
iterator __first = begin();
|
||||
iterator __last = end();
|
||||
if (__first == __last)
|
||||
return;
|
||||
iterator __next = __first;
|
||||
while (++__next != __last)
|
||||
{
|
||||
__profcxx_list2slist_operation(this->_M_list2slist_info);
|
||||
if (*__first == *__next)
|
||||
erase(__next);
|
||||
else
|
||||
__first = __next;
|
||||
__next = __first;
|
||||
}
|
||||
}
|
||||
|
||||
template<class _BinaryPredicate>
|
||||
void
|
||||
unique(_BinaryPredicate __binary_pred)
|
||||
{
|
||||
iterator __first = begin();
|
||||
iterator __last = end();
|
||||
if (__first == __last)
|
||||
return;
|
||||
iterator __next = __first;
|
||||
while (++__next != __last)
|
||||
{
|
||||
__profcxx_list2slist_operation(this->_M_list2slist_info);
|
||||
if (__binary_pred(*__first, *__next))
|
||||
erase(__next);
|
||||
else
|
||||
__first = __next;
|
||||
__next = __first;
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
#if __cplusplus >= 201103L
|
||||
merge(list&& __x)
|
||||
#else
|
||||
merge(list& __x)
|
||||
#endif
|
||||
{ _Base::merge(_GLIBCXX_MOVE(__x._M_base())); }
|
||||
|
||||
#if __cplusplus >= 201103L
|
||||
void
|
||||
merge(list& __x)
|
||||
{ this->merge(std::move(__x)); }
|
||||
#endif
|
||||
|
||||
template<class _Compare>
|
||||
void
|
||||
#if __cplusplus >= 201103L
|
||||
merge(list&& __x, _Compare __comp)
|
||||
#else
|
||||
merge(list& __x, _Compare __comp)
|
||||
#endif
|
||||
{ _Base::merge(_GLIBCXX_MOVE(__x._M_base()), __comp); }
|
||||
|
||||
#if __cplusplus >= 201103L
|
||||
template<typename _Compare>
|
||||
void
|
||||
merge(list& __x, _Compare __comp)
|
||||
{ this->merge(std::move(__x), __comp); }
|
||||
#endif
|
||||
|
||||
_Base&
|
||||
_M_base() _GLIBCXX_NOEXCEPT { return *this; }
|
||||
|
||||
const _Base&
|
||||
_M_base() const _GLIBCXX_NOEXCEPT { return *this; }
|
||||
|
||||
void _M_profile_iterate(int __rewind = 0) const
|
||||
{
|
||||
__profcxx_list2slist_operation(this->_M_list2slist_info);
|
||||
__profcxx_list2vector_iterate(this->_M_list2vector_info, __rewind);
|
||||
if (__rewind)
|
||||
__profcxx_list2slist_rewind(this->_M_list2slist_info);
|
||||
}
|
||||
|
||||
private:
|
||||
size_type
|
||||
_M_profile_insert(const_iterator __pos, size_type __size)
|
||||
{
|
||||
size_type __shift = 0;
|
||||
typename _Base::const_iterator __it = __pos.base();
|
||||
for (; __it != _Base::end(); ++__it)
|
||||
__shift++;
|
||||
__profcxx_list2slist_rewind(this->_M_list2slist_info);
|
||||
__profcxx_list2slist_operation(this->_M_list2slist_info);
|
||||
__profcxx_list2vector_insert(this->_M_list2vector_info, __shift, __size);
|
||||
}
|
||||
};
|
||||
|
||||
template<typename _Tp, typename _Alloc>
|
||||
inline bool
|
||||
operator==(const list<_Tp, _Alloc>& __lhs,
|
||||
const list<_Tp, _Alloc>& __rhs)
|
||||
{ return __lhs._M_base() == __rhs._M_base(); }
|
||||
|
||||
template<typename _Tp, typename _Alloc>
|
||||
inline bool
|
||||
operator!=(const list<_Tp, _Alloc>& __lhs,
|
||||
const list<_Tp, _Alloc>& __rhs)
|
||||
{ return __lhs._M_base() != __rhs._M_base(); }
|
||||
|
||||
template<typename _Tp, typename _Alloc>
|
||||
inline bool
|
||||
operator<(const list<_Tp, _Alloc>& __lhs,
|
||||
const list<_Tp, _Alloc>& __rhs)
|
||||
{ return __lhs._M_base() < __rhs._M_base(); }
|
||||
|
||||
template<typename _Tp, typename _Alloc>
|
||||
inline bool
|
||||
operator<=(const list<_Tp, _Alloc>& __lhs,
|
||||
const list<_Tp, _Alloc>& __rhs)
|
||||
{ return __lhs._M_base() <= __rhs._M_base(); }
|
||||
|
||||
template<typename _Tp, typename _Alloc>
|
||||
inline bool
|
||||
operator>=(const list<_Tp, _Alloc>& __lhs,
|
||||
const list<_Tp, _Alloc>& __rhs)
|
||||
{ return __lhs._M_base() >= __rhs._M_base(); }
|
||||
|
||||
template<typename _Tp, typename _Alloc>
|
||||
inline bool
|
||||
operator>(const list<_Tp, _Alloc>& __lhs,
|
||||
const list<_Tp, _Alloc>& __rhs)
|
||||
{ return __lhs._M_base() > __rhs._M_base(); }
|
||||
|
||||
template<typename _Tp, typename _Alloc>
|
||||
inline void
|
||||
swap(list<_Tp, _Alloc>& __lhs, list<_Tp, _Alloc>& __rhs)
|
||||
{ __lhs.swap(__rhs); }
|
||||
|
||||
} // namespace __profile
|
||||
} // namespace std
|
||||
|
||||
#endif
|
||||
35
openflow/usr/include/c++/5/profile/map
Normal file
35
openflow/usr/include/c++/5/profile/map
Normal file
@@ -0,0 +1,35 @@
|
||||
// Profiling map/multimap implementation -*- C++ -*-
|
||||
|
||||
// Copyright (C) 2009-2015 Free Software Foundation, Inc.
|
||||
//
|
||||
// This file is part of the GNU ISO C++ Library. This library is free
|
||||
// software; you can redistribute it and/or modify it under the
|
||||
// terms of the GNU General Public License as published by the
|
||||
// Free Software Foundation; either version 3, or (at your option)
|
||||
// any later version.
|
||||
//
|
||||
// This library is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
|
||||
// Under Section 7 of GPL version 3, you are granted additional
|
||||
// permissions described in the GCC Runtime Library Exception, version
|
||||
// 3.1, as published by the Free Software Foundation.
|
||||
|
||||
// You should have received a copy of the GNU General Public License along
|
||||
// with this library; see the file COPYING3. If not see
|
||||
// <http://www.gnu.org/licenses/>.
|
||||
|
||||
/** @file profile/map
|
||||
* This file is a GNU profile extension to the Standard C++ Library.
|
||||
*/
|
||||
|
||||
#ifndef _GLIBCXX_PROFILE_MAP
|
||||
#define _GLIBCXX_PROFILE_MAP 1
|
||||
|
||||
#include <map>
|
||||
#include <profile/map.h>
|
||||
#include <profile/multimap.h>
|
||||
|
||||
#endif
|
||||
592
openflow/usr/include/c++/5/profile/map.h
Normal file
592
openflow/usr/include/c++/5/profile/map.h
Normal file
@@ -0,0 +1,592 @@
|
||||
// Profiling map implementation -*- C++ -*-
|
||||
|
||||
// Copyright (C) 2009-2015 Free Software Foundation, Inc.
|
||||
//
|
||||
// This file is part of the GNU ISO C++ Library. This library is free
|
||||
// software; you can redistribute it and/or modify it under the
|
||||
// terms of the GNU General Public License as published by the
|
||||
// Free Software Foundation; either version 3, or (at your option)
|
||||
// any later version.
|
||||
//
|
||||
// This library is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
|
||||
// Under Section 7 of GPL version 3, you are granted additional
|
||||
// permissions described in the GCC Runtime Library Exception, version
|
||||
// 3.1, as published by the Free Software Foundation.
|
||||
|
||||
// You should have received a copy of the GNU General Public License along
|
||||
// with this library; see the file COPYING3. If not see
|
||||
// <http://www.gnu.org/licenses/>.
|
||||
|
||||
/** @file profile/map.h
|
||||
* This file is a GNU profile extension to the Standard C++ Library.
|
||||
*/
|
||||
|
||||
#ifndef _GLIBCXX_PROFILE_MAP_H
|
||||
#define _GLIBCXX_PROFILE_MAP_H 1
|
||||
|
||||
#include <profile/base.h>
|
||||
#include <profile/ordered_base.h>
|
||||
|
||||
namespace std _GLIBCXX_VISIBILITY(default)
|
||||
{
|
||||
namespace __profile
|
||||
{
|
||||
/// Class std::map wrapper with performance instrumentation.
|
||||
template<typename _Key, typename _Tp, typename _Compare = std::less<_Key>,
|
||||
typename _Allocator = std::allocator<std::pair<const _Key, _Tp> > >
|
||||
class map
|
||||
: public _GLIBCXX_STD_C::map<_Key, _Tp, _Compare, _Allocator>,
|
||||
public _Ordered_profile<map<_Key, _Tp, _Compare, _Allocator> >
|
||||
{
|
||||
typedef _GLIBCXX_STD_C::map<_Key, _Tp, _Compare, _Allocator> _Base;
|
||||
|
||||
typedef typename _Base::iterator _Base_iterator;
|
||||
typedef typename _Base::const_iterator _Base_const_iterator;
|
||||
|
||||
public:
|
||||
// types:
|
||||
typedef _Key key_type;
|
||||
typedef _Tp mapped_type;
|
||||
typedef typename _Base::value_type value_type;
|
||||
typedef _Compare key_compare;
|
||||
typedef typename _Base::reference reference;
|
||||
typedef typename _Base::const_reference const_reference;
|
||||
|
||||
typedef __iterator_tracker<_Base_iterator, map> iterator;
|
||||
typedef __iterator_tracker<_Base_const_iterator,
|
||||
map> const_iterator;
|
||||
typedef std::reverse_iterator<iterator> reverse_iterator;
|
||||
typedef std::reverse_iterator<const_iterator> const_reverse_iterator;
|
||||
|
||||
typedef typename _Base::size_type size_type;
|
||||
typedef typename _Base::difference_type difference_type;
|
||||
|
||||
// 23.3.1.1 construct/copy/destroy:
|
||||
|
||||
#if __cplusplus < 201103L
|
||||
map()
|
||||
: _Base() { }
|
||||
map(const map& __x)
|
||||
: _Base(__x) { }
|
||||
~map()
|
||||
{ }
|
||||
#else
|
||||
map() = default;
|
||||
map(const map&) = default;
|
||||
map(map&&) = default;
|
||||
~map() = default;
|
||||
#endif
|
||||
|
||||
explicit
|
||||
map(const _Compare& __comp,
|
||||
const _Allocator& __a = _Allocator())
|
||||
: _Base(__comp, __a) { }
|
||||
|
||||
#if __cplusplus >= 201103L
|
||||
template<typename _InputIterator,
|
||||
typename = std::_RequireInputIter<_InputIterator>>
|
||||
#else
|
||||
template<typename _InputIterator>
|
||||
#endif
|
||||
map(_InputIterator __first, _InputIterator __last,
|
||||
const _Compare& __comp = _Compare(),
|
||||
const _Allocator& __a = _Allocator())
|
||||
: _Base(__first, __last, __comp, __a) { }
|
||||
|
||||
map(const _Base& __x)
|
||||
: _Base(__x) { }
|
||||
|
||||
#if __cplusplus >= 201103L
|
||||
map(initializer_list<value_type> __l,
|
||||
const _Compare& __c = _Compare(),
|
||||
const _Allocator& __a = _Allocator())
|
||||
: _Base(__l, __c, __a) { }
|
||||
|
||||
explicit
|
||||
map(const _Allocator& __a)
|
||||
: _Base(__a) { }
|
||||
|
||||
map(const map& __x, const _Allocator& __a)
|
||||
: _Base(__x, __a) { }
|
||||
|
||||
map(map&& __x, const _Allocator& __a)
|
||||
noexcept( noexcept(_Base(std::move(__x), __a)) )
|
||||
: _Base(std::move(__x), __a) { }
|
||||
|
||||
map(initializer_list<value_type> __l, const _Allocator& __a)
|
||||
: _Base(__l, __a) { }
|
||||
|
||||
template<typename _InputIterator>
|
||||
map(_InputIterator __first, _InputIterator __last,
|
||||
const _Allocator& __a)
|
||||
: _Base(__first, __last, __a) { }
|
||||
#endif
|
||||
|
||||
#if __cplusplus < 201103L
|
||||
map&
|
||||
operator=(const map& __x)
|
||||
{
|
||||
this->_M_profile_destruct();
|
||||
_M_base() = __x;
|
||||
this->_M_profile_construct();
|
||||
return *this;
|
||||
}
|
||||
#else
|
||||
map&
|
||||
operator=(const map&) = default;
|
||||
|
||||
map&
|
||||
operator=(map&&) = default;
|
||||
|
||||
map&
|
||||
operator=(initializer_list<value_type> __l)
|
||||
{
|
||||
this->_M_profile_destruct();
|
||||
_M_base() = __l;
|
||||
this->_M_profile_construct();
|
||||
return *this;
|
||||
}
|
||||
#endif
|
||||
|
||||
// iterators
|
||||
iterator
|
||||
begin() _GLIBCXX_NOEXCEPT
|
||||
{ return iterator(_Base::begin(), this); }
|
||||
|
||||
const_iterator
|
||||
begin() const _GLIBCXX_NOEXCEPT
|
||||
{ return const_iterator(_Base::begin(), this); }
|
||||
|
||||
iterator
|
||||
end() _GLIBCXX_NOEXCEPT
|
||||
{ return iterator(_Base::end(), this); }
|
||||
|
||||
const_iterator
|
||||
end() const _GLIBCXX_NOEXCEPT
|
||||
{ return const_iterator(_Base::end(), this); }
|
||||
|
||||
#if __cplusplus >= 201103L
|
||||
const_iterator
|
||||
cbegin() const noexcept
|
||||
{ return const_iterator(_Base::cbegin(), this); }
|
||||
|
||||
const_iterator
|
||||
cend() const noexcept
|
||||
{ return const_iterator(_Base::cend(), this); }
|
||||
#endif
|
||||
|
||||
reverse_iterator
|
||||
rbegin() _GLIBCXX_NOEXCEPT
|
||||
{
|
||||
__profcxx_map2umap_invalidate(this->_M_map2umap_info);
|
||||
return reverse_iterator(end());
|
||||
}
|
||||
|
||||
const_reverse_iterator
|
||||
rbegin() const _GLIBCXX_NOEXCEPT
|
||||
{
|
||||
__profcxx_map2umap_invalidate(this->_M_map2umap_info);
|
||||
return const_reverse_iterator(end());
|
||||
}
|
||||
|
||||
reverse_iterator
|
||||
rend() _GLIBCXX_NOEXCEPT
|
||||
{
|
||||
__profcxx_map2umap_invalidate(this->_M_map2umap_info);
|
||||
return reverse_iterator(begin());
|
||||
}
|
||||
|
||||
const_reverse_iterator
|
||||
rend() const _GLIBCXX_NOEXCEPT
|
||||
{
|
||||
__profcxx_map2umap_invalidate(this->_M_map2umap_info);
|
||||
return const_reverse_iterator(begin());
|
||||
}
|
||||
|
||||
#if __cplusplus >= 201103L
|
||||
const_reverse_iterator
|
||||
crbegin() const noexcept
|
||||
{
|
||||
__profcxx_map2umap_invalidate(this->_M_map2umap_info);
|
||||
return const_reverse_iterator(cend());
|
||||
}
|
||||
|
||||
const_reverse_iterator
|
||||
crend() const noexcept
|
||||
{
|
||||
__profcxx_map2umap_invalidate(this->_M_map2umap_info);
|
||||
return const_reverse_iterator(cbegin());
|
||||
}
|
||||
#endif
|
||||
|
||||
// 23.3.1.2 element access:
|
||||
mapped_type&
|
||||
operator[](const key_type& __k)
|
||||
{
|
||||
__profcxx_map2umap_find(this->_M_map2umap_info, this->size());
|
||||
return _Base::operator[](__k);
|
||||
}
|
||||
|
||||
#if __cplusplus >= 201103L
|
||||
mapped_type&
|
||||
operator[](key_type&& __k)
|
||||
{
|
||||
__profcxx_map2umap_find(this->_M_map2umap_info, this->size());
|
||||
return _Base::operator[](std::move(__k));
|
||||
}
|
||||
#endif
|
||||
|
||||
mapped_type&
|
||||
at(const key_type& __k)
|
||||
{
|
||||
__profcxx_map2umap_find(this->_M_map2umap_info, this->size());
|
||||
return _Base::at(__k);
|
||||
}
|
||||
|
||||
const mapped_type&
|
||||
at(const key_type& __k) const
|
||||
{
|
||||
__profcxx_map2umap_find(this->_M_map2umap_info, this->size());
|
||||
return _Base::at(__k);
|
||||
}
|
||||
|
||||
// modifiers:
|
||||
#if __cplusplus >= 201103L
|
||||
template<typename... _Args>
|
||||
std::pair<iterator, bool>
|
||||
emplace(_Args&&... __args)
|
||||
{
|
||||
// The cost is the same whether or not the element is inserted so we
|
||||
// always report insertion of 1 element.
|
||||
__profcxx_map2umap_insert(this->_M_map2umap_info, this->size(), 1);
|
||||
auto __base_ret = _Base::emplace(std::forward<_Args>(__args)...);
|
||||
return std::make_pair(iterator(__base_ret.first, this),
|
||||
__base_ret.second);
|
||||
}
|
||||
|
||||
template<typename... _Args>
|
||||
iterator
|
||||
emplace_hint(const_iterator __pos, _Args&&... __args)
|
||||
{
|
||||
auto size_before = this->size();
|
||||
auto __res
|
||||
= _Base::emplace_hint(__pos.base(), std::forward<_Args>(__args)...);
|
||||
__profcxx_map2umap_insert(this->_M_map2umap_info,
|
||||
size_before, _M_hint_used(__pos.base(), __res) ? 0 : 1);
|
||||
return iterator(__res, this);
|
||||
}
|
||||
#endif
|
||||
|
||||
std::pair<iterator, bool>
|
||||
insert(const value_type& __x)
|
||||
{
|
||||
__profcxx_map2umap_insert(this->_M_map2umap_info, this->size(), 1);
|
||||
std::pair<_Base_iterator, bool> __base_ret = _Base::insert(__x);
|
||||
return std::make_pair(iterator(__base_ret.first, this),
|
||||
__base_ret.second);
|
||||
}
|
||||
|
||||
#if __cplusplus >= 201103L
|
||||
template<typename _Pair, typename = typename
|
||||
std::enable_if<std::is_constructible<value_type,
|
||||
_Pair&&>::value>::type>
|
||||
std::pair<iterator, bool>
|
||||
insert(_Pair&& __x)
|
||||
{
|
||||
__profcxx_map2umap_insert(this->_M_map2umap_info, this->size(), 1);
|
||||
auto __base_ret= _Base::insert(std::forward<_Pair>(__x));
|
||||
return std::make_pair(iterator(__base_ret.first, this),
|
||||
__base_ret.second);
|
||||
}
|
||||
#endif
|
||||
|
||||
#if __cplusplus >= 201103L
|
||||
void
|
||||
insert(std::initializer_list<value_type> __list)
|
||||
{ insert(__list.begin(), __list.end()); }
|
||||
#endif
|
||||
|
||||
iterator
|
||||
#if __cplusplus >= 201103L
|
||||
insert(const_iterator __pos, const value_type& __x)
|
||||
#else
|
||||
insert(iterator __pos, const value_type& __x)
|
||||
#endif
|
||||
{
|
||||
size_type size_before = this->size();
|
||||
_Base_iterator __res = _Base::insert(__pos.base(), __x);
|
||||
|
||||
__profcxx_map2umap_insert(this->_M_map2umap_info,
|
||||
size_before, _M_hint_used(__pos.base(), __res) ? 0 : 1);
|
||||
return iterator(__res, this);
|
||||
}
|
||||
|
||||
#if __cplusplus >= 201103L
|
||||
template<typename _Pair, typename = typename
|
||||
std::enable_if<std::is_constructible<value_type,
|
||||
_Pair&&>::value>::type>
|
||||
iterator
|
||||
insert(const_iterator __pos, _Pair&& __x)
|
||||
{
|
||||
size_type size_before = this->size();
|
||||
auto __res = _Base::insert(__pos.base(), std::forward<_Pair>(__x));
|
||||
|
||||
__profcxx_map2umap_insert(this->_M_map2umap_info,
|
||||
size_before, _M_hint_used(__pos.base(), __res) ? 0 : 1);
|
||||
return iterator(__res, this);
|
||||
}
|
||||
#endif
|
||||
|
||||
template<typename _InputIterator>
|
||||
void
|
||||
insert(_InputIterator __first, _InputIterator __last)
|
||||
{
|
||||
for (; __first != __last; ++__first)
|
||||
insert(*__first);
|
||||
}
|
||||
|
||||
#if __cplusplus >= 201103L
|
||||
iterator
|
||||
erase(const_iterator __pos)
|
||||
{
|
||||
__profcxx_map2umap_erase(this->_M_map2umap_info, this->size(), 1);
|
||||
return iterator(_Base::erase(__pos.base()), this);
|
||||
}
|
||||
|
||||
iterator
|
||||
erase(iterator __pos)
|
||||
{
|
||||
__profcxx_map2umap_erase(this->_M_map2umap_info, this->size(), 1);
|
||||
return iterator(_Base::erase(__pos.base()), this);
|
||||
}
|
||||
#else
|
||||
void
|
||||
erase(iterator __pos)
|
||||
{
|
||||
__profcxx_map2umap_erase(this->_M_map2umap_info, this->size(), 1);
|
||||
_Base::erase(__pos.base());
|
||||
}
|
||||
#endif
|
||||
|
||||
size_type
|
||||
erase(const key_type& __x)
|
||||
{
|
||||
__profcxx_map2umap_find(this->_M_map2umap_info, this->size());
|
||||
__profcxx_map2umap_erase(this->_M_map2umap_info, this->size(), 1);
|
||||
return _Base::erase(__x);
|
||||
}
|
||||
|
||||
#if __cplusplus >= 201103L
|
||||
iterator
|
||||
erase(const_iterator __first, const_iterator __last)
|
||||
{
|
||||
if (__first != __last)
|
||||
{
|
||||
iterator __ret;
|
||||
for (; __first != __last;)
|
||||
__ret = erase(__first++);
|
||||
return __ret;
|
||||
}
|
||||
else
|
||||
return iterator(_Base::erase(__first.base(), __last.base()), this);
|
||||
}
|
||||
#else
|
||||
void
|
||||
erase(iterator __first, iterator __last)
|
||||
{
|
||||
for (; __first != __last;)
|
||||
erase(__first++);
|
||||
}
|
||||
#endif
|
||||
|
||||
void
|
||||
swap(map& __x)
|
||||
#if __cplusplus >= 201103L
|
||||
noexcept( noexcept(declval<_Base>().swap(__x)) )
|
||||
#endif
|
||||
{
|
||||
_Base::swap(__x);
|
||||
this->_M_swap(__x);
|
||||
}
|
||||
|
||||
void
|
||||
clear() _GLIBCXX_NOEXCEPT
|
||||
{
|
||||
this->_M_profile_destruct();
|
||||
_Base::clear();
|
||||
this->_M_profile_construct();
|
||||
}
|
||||
|
||||
// 23.3.1.3 map operations:
|
||||
iterator
|
||||
find(const key_type& __x)
|
||||
{
|
||||
__profcxx_map2umap_find(this->_M_map2umap_info, this->size());
|
||||
return iterator(_Base::find(__x), this);
|
||||
}
|
||||
|
||||
const_iterator
|
||||
find(const key_type& __x) const
|
||||
{
|
||||
__profcxx_map2umap_find(this->_M_map2umap_info, this->size());
|
||||
return const_iterator(_Base::find(__x), this);
|
||||
}
|
||||
|
||||
size_type
|
||||
count(const key_type& __x) const
|
||||
{
|
||||
__profcxx_map2umap_find(this->_M_map2umap_info, this->size());
|
||||
return _Base::count(__x);
|
||||
}
|
||||
|
||||
iterator
|
||||
lower_bound(const key_type& __x)
|
||||
{
|
||||
__profcxx_map2umap_find(this->_M_map2umap_info, this->size());
|
||||
__profcxx_map2umap_invalidate(this->_M_map2umap_info);
|
||||
return iterator(_Base::lower_bound(__x), this);
|
||||
}
|
||||
|
||||
const_iterator
|
||||
lower_bound(const key_type& __x) const
|
||||
{
|
||||
__profcxx_map2umap_find(this->_M_map2umap_info, this->size());
|
||||
__profcxx_map2umap_invalidate(this->_M_map2umap_info);
|
||||
return const_iterator(_Base::lower_bound(__x), this);
|
||||
}
|
||||
|
||||
iterator
|
||||
upper_bound(const key_type& __x)
|
||||
{
|
||||
__profcxx_map2umap_find(this->_M_map2umap_info, this->size());
|
||||
__profcxx_map2umap_invalidate(this->_M_map2umap_info);
|
||||
return iterator(_Base::upper_bound(__x), this);
|
||||
}
|
||||
|
||||
const_iterator
|
||||
upper_bound(const key_type& __x) const
|
||||
{
|
||||
__profcxx_map2umap_find(this->_M_map2umap_info, this->size());
|
||||
__profcxx_map2umap_invalidate(this->_M_map2umap_info);
|
||||
return const_iterator(_Base::upper_bound(__x), this);
|
||||
}
|
||||
|
||||
std::pair<iterator,iterator>
|
||||
equal_range(const key_type& __x)
|
||||
{
|
||||
__profcxx_map2umap_find(this->_M_map2umap_info, this->size());
|
||||
std::pair<_Base_iterator, _Base_iterator> __base_ret
|
||||
= _Base::equal_range(__x);
|
||||
return std::make_pair(iterator(__base_ret.first, this),
|
||||
iterator(__base_ret.second, this));
|
||||
}
|
||||
|
||||
std::pair<const_iterator,const_iterator>
|
||||
equal_range(const key_type& __x) const
|
||||
{
|
||||
__profcxx_map2umap_find(this->_M_map2umap_info, this->size());
|
||||
std::pair<_Base_const_iterator, _Base_const_iterator> __base_ret
|
||||
= _Base::equal_range(__x);
|
||||
return std::make_pair(const_iterator(__base_ret.first, this),
|
||||
const_iterator(__base_ret.second, this));
|
||||
}
|
||||
|
||||
_Base&
|
||||
_M_base() _GLIBCXX_NOEXCEPT { return *this; }
|
||||
|
||||
const _Base&
|
||||
_M_base() const _GLIBCXX_NOEXCEPT { return *this; }
|
||||
|
||||
private:
|
||||
/** If hint is used we consider that the map and unordered_map
|
||||
* operations have equivalent insertion cost so we do not update metrics
|
||||
* about it.
|
||||
* Note that to find out if hint has been used is libstdc++
|
||||
* implementation dependent.
|
||||
*/
|
||||
bool
|
||||
_M_hint_used(_Base_const_iterator __hint, _Base_iterator __res)
|
||||
{
|
||||
return (__hint == __res
|
||||
|| (__hint == _M_base().end() && ++__res == _M_base().end())
|
||||
|| (__hint != _M_base().end() && (++__hint == __res
|
||||
|| ++__res == --__hint)));
|
||||
}
|
||||
|
||||
|
||||
template<typename _K1, typename _T1, typename _C1, typename _A1>
|
||||
friend bool
|
||||
operator==(const map<_K1, _T1, _C1, _A1>&,
|
||||
const map<_K1, _T1, _C1, _A1>&);
|
||||
|
||||
template<typename _K1, typename _T1, typename _C1, typename _A1>
|
||||
friend bool
|
||||
operator<(const map<_K1, _T1, _C1, _A1>&,
|
||||
const map<_K1, _T1, _C1, _A1>&);
|
||||
};
|
||||
|
||||
template<typename _Key, typename _Tp,
|
||||
typename _Compare, typename _Allocator>
|
||||
inline bool
|
||||
operator==(const map<_Key, _Tp, _Compare, _Allocator>& __lhs,
|
||||
const map<_Key, _Tp, _Compare, _Allocator>& __rhs)
|
||||
{
|
||||
__profcxx_map2umap_invalidate(__lhs._M_map2umap_info);
|
||||
__profcxx_map2umap_invalidate(__rhs._M_map2umap_info);
|
||||
return __lhs._M_base() == __rhs._M_base();
|
||||
}
|
||||
|
||||
template<typename _Key, typename _Tp,
|
||||
typename _Compare, typename _Allocator>
|
||||
inline bool
|
||||
operator<(const map<_Key, _Tp, _Compare, _Allocator>& __lhs,
|
||||
const map<_Key, _Tp, _Compare, _Allocator>& __rhs)
|
||||
{
|
||||
__profcxx_map2umap_invalidate(__lhs._M_map2umap_info);
|
||||
__profcxx_map2umap_invalidate(__rhs._M_map2umap_info);
|
||||
return __lhs._M_base() < __rhs._M_base();
|
||||
}
|
||||
|
||||
template<typename _Key, typename _Tp,
|
||||
typename _Compare, typename _Allocator>
|
||||
inline bool
|
||||
operator!=(const map<_Key, _Tp, _Compare, _Allocator>& __lhs,
|
||||
const map<_Key, _Tp, _Compare, _Allocator>& __rhs)
|
||||
{ return !(__lhs == __rhs); }
|
||||
|
||||
template<typename _Key, typename _Tp,
|
||||
typename _Compare, typename _Allocator>
|
||||
inline bool
|
||||
operator<=(const map<_Key, _Tp, _Compare, _Allocator>& __lhs,
|
||||
const map<_Key, _Tp, _Compare, _Allocator>& __rhs)
|
||||
{ return !(__rhs < __lhs); }
|
||||
|
||||
template<typename _Key, typename _Tp,
|
||||
typename _Compare, typename _Allocator>
|
||||
inline bool
|
||||
operator>=(const map<_Key, _Tp, _Compare, _Allocator>& __lhs,
|
||||
const map<_Key, _Tp, _Compare, _Allocator>& __rhs)
|
||||
{ return !(__lhs < __rhs); }
|
||||
|
||||
template<typename _Key, typename _Tp,
|
||||
typename _Compare, typename _Allocator>
|
||||
inline bool
|
||||
operator>(const map<_Key, _Tp, _Compare, _Allocator>& __lhs,
|
||||
const map<_Key, _Tp, _Compare, _Allocator>& __rhs)
|
||||
{ return __rhs < __lhs; }
|
||||
|
||||
template<typename _Key, typename _Tp,
|
||||
typename _Compare, typename _Allocator>
|
||||
inline void
|
||||
swap(map<_Key, _Tp, _Compare, _Allocator>& __lhs,
|
||||
map<_Key, _Tp, _Compare, _Allocator>& __rhs)
|
||||
{ __lhs.swap(__rhs); }
|
||||
|
||||
} // namespace __profile
|
||||
} // namespace std
|
||||
|
||||
#endif
|
||||
550
openflow/usr/include/c++/5/profile/multimap.h
Normal file
550
openflow/usr/include/c++/5/profile/multimap.h
Normal file
@@ -0,0 +1,550 @@
|
||||
// Profiling multimap implementation -*- C++ -*-
|
||||
|
||||
// Copyright (C) 2009-2015 Free Software Foundation, Inc.
|
||||
//
|
||||
// This file is part of the GNU ISO C++ Library. This library is free
|
||||
// software; you can redistribute it and/or modify it under the
|
||||
// terms of the GNU General Public License as published by the
|
||||
// Free Software Foundation; either version 3, or (at your option)
|
||||
// any later version.
|
||||
|
||||
// This library is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
|
||||
// Under Section 7 of GPL version 3, you are granted additional
|
||||
// permissions described in the GCC Runtime Library Exception, version
|
||||
// 3.1, as published by the Free Software Foundation.
|
||||
|
||||
// You should have received a copy of the GNU General Public License and
|
||||
// a copy of the GCC Runtime Library Exception along with this program;
|
||||
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
|
||||
// <http://www.gnu.org/licenses/>.
|
||||
|
||||
/** @file profile/multimap.h
|
||||
* This file is a GNU profile extension to the Standard C++ Library.
|
||||
*/
|
||||
|
||||
#ifndef _GLIBCXX_PROFILE_MULTIMAP_H
|
||||
#define _GLIBCXX_PROFILE_MULTIMAP_H 1
|
||||
|
||||
#include <profile/base.h>
|
||||
#include <profile/ordered_base.h>
|
||||
|
||||
namespace std _GLIBCXX_VISIBILITY(default)
|
||||
{
|
||||
namespace __profile
|
||||
{
|
||||
/// Class std::multimap wrapper with performance instrumentation.
|
||||
template<typename _Key, typename _Tp, typename _Compare = std::less<_Key>,
|
||||
typename _Allocator = std::allocator<std::pair<const _Key, _Tp> > >
|
||||
class multimap
|
||||
: public _GLIBCXX_STD_C::multimap<_Key, _Tp, _Compare, _Allocator>,
|
||||
public _Ordered_profile<map<_Key, _Tp, _Compare, _Allocator> >
|
||||
{
|
||||
typedef _GLIBCXX_STD_C::multimap<_Key, _Tp, _Compare, _Allocator> _Base;
|
||||
|
||||
typedef typename _Base::iterator _Base_iterator;
|
||||
typedef typename _Base::const_iterator _Base_const_iterator;
|
||||
|
||||
public:
|
||||
// types:
|
||||
typedef _Key key_type;
|
||||
typedef _Tp mapped_type;
|
||||
typedef std::pair<const _Key, _Tp> value_type;
|
||||
typedef _Compare key_compare;
|
||||
typedef typename _Base::reference reference;
|
||||
typedef typename _Base::const_reference const_reference;
|
||||
|
||||
typedef __iterator_tracker<_Base_iterator,
|
||||
multimap> iterator;
|
||||
typedef __iterator_tracker<_Base_const_iterator,
|
||||
multimap> const_iterator;
|
||||
typedef std::reverse_iterator<iterator> reverse_iterator;
|
||||
typedef std::reverse_iterator<const_iterator> const_reverse_iterator;
|
||||
|
||||
typedef typename _Base::size_type size_type;
|
||||
typedef typename _Base::difference_type difference_type;
|
||||
|
||||
// 23.3.1.1 construct/copy/destroy:
|
||||
|
||||
#if __cplusplus < 201103L
|
||||
multimap()
|
||||
: _Base() { }
|
||||
multimap(const multimap& __x)
|
||||
: _Base(__x) { }
|
||||
~multimap() { }
|
||||
#else
|
||||
multimap() = default;
|
||||
multimap(const multimap&) = default;
|
||||
multimap(multimap&&) = default;
|
||||
~multimap() = default;
|
||||
#endif
|
||||
|
||||
explicit multimap(const _Compare& __comp,
|
||||
const _Allocator& __a = _Allocator())
|
||||
: _Base(__comp, __a) { }
|
||||
|
||||
#if __cplusplus >= 201103L
|
||||
template<typename _InputIterator,
|
||||
typename = std::_RequireInputIter<_InputIterator>>
|
||||
#else
|
||||
template<typename _InputIterator>
|
||||
#endif
|
||||
multimap(_InputIterator __first, _InputIterator __last,
|
||||
const _Compare& __comp = _Compare(),
|
||||
const _Allocator& __a = _Allocator())
|
||||
: _Base(__first, __last, __comp, __a) { }
|
||||
|
||||
#if __cplusplus >= 201103L
|
||||
multimap(initializer_list<value_type> __l,
|
||||
const _Compare& __c = _Compare(),
|
||||
const _Allocator& __a = _Allocator())
|
||||
: _Base(__l, __c, __a) { }
|
||||
|
||||
explicit
|
||||
multimap(const _Allocator& __a)
|
||||
: _Base(__a) { }
|
||||
|
||||
multimap(const multimap& __x, const _Allocator& __a)
|
||||
: _Base(__x, __a) { }
|
||||
|
||||
multimap(multimap&& __x, const _Allocator& __a)
|
||||
noexcept( noexcept(_Base(std::move(__x), __a)) )
|
||||
: _Base(std::move(__x), __a) { }
|
||||
|
||||
multimap(initializer_list<value_type> __l, const _Allocator& __a)
|
||||
: _Base(__l, __a) { }
|
||||
|
||||
template<typename _InputIterator>
|
||||
multimap(_InputIterator __first, _InputIterator __last,
|
||||
const _Allocator& __a)
|
||||
: _Base(__first, __last, __a) { }
|
||||
#endif
|
||||
|
||||
multimap(const _Base& __x)
|
||||
: _Base(__x) { }
|
||||
|
||||
#if __cplusplus < 201103L
|
||||
multimap&
|
||||
operator=(const multimap& __x)
|
||||
{
|
||||
this->_M_profile_destruct();
|
||||
_M_base() = __x;
|
||||
this->_M_profile_construct();
|
||||
return *this;
|
||||
}
|
||||
#else
|
||||
multimap&
|
||||
operator=(const multimap&) = default;
|
||||
|
||||
multimap&
|
||||
operator=(multimap&&) = default;
|
||||
|
||||
multimap&
|
||||
operator=(initializer_list<value_type> __l)
|
||||
{
|
||||
this->_M_profile_destruct();
|
||||
_M_base() = __l;
|
||||
this->_M_profile_construct();
|
||||
return *this;
|
||||
}
|
||||
#endif
|
||||
|
||||
// iterators
|
||||
iterator
|
||||
begin() _GLIBCXX_NOEXCEPT
|
||||
{ return iterator(_Base::begin(), this); }
|
||||
|
||||
const_iterator
|
||||
begin() const _GLIBCXX_NOEXCEPT
|
||||
{ return const_iterator(_Base::begin(), this); }
|
||||
|
||||
iterator
|
||||
end() _GLIBCXX_NOEXCEPT
|
||||
{ return iterator(_Base::end(), this); }
|
||||
|
||||
const_iterator
|
||||
end() const _GLIBCXX_NOEXCEPT
|
||||
{ return const_iterator(_Base::end(), this); }
|
||||
|
||||
#if __cplusplus >= 201103L
|
||||
const_iterator
|
||||
cbegin() const noexcept
|
||||
{ return const_iterator(_Base::cbegin(), this); }
|
||||
|
||||
const_iterator
|
||||
cend() const noexcept
|
||||
{ return const_iterator(_Base::cend(), this); }
|
||||
#endif
|
||||
|
||||
reverse_iterator
|
||||
rbegin() _GLIBCXX_NOEXCEPT
|
||||
{
|
||||
__profcxx_map2umap_invalidate(this->_M_map2umap_info);
|
||||
return reverse_iterator(end());
|
||||
}
|
||||
|
||||
const_reverse_iterator
|
||||
rbegin() const _GLIBCXX_NOEXCEPT
|
||||
{
|
||||
__profcxx_map2umap_invalidate(this->_M_map2umap_info);
|
||||
return const_reverse_iterator(end());
|
||||
}
|
||||
|
||||
reverse_iterator
|
||||
rend() _GLIBCXX_NOEXCEPT
|
||||
{
|
||||
__profcxx_map2umap_invalidate(this->_M_map2umap_info);
|
||||
return reverse_iterator(begin());
|
||||
}
|
||||
|
||||
const_reverse_iterator
|
||||
rend() const _GLIBCXX_NOEXCEPT
|
||||
{
|
||||
__profcxx_map2umap_invalidate(this->_M_map2umap_info);
|
||||
return const_reverse_iterator(begin());
|
||||
}
|
||||
|
||||
#if __cplusplus >= 201103L
|
||||
const_reverse_iterator
|
||||
crbegin() const noexcept
|
||||
{
|
||||
__profcxx_map2umap_invalidate(this->_M_map2umap_info);
|
||||
return const_reverse_iterator(cend());
|
||||
}
|
||||
|
||||
const_reverse_iterator
|
||||
crend() const noexcept
|
||||
{
|
||||
__profcxx_map2umap_invalidate(this->_M_map2umap_info);
|
||||
return const_reverse_iterator(cbegin());
|
||||
}
|
||||
#endif
|
||||
|
||||
// modifiers:
|
||||
#if __cplusplus >= 201103L
|
||||
template<typename... _Args>
|
||||
iterator
|
||||
emplace(_Args&&... __args)
|
||||
{
|
||||
__profcxx_map2umap_insert(this->_M_map2umap_info, this->size(), 1);
|
||||
return iterator(_Base::emplace(std::forward<_Args>(__args)...), this);
|
||||
}
|
||||
|
||||
template<typename... _Args>
|
||||
iterator
|
||||
emplace_hint(const_iterator __pos, _Args&&... __args)
|
||||
{
|
||||
auto size_before = this->size();
|
||||
auto __res
|
||||
= _Base::emplace_hint(__pos.base(), std::forward<_Args>(__args)...);
|
||||
__profcxx_map2umap_insert(this->_M_map2umap_info,
|
||||
size_before, _M_hint_used(__pos.base(), __res) ? 0 : 1);
|
||||
return iterator(__res, this);
|
||||
}
|
||||
#endif
|
||||
|
||||
iterator
|
||||
insert(const value_type& __x)
|
||||
{
|
||||
__profcxx_map2umap_insert(this->_M_map2umap_info, this->size(), 1);
|
||||
return iterator(_Base::insert(__x), this);
|
||||
}
|
||||
|
||||
#if __cplusplus >= 201103L
|
||||
template<typename _Pair, typename = typename
|
||||
std::enable_if<std::is_constructible<value_type,
|
||||
_Pair&&>::value>::type>
|
||||
iterator
|
||||
insert(_Pair&& __x)
|
||||
{
|
||||
__profcxx_map2umap_insert(this->_M_map2umap_info, this->size(), 1);
|
||||
return iterator(_Base::insert(std::forward<_Pair>(__x)), this);
|
||||
}
|
||||
#endif
|
||||
|
||||
#if __cplusplus >= 201103L
|
||||
void
|
||||
insert(std::initializer_list<value_type> __list)
|
||||
{ insert(__list.begin(), __list.end()); }
|
||||
#endif
|
||||
|
||||
iterator
|
||||
#if __cplusplus >= 201103L
|
||||
insert(const_iterator __pos, const value_type& __x)
|
||||
#else
|
||||
insert(iterator __pos, const value_type& __x)
|
||||
#endif
|
||||
{
|
||||
size_type size_before = this->size();
|
||||
_Base_iterator __res = _Base::insert(__pos.base(), __x);
|
||||
__profcxx_map2umap_insert(this->_M_map2umap_info,
|
||||
size_before, _M_hint_used(__pos.base(), __res) ? 0 : 1);
|
||||
return iterator(__res, this);
|
||||
}
|
||||
|
||||
#if __cplusplus >= 201103L
|
||||
template<typename _Pair, typename = typename
|
||||
std::enable_if<std::is_constructible<value_type,
|
||||
_Pair&&>::value>::type>
|
||||
iterator
|
||||
insert(const_iterator __pos, _Pair&& __x)
|
||||
{
|
||||
size_type size_before = this->size();
|
||||
auto __res = _Base::insert(__pos.base(), std::forward<_Pair>(__x));
|
||||
__profcxx_map2umap_insert(this->_M_map2umap_info,
|
||||
size_before, _M_hint_used(__pos.base(), __res) ? 0 : 1);
|
||||
return iterator(__res, this);
|
||||
}
|
||||
#endif
|
||||
|
||||
template<typename _InputIterator>
|
||||
void
|
||||
insert(_InputIterator __first, _InputIterator __last)
|
||||
{
|
||||
for (; __first != __last; ++__first)
|
||||
insert(*__first);
|
||||
}
|
||||
|
||||
#if __cplusplus >= 201103L
|
||||
iterator
|
||||
erase(const_iterator __pos)
|
||||
{
|
||||
__profcxx_map2umap_erase(this->_M_map2umap_info, this->size(), 1);
|
||||
return iterator(_Base::erase(__pos.base()), this);
|
||||
}
|
||||
|
||||
iterator
|
||||
erase(iterator __pos)
|
||||
{
|
||||
__profcxx_map2umap_erase(this->_M_map2umap_info, this->size(), 1);
|
||||
return iterator(_Base::erase(__pos.base()), this);
|
||||
}
|
||||
#else
|
||||
void
|
||||
erase(iterator __pos)
|
||||
{
|
||||
__profcxx_map2umap_erase(this->_M_map2umap_info, this->size(), 1);
|
||||
_Base::erase(__pos.base());
|
||||
}
|
||||
#endif
|
||||
|
||||
size_type
|
||||
erase(const key_type& __x)
|
||||
{
|
||||
__profcxx_map2umap_find(this->_M_map2umap_info, this->size());
|
||||
__profcxx_map2umap_erase(this->_M_map2umap_info, this->size(), 1);
|
||||
return _Base::erase(__x);
|
||||
}
|
||||
|
||||
#if __cplusplus >= 201103L
|
||||
iterator
|
||||
erase(const_iterator __first, const_iterator __last)
|
||||
{
|
||||
if (__first != __last)
|
||||
{
|
||||
iterator __ret;
|
||||
for (; __first != __last;)
|
||||
__ret = erase(__first++);
|
||||
return __ret;
|
||||
}
|
||||
else
|
||||
return iterator(_Base::erase(__first.base(), __last.base()), this);
|
||||
}
|
||||
#else
|
||||
void
|
||||
erase(iterator __first, iterator __last)
|
||||
{
|
||||
for (; __first != __last;)
|
||||
erase(__first++);
|
||||
}
|
||||
#endif
|
||||
|
||||
void
|
||||
swap(multimap& __x)
|
||||
#if __cplusplus >= 201103L
|
||||
noexcept( noexcept(declval<_Base>().swap(__x)) )
|
||||
#endif
|
||||
{
|
||||
std::swap(this->_M_map2umap_info, __x._M_map2umap_info);
|
||||
_Base::swap(__x);
|
||||
}
|
||||
|
||||
void
|
||||
clear() _GLIBCXX_NOEXCEPT
|
||||
{
|
||||
this->_M_profile_destruct();
|
||||
_Base::clear();
|
||||
this->_M_profile_construct();
|
||||
}
|
||||
|
||||
// 23.3.1.3 multimap operations:
|
||||
iterator
|
||||
find(const key_type& __x)
|
||||
{
|
||||
__profcxx_map2umap_find(this->_M_map2umap_info, this->size());
|
||||
return iterator(_Base::find(__x), this);
|
||||
}
|
||||
|
||||
const_iterator
|
||||
find(const key_type& __x) const
|
||||
{
|
||||
__profcxx_map2umap_find(this->_M_map2umap_info, this->size());
|
||||
return const_iterator(_Base::find(__x), this);
|
||||
}
|
||||
|
||||
size_type
|
||||
count(const key_type& __x) const
|
||||
{
|
||||
__profcxx_map2umap_find(this->_M_map2umap_info, this->size());
|
||||
return _Base::count(__x);
|
||||
}
|
||||
|
||||
iterator
|
||||
lower_bound(const key_type& __x)
|
||||
{
|
||||
__profcxx_map2umap_find(this->_M_map2umap_info, this->size());
|
||||
__profcxx_map2umap_invalidate(this->_M_map2umap_info);
|
||||
return iterator(_Base::lower_bound(__x), this);
|
||||
}
|
||||
|
||||
const_iterator
|
||||
lower_bound(const key_type& __x) const
|
||||
{
|
||||
__profcxx_map2umap_find(this->_M_map2umap_info, this->size());
|
||||
__profcxx_map2umap_invalidate(this->_M_map2umap_info);
|
||||
return const_iterator(_Base::lower_bound(__x), this);
|
||||
}
|
||||
|
||||
iterator
|
||||
upper_bound(const key_type& __x)
|
||||
{
|
||||
__profcxx_map2umap_find(this->_M_map2umap_info, this->size());
|
||||
__profcxx_map2umap_invalidate(this->_M_map2umap_info);
|
||||
return iterator(_Base::upper_bound(__x), this);
|
||||
}
|
||||
|
||||
const_iterator
|
||||
upper_bound(const key_type& __x) const
|
||||
{
|
||||
__profcxx_map2umap_find(this->_M_map2umap_info, this->size());
|
||||
__profcxx_map2umap_invalidate(this->_M_map2umap_info);
|
||||
return const_iterator(_Base::upper_bound(__x), this);
|
||||
}
|
||||
|
||||
std::pair<iterator,iterator>
|
||||
equal_range(const key_type& __x)
|
||||
{
|
||||
__profcxx_map2umap_find(this->_M_map2umap_info, this->size());
|
||||
std::pair<_Base_iterator, _Base_iterator> __base_ret
|
||||
= _Base::equal_range(__x);
|
||||
return std::make_pair(iterator(__base_ret.first, this),
|
||||
iterator(__base_ret.second, this));
|
||||
}
|
||||
|
||||
std::pair<const_iterator,const_iterator>
|
||||
equal_range(const key_type& __x) const
|
||||
{
|
||||
__profcxx_map2umap_find(this->_M_map2umap_info, this->size());
|
||||
std::pair<_Base_const_iterator, _Base_const_iterator> __base_ret
|
||||
= _Base::equal_range(__x);
|
||||
return std::make_pair(const_iterator(__base_ret.first, this),
|
||||
const_iterator(__base_ret.second, this));
|
||||
}
|
||||
|
||||
_Base&
|
||||
_M_base() _GLIBCXX_NOEXCEPT { return *this; }
|
||||
|
||||
const _Base&
|
||||
_M_base() const _GLIBCXX_NOEXCEPT { return *this; }
|
||||
|
||||
private:
|
||||
/** If hint is used we consider that the map and unordered_map
|
||||
* operations have equivalent insertion cost so we do not update metrics
|
||||
* about it.
|
||||
* Note that to find out if hint has been used is libstdc++
|
||||
* implementation dependent.
|
||||
*/
|
||||
bool
|
||||
_M_hint_used(_Base_const_iterator __hint, _Base_iterator __res)
|
||||
{
|
||||
return (__hint == __res
|
||||
|| (__hint == _M_base().end() && ++__res == _M_base().end())
|
||||
|| (__hint != _M_base().end() && (++__hint == __res
|
||||
|| ++__res == --__hint)));
|
||||
}
|
||||
|
||||
template<typename _K1, typename _T1, typename _C1, typename _A1>
|
||||
friend bool
|
||||
operator==(const multimap<_K1, _T1, _C1, _A1>&,
|
||||
const multimap<_K1, _T1, _C1, _A1>&);
|
||||
|
||||
template<typename _K1, typename _T1, typename _C1, typename _A1>
|
||||
friend bool
|
||||
operator<(const multimap<_K1, _T1, _C1, _A1>&,
|
||||
const multimap<_K1, _T1, _C1, _A1>&);
|
||||
};
|
||||
|
||||
template<typename _Key, typename _Tp,
|
||||
typename _Compare, typename _Allocator>
|
||||
inline bool
|
||||
operator==(const multimap<_Key, _Tp, _Compare, _Allocator>& __lhs,
|
||||
const multimap<_Key, _Tp, _Compare, _Allocator>& __rhs)
|
||||
{
|
||||
__profcxx_map2umap_invalidate(__lhs._M_map2umap_info);
|
||||
__profcxx_map2umap_invalidate(__rhs._M_map2umap_info);
|
||||
return __lhs._M_base() == __rhs._M_base();
|
||||
}
|
||||
|
||||
template<typename _Key, typename _Tp,
|
||||
typename _Compare, typename _Allocator>
|
||||
inline bool
|
||||
operator<(const multimap<_Key, _Tp, _Compare, _Allocator>& __lhs,
|
||||
const multimap<_Key, _Tp, _Compare, _Allocator>& __rhs)
|
||||
{
|
||||
__profcxx_map2umap_invalidate(__lhs._M_map2umap_info);
|
||||
__profcxx_map2umap_invalidate(__rhs._M_map2umap_info);
|
||||
return __lhs._M_base() < __rhs._M_base();
|
||||
}
|
||||
|
||||
template<typename _Key, typename _Tp,
|
||||
typename _Compare, typename _Allocator>
|
||||
inline bool
|
||||
operator!=(const multimap<_Key, _Tp, _Compare, _Allocator>& __lhs,
|
||||
const multimap<_Key, _Tp, _Compare, _Allocator>& __rhs)
|
||||
{ return !(__lhs == __rhs); }
|
||||
|
||||
template<typename _Key, typename _Tp,
|
||||
typename _Compare, typename _Allocator>
|
||||
inline bool
|
||||
operator<=(const multimap<_Key, _Tp, _Compare, _Allocator>& __lhs,
|
||||
const multimap<_Key, _Tp, _Compare, _Allocator>& __rhs)
|
||||
{ return !(__rhs < __lhs); }
|
||||
|
||||
template<typename _Key, typename _Tp,
|
||||
typename _Compare, typename _Allocator>
|
||||
inline bool
|
||||
operator>=(const multimap<_Key, _Tp, _Compare, _Allocator>& __lhs,
|
||||
const multimap<_Key, _Tp, _Compare, _Allocator>& __rhs)
|
||||
{ return !(__lhs < __rhs); }
|
||||
|
||||
template<typename _Key, typename _Tp,
|
||||
typename _Compare, typename _Allocator>
|
||||
inline bool
|
||||
operator>(const multimap<_Key, _Tp, _Compare, _Allocator>& __lhs,
|
||||
const multimap<_Key, _Tp, _Compare, _Allocator>& __rhs)
|
||||
{ return __rhs < __lhs; }
|
||||
|
||||
template<typename _Key, typename _Tp,
|
||||
typename _Compare, typename _Allocator>
|
||||
inline void
|
||||
swap(multimap<_Key, _Tp, _Compare, _Allocator>& __lhs,
|
||||
multimap<_Key, _Tp, _Compare, _Allocator>& __rhs)
|
||||
{ __lhs.swap(__rhs); }
|
||||
|
||||
} // namespace __profile
|
||||
} // namespace std
|
||||
|
||||
#endif
|
||||
542
openflow/usr/include/c++/5/profile/multiset.h
Normal file
542
openflow/usr/include/c++/5/profile/multiset.h
Normal file
@@ -0,0 +1,542 @@
|
||||
// Profiling multiset implementation -*- C++ -*-
|
||||
|
||||
// Copyright (C) 2009-2015 Free Software Foundation, Inc.
|
||||
//
|
||||
// This file is part of the GNU ISO C++ Library. This library is free
|
||||
// software; you can redistribute it and/or modify it under the
|
||||
// terms of the GNU General Public License as published by the
|
||||
// Free Software Foundation; either version 3, or (at your option)
|
||||
// any later version.
|
||||
|
||||
// This library is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
|
||||
// Under Section 7 of GPL version 3, you are granted additional
|
||||
// permissions described in the GCC Runtime Library Exception, version
|
||||
// 3.1, as published by the Free Software Foundation.
|
||||
|
||||
// You should have received a copy of the GNU General Public License and
|
||||
// a copy of the GCC Runtime Library Exception along with this program;
|
||||
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
|
||||
// <http://www.gnu.org/licenses/>.
|
||||
|
||||
/** @file profile/multiset.h
|
||||
* This file is a GNU profile extension to the Standard C++ Library.
|
||||
*/
|
||||
|
||||
#ifndef _GLIBCXX_PROFILE_MULTISET_H
|
||||
#define _GLIBCXX_PROFILE_MULTISET_H 1
|
||||
|
||||
#include <profile/base.h>
|
||||
#include <profile/ordered_base.h>
|
||||
|
||||
namespace std _GLIBCXX_VISIBILITY(default)
|
||||
{
|
||||
namespace __profile
|
||||
{
|
||||
/// Class std::multiset wrapper with performance instrumentation.
|
||||
template<typename _Key, typename _Compare = std::less<_Key>,
|
||||
typename _Allocator = std::allocator<_Key> >
|
||||
class multiset
|
||||
: public _GLIBCXX_STD_C::multiset<_Key, _Compare, _Allocator>,
|
||||
public _Ordered_profile<multiset<_Key, _Compare, _Allocator> >
|
||||
{
|
||||
typedef _GLIBCXX_STD_C::multiset<_Key, _Compare, _Allocator> _Base;
|
||||
|
||||
typedef typename _Base::iterator _Base_iterator;
|
||||
typedef typename _Base::const_iterator _Base_const_iterator;
|
||||
|
||||
public:
|
||||
// types:
|
||||
typedef _Key key_type;
|
||||
typedef _Key value_type;
|
||||
typedef _Compare key_compare;
|
||||
typedef _Compare value_compare;
|
||||
typedef _Allocator allocator_type;
|
||||
typedef typename _Base::reference reference;
|
||||
typedef typename _Base::const_reference const_reference;
|
||||
|
||||
typedef __iterator_tracker<_Base_iterator,
|
||||
multiset> iterator;
|
||||
typedef __iterator_tracker<_Base_const_iterator,
|
||||
multiset> const_iterator;
|
||||
typedef std::reverse_iterator<iterator> reverse_iterator;
|
||||
typedef std::reverse_iterator<const_iterator> const_reverse_iterator;
|
||||
|
||||
typedef typename _Base::size_type size_type;
|
||||
typedef typename _Base::difference_type difference_type;
|
||||
|
||||
// 23.3.3.1 construct/copy/destroy:
|
||||
|
||||
#if __cplusplus < 201103L
|
||||
multiset()
|
||||
: _Base() { }
|
||||
multiset(const multiset& __x)
|
||||
: _Base(__x) { }
|
||||
~multiset() { }
|
||||
#else
|
||||
multiset() = default;
|
||||
multiset(const multiset&) = default;
|
||||
multiset(multiset&&) = default;
|
||||
~multiset() = default;
|
||||
#endif
|
||||
|
||||
explicit multiset(const _Compare& __comp,
|
||||
const _Allocator& __a = _Allocator())
|
||||
: _Base(__comp, __a) { }
|
||||
|
||||
#if __cplusplus >= 201103L
|
||||
template<typename _InputIterator,
|
||||
typename = std::_RequireInputIter<_InputIterator>>
|
||||
#else
|
||||
template<typename _InputIterator>
|
||||
#endif
|
||||
multiset(_InputIterator __first, _InputIterator __last,
|
||||
const _Compare& __comp = _Compare(),
|
||||
const _Allocator& __a = _Allocator())
|
||||
: _Base(__first, __last, __comp, __a) { }
|
||||
|
||||
#if __cplusplus >= 201103L
|
||||
multiset(initializer_list<value_type> __l,
|
||||
const _Compare& __comp = _Compare(),
|
||||
const allocator_type& __a = allocator_type())
|
||||
: _Base(__l, __comp, __a) { }
|
||||
|
||||
explicit
|
||||
multiset(const allocator_type& __a)
|
||||
: _Base(__a) { }
|
||||
|
||||
multiset(const multiset& __x, const allocator_type& __a)
|
||||
: _Base(__x, __a) { }
|
||||
|
||||
multiset(multiset&& __x, const allocator_type& __a)
|
||||
noexcept( noexcept(_Base(std::move(__x), __a)) )
|
||||
: _Base(std::move(__x), __a) { }
|
||||
|
||||
multiset(initializer_list<value_type> __l, const allocator_type& __a)
|
||||
: _Base(__l, __a) { }
|
||||
|
||||
template<typename _InputIterator>
|
||||
multiset(_InputIterator __first, _InputIterator __last,
|
||||
const allocator_type& __a)
|
||||
: _Base(__first, __last, __a) { }
|
||||
#endif
|
||||
|
||||
multiset(const _Base& __x)
|
||||
: _Base(__x) { }
|
||||
|
||||
#if __cplusplus < 201103L
|
||||
multiset&
|
||||
operator=(const multiset& __x)
|
||||
{
|
||||
this->_M_profile_destruct();
|
||||
_M_base() = __x;
|
||||
this->_M_profile_construct();
|
||||
return *this;
|
||||
}
|
||||
#else
|
||||
multiset&
|
||||
operator=(const multiset&) = default;
|
||||
|
||||
multiset&
|
||||
operator=(multiset&&) = default;
|
||||
|
||||
multiset&
|
||||
operator=(initializer_list<value_type> __l)
|
||||
{
|
||||
this->_M_profile_destruct();
|
||||
_M_base() = __l;
|
||||
this->_M_profile_construct();
|
||||
return *this;
|
||||
}
|
||||
#endif
|
||||
|
||||
// iterators
|
||||
iterator
|
||||
begin() _GLIBCXX_NOEXCEPT
|
||||
{ return iterator(_Base::begin(), this); }
|
||||
|
||||
const_iterator
|
||||
begin() const _GLIBCXX_NOEXCEPT
|
||||
{ return const_iterator(_Base::begin(), this); }
|
||||
|
||||
iterator
|
||||
end() _GLIBCXX_NOEXCEPT
|
||||
{ return iterator(_Base::end(), this); }
|
||||
|
||||
const_iterator
|
||||
end() const _GLIBCXX_NOEXCEPT
|
||||
{ return const_iterator(_Base::end(), this); }
|
||||
|
||||
#if __cplusplus >= 201103L
|
||||
const_iterator
|
||||
cbegin() const noexcept
|
||||
{ return const_iterator(_Base::cbegin(), this); }
|
||||
|
||||
const_iterator
|
||||
cend() const noexcept
|
||||
{ return const_iterator(_Base::cend(), this); }
|
||||
#endif
|
||||
|
||||
reverse_iterator
|
||||
rbegin() _GLIBCXX_NOEXCEPT
|
||||
{
|
||||
__profcxx_map2umap_invalidate(this->_M_map2umap_info);
|
||||
return reverse_iterator(end());
|
||||
}
|
||||
|
||||
const_reverse_iterator
|
||||
rbegin() const _GLIBCXX_NOEXCEPT
|
||||
{
|
||||
__profcxx_map2umap_invalidate(this->_M_map2umap_info);
|
||||
return const_reverse_iterator(end());
|
||||
}
|
||||
|
||||
reverse_iterator
|
||||
rend() _GLIBCXX_NOEXCEPT
|
||||
{
|
||||
__profcxx_map2umap_invalidate(this->_M_map2umap_info);
|
||||
return reverse_iterator(begin());
|
||||
}
|
||||
|
||||
const_reverse_iterator
|
||||
rend() const _GLIBCXX_NOEXCEPT
|
||||
{
|
||||
__profcxx_map2umap_invalidate(this->_M_map2umap_info);
|
||||
return const_reverse_iterator(begin());
|
||||
}
|
||||
|
||||
#if __cplusplus >= 201103L
|
||||
const_reverse_iterator
|
||||
crbegin() const noexcept
|
||||
{
|
||||
__profcxx_map2umap_invalidate(this->_M_map2umap_info);
|
||||
return const_reverse_iterator(cend());
|
||||
}
|
||||
|
||||
const_reverse_iterator
|
||||
crend() const noexcept
|
||||
{
|
||||
__profcxx_map2umap_invalidate(this->_M_map2umap_info);
|
||||
return const_reverse_iterator(cbegin());
|
||||
}
|
||||
#endif
|
||||
|
||||
void
|
||||
swap(multiset& __x)
|
||||
#if __cplusplus >= 201103L
|
||||
noexcept( noexcept(declval<_Base>().swap(__x)) )
|
||||
#endif
|
||||
{
|
||||
_Base::swap(__x);
|
||||
this->_M_swap(__x);
|
||||
}
|
||||
|
||||
// modifiers:
|
||||
#if __cplusplus >= 201103L
|
||||
template<typename... _Args>
|
||||
iterator
|
||||
emplace(_Args&&... __args)
|
||||
{
|
||||
// The cost is the same whether or not the element is inserted so we
|
||||
// always report insertion of 1 element.
|
||||
__profcxx_map2umap_insert(this->_M_map2umap_info, this->size(), 1);
|
||||
return iterator(_Base::emplace(std::forward<_Args>(__args)...), this);
|
||||
}
|
||||
|
||||
template<typename... _Args>
|
||||
iterator
|
||||
emplace_hint(const_iterator __pos, _Args&&... __args)
|
||||
{
|
||||
auto size_before = this->size();
|
||||
auto __res
|
||||
= _Base::emplace_hint(__pos.base(), std::forward<_Args>(__args)...);
|
||||
__profcxx_map2umap_insert(this->_M_map2umap_info,
|
||||
size_before, _M_hint_used(__pos.base(), __res) ? 0 : 1);
|
||||
return iterator(__res, this);
|
||||
}
|
||||
#endif
|
||||
|
||||
iterator
|
||||
insert(const value_type& __x)
|
||||
{
|
||||
__profcxx_map2umap_insert(this->_M_map2umap_info, this->size(), 1);
|
||||
return iterator(_Base::insert(__x), this);
|
||||
}
|
||||
|
||||
#if __cplusplus >= 201103L
|
||||
iterator
|
||||
insert(value_type&& __x)
|
||||
{
|
||||
__profcxx_map2umap_insert(this->_M_map2umap_info, this->size(), 1);
|
||||
return iterator(_Base::insert(std::move(__x)), this);
|
||||
}
|
||||
#endif
|
||||
|
||||
iterator
|
||||
insert(const_iterator __pos, const value_type& __x)
|
||||
{
|
||||
size_type size_before = this->size();
|
||||
_Base_iterator __res = _Base::insert(__pos.base(), __x);
|
||||
|
||||
__profcxx_map2umap_insert(this->_M_map2umap_info,
|
||||
size_before, _M_hint_used(__pos.base(), __res) ? 0 : 1);
|
||||
return iterator(__res, this);
|
||||
}
|
||||
|
||||
#if __cplusplus >= 201103L
|
||||
iterator
|
||||
insert(const_iterator __pos, value_type&& __x)
|
||||
{
|
||||
auto size_before = this->size();
|
||||
auto __res = _Base::insert(__pos.base(), std::move(__x));
|
||||
__profcxx_map2umap_insert(this->_M_map2umap_info,
|
||||
size_before, _M_hint_used(__pos.base(), __res) ? 0 : 1);
|
||||
return iterator(__res, this);
|
||||
}
|
||||
#endif
|
||||
|
||||
#if __cplusplus >= 201103L
|
||||
template<typename _InputIterator,
|
||||
typename = std::_RequireInputIter<_InputIterator>>
|
||||
#else
|
||||
template<typename _InputIterator>
|
||||
#endif
|
||||
void
|
||||
insert(_InputIterator __first, _InputIterator __last)
|
||||
{
|
||||
for (; __first != __last; ++__first)
|
||||
insert(*__first);
|
||||
}
|
||||
|
||||
#if __cplusplus >= 201103L
|
||||
void
|
||||
insert(initializer_list<value_type> __l)
|
||||
{ insert(__l.begin(), __l.end()); }
|
||||
#endif
|
||||
|
||||
#if __cplusplus >= 201103L
|
||||
iterator
|
||||
erase(const_iterator __pos)
|
||||
{
|
||||
__profcxx_map2umap_erase(this->_M_map2umap_info, this->size(), 1);
|
||||
return iterator(_Base::erase(__pos.base()), this);
|
||||
}
|
||||
#else
|
||||
void
|
||||
erase(iterator __pos)
|
||||
{
|
||||
__profcxx_map2umap_erase(this->_M_map2umap_info, this->size(), 1);
|
||||
_Base::erase(__pos.base());
|
||||
}
|
||||
#endif
|
||||
|
||||
size_type
|
||||
erase(const key_type& __x)
|
||||
{
|
||||
__profcxx_map2umap_find(this->_M_map2umap_info, this->size());
|
||||
__profcxx_map2umap_erase(this->_M_map2umap_info, this->size(), 1);
|
||||
return _Base::erase(__x);
|
||||
}
|
||||
|
||||
#if __cplusplus >= 201103L
|
||||
iterator
|
||||
erase(const_iterator __first, const_iterator __last)
|
||||
{
|
||||
if (__first != __last)
|
||||
{
|
||||
iterator __ret;
|
||||
for (; __first != __last;)
|
||||
__ret = erase(__first++);
|
||||
return __ret;
|
||||
}
|
||||
else
|
||||
return iterator(_Base::erase(__first.base(), __last.base()), this);
|
||||
}
|
||||
#else
|
||||
void
|
||||
erase(iterator __first, iterator __last)
|
||||
{
|
||||
for (; __first != __last;)
|
||||
erase(__first++);
|
||||
}
|
||||
#endif
|
||||
|
||||
void
|
||||
clear() _GLIBCXX_NOEXCEPT
|
||||
{
|
||||
this->_M_profile_destruct();
|
||||
_Base::clear();
|
||||
this->_M_profile_construct();
|
||||
}
|
||||
|
||||
size_type
|
||||
count(const key_type& __x) const
|
||||
{
|
||||
__profcxx_map2umap_find(this->_M_map2umap_info, this->size());
|
||||
return _Base::count(__x);
|
||||
}
|
||||
|
||||
// multiset operations:
|
||||
iterator
|
||||
find(const key_type& __x)
|
||||
{
|
||||
__profcxx_map2umap_find(this->_M_map2umap_info, this->size());
|
||||
return iterator(_Base::find(__x), this);
|
||||
}
|
||||
|
||||
// _GLIBCXX_RESOLVE_LIB_DEFECTS
|
||||
// 214. set::find() missing const overload
|
||||
const_iterator
|
||||
find(const key_type& __x) const
|
||||
{
|
||||
__profcxx_map2umap_find(this->_M_map2umap_info, this->size());
|
||||
return const_iterator(_Base::find(__x), this);
|
||||
}
|
||||
|
||||
iterator
|
||||
lower_bound(const key_type& __x)
|
||||
{
|
||||
__profcxx_map2umap_find(this->_M_map2umap_info, this->size());
|
||||
return iterator(_Base::lower_bound(__x), this);
|
||||
}
|
||||
|
||||
// _GLIBCXX_RESOLVE_LIB_DEFECTS
|
||||
// 214. set::find() missing const overload
|
||||
const_iterator
|
||||
lower_bound(const key_type& __x) const
|
||||
{
|
||||
__profcxx_map2umap_find(this->_M_map2umap_info, this->size());
|
||||
__profcxx_map2umap_invalidate(this->_M_map2umap_info);
|
||||
return const_iterator(_Base::lower_bound(__x), this);
|
||||
}
|
||||
|
||||
iterator
|
||||
upper_bound(const key_type& __x)
|
||||
{
|
||||
__profcxx_map2umap_find(this->_M_map2umap_info, this->size());
|
||||
__profcxx_map2umap_invalidate(this->_M_map2umap_info);
|
||||
return iterator(_Base::upper_bound(__x), this);
|
||||
}
|
||||
|
||||
// _GLIBCXX_RESOLVE_LIB_DEFECTS
|
||||
// 214. set::find() missing const overload
|
||||
const_iterator
|
||||
upper_bound(const key_type& __x) const
|
||||
{
|
||||
__profcxx_map2umap_find(this->_M_map2umap_info, this->size());
|
||||
__profcxx_map2umap_invalidate(this->_M_map2umap_info);
|
||||
return const_iterator(_Base::upper_bound(__x), this);
|
||||
}
|
||||
|
||||
std::pair<iterator,iterator>
|
||||
equal_range(const key_type& __x)
|
||||
{
|
||||
__profcxx_map2umap_find(this->_M_map2umap_info, this->size());
|
||||
std::pair<_Base_iterator, _Base_iterator> __base_ret
|
||||
= _Base::equal_range(__x);
|
||||
return std::make_pair(iterator(__base_ret.first, this),
|
||||
iterator(__base_ret.second, this));
|
||||
}
|
||||
|
||||
// _GLIBCXX_RESOLVE_LIB_DEFECTS
|
||||
// 214. set::find() missing const overload
|
||||
std::pair<const_iterator,const_iterator>
|
||||
equal_range(const key_type& __x) const
|
||||
{
|
||||
__profcxx_map2umap_find(this->_M_map2umap_info, this->size());
|
||||
std::pair<_Base_const_iterator, _Base_const_iterator> __base_ret
|
||||
= _Base::equal_range(__x);
|
||||
return std::make_pair(const_iterator(__base_ret.first, this),
|
||||
const_iterator(__base_ret.second, this));
|
||||
}
|
||||
|
||||
_Base&
|
||||
_M_base() _GLIBCXX_NOEXCEPT { return *this; }
|
||||
|
||||
const _Base&
|
||||
_M_base() const _GLIBCXX_NOEXCEPT { return *this; }
|
||||
|
||||
private:
|
||||
/** If hint is used we consider that the map and unordered_map
|
||||
* operations have equivalent insertion cost so we do not update metrics
|
||||
* about it.
|
||||
* Note that to find out if hint has been used is libstdc++
|
||||
* implementation dependent.
|
||||
*/
|
||||
bool
|
||||
_M_hint_used(_Base_const_iterator __hint, _Base_iterator __res)
|
||||
{
|
||||
return (__hint == __res
|
||||
|| (__hint == _M_base().end() && ++__res == _M_base().end())
|
||||
|| (__hint != _M_base().end() && (++__hint == __res
|
||||
|| ++__res == --__hint)));
|
||||
}
|
||||
|
||||
template<typename _K1, typename _C1, typename _A1>
|
||||
friend bool
|
||||
operator==(const multiset<_K1, _C1, _A1>&,
|
||||
const multiset<_K1, _C1, _A1>&);
|
||||
|
||||
template<typename _K1, typename _C1, typename _A1>
|
||||
friend bool
|
||||
operator< (const multiset<_K1, _C1, _A1>&,
|
||||
const multiset<_K1, _C1, _A1>&);
|
||||
};
|
||||
|
||||
template<typename _Key, typename _Compare, typename _Allocator>
|
||||
inline bool
|
||||
operator==(const multiset<_Key, _Compare, _Allocator>& __lhs,
|
||||
const multiset<_Key, _Compare, _Allocator>& __rhs)
|
||||
{
|
||||
__profcxx_map2umap_invalidate(__lhs._M_map2umap_info);
|
||||
__profcxx_map2umap_invalidate(__rhs._M_map2umap_info);
|
||||
return __lhs._M_base() == __rhs._M_base();
|
||||
}
|
||||
|
||||
template<typename _Key, typename _Compare, typename _Allocator>
|
||||
inline bool
|
||||
operator<(const multiset<_Key, _Compare, _Allocator>& __lhs,
|
||||
const multiset<_Key, _Compare, _Allocator>& __rhs)
|
||||
{
|
||||
__profcxx_map2umap_invalidate(__lhs._M_map2umap_info);
|
||||
__profcxx_map2umap_invalidate(__rhs._M_map2umap_info);
|
||||
return __lhs._M_base() < __rhs._M_base();
|
||||
}
|
||||
|
||||
template<typename _Key, typename _Compare, typename _Allocator>
|
||||
inline bool
|
||||
operator!=(const multiset<_Key, _Compare, _Allocator>& __lhs,
|
||||
const multiset<_Key, _Compare, _Allocator>& __rhs)
|
||||
{ return !(__lhs == __rhs); }
|
||||
|
||||
template<typename _Key, typename _Compare, typename _Allocator>
|
||||
inline bool
|
||||
operator<=(const multiset<_Key, _Compare, _Allocator>& __lhs,
|
||||
const multiset<_Key, _Compare, _Allocator>& __rhs)
|
||||
{ return !(__rhs < __lhs); }
|
||||
|
||||
template<typename _Key, typename _Compare, typename _Allocator>
|
||||
inline bool
|
||||
operator>=(const multiset<_Key, _Compare, _Allocator>& __lhs,
|
||||
const multiset<_Key, _Compare, _Allocator>& __rhs)
|
||||
{ return !(__lhs < __rhs); }
|
||||
|
||||
template<typename _Key, typename _Compare, typename _Allocator>
|
||||
inline bool
|
||||
operator>(const multiset<_Key, _Compare, _Allocator>& __lhs,
|
||||
const multiset<_Key, _Compare, _Allocator>& __rhs)
|
||||
{ return __rhs < __lhs; }
|
||||
|
||||
template<typename _Key, typename _Compare, typename _Allocator>
|
||||
void
|
||||
swap(multiset<_Key, _Compare, _Allocator>& __x,
|
||||
multiset<_Key, _Compare, _Allocator>& __y)
|
||||
{ return __x.swap(__y); }
|
||||
|
||||
} // namespace __profile
|
||||
} // namespace std
|
||||
|
||||
#endif
|
||||
100
openflow/usr/include/c++/5/profile/ordered_base.h
Normal file
100
openflow/usr/include/c++/5/profile/ordered_base.h
Normal file
@@ -0,0 +1,100 @@
|
||||
// Profiling unordered containers implementation details -*- C++ -*-
|
||||
|
||||
// Copyright (C) 2014-2015 Free Software Foundation, Inc.
|
||||
//
|
||||
// This file is part of the GNU ISO C++ Library. This library is free
|
||||
// software; you can redistribute it and/or modify it under the
|
||||
// terms of the GNU General Public License as published by the
|
||||
// Free Software Foundation; either version 3, or (at your option)
|
||||
// any later version.
|
||||
//
|
||||
// This library is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
|
||||
// Under Section 7 of GPL version 3, you are granted additional
|
||||
// permissions described in the GCC Runtime Library Exception, version
|
||||
// 3.1, as published by the Free Software Foundation.
|
||||
|
||||
// You should have received a copy of the GNU General Public License along
|
||||
// with this library; see the file COPYING3. If not see
|
||||
// <http://www.gnu.org/licenses/>.
|
||||
|
||||
/** @file profile/ordered_base.h
|
||||
* This file is a GNU profile extension to the Standard C++ Library.
|
||||
*/
|
||||
|
||||
#ifndef _GLIBCXX_PROFILE_ORDERED
|
||||
#define _GLIBCXX_PROFILE_ORDERED 1
|
||||
|
||||
namespace std _GLIBCXX_VISIBILITY(default)
|
||||
{
|
||||
namespace __profile
|
||||
{
|
||||
template<typename _Cont>
|
||||
class _Ordered_profile
|
||||
{
|
||||
public:
|
||||
void
|
||||
_M_profile_iterate(int __rewind = 0) const
|
||||
{ __profcxx_map2umap_iterate(this->_M_map2umap_info, __rewind); }
|
||||
|
||||
protected:
|
||||
_Ordered_profile() _GLIBCXX_NOEXCEPT
|
||||
{ _M_profile_construct(); }
|
||||
|
||||
#if __cplusplus >= 201103L
|
||||
_Ordered_profile(const _Ordered_profile&) noexcept
|
||||
: _Ordered_profile() { }
|
||||
_Ordered_profile(_Ordered_profile&& __other) noexcept
|
||||
: _Ordered_profile()
|
||||
{ _M_swap(__other); }
|
||||
|
||||
_Ordered_profile&
|
||||
operator=(const _Ordered_profile&) noexcept
|
||||
{
|
||||
_M_profile_destruct();
|
||||
_M_profile_construct();
|
||||
}
|
||||
|
||||
_Ordered_profile&
|
||||
operator=(_Ordered_profile&& __other) noexcept
|
||||
{
|
||||
_M_swap(__other);
|
||||
|
||||
__other._M_profile_destruct();
|
||||
__other._M_profile_construct();
|
||||
}
|
||||
#endif
|
||||
|
||||
~_Ordered_profile()
|
||||
{ _M_profile_destruct(); }
|
||||
|
||||
void
|
||||
_M_profile_construct() _GLIBCXX_NOEXCEPT
|
||||
{ _M_map2umap_info = __profcxx_map2umap_construct(); }
|
||||
|
||||
void
|
||||
_M_profile_destruct() _GLIBCXX_NOEXCEPT
|
||||
{
|
||||
__profcxx_map2umap_destruct(_M_map2umap_info);
|
||||
_M_map2umap_info = 0;
|
||||
}
|
||||
|
||||
void
|
||||
_M_swap(_Ordered_profile& __other)
|
||||
{ std::swap(_M_map2umap_info, __other._M_map2umap_info); }
|
||||
|
||||
__gnu_profile::__map2umap_info* _M_map2umap_info;
|
||||
|
||||
private:
|
||||
_Cont&
|
||||
_M_conjure()
|
||||
{ return *static_cast<_Cont*>(this); }
|
||||
};
|
||||
|
||||
} // namespace __profile
|
||||
} // namespace std
|
||||
|
||||
#endif
|
||||
35
openflow/usr/include/c++/5/profile/set
Normal file
35
openflow/usr/include/c++/5/profile/set
Normal file
@@ -0,0 +1,35 @@
|
||||
// Profiling set/multiset implementation -*- C++ -*-
|
||||
|
||||
// Copyright (C) 2009-2015 Free Software Foundation, Inc.
|
||||
//
|
||||
// This file is part of the GNU ISO C++ Library. This library is free
|
||||
// software; you can redistribute it and/or modify it under the
|
||||
// terms of the GNU General Public License as published by the
|
||||
// Free Software Foundation; either version 3, or (at your option)
|
||||
// any later version.
|
||||
//
|
||||
// This library is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
|
||||
// Under Section 7 of GPL version 3, you are granted additional
|
||||
// permissions described in the GCC Runtime Library Exception, version
|
||||
// 3.1, as published by the Free Software Foundation.
|
||||
|
||||
// You should have received a copy of the GNU General Public License along
|
||||
// with this library; see the file COPYING3. If not see
|
||||
// <http://www.gnu.org/licenses/>.
|
||||
|
||||
/** @file profile/set
|
||||
* This file is a GNU profile extension to the Standard C++ Library.
|
||||
*/
|
||||
|
||||
#ifndef _GLIBCXX_PROFILE_SET
|
||||
#define _GLIBCXX_PROFILE_SET 1
|
||||
|
||||
#include <set>
|
||||
#include <profile/set.h>
|
||||
#include <profile/multiset.h>
|
||||
|
||||
#endif
|
||||
523
openflow/usr/include/c++/5/profile/set.h
Normal file
523
openflow/usr/include/c++/5/profile/set.h
Normal file
@@ -0,0 +1,523 @@
|
||||
// Profiling set implementation -*- C++ -*-
|
||||
|
||||
// Copyright (C) 2009-2015 Free Software Foundation, Inc.
|
||||
//
|
||||
// This file is part of the GNU ISO C++ Library. This library is free
|
||||
// software; you can redistribute it and/or modify it under the
|
||||
// terms of the GNU General Public License as published by the
|
||||
// Free Software Foundation; either version 3, or (at your option)
|
||||
// any later version.
|
||||
|
||||
// This library is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
|
||||
// Under Section 7 of GPL version 3, you are granted additional
|
||||
// permissions described in the GCC Runtime Library Exception, version
|
||||
// 3.1, as published by the Free Software Foundation.
|
||||
|
||||
// You should have received a copy of the GNU General Public License and
|
||||
// a copy of the GCC Runtime Library Exception along with this program;
|
||||
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
|
||||
// <http://www.gnu.org/licenses/>.
|
||||
|
||||
/** @file profile/set.h
|
||||
* This file is a GNU profile extension to the Standard C++ Library.
|
||||
*/
|
||||
|
||||
#ifndef _GLIBCXX_PROFILE_SET_H
|
||||
#define _GLIBCXX_PROFILE_SET_H 1
|
||||
|
||||
#include <profile/base.h>
|
||||
#include <profile/ordered_base.h>
|
||||
|
||||
namespace std _GLIBCXX_VISIBILITY(default)
|
||||
{
|
||||
namespace __profile
|
||||
{
|
||||
/// Class std::set wrapper with performance instrumentation.
|
||||
template<typename _Key, typename _Compare = std::less<_Key>,
|
||||
typename _Allocator = std::allocator<_Key> >
|
||||
class set
|
||||
: public _GLIBCXX_STD_C::set<_Key,_Compare,_Allocator>,
|
||||
public _Ordered_profile<set<_Key, _Compare, _Allocator> >
|
||||
{
|
||||
typedef _GLIBCXX_STD_C::set<_Key, _Compare, _Allocator> _Base;
|
||||
|
||||
typedef typename _Base::iterator _Base_iterator;
|
||||
typedef typename _Base::const_iterator _Base_const_iterator;
|
||||
|
||||
public:
|
||||
// types:
|
||||
typedef _Key key_type;
|
||||
typedef _Key value_type;
|
||||
typedef _Compare key_compare;
|
||||
typedef _Compare value_compare;
|
||||
typedef typename _Base::reference reference;
|
||||
typedef typename _Base::const_reference const_reference;
|
||||
|
||||
typedef __iterator_tracker<_Base_iterator, set> iterator;
|
||||
typedef __iterator_tracker<_Base_const_iterator,
|
||||
set> const_iterator;
|
||||
typedef std::reverse_iterator<iterator> reverse_iterator;
|
||||
typedef std::reverse_iterator<const_iterator> const_reverse_iterator;
|
||||
|
||||
typedef typename _Base::size_type size_type;
|
||||
typedef typename _Base::difference_type difference_type;
|
||||
|
||||
// 23.3.3.1 construct/copy/destroy:
|
||||
#if __cplusplus < 201103L
|
||||
set()
|
||||
: _Base() { }
|
||||
set(const set& __x)
|
||||
: _Base(__x) { }
|
||||
~set() { }
|
||||
#else
|
||||
set() = default;
|
||||
set(const set&) = default;
|
||||
set(set&&) = default;
|
||||
~set() = default;
|
||||
#endif
|
||||
|
||||
explicit set(const _Compare& __comp,
|
||||
const _Allocator& __a = _Allocator())
|
||||
: _Base(__comp, __a) { }
|
||||
|
||||
#if __cplusplus >= 201103L
|
||||
template<typename _InputIterator,
|
||||
typename = std::_RequireInputIter<_InputIterator>>
|
||||
#else
|
||||
template<typename _InputIterator>
|
||||
#endif
|
||||
set(_InputIterator __first, _InputIterator __last,
|
||||
const _Compare& __comp = _Compare(),
|
||||
const _Allocator& __a = _Allocator())
|
||||
: _Base(__first, __last, __comp, __a) { }
|
||||
|
||||
#if __cplusplus >= 201103L
|
||||
set(initializer_list<value_type> __l,
|
||||
const _Compare& __comp = _Compare(),
|
||||
const _Allocator& __a = _Allocator())
|
||||
: _Base(__l, __comp, __a) { }
|
||||
|
||||
explicit
|
||||
set(const _Allocator& __a)
|
||||
: _Base(__a) { }
|
||||
|
||||
set(const set& __x, const _Allocator& __a)
|
||||
: _Base(__x, __a) { }
|
||||
|
||||
set(set&& __x, const _Allocator& __a)
|
||||
noexcept( noexcept(_Base(std::move(__x), __a)) )
|
||||
: _Base(std::move(__x), __a) { }
|
||||
|
||||
set(initializer_list<value_type> __l, const _Allocator& __a)
|
||||
: _Base(__l, __a) { }
|
||||
|
||||
template<typename _InputIterator>
|
||||
set(_InputIterator __first, _InputIterator __last,
|
||||
const _Allocator& __a)
|
||||
: _Base(__first, __last, __a) { }
|
||||
#endif
|
||||
|
||||
set(const _Base& __x)
|
||||
: _Base(__x) { }
|
||||
|
||||
#if __cplusplus < 201103L
|
||||
set&
|
||||
operator=(const set& __x)
|
||||
{
|
||||
this->_M_profile_destruct();
|
||||
_M_base() = __x;
|
||||
this->_M_profile_construct();
|
||||
return *this;
|
||||
}
|
||||
#else
|
||||
set&
|
||||
operator=(const set&) = default;
|
||||
|
||||
set&
|
||||
operator=(set&&) = default;
|
||||
|
||||
set&
|
||||
operator=(initializer_list<value_type> __l)
|
||||
{
|
||||
this->_M_profile_destruct();
|
||||
_M_base() = __l;
|
||||
this->_M_profile_construct();
|
||||
return *this;
|
||||
}
|
||||
#endif
|
||||
|
||||
// iterators
|
||||
iterator
|
||||
begin() _GLIBCXX_NOEXCEPT
|
||||
{ return iterator(_Base::begin(), this); }
|
||||
|
||||
const_iterator
|
||||
begin() const _GLIBCXX_NOEXCEPT
|
||||
{ return const_iterator(_Base::begin(), this); }
|
||||
|
||||
iterator
|
||||
end() _GLIBCXX_NOEXCEPT
|
||||
{ return iterator(_Base::end(), this); }
|
||||
|
||||
const_iterator
|
||||
end() const _GLIBCXX_NOEXCEPT
|
||||
{ return const_iterator(_Base::end(), this); }
|
||||
|
||||
#if __cplusplus >= 201103L
|
||||
const_iterator
|
||||
cbegin() const noexcept
|
||||
{ return const_iterator(_Base::cbegin(), this); }
|
||||
|
||||
const_iterator
|
||||
cend() const noexcept
|
||||
{ return const_iterator(_Base::cend(), this); }
|
||||
#endif
|
||||
|
||||
reverse_iterator
|
||||
rbegin() _GLIBCXX_NOEXCEPT
|
||||
{
|
||||
__profcxx_map2umap_invalidate(this->_M_map2umap_info);
|
||||
return reverse_iterator(end());
|
||||
}
|
||||
|
||||
const_reverse_iterator
|
||||
rbegin() const _GLIBCXX_NOEXCEPT
|
||||
{
|
||||
__profcxx_map2umap_invalidate(this->_M_map2umap_info);
|
||||
return const_reverse_iterator(end());
|
||||
}
|
||||
|
||||
reverse_iterator
|
||||
rend() _GLIBCXX_NOEXCEPT
|
||||
{
|
||||
__profcxx_map2umap_invalidate(this->_M_map2umap_info);
|
||||
return reverse_iterator(begin());
|
||||
}
|
||||
|
||||
const_reverse_iterator
|
||||
rend() const _GLIBCXX_NOEXCEPT
|
||||
{
|
||||
__profcxx_map2umap_invalidate(this->_M_map2umap_info);
|
||||
return const_reverse_iterator(begin());
|
||||
}
|
||||
|
||||
#if __cplusplus >= 201103L
|
||||
const_reverse_iterator
|
||||
crbegin() const noexcept
|
||||
{
|
||||
__profcxx_map2umap_invalidate(this->_M_map2umap_info);
|
||||
return const_reverse_iterator(cend());
|
||||
}
|
||||
|
||||
const_reverse_iterator
|
||||
crend() const noexcept
|
||||
{
|
||||
__profcxx_map2umap_invalidate(this->_M_map2umap_info);
|
||||
return const_reverse_iterator(cbegin());
|
||||
}
|
||||
#endif
|
||||
|
||||
void
|
||||
swap(set& __x)
|
||||
#if __cplusplus >= 201103L
|
||||
noexcept( noexcept(declval<_Base>().swap(__x)) )
|
||||
#endif
|
||||
{
|
||||
_Base::swap(__x);
|
||||
this->_M_swap(__x);
|
||||
}
|
||||
|
||||
// modifiers:
|
||||
#if __cplusplus >= 201103L
|
||||
template<typename... _Args>
|
||||
std::pair<iterator, bool>
|
||||
emplace(_Args&&... __args)
|
||||
{
|
||||
__profcxx_map2umap_insert(this->_M_map2umap_info, this->size(), 1);
|
||||
auto __base_ret = _Base::emplace(std::forward<_Args>(__args)...);
|
||||
return std::make_pair(iterator(__base_ret.first, this),
|
||||
__base_ret.second);
|
||||
}
|
||||
|
||||
template<typename... _Args>
|
||||
iterator
|
||||
emplace_hint(const_iterator __pos, _Args&&... __args)
|
||||
{
|
||||
auto size_before = this->size();
|
||||
auto __res
|
||||
= _Base::emplace_hint(__pos.base(), std::forward<_Args>(__args)...);
|
||||
__profcxx_map2umap_insert(this->_M_map2umap_info,
|
||||
size_before, _M_hint_used(__pos.base(), __res) ? 0 : 1);
|
||||
return iterator(__res, this);
|
||||
}
|
||||
#endif
|
||||
|
||||
std::pair<iterator, bool>
|
||||
insert(const value_type& __x)
|
||||
{
|
||||
__profcxx_map2umap_insert(this->_M_map2umap_info, this->size(), 1);
|
||||
std::pair<_Base_iterator, bool> __base_ret = _Base::insert(__x);
|
||||
return std::make_pair(iterator(__base_ret.first, this),
|
||||
__base_ret.second);
|
||||
}
|
||||
|
||||
#if __cplusplus >= 201103L
|
||||
std::pair<iterator, bool>
|
||||
insert(value_type&& __x)
|
||||
{
|
||||
__profcxx_map2umap_insert(this->_M_map2umap_info, this->size(), 1);
|
||||
std::pair<_Base_iterator, bool> __base_ret
|
||||
= _Base::insert(std::move(__x));
|
||||
return std::make_pair(iterator(__base_ret.first, this),
|
||||
__base_ret.second);
|
||||
}
|
||||
#endif
|
||||
|
||||
iterator
|
||||
insert(const_iterator __pos, const value_type& __x)
|
||||
{
|
||||
size_type size_before = this->size();
|
||||
_Base_iterator __res = _Base::insert(__pos.base(), __x);
|
||||
__profcxx_map2umap_insert(this->_M_map2umap_info,
|
||||
size_before, _M_hint_used(__pos.base(), __res) ? 0 : 1);
|
||||
return iterator(__res, this);
|
||||
}
|
||||
|
||||
#if __cplusplus >= 201103L
|
||||
iterator
|
||||
insert(const_iterator __pos, value_type&& __x)
|
||||
{ return iterator(_Base::insert(__pos.base(), std::move(__x)), this); }
|
||||
#endif
|
||||
|
||||
template<typename _InputIterator>
|
||||
void
|
||||
insert(_InputIterator __first, _InputIterator __last)
|
||||
{
|
||||
for (; __first != __last; ++__first)
|
||||
insert(*__first);
|
||||
}
|
||||
|
||||
#if __cplusplus >= 201103L
|
||||
void
|
||||
insert(initializer_list<value_type> __l)
|
||||
{ insert(__l.begin(), __l.end()); }
|
||||
#endif
|
||||
|
||||
#if __cplusplus >= 201103L
|
||||
iterator
|
||||
erase(const_iterator __pos)
|
||||
{
|
||||
__profcxx_map2umap_erase(this->_M_map2umap_info, this->size(), 1);
|
||||
return iterator(_Base::erase(__pos.base()), this);
|
||||
}
|
||||
#else
|
||||
void
|
||||
erase(iterator __pos)
|
||||
{
|
||||
__profcxx_map2umap_erase(this->_M_map2umap_info, this->size(), 1);
|
||||
_Base::erase(__pos.base());
|
||||
}
|
||||
#endif
|
||||
|
||||
size_type
|
||||
erase(const key_type& __x)
|
||||
{
|
||||
__profcxx_map2umap_find(this->_M_map2umap_info, this->size());
|
||||
__profcxx_map2umap_erase(this->_M_map2umap_info, this->size(), 1);
|
||||
return _Base::erase(__x);
|
||||
}
|
||||
|
||||
#if __cplusplus >= 201103L
|
||||
iterator
|
||||
erase(const_iterator __first, const_iterator __last)
|
||||
{
|
||||
if (__first != __last)
|
||||
{
|
||||
iterator __ret;
|
||||
for (; __first != __last;)
|
||||
__ret = erase(__first++);
|
||||
return __ret;
|
||||
}
|
||||
|
||||
return iterator(_Base::erase(__first.base(), __last.base()), this);
|
||||
}
|
||||
#else
|
||||
void
|
||||
erase(iterator __first, iterator __last)
|
||||
{
|
||||
for (; __first != __last;)
|
||||
erase(__first++);
|
||||
}
|
||||
#endif
|
||||
|
||||
void
|
||||
clear() _GLIBCXX_NOEXCEPT
|
||||
{
|
||||
this->_M_profile_destruct();
|
||||
_Base::clear();
|
||||
this->_M_profile_construct();
|
||||
}
|
||||
|
||||
size_type
|
||||
count(const key_type& __x) const
|
||||
{
|
||||
__profcxx_map2umap_find(this->_M_map2umap_info, this->size());
|
||||
return _Base::count(__x);
|
||||
}
|
||||
|
||||
// set operations:
|
||||
iterator
|
||||
find(const key_type& __x)
|
||||
{
|
||||
__profcxx_map2umap_find(this->_M_map2umap_info, this->size());
|
||||
return iterator(_Base::find(__x), this);
|
||||
}
|
||||
|
||||
const_iterator
|
||||
find(const key_type& __x) const
|
||||
{
|
||||
__profcxx_map2umap_find(this->_M_map2umap_info, this->size());
|
||||
return const_iterator(_Base::find(__x), this);
|
||||
}
|
||||
|
||||
iterator
|
||||
lower_bound(const key_type& __x)
|
||||
{
|
||||
__profcxx_map2umap_find(this->_M_map2umap_info, this->size());
|
||||
__profcxx_map2umap_invalidate(this->_M_map2umap_info);
|
||||
return iterator(_Base::lower_bound(__x), this);
|
||||
}
|
||||
|
||||
const_iterator
|
||||
lower_bound(const key_type& __x) const
|
||||
{
|
||||
__profcxx_map2umap_find(this->_M_map2umap_info, this->size());
|
||||
__profcxx_map2umap_invalidate(this->_M_map2umap_info);
|
||||
return const_iterator(_Base::lower_bound(__x), this);
|
||||
}
|
||||
|
||||
iterator
|
||||
upper_bound(const key_type& __x)
|
||||
{
|
||||
__profcxx_map2umap_find(this->_M_map2umap_info, this->size());
|
||||
__profcxx_map2umap_invalidate(this->_M_map2umap_info);
|
||||
return iterator(_Base::upper_bound(__x), this);
|
||||
}
|
||||
|
||||
const_iterator
|
||||
upper_bound(const key_type& __x) const
|
||||
{
|
||||
__profcxx_map2umap_find(this->_M_map2umap_info, this->size());
|
||||
__profcxx_map2umap_invalidate(this->_M_map2umap_info);
|
||||
return const_iterator(_Base::upper_bound(__x), this);
|
||||
}
|
||||
|
||||
std::pair<iterator, iterator>
|
||||
equal_range(const key_type& __x)
|
||||
{
|
||||
__profcxx_map2umap_find(this->_M_map2umap_info, this->size());
|
||||
std::pair<_Base_iterator, _Base_iterator> __base_ret
|
||||
= _Base::equal_range(__x);
|
||||
return std::make_pair(iterator(__base_ret.first, this),
|
||||
iterator(__base_ret.second, this));
|
||||
}
|
||||
|
||||
std::pair<const_iterator, const_iterator>
|
||||
equal_range(const key_type& __x) const
|
||||
{
|
||||
__profcxx_map2umap_find(this->_M_map2umap_info, this->size());
|
||||
std::pair<_Base_const_iterator, _Base_const_iterator> __base_ret
|
||||
= _Base::equal_range(__x);
|
||||
return std::make_pair(const_iterator(__base_ret.first, this),
|
||||
const_iterator(__base_ret.second, this));
|
||||
}
|
||||
|
||||
_Base&
|
||||
_M_base() _GLIBCXX_NOEXCEPT { return *this; }
|
||||
|
||||
const _Base&
|
||||
_M_base() const _GLIBCXX_NOEXCEPT { return *this; }
|
||||
|
||||
private:
|
||||
/** If hint is used we consider that the map and unordered_map
|
||||
* operations have equivalent insertion cost so we do not update metrics
|
||||
* about it.
|
||||
* Note that to find out if hint has been used is libstdc++
|
||||
* implementation dependent.
|
||||
*/
|
||||
bool
|
||||
_M_hint_used(_Base_const_iterator __hint, _Base_iterator __res)
|
||||
{
|
||||
return (__hint == __res
|
||||
|| (__hint == _M_base().end() && ++__res == _M_base().end())
|
||||
|| (__hint != _M_base().end() && (++__hint == __res
|
||||
|| ++__res == --__hint)));
|
||||
}
|
||||
|
||||
template<typename _K1, typename _C1, typename _A1>
|
||||
friend bool
|
||||
operator==(const set<_K1, _C1, _A1>&, const set<_K1, _C1, _A1>&);
|
||||
|
||||
template<typename _K1, typename _C1, typename _A1>
|
||||
friend bool
|
||||
operator<(const set<_K1, _C1, _A1>&, const set<_K1, _C1, _A1>&);
|
||||
};
|
||||
|
||||
template<typename _Key, typename _Compare, typename _Allocator>
|
||||
inline bool
|
||||
operator==(const set<_Key, _Compare, _Allocator>& __lhs,
|
||||
const set<_Key, _Compare, _Allocator>& __rhs)
|
||||
{
|
||||
__profcxx_map2umap_invalidate(__lhs._M_map2umap_info);
|
||||
__profcxx_map2umap_invalidate(__rhs._M_map2umap_info);
|
||||
return __lhs._M_base() == __rhs._M_base();
|
||||
}
|
||||
|
||||
template<typename _Key, typename _Compare, typename _Allocator>
|
||||
inline bool
|
||||
operator<(const set<_Key, _Compare, _Allocator>& __lhs,
|
||||
const set<_Key, _Compare, _Allocator>& __rhs)
|
||||
{
|
||||
__profcxx_map2umap_invalidate(__lhs._M_map2umap_info);
|
||||
__profcxx_map2umap_invalidate(__rhs._M_map2umap_info);
|
||||
return __lhs._M_base() < __rhs._M_base();
|
||||
}
|
||||
|
||||
template<typename _Key, typename _Compare, typename _Allocator>
|
||||
inline bool
|
||||
operator!=(const set<_Key, _Compare, _Allocator>& __lhs,
|
||||
const set<_Key, _Compare, _Allocator>& __rhs)
|
||||
{ return !(__lhs == __rhs); }
|
||||
|
||||
template<typename _Key, typename _Compare, typename _Allocator>
|
||||
inline bool
|
||||
operator<=(const set<_Key, _Compare, _Allocator>& __lhs,
|
||||
const set<_Key, _Compare, _Allocator>& __rhs)
|
||||
{ return !(__rhs < __lhs); }
|
||||
|
||||
template<typename _Key, typename _Compare, typename _Allocator>
|
||||
inline bool
|
||||
operator>=(const set<_Key, _Compare, _Allocator>& __lhs,
|
||||
const set<_Key, _Compare, _Allocator>& __rhs)
|
||||
{ return !(__lhs < __rhs); }
|
||||
|
||||
template<typename _Key, typename _Compare, typename _Allocator>
|
||||
inline bool
|
||||
operator>(const set<_Key, _Compare, _Allocator>& __lhs,
|
||||
const set<_Key, _Compare, _Allocator>& __rhs)
|
||||
{ return __rhs < __lhs; }
|
||||
|
||||
template<typename _Key, typename _Compare, typename _Allocator>
|
||||
void
|
||||
swap(set<_Key, _Compare, _Allocator>& __x,
|
||||
set<_Key, _Compare, _Allocator>& __y)
|
||||
{ return __x.swap(__y); }
|
||||
|
||||
} // namespace __profile
|
||||
} // namespace std
|
||||
|
||||
#endif
|
||||
308
openflow/usr/include/c++/5/profile/unordered_base.h
Normal file
308
openflow/usr/include/c++/5/profile/unordered_base.h
Normal file
@@ -0,0 +1,308 @@
|
||||
// Profiling unordered containers implementation details -*- C++ -*-
|
||||
|
||||
// Copyright (C) 2013-2015 Free Software Foundation, Inc.
|
||||
//
|
||||
// This file is part of the GNU ISO C++ Library. This library is free
|
||||
// software; you can redistribute it and/or modify it under the
|
||||
// terms of the GNU General Public License as published by the
|
||||
// Free Software Foundation; either version 3, or (at your option)
|
||||
// any later version.
|
||||
//
|
||||
// This library is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
|
||||
// Under Section 7 of GPL version 3, you are granted additional
|
||||
// permissions described in the GCC Runtime Library Exception, version
|
||||
// 3.1, as published by the Free Software Foundation.
|
||||
|
||||
// You should have received a copy of the GNU General Public License along
|
||||
// with this library; see the file COPYING3. If not see
|
||||
// <http://www.gnu.org/licenses/>.
|
||||
|
||||
/** @file profile/unordered_base.h
|
||||
* This file is a GNU profile extension to the Standard C++ Library.
|
||||
*/
|
||||
|
||||
#ifndef _GLIBCXX_PROFILE_UNORDERED
|
||||
#define _GLIBCXX_PROFILE_UNORDERED 1
|
||||
|
||||
namespace std _GLIBCXX_VISIBILITY(default)
|
||||
{
|
||||
namespace __profile
|
||||
{
|
||||
template<typename _UnorderedCont,
|
||||
typename _Value, bool _Cache_hash_code>
|
||||
struct _Bucket_index_helper;
|
||||
|
||||
template<typename _UnorderedCont, typename _Value>
|
||||
struct _Bucket_index_helper<_UnorderedCont, _Value, true>
|
||||
{
|
||||
static std::size_t
|
||||
bucket(const _UnorderedCont& __uc,
|
||||
const __detail::_Hash_node<_Value, true>* __node)
|
||||
{ return __node->_M_hash_code % __uc.bucket_count(); }
|
||||
};
|
||||
|
||||
template<typename _UnorderedCont, typename _Value>
|
||||
struct _Bucket_index_helper<_UnorderedCont, _Value, false>
|
||||
{
|
||||
static std::size_t
|
||||
bucket(const _UnorderedCont& __uc,
|
||||
const __detail::_Hash_node<_Value, false>* __node)
|
||||
{ return __uc.bucket(__node->_M_v()); }
|
||||
};
|
||||
|
||||
template<typename _UnorderedCont, typename _Key, typename _Mapped>
|
||||
struct _Bucket_index_helper<_UnorderedCont,
|
||||
std::pair<const _Key, _Mapped>, false>
|
||||
{
|
||||
typedef std::pair<const _Key, _Mapped> _Value;
|
||||
|
||||
static std::size_t
|
||||
bucket(const _UnorderedCont& __uc,
|
||||
const __detail::_Hash_node<_Value, false>* __node)
|
||||
{ return __uc.bucket(__node->_M_v().first); }
|
||||
};
|
||||
|
||||
template<typename _UnorderedCont, typename _Value, bool _Cache_hash_code>
|
||||
std::size_t
|
||||
__get_bucket_index(const _UnorderedCont& __uc,
|
||||
const __detail::_Hash_node<_Value, _Cache_hash_code>* __node)
|
||||
{
|
||||
using __bucket_index_helper
|
||||
= _Bucket_index_helper<_UnorderedCont, _Value, _Cache_hash_code>;
|
||||
return __bucket_index_helper::bucket(__uc, __node);
|
||||
}
|
||||
|
||||
template<typename _UnorderedCont,
|
||||
typename _Value, bool _Cache_hash_code>
|
||||
struct _Equal_helper;
|
||||
|
||||
template<typename _UnorderedCont, typename _Value>
|
||||
struct _Equal_helper<_UnorderedCont, _Value, true>
|
||||
{
|
||||
static std::size_t
|
||||
are_equal(const _UnorderedCont& __uc,
|
||||
const __detail::_Hash_node<_Value, true>* __lhs,
|
||||
const __detail::_Hash_node<_Value, true>* __rhs)
|
||||
{
|
||||
return __lhs->_M_hash_code == __rhs->_M_hash_code
|
||||
&& __uc.key_eq()(__lhs->_M_v(), __rhs->_M_v());
|
||||
}
|
||||
};
|
||||
|
||||
template<typename _UnorderedCont,
|
||||
typename _Value>
|
||||
struct _Equal_helper<_UnorderedCont, _Value, false>
|
||||
{
|
||||
static std::size_t
|
||||
are_equal(const _UnorderedCont& __uc,
|
||||
const __detail::_Hash_node<_Value, false>* __lhs,
|
||||
const __detail::_Hash_node<_Value, false>* __rhs)
|
||||
{ return __uc.key_eq()(__lhs->_M_v(), __rhs->_M_v()); }
|
||||
};
|
||||
|
||||
template<typename _UnorderedCont,
|
||||
typename _Key, typename _Mapped>
|
||||
struct _Equal_helper<_UnorderedCont, std::pair<const _Key, _Mapped>, true>
|
||||
{
|
||||
typedef std::pair<const _Key, _Mapped> _Value;
|
||||
|
||||
static std::size_t
|
||||
are_equal(const _UnorderedCont& __uc,
|
||||
const __detail::_Hash_node<_Value, true>* __lhs,
|
||||
const __detail::_Hash_node<_Value, true>* __rhs)
|
||||
{
|
||||
return __lhs->_M_hash_code == __rhs->_M_hash_code
|
||||
&& __uc.key_eq()(__lhs->_M_v().first, __rhs->_M_v().first);
|
||||
}
|
||||
};
|
||||
|
||||
template<typename _UnorderedCont,
|
||||
typename _Key, typename _Mapped>
|
||||
struct _Equal_helper<_UnorderedCont, std::pair<const _Key, _Mapped>, false>
|
||||
{
|
||||
typedef std::pair<const _Key, _Mapped> _Value;
|
||||
|
||||
static std::size_t
|
||||
are_equal(const _UnorderedCont& __uc,
|
||||
const __detail::_Hash_node<_Value, false>* __lhs,
|
||||
const __detail::_Hash_node<_Value, false>* __rhs)
|
||||
{ return __uc.key_eq()(__lhs->_M_v().first, __rhs->_M_v().first); }
|
||||
};
|
||||
|
||||
template<typename _UnorderedCont, typename _Value, bool _Cache_hash_code>
|
||||
bool
|
||||
__are_equal(const _UnorderedCont& __uc,
|
||||
const __detail::_Hash_node<_Value, _Cache_hash_code>* __lhs,
|
||||
const __detail::_Hash_node<_Value, _Cache_hash_code>* __rhs)
|
||||
{
|
||||
using __equal_helper
|
||||
= _Equal_helper<_UnorderedCont, _Value, _Cache_hash_code>;
|
||||
return __equal_helper::are_equal(__uc, __lhs, __rhs);
|
||||
}
|
||||
|
||||
template<typename _UnorderedCont, bool _Unique_keys>
|
||||
class _Unordered_profile
|
||||
{
|
||||
_UnorderedCont&
|
||||
_M_conjure()
|
||||
{ return *(static_cast<_UnorderedCont*>(this)); }
|
||||
|
||||
using __unique_keys = std::integral_constant<bool, _Unique_keys>;
|
||||
|
||||
protected:
|
||||
_Unordered_profile() noexcept
|
||||
{ _M_profile_construct(); }
|
||||
|
||||
_Unordered_profile(const _Unordered_profile&) noexcept
|
||||
: _Unordered_profile() { }
|
||||
|
||||
_Unordered_profile(_Unordered_profile&& __other) noexcept
|
||||
: _Unordered_profile()
|
||||
{ _M_swap(__other); }
|
||||
|
||||
~_Unordered_profile()
|
||||
{ _M_profile_destruct(); }
|
||||
|
||||
_Unordered_profile&
|
||||
operator=(const _Unordered_profile&) noexcept
|
||||
{
|
||||
// Assignment just reset profiling.
|
||||
_M_profile_destruct();
|
||||
_M_profile_construct();
|
||||
}
|
||||
|
||||
_Unordered_profile&
|
||||
operator=(_Unordered_profile&& __other) noexcept
|
||||
{
|
||||
// Take profiling of the moved instance...
|
||||
_M_swap(__other);
|
||||
|
||||
// ...and then reset other instance profiling.
|
||||
__other._M_profile_destruct();
|
||||
__other._M_profile_construct();
|
||||
}
|
||||
|
||||
void
|
||||
_M_profile_construct() noexcept
|
||||
{
|
||||
auto& __uc = _M_conjure();
|
||||
_M_size_info = __profcxx_hashtable_size_construct(__uc.bucket_count());
|
||||
_M_hashfunc_info = __profcxx_hash_func_construct();
|
||||
}
|
||||
|
||||
void
|
||||
_M_profile_destruct() noexcept
|
||||
{
|
||||
auto& __uc = _M_conjure();
|
||||
__profcxx_hashtable_size_destruct(_M_size_info,
|
||||
__uc.bucket_count(), __uc.size());
|
||||
_M_size_info = 0;
|
||||
|
||||
if (!_M_hashfunc_info)
|
||||
return;
|
||||
|
||||
_M_profile_destruct(__unique_keys());
|
||||
_M_hashfunc_info = 0;
|
||||
}
|
||||
|
||||
void
|
||||
_M_swap(_Unordered_profile& __other) noexcept
|
||||
{
|
||||
std::swap(_M_size_info, __other._M_size_info);
|
||||
std::swap(_M_hashfunc_info, __other._M_hashfunc_info);
|
||||
}
|
||||
|
||||
void
|
||||
_M_profile_resize(std::size_t __old_size)
|
||||
{
|
||||
auto __new_size = _M_conjure().bucket_count();
|
||||
if (__old_size != __new_size)
|
||||
__profcxx_hashtable_size_resize(_M_size_info, __old_size, __new_size);
|
||||
}
|
||||
|
||||
__gnu_profile::__container_size_info* _M_size_info;
|
||||
__gnu_profile::__hashfunc_info* _M_hashfunc_info;
|
||||
|
||||
private:
|
||||
void
|
||||
_M_profile_destruct(std::true_type);
|
||||
|
||||
void
|
||||
_M_profile_destruct(std::false_type);
|
||||
};
|
||||
|
||||
template<typename _UnorderedCont, bool _Unique_keys>
|
||||
void
|
||||
_Unordered_profile<_UnorderedCont, _Unique_keys>::
|
||||
_M_profile_destruct(std::true_type)
|
||||
{
|
||||
auto& __uc = _M_conjure();
|
||||
std::size_t __hops = 0, __lc = 0, __chain = 0;
|
||||
auto __it = __uc.begin();
|
||||
while (__it != __uc.end())
|
||||
{
|
||||
auto __bkt = __get_bucket_index(__uc, __it._M_cur);
|
||||
auto __lit = __uc.begin(__bkt);
|
||||
auto __lend = __uc.end(__bkt);
|
||||
for (++__it, ++__lit; __lit != __lend; ++__it, ++__lit)
|
||||
++__chain;
|
||||
|
||||
if (__chain)
|
||||
{
|
||||
++__chain;
|
||||
__lc = __lc > __chain ? __lc : __chain;
|
||||
__hops += __chain * (__chain - 1) / 2;
|
||||
__chain = 0;
|
||||
}
|
||||
}
|
||||
|
||||
__profcxx_hash_func_destruct(_M_hashfunc_info,
|
||||
__lc, __uc.size(), __hops);
|
||||
}
|
||||
|
||||
template<typename _UnorderedCont, bool _Unique_keys>
|
||||
void
|
||||
_Unordered_profile<_UnorderedCont, _Unique_keys>::
|
||||
_M_profile_destruct(std::false_type)
|
||||
{
|
||||
auto& __uc = _M_conjure();
|
||||
std::size_t __hops = 0, __lc = 0, __chain = 0, __unique_size = 0;
|
||||
auto __it = __uc.begin();
|
||||
while (__it != __uc.end())
|
||||
{
|
||||
auto __bkt = __get_bucket_index(__uc, __it._M_cur);
|
||||
auto __lit = __uc.begin(__bkt);
|
||||
auto __lend = __uc.end(__bkt);
|
||||
auto __pit = __it;
|
||||
++__unique_size;
|
||||
for (++__it, ++__lit; __lit != __lend; ++__it, ++__lit)
|
||||
{
|
||||
if (!__are_equal(__uc, __pit._M_cur, __it._M_cur))
|
||||
{
|
||||
++__chain;
|
||||
++__unique_size;
|
||||
__pit = __it;
|
||||
}
|
||||
}
|
||||
|
||||
if (__chain)
|
||||
{
|
||||
++__chain;
|
||||
__lc = __lc > __chain ? __lc : __chain;
|
||||
__hops += __chain * (__chain - 1) / 2;
|
||||
__chain = 0;
|
||||
}
|
||||
}
|
||||
|
||||
__profcxx_hash_func_destruct(_M_hashfunc_info,
|
||||
__lc, __unique_size, __hops);
|
||||
}
|
||||
|
||||
} // namespace __profile
|
||||
} // namespace std
|
||||
|
||||
#endif
|
||||
584
openflow/usr/include/c++/5/profile/unordered_map
Normal file
584
openflow/usr/include/c++/5/profile/unordered_map
Normal file
@@ -0,0 +1,584 @@
|
||||
// Profiling unordered_map/unordered_multimap implementation -*- C++ -*-
|
||||
|
||||
// Copyright (C) 2009-2015 Free Software Foundation, Inc.
|
||||
//
|
||||
// This file is part of the GNU ISO C++ Library. This library is free
|
||||
// software; you can redistribute it and/or modify it under the
|
||||
// terms of the GNU General Public License as published by the
|
||||
// Free Software Foundation; either version 3, or (at your option)
|
||||
// any later version.
|
||||
//
|
||||
// This library is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
|
||||
// Under Section 7 of GPL version 3, you are granted additional
|
||||
// permissions described in the GCC Runtime Library Exception, version
|
||||
// 3.1, as published by the Free Software Foundation.
|
||||
|
||||
// You should have received a copy of the GNU General Public License along
|
||||
// with this library; see the file COPYING3. If not see
|
||||
// <http://www.gnu.org/licenses/>.
|
||||
|
||||
/** @file profile/unordered_map
|
||||
* This file is a GNU profile extension to the Standard C++ Library.
|
||||
*/
|
||||
|
||||
#ifndef _GLIBCXX_PROFILE_UNORDERED_MAP
|
||||
#define _GLIBCXX_PROFILE_UNORDERED_MAP 1
|
||||
|
||||
#if __cplusplus < 201103L
|
||||
# include <bits/c++0x_warning.h>
|
||||
#else
|
||||
# include <unordered_map>
|
||||
|
||||
#include <profile/base.h>
|
||||
#include <profile/unordered_base.h>
|
||||
|
||||
#define _GLIBCXX_BASE unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>
|
||||
#define _GLIBCXX_STD_BASE _GLIBCXX_STD_C::_GLIBCXX_BASE
|
||||
|
||||
namespace std _GLIBCXX_VISIBILITY(default)
|
||||
{
|
||||
namespace __profile
|
||||
{
|
||||
/// Class std::unordered_map wrapper with performance instrumentation.
|
||||
template<typename _Key, typename _Tp,
|
||||
typename _Hash = std::hash<_Key>,
|
||||
typename _Pred = std::equal_to<_Key>,
|
||||
typename _Alloc = std::allocator<std::pair<const _Key, _Tp> > >
|
||||
class unordered_map
|
||||
: public _GLIBCXX_STD_BASE,
|
||||
public _Unordered_profile<unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>,
|
||||
true>
|
||||
{
|
||||
typedef typename _GLIBCXX_STD_BASE _Base;
|
||||
|
||||
_Base&
|
||||
_M_base() noexcept { return *this; }
|
||||
|
||||
const _Base&
|
||||
_M_base() const noexcept { return *this; }
|
||||
|
||||
public:
|
||||
typedef typename _Base::size_type size_type;
|
||||
typedef typename _Base::hasher hasher;
|
||||
typedef typename _Base::key_equal key_equal;
|
||||
typedef typename _Base::allocator_type allocator_type;
|
||||
typedef typename _Base::key_type key_type;
|
||||
typedef typename _Base::value_type value_type;
|
||||
typedef typename _Base::difference_type difference_type;
|
||||
typedef typename _Base::reference reference;
|
||||
typedef typename _Base::const_reference const_reference;
|
||||
typedef typename _Base::mapped_type mapped_type;
|
||||
|
||||
typedef typename _Base::iterator iterator;
|
||||
typedef typename _Base::const_iterator const_iterator;
|
||||
|
||||
unordered_map() = default;
|
||||
|
||||
explicit
|
||||
unordered_map(size_type __n,
|
||||
const hasher& __hf = hasher(),
|
||||
const key_equal& __eql = key_equal(),
|
||||
const allocator_type& __a = allocator_type())
|
||||
: _Base(__n, __hf, __eql, __a) { }
|
||||
|
||||
template<typename _InputIterator>
|
||||
unordered_map(_InputIterator __f, _InputIterator __l,
|
||||
size_type __n = 0,
|
||||
const hasher& __hf = hasher(),
|
||||
const key_equal& __eql = key_equal(),
|
||||
const allocator_type& __a = allocator_type())
|
||||
: _Base(__f, __l, __n, __hf, __eql, __a) { }
|
||||
|
||||
unordered_map(const unordered_map&) = default;
|
||||
|
||||
unordered_map(const _Base& __x)
|
||||
: _Base(__x) { }
|
||||
|
||||
unordered_map(unordered_map&&) = default;
|
||||
|
||||
explicit
|
||||
unordered_map(const allocator_type& __a)
|
||||
: _Base(__a) { }
|
||||
|
||||
unordered_map(const unordered_map& __umap,
|
||||
const allocator_type& __a)
|
||||
: _Base(__umap, __a) { }
|
||||
|
||||
unordered_map(unordered_map&& __umap,
|
||||
const allocator_type& __a)
|
||||
: _Base(std::move(__umap._M_base()), __a) { }
|
||||
|
||||
unordered_map(initializer_list<value_type> __l,
|
||||
size_type __n = 0,
|
||||
const hasher& __hf = hasher(),
|
||||
const key_equal& __eql = key_equal(),
|
||||
const allocator_type& __a = allocator_type())
|
||||
: _Base(__l, __n, __hf, __eql, __a) { }
|
||||
|
||||
unordered_map(size_type __n, const allocator_type& __a)
|
||||
: unordered_map(__n, hasher(), key_equal(), __a)
|
||||
{ }
|
||||
|
||||
unordered_map(size_type __n, const hasher& __hf,
|
||||
const allocator_type& __a)
|
||||
: unordered_map(__n, __hf, key_equal(), __a)
|
||||
{ }
|
||||
|
||||
template<typename _InputIterator>
|
||||
unordered_map(_InputIterator __first, _InputIterator __last,
|
||||
size_type __n,
|
||||
const allocator_type& __a)
|
||||
: unordered_map(__first, __last, __n, hasher(), key_equal(), __a)
|
||||
{ }
|
||||
|
||||
template<typename _InputIterator>
|
||||
unordered_map(_InputIterator __first, _InputIterator __last,
|
||||
size_type __n, const hasher& __hf,
|
||||
const allocator_type& __a)
|
||||
: unordered_map(__first, __last, __n, __hf, key_equal(), __a)
|
||||
{ }
|
||||
|
||||
unordered_map(initializer_list<value_type> __l,
|
||||
size_type __n,
|
||||
const allocator_type& __a)
|
||||
: unordered_map(__l, __n, hasher(), key_equal(), __a)
|
||||
{ }
|
||||
|
||||
unordered_map(initializer_list<value_type> __l,
|
||||
size_type __n, const hasher& __hf,
|
||||
const allocator_type& __a)
|
||||
: unordered_map(__l, __n, __hf, key_equal(), __a)
|
||||
{ }
|
||||
|
||||
unordered_map&
|
||||
operator=(const unordered_map&) = default;
|
||||
|
||||
unordered_map&
|
||||
operator=(unordered_map&&) = default;
|
||||
|
||||
unordered_map&
|
||||
operator=(initializer_list<value_type> __l)
|
||||
{
|
||||
this->_M_profile_destruct();
|
||||
_M_base() = __l;
|
||||
this->_M_profile_construct();
|
||||
return *this;
|
||||
}
|
||||
|
||||
void
|
||||
clear() noexcept
|
||||
{
|
||||
this->_M_profile_destruct();
|
||||
_Base::clear();
|
||||
this->_M_profile_construct();
|
||||
}
|
||||
|
||||
template<typename... _Args>
|
||||
std::pair<iterator, bool>
|
||||
emplace(_Args&&... __args)
|
||||
{
|
||||
size_type __old_size = _Base::bucket_count();
|
||||
std::pair<iterator, bool> __res
|
||||
= _Base::emplace(std::forward<_Args>(__args)...);
|
||||
this->_M_profile_resize(__old_size);
|
||||
return __res;
|
||||
}
|
||||
|
||||
template<typename... _Args>
|
||||
iterator
|
||||
emplace_hint(const_iterator __it, _Args&&... __args)
|
||||
{
|
||||
size_type __old_size = _Base::bucket_count();
|
||||
iterator __res
|
||||
= _Base::emplace_hint(__it, std::forward<_Args>(__args)...);
|
||||
this->_M_profile_resize(__old_size);
|
||||
return __res;
|
||||
}
|
||||
|
||||
void
|
||||
insert(std::initializer_list<value_type> __l)
|
||||
{
|
||||
size_type __old_size = _Base::bucket_count();
|
||||
_Base::insert(__l);
|
||||
this->_M_profile_resize(__old_size);
|
||||
}
|
||||
|
||||
std::pair<iterator, bool>
|
||||
insert(const value_type& __obj)
|
||||
{
|
||||
size_type __old_size = _Base::bucket_count();
|
||||
std::pair<iterator, bool> __res = _Base::insert(__obj);
|
||||
this->_M_profile_resize(__old_size);
|
||||
return __res;
|
||||
}
|
||||
|
||||
iterator
|
||||
insert(const_iterator __iter, const value_type& __v)
|
||||
{
|
||||
size_type __old_size = _Base::bucket_count();
|
||||
iterator __res = _Base::insert(__iter, __v);
|
||||
this->_M_profile_resize(__old_size);
|
||||
return __res;
|
||||
}
|
||||
|
||||
template<typename _Pair, typename = typename
|
||||
std::enable_if<std::is_constructible<value_type,
|
||||
_Pair&&>::value>::type>
|
||||
std::pair<iterator, bool>
|
||||
insert(_Pair&& __obj)
|
||||
{
|
||||
size_type __old_size = _Base::bucket_count();
|
||||
std::pair<iterator, bool> __res
|
||||
= _Base::insert(std::forward<_Pair>(__obj));
|
||||
this->_M_profile_resize(__old_size);
|
||||
return __res;
|
||||
}
|
||||
|
||||
template<typename _Pair, typename = typename
|
||||
std::enable_if<std::is_constructible<value_type,
|
||||
_Pair&&>::value>::type>
|
||||
iterator
|
||||
insert(const_iterator __iter, _Pair&& __v)
|
||||
{
|
||||
size_type __old_size = _Base::bucket_count();
|
||||
iterator __res = _Base::insert(__iter, std::forward<_Pair>(__v));
|
||||
this->_M_profile_resize(__old_size);
|
||||
return __res;
|
||||
}
|
||||
|
||||
template<typename _InputIter>
|
||||
void
|
||||
insert(_InputIter __first, _InputIter __last)
|
||||
{
|
||||
size_type __old_size = _Base::bucket_count();
|
||||
_Base::insert(__first, __last);
|
||||
this->_M_profile_resize(__old_size);
|
||||
}
|
||||
|
||||
// operator[]
|
||||
mapped_type&
|
||||
operator[](const _Key& __k)
|
||||
{
|
||||
size_type __old_size = _Base::bucket_count();
|
||||
mapped_type& __res = _M_base()[__k];
|
||||
this->_M_profile_resize(__old_size);
|
||||
return __res;
|
||||
}
|
||||
|
||||
mapped_type&
|
||||
operator[](_Key&& __k)
|
||||
{
|
||||
size_type __old_size = _Base::bucket_count();
|
||||
mapped_type& __res = _M_base()[std::move(__k)];
|
||||
this->_M_profile_resize(__old_size);
|
||||
return __res;
|
||||
}
|
||||
|
||||
void
|
||||
swap(unordered_map& __x)
|
||||
noexcept( noexcept(__x._M_base().swap(__x)) )
|
||||
{
|
||||
_Base::swap(__x._M_base());
|
||||
this->_M_swap(__x);
|
||||
}
|
||||
|
||||
void rehash(size_type __n)
|
||||
{
|
||||
size_type __old_size = _Base::bucket_count();
|
||||
_Base::rehash(__n);
|
||||
this->_M_profile_resize(__old_size);
|
||||
}
|
||||
};
|
||||
|
||||
template<typename _Key, typename _Tp, typename _Hash,
|
||||
typename _Pred, typename _Alloc>
|
||||
inline void
|
||||
swap(unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>& __x,
|
||||
unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>& __y)
|
||||
{ __x.swap(__y); }
|
||||
|
||||
template<typename _Key, typename _Tp, typename _Hash,
|
||||
typename _Pred, typename _Alloc>
|
||||
inline bool
|
||||
operator==(const unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>& __x,
|
||||
const unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>& __y)
|
||||
{ return static_cast<const _GLIBCXX_STD_BASE&>(__x) == __y; }
|
||||
|
||||
template<typename _Key, typename _Tp, typename _Hash,
|
||||
typename _Pred, typename _Alloc>
|
||||
inline bool
|
||||
operator!=(const unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>& __x,
|
||||
const unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>& __y)
|
||||
{ return !(__x == __y); }
|
||||
|
||||
#undef _GLIBCXX_BASE
|
||||
#undef _GLIBCXX_STD_BASE
|
||||
#define _GLIBCXX_BASE unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>
|
||||
#define _GLIBCXX_STD_BASE _GLIBCXX_STD_C::_GLIBCXX_BASE
|
||||
|
||||
/// Class std::unordered_multimap wrapper with performance instrumentation.
|
||||
template<typename _Key, typename _Tp,
|
||||
typename _Hash = std::hash<_Key>,
|
||||
typename _Pred = std::equal_to<_Key>,
|
||||
typename _Alloc = std::allocator<std::pair<const _Key, _Tp> > >
|
||||
class unordered_multimap
|
||||
: public _GLIBCXX_STD_BASE,
|
||||
public _Unordered_profile<unordered_multimap<_Key, _Tp,
|
||||
_Hash, _Pred, _Alloc>,
|
||||
false>
|
||||
{
|
||||
typedef typename _GLIBCXX_STD_BASE _Base;
|
||||
|
||||
_Base&
|
||||
_M_base() noexcept { return *this; }
|
||||
|
||||
const _Base&
|
||||
_M_base() const noexcept { return *this; }
|
||||
|
||||
public:
|
||||
typedef typename _Base::size_type size_type;
|
||||
typedef typename _Base::hasher hasher;
|
||||
typedef typename _Base::key_equal key_equal;
|
||||
typedef typename _Base::allocator_type allocator_type;
|
||||
typedef typename _Base::key_type key_type;
|
||||
typedef typename _Base::value_type value_type;
|
||||
typedef typename _Base::difference_type difference_type;
|
||||
typedef typename _Base::reference reference;
|
||||
typedef typename _Base::const_reference const_reference;
|
||||
|
||||
typedef typename _Base::iterator iterator;
|
||||
typedef typename _Base::const_iterator const_iterator;
|
||||
|
||||
unordered_multimap() = default;
|
||||
|
||||
explicit
|
||||
unordered_multimap(size_type __n,
|
||||
const hasher& __hf = hasher(),
|
||||
const key_equal& __eql = key_equal(),
|
||||
const allocator_type& __a = allocator_type())
|
||||
: _Base(__n, __hf, __eql, __a) { }
|
||||
|
||||
template<typename _InputIterator>
|
||||
unordered_multimap(_InputIterator __f, _InputIterator __l,
|
||||
size_type __n = 0,
|
||||
const hasher& __hf = hasher(),
|
||||
const key_equal& __eql = key_equal(),
|
||||
const allocator_type& __a = allocator_type())
|
||||
: _Base(__f, __l, __n, __hf, __eql, __a) { }
|
||||
|
||||
unordered_multimap(const unordered_multimap&) = default;
|
||||
|
||||
unordered_multimap(const _Base& __x)
|
||||
: _Base(__x) { }
|
||||
|
||||
unordered_multimap(unordered_multimap&&) = default;
|
||||
|
||||
explicit
|
||||
unordered_multimap(const allocator_type& __a)
|
||||
: _Base(__a) { }
|
||||
|
||||
unordered_multimap(const unordered_multimap& __ummap,
|
||||
const allocator_type& __a)
|
||||
: _Base(__ummap._M_base(), __a) { }
|
||||
|
||||
unordered_multimap(unordered_multimap&& __ummap,
|
||||
const allocator_type& __a)
|
||||
: _Base(std::move(__ummap._M_base()), __a) { }
|
||||
|
||||
unordered_multimap(initializer_list<value_type> __l,
|
||||
size_type __n = 0,
|
||||
const hasher& __hf = hasher(),
|
||||
const key_equal& __eql = key_equal(),
|
||||
const allocator_type& __a = allocator_type())
|
||||
: _Base(__l, __n, __hf, __eql, __a) { }
|
||||
|
||||
unordered_multimap(size_type __n, const allocator_type& __a)
|
||||
: unordered_multimap(__n, hasher(), key_equal(), __a)
|
||||
{ }
|
||||
|
||||
unordered_multimap(size_type __n, const hasher& __hf,
|
||||
const allocator_type& __a)
|
||||
: unordered_multimap(__n, __hf, key_equal(), __a)
|
||||
{ }
|
||||
|
||||
template<typename _InputIterator>
|
||||
unordered_multimap(_InputIterator __first, _InputIterator __last,
|
||||
size_type __n,
|
||||
const allocator_type& __a)
|
||||
: unordered_multimap(__first, __last, __n, hasher(), key_equal(), __a)
|
||||
{ }
|
||||
|
||||
template<typename _InputIterator>
|
||||
unordered_multimap(_InputIterator __first, _InputIterator __last,
|
||||
size_type __n, const hasher& __hf,
|
||||
const allocator_type& __a)
|
||||
: unordered_multimap(__first, __last, __n, __hf, key_equal(), __a)
|
||||
{ }
|
||||
|
||||
unordered_multimap(initializer_list<value_type> __l,
|
||||
size_type __n,
|
||||
const allocator_type& __a)
|
||||
: unordered_multimap(__l, __n, hasher(), key_equal(), __a)
|
||||
{ }
|
||||
|
||||
unordered_multimap(initializer_list<value_type> __l,
|
||||
size_type __n, const hasher& __hf,
|
||||
const allocator_type& __a)
|
||||
: unordered_multimap(__l, __n, __hf, key_equal(), __a)
|
||||
{ }
|
||||
|
||||
unordered_multimap&
|
||||
operator=(const unordered_multimap&) = default;
|
||||
|
||||
unordered_multimap&
|
||||
operator=(unordered_multimap&&) = default;
|
||||
|
||||
unordered_multimap&
|
||||
operator=(initializer_list<value_type> __l)
|
||||
{
|
||||
this->_M_profile_destruct();
|
||||
_M_base() = __l;
|
||||
this->_M_profile_construct();
|
||||
return *this;
|
||||
}
|
||||
|
||||
void
|
||||
clear() noexcept
|
||||
{
|
||||
this->_M_profile_destruct();
|
||||
_Base::clear();
|
||||
this->_M_profile_construct();
|
||||
}
|
||||
|
||||
template<typename... _Args>
|
||||
iterator
|
||||
emplace(_Args&&... __args)
|
||||
{
|
||||
size_type __old_size = _Base::bucket_count();
|
||||
iterator __res
|
||||
= _Base::emplace(std::forward<_Args>(__args)...);
|
||||
this->_M_profile_resize(__old_size);
|
||||
return __res;
|
||||
}
|
||||
|
||||
template<typename... _Args>
|
||||
iterator
|
||||
emplace_hint(const_iterator __it, _Args&&... __args)
|
||||
{
|
||||
size_type __old_size = _Base::bucket_count();
|
||||
iterator __res
|
||||
= _Base::emplace_hint(__it, std::forward<_Args>(__args)...);
|
||||
this->_M_profile_resize(__old_size);
|
||||
return __res;
|
||||
}
|
||||
|
||||
void
|
||||
insert(std::initializer_list<value_type> __l)
|
||||
{
|
||||
size_type __old_size = _Base::bucket_count();
|
||||
_Base::insert(__l);
|
||||
this->_M_profile_resize(__old_size);
|
||||
}
|
||||
|
||||
iterator
|
||||
insert(const value_type& __obj)
|
||||
{
|
||||
size_type __old_size = _Base::bucket_count();
|
||||
iterator __res = _Base::insert(__obj);
|
||||
this->_M_profile_resize(__old_size);
|
||||
return __res;
|
||||
}
|
||||
|
||||
iterator
|
||||
insert(const_iterator __iter, const value_type& __v)
|
||||
{
|
||||
size_type __old_size = _Base::bucket_count();
|
||||
iterator __res = _Base::insert(__iter, __v);
|
||||
this->_M_profile_resize(__old_size);
|
||||
return __res;
|
||||
}
|
||||
|
||||
template<typename _Pair, typename = typename
|
||||
std::enable_if<std::is_constructible<value_type,
|
||||
_Pair&&>::value>::type>
|
||||
iterator
|
||||
insert(_Pair&& __obj)
|
||||
{
|
||||
size_type __old_size = _Base::bucket_count();
|
||||
iterator __res = _Base::insert(std::forward<_Pair>(__obj));
|
||||
this->_M_profile_resize(__old_size);
|
||||
return __res;
|
||||
}
|
||||
|
||||
template<typename _Pair, typename = typename
|
||||
std::enable_if<std::is_constructible<value_type,
|
||||
_Pair&&>::value>::type>
|
||||
iterator
|
||||
insert(const_iterator __iter, _Pair&& __v)
|
||||
{
|
||||
size_type __old_size = _Base::bucket_count();
|
||||
iterator __res = _Base::insert(__iter, std::forward<_Pair>(__v));
|
||||
this->_M_profile_resize(__old_size);
|
||||
return __res;
|
||||
}
|
||||
|
||||
template<typename _InputIter>
|
||||
void
|
||||
insert(_InputIter __first, _InputIter __last)
|
||||
{
|
||||
size_type __old_size = _Base::bucket_count();
|
||||
_Base::insert(__first, __last);
|
||||
this->_M_profile_resize(__old_size);
|
||||
}
|
||||
|
||||
void
|
||||
swap(unordered_multimap& __x)
|
||||
noexcept( noexcept(__x._M_base().swap(__x)) )
|
||||
{
|
||||
_Base::swap(__x._M_base());
|
||||
this->_M_swap(__x);
|
||||
}
|
||||
|
||||
void
|
||||
rehash(size_type __n)
|
||||
{
|
||||
size_type __old_size = _Base::bucket_count();
|
||||
_Base::rehash(__n);
|
||||
this->_M_profile_resize(__old_size);
|
||||
}
|
||||
};
|
||||
|
||||
template<typename _Key, typename _Tp, typename _Hash,
|
||||
typename _Pred, typename _Alloc>
|
||||
inline void
|
||||
swap(unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>& __x,
|
||||
unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>& __y)
|
||||
{ __x.swap(__y); }
|
||||
|
||||
template<typename _Key, typename _Tp, typename _Hash,
|
||||
typename _Pred, typename _Alloc>
|
||||
inline bool
|
||||
operator==(const unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>& __x,
|
||||
const unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>& __y)
|
||||
{ return static_cast<const _GLIBCXX_STD_BASE&>(__x) == __y; }
|
||||
|
||||
template<typename _Key, typename _Tp, typename _Hash,
|
||||
typename _Pred, typename _Alloc>
|
||||
inline bool
|
||||
operator!=(const unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>& __x,
|
||||
const unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>& __y)
|
||||
{ return !(__x == __y); }
|
||||
|
||||
} // namespace __profile
|
||||
} // namespace std
|
||||
|
||||
#undef _GLIBCXX_BASE
|
||||
#undef _GLIBCXX_STD_BASE
|
||||
|
||||
#endif // C++11
|
||||
|
||||
#endif
|
||||
559
openflow/usr/include/c++/5/profile/unordered_set
Normal file
559
openflow/usr/include/c++/5/profile/unordered_set
Normal file
@@ -0,0 +1,559 @@
|
||||
// Profiling unordered_set/unordered_multiset implementation -*- C++ -*-
|
||||
|
||||
// Copyright (C) 2009-2015 Free Software Foundation, Inc.
|
||||
//
|
||||
// This file is part of the GNU ISO C++ Library. This library is free
|
||||
// software; you can redistribute it and/or modify it under the
|
||||
// terms of the GNU General Public License as published by the
|
||||
// Free Software Foundation; either version 3, or (at your option)
|
||||
// any later version.
|
||||
//
|
||||
// This library is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
|
||||
// Under Section 7 of GPL version 3, you are granted additional
|
||||
// permissions described in the GCC Runtime Library Exception, version
|
||||
// 3.1, as published by the Free Software Foundation.
|
||||
|
||||
// You should have received a copy of the GNU General Public License along
|
||||
// with this library; see the file COPYING3. If not see
|
||||
// <http://www.gnu.org/licenses/>.
|
||||
|
||||
/** @file profile/unordered_set
|
||||
* This file is a GNU profile extension to the Standard C++ Library.
|
||||
*/
|
||||
|
||||
#ifndef _GLIBCXX_PROFILE_UNORDERED_SET
|
||||
#define _GLIBCXX_PROFILE_UNORDERED_SET 1
|
||||
|
||||
#if __cplusplus < 201103L
|
||||
# include <bits/c++0x_warning.h>
|
||||
#else
|
||||
# include <unordered_set>
|
||||
|
||||
#include <profile/base.h>
|
||||
#include <profile/unordered_base.h>
|
||||
|
||||
#define _GLIBCXX_BASE unordered_set<_Key, _Hash, _Pred, _Alloc>
|
||||
#define _GLIBCXX_STD_BASE _GLIBCXX_STD_C::_GLIBCXX_BASE
|
||||
|
||||
namespace std _GLIBCXX_VISIBILITY(default)
|
||||
{
|
||||
namespace __profile
|
||||
{
|
||||
/** @brief Unordered_set wrapper with performance instrumentation. */
|
||||
template<typename _Key,
|
||||
typename _Hash = std::hash<_Key>,
|
||||
typename _Pred = std::equal_to<_Key>,
|
||||
typename _Alloc = std::allocator<_Key> >
|
||||
class unordered_set
|
||||
: public _GLIBCXX_STD_BASE,
|
||||
public _Unordered_profile<unordered_set<_Key, _Hash, _Pred, _Alloc>,
|
||||
true>
|
||||
{
|
||||
typedef _GLIBCXX_STD_BASE _Base;
|
||||
|
||||
_Base&
|
||||
_M_base() noexcept { return *this; }
|
||||
|
||||
const _Base&
|
||||
_M_base() const noexcept { return *this; }
|
||||
|
||||
public:
|
||||
typedef typename _Base::size_type size_type;
|
||||
typedef typename _Base::hasher hasher;
|
||||
typedef typename _Base::key_equal key_equal;
|
||||
typedef typename _Base::allocator_type allocator_type;
|
||||
typedef typename _Base::key_type key_type;
|
||||
typedef typename _Base::value_type value_type;
|
||||
typedef typename _Base::difference_type difference_type;
|
||||
typedef typename _Base::reference reference;
|
||||
typedef typename _Base::const_reference const_reference;
|
||||
|
||||
typedef typename _Base::iterator iterator;
|
||||
typedef typename _Base::const_iterator const_iterator;
|
||||
|
||||
unordered_set() = default;
|
||||
|
||||
explicit
|
||||
unordered_set(size_type __n,
|
||||
const hasher& __hf = hasher(),
|
||||
const key_equal& __eql = key_equal(),
|
||||
const allocator_type& __a = allocator_type())
|
||||
: _Base(__n, __hf, __eql, __a)
|
||||
{ }
|
||||
|
||||
template<typename _InputIterator>
|
||||
unordered_set(_InputIterator __f, _InputIterator __l,
|
||||
size_type __n = 0,
|
||||
const hasher& __hf = hasher(),
|
||||
const key_equal& __eql = key_equal(),
|
||||
const allocator_type& __a = allocator_type())
|
||||
: _Base(__f, __l, __n, __hf, __eql, __a)
|
||||
{ }
|
||||
|
||||
unordered_set(const unordered_set&) = default;
|
||||
|
||||
unordered_set(const _Base& __x)
|
||||
: _Base(__x)
|
||||
{ }
|
||||
|
||||
unordered_set(unordered_set&&) = default;
|
||||
|
||||
explicit
|
||||
unordered_set(const allocator_type& __a)
|
||||
: _Base(__a)
|
||||
{ }
|
||||
|
||||
unordered_set(const unordered_set& __uset,
|
||||
const allocator_type& __a)
|
||||
: _Base(__uset._M_base(), __a)
|
||||
{ }
|
||||
|
||||
unordered_set(unordered_set&& __uset,
|
||||
const allocator_type& __a)
|
||||
: _Base(std::move(__uset._M_base()), __a)
|
||||
{ }
|
||||
|
||||
unordered_set(initializer_list<value_type> __l,
|
||||
size_type __n = 0,
|
||||
const hasher& __hf = hasher(),
|
||||
const key_equal& __eql = key_equal(),
|
||||
const allocator_type& __a = allocator_type())
|
||||
: _Base(__l, __n, __hf, __eql, __a)
|
||||
{ }
|
||||
|
||||
unordered_set(size_type __n, const allocator_type& __a)
|
||||
: unordered_set(__n, hasher(), key_equal(), __a)
|
||||
{ }
|
||||
|
||||
unordered_set(size_type __n, const hasher& __hf,
|
||||
const allocator_type& __a)
|
||||
: unordered_set(__n, __hf, key_equal(), __a)
|
||||
{ }
|
||||
|
||||
template<typename _InputIterator>
|
||||
unordered_set(_InputIterator __first, _InputIterator __last,
|
||||
size_type __n,
|
||||
const allocator_type& __a)
|
||||
: unordered_set(__first, __last, __n, hasher(), key_equal(), __a)
|
||||
{ }
|
||||
|
||||
template<typename _InputIterator>
|
||||
unordered_set(_InputIterator __first, _InputIterator __last,
|
||||
size_type __n, const hasher& __hf,
|
||||
const allocator_type& __a)
|
||||
: unordered_set(__first, __last, __n, __hf, key_equal(), __a)
|
||||
{ }
|
||||
|
||||
unordered_set(initializer_list<value_type> __l,
|
||||
size_type __n,
|
||||
const allocator_type& __a)
|
||||
: unordered_set(__l, __n, hasher(), key_equal(), __a)
|
||||
{ }
|
||||
|
||||
unordered_set(initializer_list<value_type> __l,
|
||||
size_type __n, const hasher& __hf,
|
||||
const allocator_type& __a)
|
||||
: unordered_set(__l, __n, __hf, key_equal(), __a)
|
||||
{ }
|
||||
|
||||
unordered_set&
|
||||
operator=(const unordered_set&) = default;
|
||||
|
||||
unordered_set&
|
||||
operator=(unordered_set&&) = default;
|
||||
|
||||
unordered_set&
|
||||
operator=(initializer_list<value_type> __l)
|
||||
{
|
||||
this->_M_profile_destruct();
|
||||
_M_base() = __l;
|
||||
this->_M_profile_construct();
|
||||
return *this;
|
||||
}
|
||||
|
||||
void
|
||||
swap(unordered_set& __x)
|
||||
noexcept( noexcept(__x._M_base().swap(__x)) )
|
||||
{
|
||||
_Base::swap(__x);
|
||||
this->_M_swap(__x);
|
||||
}
|
||||
|
||||
void
|
||||
clear() noexcept
|
||||
{
|
||||
this->_M_profile_destruct();
|
||||
_Base::clear();
|
||||
this->_M_profile_construct();
|
||||
}
|
||||
|
||||
template<typename... _Args>
|
||||
std::pair<iterator, bool>
|
||||
emplace(_Args&&... __args)
|
||||
{
|
||||
size_type __old_size = _Base::bucket_count();
|
||||
std::pair<iterator, bool> __res
|
||||
= _Base::emplace(std::forward<_Args>(__args)...);
|
||||
this->_M_profile_resize(__old_size);
|
||||
return __res;
|
||||
}
|
||||
|
||||
template<typename... _Args>
|
||||
iterator
|
||||
emplace_hint(const_iterator __it, _Args&&... __args)
|
||||
{
|
||||
size_type __old_size = _Base::bucket_count();
|
||||
iterator __res
|
||||
= _Base::emplace_hint(__it, std::forward<_Args>(__args)...);
|
||||
this->_M_profile_resize(__old_size);
|
||||
return __res;
|
||||
}
|
||||
|
||||
void
|
||||
insert(std::initializer_list<value_type> __l)
|
||||
{
|
||||
size_type __old_size = _Base::bucket_count();
|
||||
_Base::insert(__l);
|
||||
this->_M_profile_resize(__old_size);
|
||||
}
|
||||
|
||||
std::pair<iterator, bool>
|
||||
insert(const value_type& __obj)
|
||||
{
|
||||
size_type __old_size = _Base::bucket_count();
|
||||
std::pair<iterator, bool> __res = _Base::insert(__obj);
|
||||
this->_M_profile_resize(__old_size);
|
||||
return __res;
|
||||
}
|
||||
|
||||
iterator
|
||||
insert(const_iterator __iter, const value_type& __v)
|
||||
{
|
||||
size_type __old_size = _Base::bucket_count();
|
||||
iterator __res = _Base::insert(__iter, __v);
|
||||
this->_M_profile_resize(__old_size);
|
||||
return __res;
|
||||
}
|
||||
|
||||
std::pair<iterator, bool>
|
||||
insert(value_type&& __obj)
|
||||
{
|
||||
size_type __old_size = _Base::bucket_count();
|
||||
std::pair<iterator, bool> __res = _Base::insert(std::move(__obj));
|
||||
this->_M_profile_resize(__old_size);
|
||||
return __res;
|
||||
}
|
||||
|
||||
iterator
|
||||
insert(const_iterator __iter, value_type&& __v)
|
||||
{
|
||||
size_type __old_size = _Base::bucket_count();
|
||||
iterator __res = _Base::insert(__iter, std::move(__v));
|
||||
this->_M_profile_resize(__old_size);
|
||||
return __res;
|
||||
}
|
||||
|
||||
template<typename _InputIter>
|
||||
void
|
||||
insert(_InputIter __first, _InputIter __last)
|
||||
{
|
||||
size_type __old_size = _Base::bucket_count();
|
||||
_Base::insert(__first, __last);
|
||||
this->_M_profile_resize(__old_size);
|
||||
}
|
||||
|
||||
void
|
||||
rehash(size_type __n)
|
||||
{
|
||||
size_type __old_size = _Base::bucket_count();
|
||||
_Base::rehash(__n);
|
||||
this->_M_profile_resize(__old_size);
|
||||
}
|
||||
};
|
||||
|
||||
template<typename _Key, typename _Hash, typename _Pred, typename _Alloc>
|
||||
inline void
|
||||
swap(unordered_set<_Key, _Hash, _Pred, _Alloc>& __x,
|
||||
unordered_set<_Key, _Hash, _Pred, _Alloc>& __y)
|
||||
{ __x.swap(__y); }
|
||||
|
||||
template<typename _Key, typename _Hash, typename _Pred, typename _Alloc>
|
||||
inline bool
|
||||
operator==(const unordered_set<_Key, _Hash, _Pred, _Alloc>& __x,
|
||||
const unordered_set<_Key, _Hash, _Pred, _Alloc>& __y)
|
||||
{ return static_cast<const _GLIBCXX_STD_BASE&>(__x) == __y; }
|
||||
|
||||
template<typename _Key, typename _Hash, typename _Pred, typename _Alloc>
|
||||
inline bool
|
||||
operator!=(const unordered_set<_Key, _Hash, _Pred, _Alloc>& __x,
|
||||
const unordered_set<_Key, _Hash, _Pred, _Alloc>& __y)
|
||||
{ return !(__x == __y); }
|
||||
|
||||
#undef _GLIBCXX_BASE
|
||||
#undef _GLIBCXX_STD_BASE
|
||||
#define _GLIBCXX_STD_BASE _GLIBCXX_STD_C::_GLIBCXX_BASE
|
||||
#define _GLIBCXX_BASE unordered_multiset<_Value, _Hash, _Pred, _Alloc>
|
||||
|
||||
/** @brief Unordered_multiset wrapper with performance instrumentation. */
|
||||
template<typename _Value,
|
||||
typename _Hash = std::hash<_Value>,
|
||||
typename _Pred = std::equal_to<_Value>,
|
||||
typename _Alloc = std::allocator<_Value> >
|
||||
class unordered_multiset
|
||||
: public _GLIBCXX_STD_BASE,
|
||||
public _Unordered_profile<unordered_multiset<_Value,
|
||||
_Hash, _Pred, _Alloc>,
|
||||
false>
|
||||
{
|
||||
typedef _GLIBCXX_STD_BASE _Base;
|
||||
|
||||
_Base&
|
||||
_M_base() noexcept { return *this; }
|
||||
|
||||
const _Base&
|
||||
_M_base() const noexcept { return *this; }
|
||||
|
||||
public:
|
||||
typedef typename _Base::size_type size_type;
|
||||
typedef typename _Base::hasher hasher;
|
||||
typedef typename _Base::key_equal key_equal;
|
||||
typedef typename _Base::allocator_type allocator_type;
|
||||
typedef typename _Base::key_type key_type;
|
||||
typedef typename _Base::value_type value_type;
|
||||
typedef typename _Base::difference_type difference_type;
|
||||
typedef typename _Base::reference reference;
|
||||
typedef typename _Base::const_reference const_reference;
|
||||
|
||||
typedef typename _Base::iterator iterator;
|
||||
typedef typename _Base::const_iterator const_iterator;
|
||||
|
||||
unordered_multiset() = default;
|
||||
|
||||
explicit
|
||||
unordered_multiset(size_type __n,
|
||||
const hasher& __hf = hasher(),
|
||||
const key_equal& __eql = key_equal(),
|
||||
const allocator_type& __a = allocator_type())
|
||||
: _Base(__n, __hf, __eql, __a)
|
||||
{ }
|
||||
|
||||
template<typename _InputIterator>
|
||||
unordered_multiset(_InputIterator __f, _InputIterator __l,
|
||||
size_type __n = 0,
|
||||
const hasher& __hf = hasher(),
|
||||
const key_equal& __eql = key_equal(),
|
||||
const allocator_type& __a = allocator_type())
|
||||
: _Base(__f, __l, __n, __hf, __eql, __a)
|
||||
{ }
|
||||
|
||||
unordered_multiset(const unordered_multiset&) = default;
|
||||
|
||||
unordered_multiset(const _Base& __x)
|
||||
: _Base(__x)
|
||||
{ }
|
||||
|
||||
unordered_multiset(unordered_multiset&&) = default;
|
||||
|
||||
explicit
|
||||
unordered_multiset(const allocator_type& __a)
|
||||
: _Base(__a)
|
||||
{ }
|
||||
|
||||
unordered_multiset(const unordered_multiset& __umset,
|
||||
const allocator_type& __a)
|
||||
: _Base(__umset._M_base(), __a)
|
||||
{ }
|
||||
|
||||
unordered_multiset(unordered_multiset&& __umset,
|
||||
const allocator_type& __a)
|
||||
: _Base(std::move(__umset._M_base()), __a)
|
||||
{ }
|
||||
|
||||
unordered_multiset(initializer_list<value_type> __l,
|
||||
size_type __n = 0,
|
||||
const hasher& __hf = hasher(),
|
||||
const key_equal& __eql = key_equal(),
|
||||
const allocator_type& __a = allocator_type())
|
||||
: _Base(__l, __n, __hf, __eql, __a)
|
||||
{ }
|
||||
|
||||
unordered_multiset(size_type __n, const allocator_type& __a)
|
||||
: unordered_multiset(__n, hasher(), key_equal(), __a)
|
||||
{ }
|
||||
|
||||
unordered_multiset(size_type __n, const hasher& __hf,
|
||||
const allocator_type& __a)
|
||||
: unordered_multiset(__n, __hf, key_equal(), __a)
|
||||
{ }
|
||||
|
||||
template<typename _InputIterator>
|
||||
unordered_multiset(_InputIterator __first, _InputIterator __last,
|
||||
size_type __n,
|
||||
const allocator_type& __a)
|
||||
: unordered_multiset(__first, __last, __n, hasher(), key_equal(), __a)
|
||||
{ }
|
||||
|
||||
template<typename _InputIterator>
|
||||
unordered_multiset(_InputIterator __first, _InputIterator __last,
|
||||
size_type __n, const hasher& __hf,
|
||||
const allocator_type& __a)
|
||||
: unordered_multiset(__first, __last, __n, __hf, key_equal(), __a)
|
||||
{ }
|
||||
|
||||
unordered_multiset(initializer_list<value_type> __l,
|
||||
size_type __n,
|
||||
const allocator_type& __a)
|
||||
: unordered_multiset(__l, __n, hasher(), key_equal(), __a)
|
||||
{ }
|
||||
|
||||
unordered_multiset(initializer_list<value_type> __l,
|
||||
size_type __n, const hasher& __hf,
|
||||
const allocator_type& __a)
|
||||
: unordered_multiset(__l, __n, __hf, key_equal(), __a)
|
||||
{ }
|
||||
|
||||
unordered_multiset&
|
||||
operator=(const unordered_multiset&) = default;
|
||||
|
||||
unordered_multiset&
|
||||
operator=(unordered_multiset&&) = default;
|
||||
|
||||
unordered_multiset&
|
||||
operator=(initializer_list<value_type> __l)
|
||||
{
|
||||
this->_M_profile_destruct();
|
||||
_M_base() = __l;
|
||||
this->_M_profile_construct();
|
||||
return *this;
|
||||
}
|
||||
|
||||
void
|
||||
swap(unordered_multiset& __x)
|
||||
noexcept( noexcept(__x._M_base().swap(__x)) )
|
||||
{
|
||||
_Base::swap(__x);
|
||||
this->_M_swap(__x);
|
||||
}
|
||||
|
||||
void
|
||||
clear() noexcept
|
||||
{
|
||||
this->_M_profile_destruct();
|
||||
_Base::clear();
|
||||
this->_M_profile_construct();
|
||||
}
|
||||
|
||||
template<typename... _Args>
|
||||
iterator
|
||||
emplace(_Args&&... __args)
|
||||
{
|
||||
size_type __old_size = _Base::bucket_count();
|
||||
iterator __res = _Base::emplace(std::forward<_Args>(__args)...);
|
||||
this->_M_profile_resize(__old_size);
|
||||
return __res;
|
||||
}
|
||||
|
||||
template<typename... _Args>
|
||||
iterator
|
||||
emplace_hint(const_iterator __it, _Args&&... __args)
|
||||
{
|
||||
size_type __old_size = _Base::bucket_count();
|
||||
iterator __res
|
||||
= _Base::emplace_hint(__it, std::forward<_Args>(__args)...);
|
||||
this->_M_profile_resize(__old_size);
|
||||
return __res;
|
||||
}
|
||||
|
||||
void
|
||||
insert(std::initializer_list<value_type> __l)
|
||||
{
|
||||
size_type __old_size = _Base::bucket_count();
|
||||
_Base::insert(__l);
|
||||
this->_M_profile_resize(__old_size);
|
||||
}
|
||||
|
||||
iterator
|
||||
insert(const value_type& __obj)
|
||||
{
|
||||
size_type __old_size = _Base::bucket_count();
|
||||
iterator __res = _Base::insert(__obj);
|
||||
this->_M_profile_resize(__old_size);
|
||||
return __res;
|
||||
}
|
||||
|
||||
iterator
|
||||
insert(const_iterator __iter, const value_type& __v)
|
||||
{
|
||||
size_type __old_size = _Base::bucket_count();
|
||||
iterator __res = _Base::insert(__iter, __v);
|
||||
this->_M_profile_resize(__old_size);
|
||||
return __res;
|
||||
}
|
||||
|
||||
iterator
|
||||
insert(value_type&& __obj)
|
||||
{
|
||||
size_type __old_size = _Base::bucket_count();
|
||||
iterator __res = _Base::insert(std::move(__obj));
|
||||
this->_M_profile_resize(__old_size);
|
||||
return __res;
|
||||
}
|
||||
|
||||
iterator
|
||||
insert(const_iterator __iter, value_type&& __v)
|
||||
{
|
||||
size_type __old_size = _Base::bucket_count();
|
||||
iterator __res = _Base::insert(__iter, std::move(__v));
|
||||
this->_M_profile_resize(__old_size);
|
||||
return __res;
|
||||
}
|
||||
|
||||
template<typename _InputIter>
|
||||
void
|
||||
insert(_InputIter __first, _InputIter __last)
|
||||
{
|
||||
size_type __old_size = _Base::bucket_count();
|
||||
_Base::insert(__first, __last);
|
||||
this->_M_profile_resize(__old_size);
|
||||
}
|
||||
|
||||
void
|
||||
rehash(size_type __n)
|
||||
{
|
||||
size_type __old_size = _Base::bucket_count();
|
||||
_Base::rehash(__n);
|
||||
this->_M_profile_resize(__old_size);
|
||||
}
|
||||
};
|
||||
|
||||
template<typename _Value, typename _Hash, typename _Pred, typename _Alloc>
|
||||
inline void
|
||||
swap(unordered_multiset<_Value, _Hash, _Pred, _Alloc>& __x,
|
||||
unordered_multiset<_Value, _Hash, _Pred, _Alloc>& __y)
|
||||
{ __x.swap(__y); }
|
||||
|
||||
template<typename _Value, typename _Hash, typename _Pred, typename _Alloc>
|
||||
inline bool
|
||||
operator==(const unordered_multiset<_Value, _Hash, _Pred, _Alloc>& __x,
|
||||
const unordered_multiset<_Value, _Hash, _Pred, _Alloc>& __y)
|
||||
{ return static_cast<const _GLIBCXX_STD_BASE&>(__x) == __y; }
|
||||
|
||||
template<typename _Value, typename _Hash, typename _Pred, typename _Alloc>
|
||||
inline bool
|
||||
operator!=(const unordered_multiset<_Value, _Hash, _Pred, _Alloc>& __x,
|
||||
const unordered_multiset<_Value, _Hash, _Pred, _Alloc>& __y)
|
||||
{ return !(__x == __y); }
|
||||
|
||||
} // namespace __profile
|
||||
} // namespace std
|
||||
|
||||
#undef _GLIBCXX_BASE
|
||||
#undef _GLIBCXX_STD_BASE
|
||||
|
||||
#endif // C++11
|
||||
|
||||
#endif
|
||||
583
openflow/usr/include/c++/5/profile/vector
Normal file
583
openflow/usr/include/c++/5/profile/vector
Normal file
@@ -0,0 +1,583 @@
|
||||
// Profiling vector implementation -*- C++ -*-
|
||||
|
||||
// Copyright (C) 2009-2015 Free Software Foundation, Inc.
|
||||
//
|
||||
// This file is part of the GNU ISO C++ Library. This library is free
|
||||
// software; you can redistribute it and/or modify it under the
|
||||
// terms of the GNU General Public License as published by the
|
||||
// Free Software Foundation; either version 3, or (at your option)
|
||||
// any later version.
|
||||
//
|
||||
// This library is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
|
||||
// Under Section 7 of GPL version 3, you are granted additional
|
||||
// permissions described in the GCC Runtime Library Exception, version
|
||||
// 3.1, as published by the Free Software Foundation.
|
||||
|
||||
// You should have received a copy of the GNU General Public License along
|
||||
// with this library; see the file COPYING3. If not see
|
||||
// <http://www.gnu.org/licenses/>.
|
||||
|
||||
/** @file profile/vector
|
||||
* This file is a GNU profile extension to the Standard C++ Library.
|
||||
*/
|
||||
|
||||
#ifndef _GLIBCXX_PROFILE_VECTOR
|
||||
#define _GLIBCXX_PROFILE_VECTOR 1
|
||||
|
||||
#include <vector>
|
||||
#include <utility>
|
||||
#include <profile/base.h>
|
||||
#include <profile/iterator_tracker.h>
|
||||
|
||||
namespace std _GLIBCXX_VISIBILITY(default)
|
||||
{
|
||||
namespace __profile
|
||||
{
|
||||
template<typename _Vector>
|
||||
class _Vector_profile_pre
|
||||
{
|
||||
_Vector&
|
||||
_M_conjure()
|
||||
{ return *static_cast<_Vector*>(this); }
|
||||
|
||||
public:
|
||||
#if __cplusplus >= 201103L
|
||||
_Vector_profile_pre() = default;
|
||||
_Vector_profile_pre(const _Vector_profile_pre&) = default;
|
||||
_Vector_profile_pre(_Vector_profile_pre&&) = default;
|
||||
|
||||
_Vector_profile_pre&
|
||||
operator=(const _Vector_profile_pre&)
|
||||
{ _M_conjure()._M_profile_destruct(); }
|
||||
|
||||
_Vector_profile_pre&
|
||||
operator=(_Vector_profile_pre&&) noexcept
|
||||
{ _M_conjure()._M_profile_destruct(); }
|
||||
#endif
|
||||
};
|
||||
|
||||
template<typename _Vector>
|
||||
class _Vector_profile_post
|
||||
{
|
||||
_Vector&
|
||||
_M_conjure()
|
||||
{ return *static_cast<_Vector*>(this); }
|
||||
|
||||
protected:
|
||||
__gnu_profile::__container_size_info* _M_size_info;
|
||||
__gnu_profile::__vector2list_info* _M_vect2list_info;
|
||||
|
||||
_Vector_profile_post() _GLIBCXX_NOEXCEPT
|
||||
{ _M_profile_construct(); }
|
||||
|
||||
#if __cplusplus >= 201103L
|
||||
_Vector_profile_post(const _Vector_profile_post&) noexcept
|
||||
: _Vector_profile_post() { }
|
||||
_Vector_profile_post(_Vector_profile_post&& __other) noexcept
|
||||
: _Vector_profile_post()
|
||||
{ _M_swap(__other); }
|
||||
|
||||
_Vector_profile_post&
|
||||
operator=(const _Vector_profile_post&) noexcept
|
||||
{ _M_profile_construct(); }
|
||||
|
||||
_Vector_profile_post&
|
||||
operator=(_Vector_profile_post&& __other) noexcept
|
||||
{
|
||||
_M_swap(__other);
|
||||
__other._M_profile_construct();
|
||||
}
|
||||
#endif
|
||||
|
||||
~_Vector_profile_post()
|
||||
{ _M_conjure()._M_profile_destruct(); }
|
||||
|
||||
public:
|
||||
void
|
||||
_M_profile_construct() _GLIBCXX_NOEXCEPT
|
||||
{
|
||||
_M_size_info =
|
||||
__profcxx_vector_size_construct(_M_conjure().capacity());
|
||||
_M_vect2list_info = __profcxx_vector2list_construct();
|
||||
}
|
||||
|
||||
void
|
||||
_M_profile_destruct() _GLIBCXX_NOEXCEPT
|
||||
{
|
||||
__profcxx_vector2list_destruct(_M_vect2list_info);
|
||||
_M_vect2list_info = 0;
|
||||
__profcxx_vector_size_destruct(_M_size_info,
|
||||
_M_conjure().capacity(),
|
||||
_M_conjure().size());
|
||||
_M_size_info = 0;
|
||||
}
|
||||
|
||||
void
|
||||
_M_swap(_Vector_profile_post& __other) _GLIBCXX_NOEXCEPT
|
||||
{
|
||||
std::swap(_M_size_info, __other._M_size_info);
|
||||
std::swap(_M_vect2list_info, __other._M_vect2list_info);
|
||||
}
|
||||
};
|
||||
|
||||
template<typename _Tp,
|
||||
typename _Allocator = std::allocator<_Tp> >
|
||||
class vector
|
||||
: public _Vector_profile_pre<vector<_Tp, _Allocator> >,
|
||||
public _GLIBCXX_STD_C::vector<_Tp, _Allocator>,
|
||||
public _Vector_profile_post<vector<_Tp, _Allocator> >
|
||||
{
|
||||
typedef _GLIBCXX_STD_C::vector<_Tp, _Allocator> _Base;
|
||||
|
||||
typedef typename _Base::iterator _Base_iterator;
|
||||
typedef typename _Base::const_iterator _Base_const_iterator;
|
||||
|
||||
public:
|
||||
typedef typename _Base::reference reference;
|
||||
typedef typename _Base::const_reference const_reference;
|
||||
|
||||
typedef __iterator_tracker<_Base_iterator, vector>
|
||||
iterator;
|
||||
typedef __iterator_tracker<_Base_const_iterator, vector>
|
||||
const_iterator;
|
||||
|
||||
typedef typename _Base::size_type size_type;
|
||||
typedef typename _Base::difference_type difference_type;
|
||||
|
||||
typedef _Tp value_type;
|
||||
typedef _Allocator allocator_type;
|
||||
typedef typename _Base::pointer pointer;
|
||||
typedef typename _Base::const_pointer const_pointer;
|
||||
typedef std::reverse_iterator<iterator> reverse_iterator;
|
||||
typedef std::reverse_iterator<const_iterator> const_reverse_iterator;
|
||||
|
||||
_Base&
|
||||
_M_base() _GLIBCXX_NOEXCEPT { return *this; }
|
||||
|
||||
const _Base&
|
||||
_M_base() const _GLIBCXX_NOEXCEPT { return *this; }
|
||||
|
||||
// 23.2.4.1 construct/copy/destroy:
|
||||
|
||||
#if __cplusplus < 201103L
|
||||
vector()
|
||||
{ }
|
||||
|
||||
vector(const vector& __x)
|
||||
: _Base(__x) { }
|
||||
#else
|
||||
vector() = default;
|
||||
vector(const vector&) = default;
|
||||
vector(vector&&) = default;
|
||||
#endif
|
||||
|
||||
explicit
|
||||
vector(const _Allocator& __a) _GLIBCXX_NOEXCEPT
|
||||
: _Base(__a) { }
|
||||
|
||||
#if __cplusplus >= 201103L
|
||||
explicit
|
||||
vector(size_type __n, const _Allocator& __a = _Allocator())
|
||||
: _Base(__n, __a) { }
|
||||
|
||||
vector(size_type __n, const _Tp& __value,
|
||||
const _Allocator& __a = _Allocator())
|
||||
: _Base(__n, __value, __a) { }
|
||||
#else
|
||||
explicit
|
||||
vector(size_type __n, const _Tp& __value = _Tp(),
|
||||
const _Allocator& __a = _Allocator())
|
||||
: _Base(__n, __value, __a) { }
|
||||
#endif
|
||||
|
||||
#if __cplusplus >= 201103L
|
||||
template<typename _InputIterator,
|
||||
typename = std::_RequireInputIter<_InputIterator>>
|
||||
#else
|
||||
template<typename _InputIterator>
|
||||
#endif
|
||||
vector(_InputIterator __first, _InputIterator __last,
|
||||
const _Allocator& __a = _Allocator())
|
||||
: _Base(__first, __last, __a) { }
|
||||
|
||||
/// Construction from a normal-mode vector
|
||||
vector(const _Base& __x)
|
||||
: _Base(__x) { }
|
||||
|
||||
#if __cplusplus >= 201103L
|
||||
vector(const _Base& __x, const _Allocator& __a)
|
||||
: _Base(__x, __a) { }
|
||||
|
||||
vector(vector&& __x, const _Allocator& __a)
|
||||
: _Base(std::move(__x), __a) { }
|
||||
|
||||
vector(initializer_list<value_type> __l,
|
||||
const allocator_type& __a = allocator_type())
|
||||
: _Base(__l, __a) { }
|
||||
#endif
|
||||
|
||||
#if __cplusplus < 201103L
|
||||
vector&
|
||||
operator=(const vector& __x)
|
||||
{
|
||||
this->_M_profile_destruct();
|
||||
_M_base() = __x;
|
||||
this->_M_profile_construct();
|
||||
return *this;
|
||||
}
|
||||
#else
|
||||
vector&
|
||||
operator=(const vector&) = default;
|
||||
|
||||
vector&
|
||||
operator=(vector&&) = default;
|
||||
|
||||
vector&
|
||||
operator=(initializer_list<value_type> __l)
|
||||
{
|
||||
this->_M_profile_destruct();
|
||||
_M_base() = __l;
|
||||
this->_M_profile_construct();
|
||||
return *this;
|
||||
}
|
||||
#endif
|
||||
|
||||
// iterators:
|
||||
iterator
|
||||
begin() _GLIBCXX_NOEXCEPT
|
||||
{ return iterator(_Base::begin(), this); }
|
||||
|
||||
const_iterator
|
||||
begin() const _GLIBCXX_NOEXCEPT
|
||||
{ return const_iterator(_Base::begin(), this); }
|
||||
|
||||
iterator
|
||||
end() _GLIBCXX_NOEXCEPT
|
||||
{ return iterator(_Base::end(), this); }
|
||||
|
||||
const_iterator
|
||||
end() const _GLIBCXX_NOEXCEPT
|
||||
{ return const_iterator(_Base::end(), this); }
|
||||
|
||||
reverse_iterator
|
||||
rbegin() _GLIBCXX_NOEXCEPT
|
||||
{ return reverse_iterator(end()); }
|
||||
|
||||
const_reverse_iterator
|
||||
rbegin() const _GLIBCXX_NOEXCEPT
|
||||
{ return const_reverse_iterator(end()); }
|
||||
|
||||
reverse_iterator
|
||||
rend() _GLIBCXX_NOEXCEPT
|
||||
{ return reverse_iterator(begin()); }
|
||||
|
||||
const_reverse_iterator
|
||||
rend() const _GLIBCXX_NOEXCEPT
|
||||
{ return const_reverse_iterator(begin()); }
|
||||
|
||||
#if __cplusplus >= 201103L
|
||||
const_iterator
|
||||
cbegin() const noexcept
|
||||
{ return const_iterator(_Base::begin(), this); }
|
||||
|
||||
const_iterator
|
||||
cend() const noexcept
|
||||
{ return const_iterator(_Base::end(), this); }
|
||||
|
||||
const_reverse_iterator
|
||||
crbegin() const noexcept
|
||||
{ return const_reverse_iterator(end()); }
|
||||
|
||||
const_reverse_iterator
|
||||
crend() const noexcept
|
||||
{ return const_reverse_iterator(begin()); }
|
||||
#endif
|
||||
|
||||
// 23.2.4.2 capacity:
|
||||
|
||||
#if __cplusplus >= 201103L
|
||||
void
|
||||
resize(size_type __sz)
|
||||
{
|
||||
__profcxx_vector2list_invalid_operator(this->_M_vect2list_info);
|
||||
_M_profile_resize(this->capacity(), __sz);
|
||||
_Base::resize(__sz);
|
||||
}
|
||||
|
||||
void
|
||||
resize(size_type __sz, const _Tp& __c)
|
||||
{
|
||||
__profcxx_vector2list_invalid_operator(this->_M_vect2list_info);
|
||||
_M_profile_resize(this->capacity(), __sz);
|
||||
_Base::resize(__sz, __c);
|
||||
}
|
||||
#else
|
||||
void
|
||||
resize(size_type __sz, _Tp __c = _Tp())
|
||||
{
|
||||
__profcxx_vector2list_invalid_operator(this->_M_vect2list_info);
|
||||
_M_profile_resize(this->capacity(), __sz);
|
||||
_Base::resize(__sz, __c);
|
||||
}
|
||||
#endif
|
||||
|
||||
// element access:
|
||||
reference
|
||||
operator[](size_type __n) _GLIBCXX_NOEXCEPT
|
||||
{
|
||||
__profcxx_vector2list_invalid_operator(this->_M_vect2list_info);
|
||||
return _M_base()[__n];
|
||||
}
|
||||
const_reference
|
||||
operator[](size_type __n) const _GLIBCXX_NOEXCEPT
|
||||
{
|
||||
__profcxx_vector2list_invalid_operator(this->_M_vect2list_info);
|
||||
return _M_base()[__n];
|
||||
}
|
||||
|
||||
// 23.2.4.3 modifiers:
|
||||
void
|
||||
push_back(const _Tp& __x)
|
||||
{
|
||||
size_type __old_size = this->capacity();
|
||||
_Base::push_back(__x);
|
||||
_M_profile_resize(__old_size, this->capacity());
|
||||
}
|
||||
|
||||
#if __cplusplus >= 201103L
|
||||
void
|
||||
push_back(_Tp&& __x)
|
||||
{
|
||||
size_type __old_size = this->capacity();
|
||||
_Base::push_back(std::move(__x));
|
||||
_M_profile_resize(__old_size, this->capacity());
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
iterator
|
||||
#if __cplusplus >= 201103L
|
||||
insert(const_iterator __pos, const _Tp& __x)
|
||||
#else
|
||||
insert(iterator __pos, const _Tp& __x)
|
||||
#endif
|
||||
{
|
||||
__profcxx_vector2list_insert(this->_M_vect2list_info,
|
||||
__pos.base() - _Base::begin(),
|
||||
this->size());
|
||||
size_type __old_size = this->capacity();
|
||||
_Base_iterator __res = _Base::insert(__pos.base(), __x);
|
||||
_M_profile_resize(__old_size, this->capacity());
|
||||
return iterator(__res, this);
|
||||
}
|
||||
|
||||
#if __cplusplus >= 201103L
|
||||
iterator
|
||||
insert(const_iterator __pos, _Tp&& __x)
|
||||
{
|
||||
__profcxx_vector2list_insert(this->_M_vect2list_info,
|
||||
__pos.base() - _Base::cbegin(),
|
||||
this->size());
|
||||
size_type __old_size = this->capacity();
|
||||
_Base_iterator __res = _Base::insert(__pos.base(), __x);
|
||||
_M_profile_resize(__old_size, this->capacity());
|
||||
return iterator(__res, this);
|
||||
}
|
||||
|
||||
template<typename... _Args>
|
||||
iterator
|
||||
emplace(const_iterator __pos, _Args&&... __args)
|
||||
{
|
||||
_Base_iterator __res = _Base::emplace(__pos.base(),
|
||||
std::forward<_Args>(__args)...);
|
||||
return iterator(__res, this);
|
||||
}
|
||||
|
||||
iterator
|
||||
insert(const_iterator __pos, initializer_list<value_type> __l)
|
||||
{ return this->insert(__pos, __l.begin(), __l.end()); }
|
||||
#endif
|
||||
|
||||
void
|
||||
swap(vector& __x)
|
||||
#if __cplusplus >= 201103L
|
||||
noexcept( noexcept(declval<_Base>().swap(__x)) )
|
||||
#endif
|
||||
{
|
||||
_Base::swap(__x);
|
||||
this->_M_swap(__x);
|
||||
}
|
||||
|
||||
#if __cplusplus >= 201103L
|
||||
iterator
|
||||
insert(const_iterator __pos, size_type __n, const _Tp& __x)
|
||||
{
|
||||
__profcxx_vector2list_insert(this->_M_vect2list_info,
|
||||
__pos.base() - _Base::cbegin(),
|
||||
this->size());
|
||||
size_type __old_size = this->capacity();
|
||||
_Base_iterator __res = _Base::insert(__pos, __n, __x);
|
||||
_M_profile_resize(__old_size, this->capacity());
|
||||
return iterator(__res, this);
|
||||
}
|
||||
#else
|
||||
void
|
||||
insert(iterator __pos, size_type __n, const _Tp& __x)
|
||||
{
|
||||
__profcxx_vector2list_insert(this->_M_vect2list_info,
|
||||
__pos.base() - _Base::begin(),
|
||||
this->size());
|
||||
size_type __old_size = this->capacity();
|
||||
_Base::insert(__pos, __n, __x);
|
||||
_M_profile_resize(__old_size, this->capacity());
|
||||
}
|
||||
#endif
|
||||
|
||||
#if __cplusplus >= 201103L
|
||||
template<typename _InputIterator,
|
||||
typename = std::_RequireInputIter<_InputIterator>>
|
||||
iterator
|
||||
insert(const_iterator __pos,
|
||||
_InputIterator __first, _InputIterator __last)
|
||||
{
|
||||
__profcxx_vector2list_insert(this->_M_vect2list_info,
|
||||
__pos.base() - _Base::cbegin(),
|
||||
this->size());
|
||||
size_type __old_size = this->capacity();
|
||||
_Base_iterator __res = _Base::insert(__pos, __first, __last);
|
||||
_M_profile_resize(__old_size, this->capacity());
|
||||
return iterator(__res, this);
|
||||
}
|
||||
#else
|
||||
template<typename _InputIterator>
|
||||
void
|
||||
insert(iterator __pos,
|
||||
_InputIterator __first, _InputIterator __last)
|
||||
{
|
||||
__profcxx_vector2list_insert(this->_M_vect2list_info,
|
||||
__pos.base() - _Base::begin(),
|
||||
this->size());
|
||||
size_type __old_size = this->capacity();
|
||||
_Base::insert(__pos, __first, __last);
|
||||
_M_profile_resize(__old_size, this->capacity());
|
||||
}
|
||||
#endif
|
||||
|
||||
iterator
|
||||
#if __cplusplus >= 201103L
|
||||
erase(const_iterator __pos)
|
||||
#else
|
||||
erase(iterator __pos)
|
||||
#endif
|
||||
{ return iterator(_Base::erase(__pos.base()), this); }
|
||||
|
||||
iterator
|
||||
#if __cplusplus >= 201103L
|
||||
erase(const_iterator __first, const_iterator __last)
|
||||
#else
|
||||
erase(iterator __first, iterator __last)
|
||||
#endif
|
||||
{ return iterator(_Base::erase(__first.base(), __last.base()), this); }
|
||||
|
||||
void
|
||||
clear() _GLIBCXX_NOEXCEPT
|
||||
{
|
||||
this->_M_profile_destruct();
|
||||
_Base::clear();
|
||||
this->_M_profile_construct();
|
||||
}
|
||||
|
||||
inline void
|
||||
_M_profile_iterate(int __rewind = 0) const
|
||||
{ __profcxx_vector2list_iterate(this->_M_vect2list_info, __rewind); }
|
||||
|
||||
private:
|
||||
void _M_profile_resize(size_type __old_size, size_type __new_size)
|
||||
{
|
||||
if (__old_size < __new_size)
|
||||
{
|
||||
__profcxx_vector_size_resize(this->_M_size_info,
|
||||
this->size(), __new_size);
|
||||
__profcxx_vector2list_resize(this->_M_vect2list_info,
|
||||
this->size(), __new_size);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
template<typename _Tp, typename _Alloc>
|
||||
inline bool
|
||||
operator==(const vector<_Tp, _Alloc>& __lhs,
|
||||
const vector<_Tp, _Alloc>& __rhs)
|
||||
{ return __lhs._M_base() == __rhs._M_base(); }
|
||||
|
||||
template<typename _Tp, typename _Alloc>
|
||||
inline bool
|
||||
operator!=(const vector<_Tp, _Alloc>& __lhs,
|
||||
const vector<_Tp, _Alloc>& __rhs)
|
||||
{ return __lhs._M_base() != __rhs._M_base(); }
|
||||
|
||||
template<typename _Tp, typename _Alloc>
|
||||
inline bool
|
||||
operator<(const vector<_Tp, _Alloc>& __lhs,
|
||||
const vector<_Tp, _Alloc>& __rhs)
|
||||
{ return __lhs._M_base() < __rhs._M_base(); }
|
||||
|
||||
template<typename _Tp, typename _Alloc>
|
||||
inline bool
|
||||
operator<=(const vector<_Tp, _Alloc>& __lhs,
|
||||
const vector<_Tp, _Alloc>& __rhs)
|
||||
{ return __lhs._M_base() <= __rhs._M_base(); }
|
||||
|
||||
template<typename _Tp, typename _Alloc>
|
||||
inline bool
|
||||
operator>=(const vector<_Tp, _Alloc>& __lhs,
|
||||
const vector<_Tp, _Alloc>& __rhs)
|
||||
{ return __lhs._M_base() >= __rhs._M_base(); }
|
||||
|
||||
template<typename _Tp, typename _Alloc>
|
||||
inline bool
|
||||
operator>(const vector<_Tp, _Alloc>& __lhs,
|
||||
const vector<_Tp, _Alloc>& __rhs)
|
||||
{ return __lhs._M_base() > __rhs._M_base(); }
|
||||
|
||||
template<typename _Tp, typename _Alloc>
|
||||
inline void
|
||||
swap(vector<_Tp, _Alloc>& __lhs, vector<_Tp, _Alloc>& __rhs)
|
||||
{ __lhs.swap(__rhs); }
|
||||
|
||||
#if __cplusplus >= 201103L
|
||||
template<typename _Tp, typename _Alloc>
|
||||
inline void
|
||||
swap(vector<_Tp, _Alloc>&& __lhs, vector<_Tp, _Alloc>& __rhs)
|
||||
{ __lhs.swap(__rhs); }
|
||||
|
||||
template<typename _Tp, typename _Alloc>
|
||||
inline void
|
||||
swap(vector<_Tp, _Alloc>& __lhs, vector<_Tp, _Alloc>&& __rhs)
|
||||
{ __lhs.swap(__rhs); }
|
||||
#endif
|
||||
|
||||
} // namespace __profile
|
||||
|
||||
#if __cplusplus >= 201103L
|
||||
// DR 1182.
|
||||
/// std::hash specialization for vector<bool>.
|
||||
template<typename _Alloc>
|
||||
struct hash<__profile::vector<bool, _Alloc>>
|
||||
: public __hash_base<size_t, __profile::vector<bool, _Alloc>>
|
||||
{
|
||||
size_t
|
||||
operator()(const __profile::vector<bool, _Alloc>& __b) const noexcept
|
||||
{
|
||||
return std::hash<_GLIBCXX_STD_C::vector<bool, _Alloc>>()(__b._M_base());
|
||||
}
|
||||
};
|
||||
#endif
|
||||
|
||||
} // namespace std
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user