30 #ifndef _GLIBCXX_PROFILE_PROFILER_VECTOR_TO_LIST_H 31 #define _GLIBCXX_PROFILE_PROFILER_VECTOR_TO_LIST_H 1 46 _M_resize(0), _M_list_cost(0), _M_vector_cost(0)
52 __object_info_base::__merge(__o);
53 _M_shift_count += __o._M_shift_count;
54 _M_iterate += __o._M_iterate;
55 _M_vector_cost += __o._M_vector_cost;
56 _M_list_cost += __o._M_list_cost;
57 _M_resize += __o._M_resize;
61 __write(FILE* __f)
const 63 std::fprintf(__f,
"%Zu %Zu %Zu %.0f %.0f\n", _M_shift_count,
64 _M_resize, _M_iterate, _M_vector_cost, _M_list_cost);
69 {
return _M_vector_cost - _M_list_cost; }
73 {
return "change std::vector to std::list"; }
77 {
return _M_shift_count; }
81 {
return _M_iterate; }
85 {
return _M_list_cost; }
92 __set_list_cost(
float __lc)
93 { _M_list_cost = __lc; }
96 __set_vector_cost(
float __vc)
97 { _M_vector_cost = __vc; }
100 __opr_insert(std::size_t __pos, std::size_t __num)
101 { _M_shift_count += __num - __pos; }
104 __opr_iterate(
int __num)
105 { __gnu_cxx::__atomic_add(&_M_iterate, __num); }
108 __resize(std::size_t __from, std::size_t)
109 { _M_resize += __from; }
112 std::size_t _M_shift_count;
113 mutable _Atomic_word _M_iterate;
114 std::size_t _M_resize;
116 float _M_vector_cost;
132 :
public __trace_base<__vector2list_info, __vector2list_stack_info>
137 { __id =
"vector-to-list"; }
145 float __vc = __vector_cost(__obj_info->__shift_count(),
146 __obj_info->__iterate(),
147 __obj_info->__resize());
148 float __lc = __list_cost(__obj_info->__shift_count(),
149 __obj_info->__iterate(),
150 __obj_info->__resize());
151 __obj_info->__set_vector_cost(__vc);
152 __obj_info->__set_list_cost(__lc);
154 __retire_object(__obj_info);
159 __vector_cost(std::size_t __shift, std::size_t __iterate,
160 std::size_t __resize)
163 * _GLIBCXX_PROFILE_DATA(__vector_shift_cost_factor).__value
165 * _GLIBCXX_PROFILE_DATA(__vector_iterate_cost_factor).__value
167 * _GLIBCXX_PROFILE_DATA(__vector_resize_cost_factor).__value);
171 __list_cost(std::size_t __shift, std::size_t __iterate,
172 std::size_t __resize)
175 * _GLIBCXX_PROFILE_DATA(__list_shift_cost_factor).__value
177 * _GLIBCXX_PROFILE_DATA(__list_iterate_cost_factor).__value
179 * _GLIBCXX_PROFILE_DATA(__list_resize_cost_factor).__value);
185 __trace_vector_to_list_init()
189 __trace_vector_to_list_free()
190 {
delete _GLIBCXX_PROFILE_DATA(_S_vector_to_list); }
193 __trace_vector_to_list_report(FILE* __f, __warning_vector_t& __warnings)
194 { __trace_report(_GLIBCXX_PROFILE_DATA(_S_vector_to_list), __f, __warnings); }
196 inline __vector2list_info*
197 __trace_vector_to_list_construct()
202 if (!__reentrance_guard::__get_in())
205 __reentrance_guard __get_out;
206 return _GLIBCXX_PROFILE_DATA(_S_vector_to_list)
207 ->__add_object(__get_stack());
211 __trace_vector_to_list_insert(__vector2list_info* __obj_info,
218 __obj_info->__opr_insert(__pos, __num);
222 __trace_vector_to_list_iterate(__vector2list_info* __obj_info,
int)
228 __obj_info->__opr_iterate(1);
232 __trace_vector_to_list_invalid_operator(__vector2list_info* __obj_info)
237 __obj_info->__set_invalid();
241 __trace_vector_to_list_resize(__vector2list_info* __obj_info,
248 __obj_info->__resize(__from, __to);
252 __trace_vector_to_list_destruct(__vector2list_info* __obj_info)
257 _GLIBCXX_PROFILE_DATA(_S_vector_to_list)->__destruct(__obj_info);
A vector-to-list instrumentation line in the stack table.
Interface of the profiling runtime library.
GNU profile code for public use.
_GLIBCXX_END_NAMESPACE_CXX11 typedef basic_string< char > string
A string of char.
Base class for all trace producers.
bool __profcxx_init()
This function must be called by each instrumentation point.
Base class for a line in the object table.
A vector-to-list instrumentation line in the object table.
Vector-to-list instrumentation producer.
Data structures to represent profiling traces.
Data structures to represent a single profiling event.