libstdc++
profiler_vector_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_vector_size.h
00025  *  @brief Collection of vector size traces.
00026  */
00027 
00028 // Written by Lixia Liu and Silvius Rus.
00029 
00030 #ifndef _GLIBCXX_PROFILE_PROFILER_VECTOR_SIZE_H
00031 #define _GLIBCXX_PROFILE_PROFILER_VECTOR_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_vector_size
00043   : public __trace_container_size
00044   {
00045   public:
00046     __trace_vector_size()
00047     : __trace_container_size()
00048     { __id = "vector-size"; }
00049   };
00050 
00051   inline void
00052   __trace_vector_size_init()
00053   { _GLIBCXX_PROFILE_DATA(_S_vector_size) = new __trace_vector_size(); }
00054 
00055   inline void
00056   __trace_vector_size_report(FILE* __f, __warning_vector_t& __warnings)
00057   {
00058     if (_GLIBCXX_PROFILE_DATA(_S_vector_size))
00059       {
00060     _GLIBCXX_PROFILE_DATA(_S_vector_size)->__collect_warnings(__warnings);
00061     _GLIBCXX_PROFILE_DATA(_S_vector_size)->__write(__f);
00062       }
00063   }
00064 
00065   inline void
00066   __trace_vector_size_construct(const void* __obj, std::size_t __num)
00067   {
00068     if (!__profcxx_init())
00069       return;
00070 
00071     _GLIBCXX_PROFILE_DATA(_S_vector_size)->__insert(__obj, __get_stack(),
00072                             __num);
00073   }
00074 
00075   inline void
00076   __trace_vector_size_destruct(const void* __obj, std::size_t __num,
00077                    std::size_t __inum)
00078   {
00079     if (!__profcxx_init())
00080       return;
00081 
00082     _GLIBCXX_PROFILE_DATA(_S_vector_size)->__destruct(__obj, __num, __inum);
00083   }
00084 
00085   inline void
00086   __trace_vector_size_resize(const void* __obj, std::size_t __from,
00087                  std::size_t __to)
00088   {
00089     if (!__profcxx_init())
00090       return;
00091 
00092     _GLIBCXX_PROFILE_DATA(_S_vector_size)->__resize(__obj, __from, __to);
00093   }
00094 
00095 } // namespace __gnu_profile
00096 
00097 #endif /* _GLIBCXX_PROFILE_PROFILER_VECTOR_SIZE_H */