profiler_vector_size.h

Go to the documentation of this file.
00001 // -*- C++ -*-
00002 //
00003 // Copyright (C) 2009 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 terms
00007 // of the GNU General Public License as published by the Free Software
00008 // Foundation; either version 2, or (at your option) any later
00009 // version.
00010 
00011 // This library is distributed in the hope that it will be useful, but
00012 // WITHOUT ANY WARRANTY; without even the implied warranty of
00013 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00014 // General Public License for more details.
00015 
00016 // You should have received a copy of the GNU General Public License
00017 // along with this library; see the file COPYING.  If not, write to
00018 // the Free Software Foundation, 59 Temple Place - Suite 330, Boston,
00019 // MA 02111-1307, USA.
00020 
00021 // As a special exception, you may use this file as part of a free
00022 // software library without restriction.  Specifically, if other files
00023 // instantiate templates or use macros or inline functions from this
00024 // file, or you compile this file and link it with other files to
00025 // produce an executable, this file does not by itself cause the
00026 // resulting executable to be covered by the GNU General Public
00027 // License.  This exception does not however invalidate any other
00028 // reasons why the executable file might be covered by the GNU General
00029 // Public License.
00030 
00031 /** @file profile/impl/profiler_vector_size.h
00032  *  @brief Collection of vector size traces.
00033  */
00034 
00035 // Written by Lixia Liu and Silvius Rus.
00036 
00037 #ifndef _GLIBCXX_PROFILE_PROFILER_VECTOR_SIZE_H
00038 #define _GLIBCXX_PROFILE_PROFILER_VECTOR_SIZE_H 1
00039 
00040 #ifdef __GXX_EXPERIMENTAL_CXX0X__
00041 #include <cstdlib>
00042 #include <cstdio>
00043 #include <cstring>
00044 #else
00045 #include <stdlib.h>
00046 #include <stdio.h>
00047 #include <string.h>
00048 #endif
00049 #include "profile/impl/profiler.h"
00050 #include "profile/impl/profiler_node.h"
00051 #include "profile/impl/profiler_trace.h"
00052 #include "profile/impl/profiler_state.h"
00053 #include "profile/impl/profiler_container_size.h"
00054 
00055 namespace __gnu_profile
00056 {
00057 
00058 /** @brief Hashtable size instrumentation trace producer.  */
00059 class __trace_vector_size : public __trace_container_size
00060 {
00061  public:
00062   __trace_vector_size() : __trace_container_size() { __id = "vector-size"; }
00063 };
00064 
00065 inline void __trace_vector_size_init()
00066 {
00067   _GLIBCXX_PROFILE_DATA(_S_vector_size) = new __trace_vector_size();
00068 }
00069 
00070 inline void __trace_vector_size_report(FILE* __f, 
00071                                        __warning_vector_t& __warnings)
00072 {
00073   if (_GLIBCXX_PROFILE_DATA(_S_vector_size)) {
00074     _GLIBCXX_PROFILE_DATA(_S_vector_size)->__collect_warnings(__warnings);
00075     _GLIBCXX_PROFILE_DATA(_S_vector_size)->__write(__f);
00076   }
00077 }
00078 
00079 inline void __trace_vector_size_construct(const void* __obj, size_t __num)
00080 {
00081   if (!__profcxx_init()) return;
00082 
00083   _GLIBCXX_PROFILE_DATA(_S_vector_size)->__insert(__obj, __get_stack(), __num);
00084 }
00085 
00086 inline void __trace_vector_size_destruct(const void* __obj, size_t __num,
00087                                          size_t __inum)
00088 {
00089   if (!__profcxx_init()) return;
00090 
00091   _GLIBCXX_PROFILE_DATA(_S_vector_size)->__destruct(__obj, __num, __inum);
00092 }
00093 
00094 inline void __trace_vector_size_resize(const void* __obj, size_t __from,
00095                                        size_t __to)
00096 {
00097   if (!__profcxx_init()) return;
00098 
00099   _GLIBCXX_PROFILE_DATA(_S_vector_size)->__resize(__obj, __from, __to);
00100 }
00101 
00102 } // namespace __gnu_profile
00103 
00104 #endif /* _GLIBCXX_PROFILE_PROFILER_VECTOR_SIZE_H */