Reverting merge from trunk
[official-gcc.git] / libstdc++-v3 / include / profile / impl / profiler_vector_size.h
blobc0cb5ff71d351393eed1e3639e51e419416ce5de
1 // -*- C++ -*-
2 //
3 // Copyright (C) 2009-2013 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.
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.
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.
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/>.
24 /** @file profile/impl/profiler_vector_size.h
25 * @brief Collection of vector size traces.
28 // Written by Lixia Liu and Silvius Rus.
30 #ifndef _GLIBCXX_PROFILE_PROFILER_VECTOR_SIZE_H
31 #define _GLIBCXX_PROFILE_PROFILER_VECTOR_SIZE_H 1
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"
39 namespace __gnu_profile
41 /** @brief Hashtable size instrumentation trace producer. */
42 class __trace_vector_size
43 : public __trace_container_size
45 public:
46 __trace_vector_size()
47 : __trace_container_size()
48 { __id = "vector-size"; }
51 inline void
52 __trace_vector_size_init()
53 { _GLIBCXX_PROFILE_DATA(_S_vector_size) = new __trace_vector_size(); }
55 inline void
56 __trace_vector_size_report(FILE* __f, __warning_vector_t& __warnings)
58 if (_GLIBCXX_PROFILE_DATA(_S_vector_size))
60 _GLIBCXX_PROFILE_DATA(_S_vector_size)->__collect_warnings(__warnings);
61 _GLIBCXX_PROFILE_DATA(_S_vector_size)->__write(__f);
65 inline void
66 __trace_vector_size_construct(const void* __obj, std::size_t __num)
68 if (!__profcxx_init())
69 return;
71 _GLIBCXX_PROFILE_DATA(_S_vector_size)->__insert(__obj, __get_stack(),
72 __num);
75 inline void
76 __trace_vector_size_destruct(const void* __obj, std::size_t __num,
77 std::size_t __inum)
79 if (!__profcxx_init())
80 return;
82 _GLIBCXX_PROFILE_DATA(_S_vector_size)->__destruct(__obj, __num, __inum);
85 inline void
86 __trace_vector_size_resize(const void* __obj, std::size_t __from,
87 std::size_t __to)
89 if (!__profcxx_init())
90 return;
92 _GLIBCXX_PROFILE_DATA(_S_vector_size)->__resize(__obj, __from, __to);
95 } // namespace __gnu_profile
97 #endif /* _GLIBCXX_PROFILE_PROFILER_VECTOR_SIZE_H */