libstdc++
profiler_hashtable_size.h
Go to the documentation of this file.
00001 // -*- C++ -*-
00002 //
00003 // Copyright (C) 2009, 2010 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_report(FILE* __f, __warning_vector_t& __warnings)
00057   {
00058     if (_GLIBCXX_PROFILE_DATA(_S_hashtable_size))
00059       {
00060     _GLIBCXX_PROFILE_DATA(_S_hashtable_size)->
00061       __collect_warnings(__warnings);
00062     _GLIBCXX_PROFILE_DATA(_S_hashtable_size)->__write(__f);
00063       }
00064   }
00065 
00066   inline void
00067   __trace_hashtable_size_construct(const void* __obj, std::size_t __num)
00068   {
00069     if (!__profcxx_init())
00070       return;
00071   
00072     _GLIBCXX_PROFILE_DATA(_S_hashtable_size)->__insert(__obj, __get_stack(),
00073                                __num);
00074   }
00075 
00076   inline void
00077   __trace_hashtable_size_destruct(const void* __obj, std::size_t __num, 
00078                   std::size_t __inum)
00079   {
00080     if (!__profcxx_init())
00081       return;
00082 
00083     _GLIBCXX_PROFILE_DATA(_S_hashtable_size)->__destruct(__obj, __num, __inum);
00084   }
00085 
00086   inline void
00087   __trace_hashtable_size_resize(const void* __obj, std::size_t __from, 
00088                 std::size_t __to)
00089   {
00090     if (!__profcxx_init())
00091       return;
00092 
00093     _GLIBCXX_PROFILE_DATA(_S_hashtable_size)->__resize(__obj, __from, __to);
00094   }
00095 
00096 } // namespace __gnu_profile
00097 
00098 #endif /* _GLIBCXX_PROFILE_PROFILER_HASHTABLE_SIZE_H */