Ocean
Performance.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) Meta Platforms, Inc. and affiliates.
3  *
4  * This source code is licensed under the MIT license found in the
5  * LICENSE file in the root directory of this source tree.
6  */
7 
8 #ifndef META_OCEAN_SYSTEM_PERFORMANCE_H
9 #define META_OCEAN_SYSTEM_PERFORMANCE_H
10 
11 #include "ocean/system/System.h"
12 
13 #include "ocean/base/Singleton.h"
14 
15 namespace Ocean
16 {
17 
18 namespace System
19 {
20 
21 /**
22  * This class implements functionalities concerning the underlying system performance.
23  * @ingroup system
24  */
25 class OCEAN_SYSTEM_EXPORT Performance : public Singleton<Performance>
26 {
27  friend class Singleton<Performance>;
28 
29  public:
30 
31  /**
32  * Definition of different system performance levels.
33  */
34  enum PerformanceLevel : uint32_t
35  {
36  /// Performance level for e.g. mobile phones
38  /// Performance level for e.g. mobile computers
40  /// Performance level for e.g. desktop computers
42  /// Performance level for e.g. workstations
44  /// Performance level for e.g. high performance workstations
45  LEVEL_ULTRA
46  };
47 
48  public:
49 
50  /**
51  * Returns the current performance level.
52  * @return Current selected performance level
53  */
55 
56  /**
57  * Sets the current performance level.
58  * @param level New performance level
59  */
61 
62  protected:
63 
64  /**
65  * Creates a new Performance object.<br>
66  * The default medium performance depends on the number of available processor cores.<br>
67  * A system with one processor core has performance value 'medium' as default.<br>
68  * Systems with two processor cores have performance value 'high' as default.<br>
69  * And systems with four or more processor cores have performance value 'ultra' as default.<br>
70  * However the performance value can be changed at any time.
71  */
73 
74  protected:
75 
76  /// Current performance level.
77  PerformanceLevel performanceLevel_ = LEVEL_MEDIUM;
78 };
79 
80 }
81 
82 }
83 
84 #endif // META_OCEAN_SYSTEM_PERFORMANCE_H
This template class is the base class for all singleton objects.
Definition: Singleton.h:71
This class implements functionalities concerning the underlying system performance.
Definition: Performance.h:26
Performance()
Creates a new Performance object.
PerformanceLevel
Definition of different system performance levels.
Definition: Performance.h:35
@ LEVEL_MEDIUM
Performance level for e.g. mobile computers.
Definition: Performance.h:39
@ LEVEL_VERY_HIGH
Performance level for e.g. workstations.
Definition: Performance.h:43
@ LEVEL_HIGH
Performance level for e.g. desktop computers.
Definition: Performance.h:41
@ LEVEL_LOW
Performance level for e.g. mobile phones.
Definition: Performance.h:37
PerformanceLevel performanceLevel()
Returns the current performance level.
void setPerformanceLevel(const PerformanceLevel level)
Sets the current performance level.
The namespace covering the entire Ocean framework.
Definition: Accessor.h:15