1 /* 2 * Copyright (c) 2024 Huawei Device Co., Ltd. 3 * Licensed under the Apache License, Version 2.0 (the "License"); 4 * you may not use this file except in compliance with the License. 5 * You may obtain a copy of the License at 6 * 7 * http://www.apache.org/licenses/LICENSE-2.0 8 * 9 * Unless required by applicable law or agreed to in writing, software 10 * distributed under the License is distributed on an "AS IS" BASIS, 11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 * See the License for the specific language governing permissions and 13 * limitations under the License. 14 */ 15 16 #ifndef OHOS_ABILITY_CJ_ENVIRONMENT_CJ_INTERFACE_H 17 #define OHOS_ABILITY_CJ_ENVIRONMENT_CJ_INTERFACE_H 18 19 #include <stdint.h> 20 21 using CJThreadHandle = void*; 22 23 namespace OHOS { 24 25 enum RTLogLevel { 26 RTLOG_VERBOSE, 27 RTLOG_DEBUGY, 28 RTLOG_INFO, 29 RTLOG_WARNING, 30 RTLOG_ERROR, 31 RTLOG_FATAL_WITHOUT_ABORT, 32 RTLOG_FATAL, 33 RTLOG_OFF 34 }; 35 36 enum RTErrorCode { E_OK = 0, E_ARGS = -1, E_TIMEOUT = -2, E_STATE = -3, E_FAILED = -4 }; 37 38 struct HeapParam { 39 size_t regionSize; 40 size_t heapSize; 41 double exemptionThreshold; 42 double heapUtilization; 43 double heapGrowth; 44 double allocationRate; 45 size_t allocationWaitTime; 46 }; 47 48 struct GCParam { 49 size_t gcThreshold; 50 double garbageThreshold; 51 uint64_t gcInterval; 52 uint64_t backupGCInterval; 53 int32_t gcThreads; 54 }; 55 56 struct LogParam { 57 enum RTLogLevel logLevel; 58 }; 59 60 struct ConcurrencyParam { 61 size_t thStackSize; 62 size_t coStackSize; 63 uint32_t processorNum; 64 }; 65 66 struct RuntimeParam { 67 struct HeapParam heapParam; 68 struct GCParam gcParam; 69 struct LogParam logParam; 70 struct ConcurrencyParam coParam; 71 }; 72 73 #if defined(__OHOS__) && (__OHOS__ == 1) 74 using LogHandle = void (*)(const char*); 75 #endif 76 } 77 #endif // OHOS_ABILITY_CJ_ENVIRONMENT_CJ_INTERFACE_H 78