libstdc++
|
00001 // -*- C++ -*- 00002 // 00003 // Copyright (C) 2009-2015 Free Software Foundation, Inc. 00004 // 00005 // This file is part of the GNU ISO C++ Library. This library is free 00006 // software; you can redistribute it and/or modify it under the 00007 // terms of the GNU General Public License as published by the 00008 // Free Software Foundation; either version 3, or (at your option) 00009 // any later version. 00010 // 00011 // This library is distributed in the hope that it will be useful, 00012 // but WITHOUT ANY WARRANTY; without even the implied warranty of 00013 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00014 // GNU General Public License for more details. 00015 00016 // Under Section 7 of GPL version 3, you are granted additional 00017 // permissions described in the GCC Runtime Library Exception, version 00018 // 3.1, as published by the Free Software Foundation. 00019 00020 // You should have received a copy of the GNU General Public License along 00021 // with this library; see the file COPYING3. If not see 00022 // <http://www.gnu.org/licenses/>. 00023 00024 /** @file profile/impl/profiler_hashtable_size.h 00025 * @brief Collection of hashtable size traces. 00026 */ 00027 00028 // Written by Lixia Liu and Silvius Rus. 00029 00030 #ifndef _GLIBCXX_PROFILE_PROFILER_HASHTABLE_SIZE_H 00031 #define _GLIBCXX_PROFILE_PROFILER_HASHTABLE_SIZE_H 1 00032 00033 #include "profile/impl/profiler.h" 00034 #include "profile/impl/profiler_node.h" 00035 #include "profile/impl/profiler_trace.h" 00036 #include "profile/impl/profiler_state.h" 00037 #include "profile/impl/profiler_container_size.h" 00038 00039 namespace __gnu_profile 00040 { 00041 /** @brief Hashtable size instrumentation trace producer. */ 00042 class __trace_hashtable_size 00043 : public __trace_container_size 00044 { 00045 public: 00046 __trace_hashtable_size() 00047 : __trace_container_size() 00048 { __id = "hashtable-size"; } 00049 }; 00050 00051 inline void 00052 __trace_hashtable_size_init() 00053 { _GLIBCXX_PROFILE_DATA(_S_hashtable_size) = new __trace_hashtable_size(); } 00054 00055 inline void 00056 __trace_hashtable_size_free() 00057 { delete _GLIBCXX_PROFILE_DATA(_S_hashtable_size); } 00058 00059 inline void 00060 __trace_hashtable_size_report(FILE* __f, __warning_vector_t& __warnings) 00061 { __trace_report(_GLIBCXX_PROFILE_DATA(_S_hashtable_size), __f, __warnings); } 00062 00063 inline __container_size_info* 00064 __trace_hashtable_size_construct(std::size_t __num) 00065 { 00066 if (!__profcxx_init()) 00067 return 0; 00068 00069 if (!__reentrance_guard::__get_in()) 00070 return 0; 00071 00072 __reentrance_guard __get_out; 00073 return _GLIBCXX_PROFILE_DATA(_S_hashtable_size)-> 00074 __insert(__get_stack(), __num); 00075 } 00076 00077 inline void 00078 __trace_hashtable_size_resize(__container_size_info* __obj_info, 00079 std::size_t __from, std::size_t __to) 00080 { 00081 if (!__obj_info) 00082 return; 00083 00084 __obj_info->__resize(__from, __to); 00085 } 00086 00087 inline void 00088 __trace_hashtable_size_destruct(__container_size_info* __obj_info, 00089 std::size_t __num, std::size_t __inum) 00090 { 00091 if (!__obj_info) 00092 return; 00093 00094 _GLIBCXX_PROFILE_DATA(_S_hashtable_size)-> 00095 __destruct(__obj_info, __num, __inum); 00096 } 00097 00098 } // namespace __gnu_profile 00099 00100 #endif /* _GLIBCXX_PROFILE_PROFILER_HASHTABLE_SIZE_H */