]> rtime.felk.cvut.cz Git - l4.git/blob - l4/pkg/l4re-core/libstdc++-v3/contrib/libstdc++-v3-4.6/include/profile/impl/profiler_state.h
Update
[l4.git] / l4 / pkg / l4re-core / libstdc++-v3 / contrib / libstdc++-v3-4.6 / include / profile / impl / profiler_state.h
1 // -*- C++ -*-
2 //
3 // Copyright (C) 2009, 2010 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_state.h
25  *  @brief Global profiler state.
26  */
27
28 // Written by Lixia Liu and Silvius Rus.
29
30 #ifndef _GLIBCXX_PROFILE_PROFILER_STATE_H
31 #define _GLIBCXX_PROFILE_PROFILER_STATE_H 1
32
33 namespace __gnu_profile
34 {
35   enum __state_type { __ON, __OFF, __INVALID };
36
37   _GLIBCXX_PROFILE_DEFINE_DATA(__state_type, __state, __INVALID);
38
39   inline bool
40   __turn(__state_type __s)
41   { return (_GLIBCXX_PROFILE_DATA(__state)
42             == __sync_val_compare_and_swap(&_GLIBCXX_PROFILE_DATA(__state),
43                                            __INVALID, __s)); }
44
45   inline bool
46   __turn_on()
47   { return __turn(__ON); }
48
49   inline bool
50   __turn_off()
51   { return __turn(__OFF); }
52
53   inline bool
54   __is_on()
55   { return _GLIBCXX_PROFILE_DATA(__state) == __ON; }
56
57   inline bool
58   __is_off()
59   { return _GLIBCXX_PROFILE_DATA(__state) == __OFF; }
60
61   inline bool
62   __is_invalid()
63   { return _GLIBCXX_PROFILE_DATA(__state) == __INVALID; }
64
65 } // end namespace __gnu_profile
66 #endif /* _GLIBCXX_PROFILE_PROFILER_STATE_H */