]> git.ipfire.org Git - thirdparty/gcc.git/blame - libstdc++-v3/include/profile/impl/profiler_state.h
avr.md (neghi2): Remove "!d,0" alternative.
[thirdparty/gcc.git] / libstdc++-v3 / include / profile / impl / profiler_state.h
CommitLineData
1218d701
SR
1// -*- C++ -*-
2//
75cee7c6 3// Copyright (C) 2009, 2010, 2012 Free Software Foundation, Inc.
1218d701
SR
4//
5// This file is part of the GNU ISO C++ Library. This library is free
4bee90f7
PC
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// You should have received a copy of the GNU General Public License along
17// with this library; see the file COPYING3. If not see
18// <http://www.gnu.org/licenses/>.
1218d701 19
8e32aa11 20/** @file profile/impl/profiler_state.h
1218d701
SR
21 * @brief Global profiler state.
22 */
23
24// Written by Lixia Liu and Silvius Rus.
25
6b223191
BK
26#ifndef _GLIBCXX_PROFILE_PROFILER_STATE_H
27#define _GLIBCXX_PROFILE_PROFILER_STATE_H 1
1218d701 28
9ee6a740 29namespace __gnu_profile
1218d701 30{
b0af13ea 31 enum __state_type { __ON, __OFF, __INVALID };
a1360f57 32
b0af13ea 33 _GLIBCXX_PROFILE_DEFINE_DATA(__state_type, __state, __INVALID);
a1360f57 34
b0af13ea
PC
35 inline bool
36 __turn(__state_type __s)
75cee7c6
BK
37 {
38 __state_type inv(__INVALID);
39 return __atomic_compare_exchange_n(&_GLIBCXX_PROFILE_DATA(__state),
b2cb6964 40 &inv, __s, false, __ATOMIC_ACQ_REL,
75cee7c6
BK
41 __ATOMIC_RELAXED);
42 }
a1360f57 43
b0af13ea
PC
44 inline bool
45 __turn_on()
46 { return __turn(__ON); }
a1360f57 47
b0af13ea
PC
48 inline bool
49 __turn_off()
50 { return __turn(__OFF); }
a1360f57 51
b0af13ea
PC
52 inline bool
53 __is_on()
54 { return _GLIBCXX_PROFILE_DATA(__state) == __ON; }
a1360f57 55
b0af13ea
PC
56 inline bool
57 __is_off()
58 { return _GLIBCXX_PROFILE_DATA(__state) == __OFF; }
a1360f57 59
b0af13ea
PC
60 inline bool
61 __is_invalid()
62 { return _GLIBCXX_PROFILE_DATA(__state) == __INVALID; }
1218d701 63
9ee6a740 64} // end namespace __gnu_profile
6b223191 65#endif /* _GLIBCXX_PROFILE_PROFILER_STATE_H */