Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
PojavLauncherTeam
GitHub Repository: PojavLauncherTeam/openj9
Path: blob/master/runtime/gc_realtime/OSInterface.hpp
5985 views
1
/*******************************************************************************
2
* Copyright (c) 1991, 2019 IBM Corp. and others
3
*
4
* This program and the accompanying materials are made available under
5
* the terms of the Eclipse Public License 2.0 which accompanies this
6
* distribution and is available at https://www.eclipse.org/legal/epl-2.0/
7
* or the Apache License, Version 2.0 which accompanies this distribution and
8
* is available at https://www.apache.org/licenses/LICENSE-2.0.
9
*
10
* This Source Code may also be made available under the following
11
* Secondary Licenses when the conditions for such availability set
12
* forth in the Eclipse Public License, v. 2.0 are satisfied: GNU
13
* General Public License, version 2 with the GNU Classpath
14
* Exception [1] and GNU General Public License, version 2 with the
15
* OpenJDK Assembly Exception [2].
16
*
17
* [1] https://www.gnu.org/software/classpath/license.html
18
* [2] http://openjdk.java.net/legal/assembly-exception.html
19
*
20
* SPDX-License-Identifier: EPL-2.0 OR Apache-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 OR LicenseRef-GPL-2.0 WITH Assembly-exception
21
*******************************************************************************/
22
23
/**
24
* @file
25
* @ingroup GC_Metronome
26
*/
27
28
#if !defined(OSINTERFACE_HPP_)
29
#define OSINTERFACE_HPP_
30
31
#include "Base.hpp"
32
#include "GCExtensionsBase.hpp"
33
34
class MM_EnvironmentBase;
35
class MM_OSInterface;
36
class MM_ProcessorInfo;
37
38
#if defined(WIN32)
39
#define SCHED_RR 0
40
#define SCHED_FIFO 0
41
#endif /* WIN32 */
42
43
44
45
/**
46
* @todo Provide class documentation
47
* @ingroup GC_Metronome
48
*/
49
class MM_OSInterface : public MM_BaseVirtual
50
{
51
/* Data members / types */
52
public:
53
MM_GCExtensionsBase *_extensions;
54
U_64 _omrtime_hires_clock_nanoSecondMultiplyFactor; /**< The results of j9time_hires_clock must be multiplied by this value, if non-zero, to obtain time in micro-seconds. */
55
U_64 _omrtime_hires_clock_nanoSecondDivideFactor; /**< If the MultiplyFactor is zero, the results of j9time_hires_clock must be divided by this value, to obtain time in micro-seconds. */
56
I_64 _omrtime_hires_clock_nanoSecondOffset; /**< After multiplying by the above factor, subtract the offset to obtain time relative to machine boot time. */
57
U_64 _ticksPerMicroSecond;
58
protected:
59
private:
60
OMR_VM *_vm;
61
uintptr_t _numProcessors;
62
U_64 _physicalMemoryBytes;
63
MM_ProcessorInfo *_processorInfo;
64
65
/* Methods */
66
public:
67
static MM_OSInterface *newInstance(MM_EnvironmentBase *env);
68
bool initialize(MM_EnvironmentBase *env);
69
virtual void kill(MM_EnvironmentBase *env);
70
void tearDown(MM_EnvironmentBase *env);
71
void startup();
72
U_64 nanoTime();
73
void maskSignals();
74
bool hiresTimerAvailable();
75
bool rtcTimerAvailable();
76
bool itTimerAvailable();
77
uintptr_t getNumbersOfProcessors() {return _numProcessors;}
78
79
MM_OSInterface() :
80
_processorInfo(NULL)
81
{
82
_typeId = __FUNCTION__;
83
}
84
protected:
85
private:
86
};
87
88
89
#endif /* OSINTERFACE_HPP_ */
90
91