Subversion Repositories Kolibri OS

Rev

Blame | Last modification | View Log | RSS feed

  1. // -*- C++ -*-
  2. //
  3. // Copyright (C) 2009-2015 Free Software Foundation, Inc.
  4. //
  5. // This file is part of the GNU ISO C++ Library.  This library is free
  6. // software; you can redistribute it and/or modify it under the
  7. // terms of the GNU General Public License as published by the
  8. // Free Software Foundation; either version 3, or (at your option)
  9. // any later version.
  10. //
  11. // This library is distributed in the hope that it will be useful,
  12. // but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  14. // GNU General Public License for more details.
  15.  
  16. // Under Section 7 of GPL version 3, you are granted additional
  17. // permissions described in the GCC Runtime Library Exception, version
  18. // 3.1, as published by the Free Software Foundation.
  19.  
  20. // You should have received a copy of the GNU General Public License along
  21. // with this library; see the file COPYING3.  If not see
  22. // <http://www.gnu.org/licenses/>.
  23.  
  24. /** @file profile/impl/profiler_hashtable_size.h
  25.  *  @brief Collection of hashtable size traces.
  26.  */
  27.  
  28. // Written by Lixia Liu and Silvius Rus.
  29.  
  30. #ifndef _GLIBCXX_PROFILE_PROFILER_HASHTABLE_SIZE_H
  31. #define _GLIBCXX_PROFILE_PROFILER_HASHTABLE_SIZE_H 1
  32.  
  33. #include "profile/impl/profiler.h"
  34. #include "profile/impl/profiler_node.h"
  35. #include "profile/impl/profiler_trace.h"
  36. #include "profile/impl/profiler_state.h"
  37. #include "profile/impl/profiler_container_size.h"
  38.  
  39. namespace __gnu_profile
  40. {
  41.   /** @brief Hashtable size instrumentation trace producer.  */
  42.   class __trace_hashtable_size
  43.   : public __trace_container_size
  44.   {
  45.   public:
  46.     __trace_hashtable_size()
  47.     : __trace_container_size()
  48.     { __id = "hashtable-size"; }
  49.   };
  50.  
  51.   inline void
  52.   __trace_hashtable_size_init()
  53.   { _GLIBCXX_PROFILE_DATA(_S_hashtable_size) = new __trace_hashtable_size(); }
  54.  
  55.   inline void
  56.   __trace_hashtable_size_free()
  57.   { delete _GLIBCXX_PROFILE_DATA(_S_hashtable_size); }
  58.  
  59.   inline void
  60.   __trace_hashtable_size_report(FILE* __f, __warning_vector_t& __warnings)
  61.   { __trace_report(_GLIBCXX_PROFILE_DATA(_S_hashtable_size), __f, __warnings); }
  62.  
  63.   inline __container_size_info*
  64.   __trace_hashtable_size_construct(std::size_t __num)
  65.   {
  66.     if (!__profcxx_init())
  67.       return 0;
  68.  
  69.     if (!__reentrance_guard::__get_in())
  70.       return 0;
  71.  
  72.     __reentrance_guard __get_out;
  73.     return _GLIBCXX_PROFILE_DATA(_S_hashtable_size)->
  74.       __insert(__get_stack(), __num);
  75.   }
  76.  
  77.   inline void
  78.   __trace_hashtable_size_resize(__container_size_info* __obj_info,
  79.                                 std::size_t __from, std::size_t __to)
  80.   {
  81.     if (!__obj_info)
  82.       return;
  83.  
  84.     __obj_info->__resize(__from, __to);
  85.   }
  86.  
  87.   inline void
  88.   __trace_hashtable_size_destruct(__container_size_info* __obj_info,
  89.                                   std::size_t __num, std::size_t __inum)
  90.   {
  91.     if (!__obj_info)
  92.       return;
  93.  
  94.     _GLIBCXX_PROFILE_DATA(_S_hashtable_size)->
  95.       __destruct(__obj_info, __num, __inum);
  96.   }
  97.  
  98. } // namespace __gnu_profile
  99.  
  100. #endif /* _GLIBCXX_PROFILE_PROFILER_HASHTABLE_SIZE_H */
  101.