Path: blob/master/runtime/gc_realtime/OSInterface.hpp
5985 views
/*******************************************************************************1* Copyright (c) 1991, 2019 IBM Corp. and others2*3* This program and the accompanying materials are made available under4* the terms of the Eclipse Public License 2.0 which accompanies this5* distribution and is available at https://www.eclipse.org/legal/epl-2.0/6* or the Apache License, Version 2.0 which accompanies this distribution and7* is available at https://www.apache.org/licenses/LICENSE-2.0.8*9* This Source Code may also be made available under the following10* Secondary Licenses when the conditions for such availability set11* forth in the Eclipse Public License, v. 2.0 are satisfied: GNU12* General Public License, version 2 with the GNU Classpath13* Exception [1] and GNU General Public License, version 2 with the14* OpenJDK Assembly Exception [2].15*16* [1] https://www.gnu.org/software/classpath/license.html17* [2] http://openjdk.java.net/legal/assembly-exception.html18*19* 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-exception20*******************************************************************************/2122/**23* @file24* @ingroup GC_Metronome25*/2627#if !defined(OSINTERFACE_HPP_)28#define OSINTERFACE_HPP_2930#include "Base.hpp"31#include "GCExtensionsBase.hpp"3233class MM_EnvironmentBase;34class MM_OSInterface;35class MM_ProcessorInfo;3637#if defined(WIN32)38#define SCHED_RR 039#define SCHED_FIFO 040#endif /* WIN32 */41424344/**45* @todo Provide class documentation46* @ingroup GC_Metronome47*/48class MM_OSInterface : public MM_BaseVirtual49{50/* Data members / types */51public:52MM_GCExtensionsBase *_extensions;53U_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. */54U_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. */55I_64 _omrtime_hires_clock_nanoSecondOffset; /**< After multiplying by the above factor, subtract the offset to obtain time relative to machine boot time. */56U_64 _ticksPerMicroSecond;57protected:58private:59OMR_VM *_vm;60uintptr_t _numProcessors;61U_64 _physicalMemoryBytes;62MM_ProcessorInfo *_processorInfo;6364/* Methods */65public:66static MM_OSInterface *newInstance(MM_EnvironmentBase *env);67bool initialize(MM_EnvironmentBase *env);68virtual void kill(MM_EnvironmentBase *env);69void tearDown(MM_EnvironmentBase *env);70void startup();71U_64 nanoTime();72void maskSignals();73bool hiresTimerAvailable();74bool rtcTimerAvailable();75bool itTimerAvailable();76uintptr_t getNumbersOfProcessors() {return _numProcessors;}7778MM_OSInterface() :79_processorInfo(NULL)80{81_typeId = __FUNCTION__;82}83protected:84private:85};868788#endif /* OSINTERFACE_HPP_ */899091