Spinning Topp Logo BlackTopp Studios
inc
systemcalls.h
Go to the documentation of this file.
1 // The DAGFrameScheduler is a Multi-Threaded lock free and wait free scheduling library.
2 // © Copyright 2010 - 2016 BlackTopp Studios Inc.
3 /* This file is part of The DAGFrameScheduler.
4 
5  The DAGFrameScheduler is free software: you can redistribute it and/or modify
6  it under the terms of the GNU General Public License as published by
7  the Free Software Foundation, either version 3 of the License, or
8  (at your option) any later version.
9 
10  The DAGFrameScheduler is distributed in the hope that it will be useful,
11  but WITHOUT ANY WARRANTY; without even the implied warranty of
12  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  GNU General Public License for more details.
14 
15  You should have received a copy of the GNU General Public License
16  along with The DAGFrameScheduler. If not, see <http://www.gnu.org/licenses/>.
17 */
18 /* The original authors have included a copy of the license specified above in the
19  'doc' folder. See 'gpl.txt'
20 */
21 /* We welcome the use of the DAGFrameScheduler to anyone, including companies who wish to
22  Build professional software and charge for their product.
23 
24  However there are some practical restrictions, so if your project involves
25  any of the following you should contact us and we will try to work something
26  out:
27  - DRM or Copy Protection of any kind(except Copyrights)
28  - Software Patents You Do Not Wish to Freely License
29  - Any Kind of Linking to Non-GPL licensed Works
30  - Are Currently In Violation of Another Copyright Holder's GPL License
31  - If You want to change our code and not add a few hundred MB of stuff to
32  your distribution
33 
34  These and other limitations could cause serious legal problems if you ignore
35  them, so it is best to simply contact us or the Free Software Foundation, if
36  you have any questions.
37 
38  Joseph Toppi - toppij@gmail.com
39  John Blackwood - makoenergy02@gmail.com
40 */
41 #ifndef _systemcalls_h
42 #define _systemcalls_h
43 
44 /// @file
45 /// @brief This file defines a minimalistic cross-platform thread that the scheduler uses to schedule tasks.
46 
47 #include "datatypes.h"
48 
49 namespace Mezzanine
50 {
51  /// @brief Get a timestamp, in microseconds. This will generally be some multiple of the GetTimeStampResolution return value.
52  /// @warning On some platforms this requires a static initialization, an can cause undefined behavior if called before static initializations are complete
53  /// @return The largest size integer containing a timestamp that can be compared to other timestamps, but hads no guarantees for external value.
55 
56  /// @brief Get the resolution of the timestamp in microseconds. This is the smallest amount of time that the GetTimeStamp can accurately track.
57  /// @return A Whole which returns in millionths of a second the smallest unit of time that GetTimeStamp can measure.
59 
60  /// @brief Get the amount of logical processors, a reasononable amount to use for thread creation.
61  /// @details This returns whatever your OS thinks is the count of CPUs. This could include
62  /// Hyperthreading unit on Intel's chip, or it might not, it could include the threads from
63  /// Niagra CPUs or it might not, it could return just about any value on a given piece of
64  /// and should return a reasonable value for how many threads should be used.
65  /// @return A Whole containing the amount of processors.
67 
68  /// @brief How much storage can be used before RAM must be used.
69  /// @details In many modern system cache (of all levels) is signifigantly faster than main
70  /// memory. For this reason the most useful cache value is the largest cache. This attempts
71  /// to get the largest value of cache on the CPU. If there are multiple physical CPUs (as
72  /// opposed to multiple cores) this will likely return the amount of cache on each CPU
73  /// package. This is useful for tuning alogrithms in a specific places and only in a single
74  /// thread.
75  /// @return The size of the largest CPU cache in bytes.
76  /// @warning There is a bug in MinGw which prevents this from working on windows. This always returns 32768 in such situations.
78 
79  /// @brief Get the size of one unit of storage on the CPU cache for purposes of tuning alogrithms.
80  /// @details This gets the smallest line size amongst available caches on the current system, it
81  /// assumes that L1 cache lines are smaller than L2 and those are smaller than L3 and so if required.
82  /// @return The size of a single cache line/cache unit
83  /// @warning There is a bug in MinGw which prevents this from working on windows. This always returns 64 in such situations.
85 
86 }//Mezzanine
87 
88 #endif
MaxInt GetTimeStamp()
Get a timestamp, in microseconds. This will generally be some multiple of the GetTimeStampResolution ...
All the definitions for datatypes as well as some basic conversion functions are defined here...
Whole GetCachelineSize()
Get the size of one unit of storage on the CPU cache for purposes of tuning alogrithms.
Whole MEZZ_LIB GetCPUCount()
Get the amount of logical processors, a reasononable amount to use for thread creation.
Whole GetCacheSize()
How much storage can be used before RAM must be used.
#define MEZZ_LIB
Some platforms require special decorations to denote what is exported/imported in a share library...
long long MaxInt
A large integer type suitable for compile time math and long term microsecond time keeping...
Definition: datatypes.h:190
The bulk of the engine components go in this namspace.
Definition: actor.cpp:56
unsigned long Whole
Whole is an unsigned integer, it will be at least 32bits in size.
Definition: datatypes.h:151
Whole GetTimeStampResolution()
Get the resolution of the timestamp in microseconds. This is the smallest amount of time that the Get...