Torque3D Documentation / _generateds / platformCPUCount.h

platformCPUCount.h

Engine/source/platform/platformCPUCount.h

More...

Namespaces:

namespace

Detailed Description

 1
 2//-----------------------------------------------------------------------------
 3// Copyright (c) 2012 GarageGames, LLC
 4//
 5// Permission is hereby granted, free of charge, to any person obtaining a copy
 6// of this software and associated documentation files (the "Software"), to
 7// deal in the Software without restriction, including without limitation the
 8// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
 9// sell copies of the Software, and to permit persons to whom the Software is
10// furnished to do so, subject to the following conditions:
11//
12// The above copyright notice and this permission notice shall be included in
13// all copies or substantial portions of the Software.
14//
15// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
20// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
21// IN THE SOFTWARE.
22//-----------------------------------------------------------------------------
23
24#ifndef _TORQUE_PLATFORM_PLATFORMCPUCOUNT_H_
25#define _TORQUE_PLATFORM_PLATFORMCPUCOUNT_H_
26
27#include "platform/platform.h"
28
29namespace CPUInfo
30{
31   enum EConfig
32   {
33      CONFIG_UserConfigIssue,
34      CONFIG_SingleCoreHTEnabled,
35      CONFIG_SingleCoreHTDisabled,
36      CONFIG_SingleCoreAndHTNotCapable,
37      CONFIG_MultiCoreAndHTNotCapable,
38      CONFIG_MultiCoreAndHTEnabled,
39      CONFIG_MultiCoreAndHTDisabled,
40   };
41
42   inline bool isMultiCore( EConfig config )
43   {
44      switch( config )
45      {
46      case CONFIG_MultiCoreAndHTNotCapable:
47      case CONFIG_MultiCoreAndHTEnabled:
48      case CONFIG_MultiCoreAndHTDisabled:
49         return true;
50
51      default:
52         return false;
53      }
54   }
55
56   inline bool isHyperThreaded( EConfig config )
57   {
58      switch( config )
59      {
60      case CONFIG_SingleCoreHTEnabled:
61      case CONFIG_MultiCoreAndHTEnabled:
62         return true;
63
64      default:
65         return false;
66      }
67   }
68
69   EConfig CPUCount( U32& totalAvailableLogical,
70      U32& totalAvailableCores,
71      U32& numPhysical );
72
73} // namespace CPUInfo
74
75#endif // _TORQUE_PLATFORM_PLATFORMCOUNT_H_
76
77