30 #ifndef _GLIBCXX_PROFILE_PROFILER_NODE_H
31 #define _GLIBCXX_PROFILE_PROFILER_NODE_H 1
36 #if defined _GLIBCXX_HAVE_EXECINFO_H
40 namespace __gnu_profile
42 typedef const void* __object_t;
43 typedef void* __instruction_address_t;
44 typedef std::_GLIBCXX_STD_C::vector<__instruction_address_t> __stack_npt;
45 typedef __stack_npt* __stack_t;
47 std::size_t __stack_max_depth();
52 #if defined _GLIBCXX_HAVE_EXECINFO_H
53 std::size_t __max_depth = __stack_max_depth();
56 __stack_npt __buffer(__max_depth);
57 int __depth = backtrace(&__buffer[0], __max_depth);
58 __stack_t __stack =
new __stack_npt(__depth);
59 __builtin_memcpy(&(*__stack)[0], &__buffer[0],
60 __depth *
sizeof(__object_t));
68 __size(__stack_t __stack)
73 return __stack->size();
78 __write(FILE* __f, __stack_t __stack)
83 __stack_npt::const_iterator __it;
84 for (__it = __stack->begin(); __it != __stack->end(); ++__it)
85 std::fprintf(__f,
"%p ", *__it);
93 operator()(__stack_t __s)
const
98 __UINTPTR_TYPE__ __index = 0;
99 __stack_npt::const_iterator __it;
100 for (__it = __s->begin(); __it != __s->end(); ++__it)
101 __index += reinterpret_cast<__UINTPTR_TYPE__>(*__it);
105 bool operator() (__stack_t __stack1, __stack_t __stack2)
const
107 if (!__stack1 && !__stack2)
109 if (!__stack1 || !__stack2)
111 if (__stack1->size() != __stack2->size())
114 std::size_t __byte_size
115 = __stack1->size() *
sizeof(__stack_npt::value_type);
116 return __builtin_memcmp(&(*__stack1)[0], &(*__stack2)[0],
129 : _M_stack(__stack), _M_valid(
true) { }
132 : _M_stack(__o._M_stack), _M_valid(__o._M_valid) { }
144 virtual void __write(FILE* __f)
const = 0;
153 template<
typename __
object_info>
160 void __merge(
const __object_info& __info) = 0;
161 virtual float __magnitude()
const = 0;
162 virtual const char* __get_id()
const = 0;
Base class for a line in the object table.
Base class for a line in the stack table.
Hash function for summary trace using call stack as index.