| 1 | /* |
| 2 | * This Source Code Form is subject to the terms of the Mozilla Public |
| 3 | * License, v. 2.0. If a copy of the MPL was not distributed with this |
| 4 | * file, You can obtain one at http://mozilla.org/MPL/2.0/. |
| 5 | * |
| 6 | * Copyright 1997 - July 2008 CWI, August 2008 - 2019 MonetDB B.V. |
| 7 | */ |
| 8 | |
| 9 | #ifndef _MAL_RESOURCE_H |
| 10 | #define _MAL_RESOURCE_H |
| 11 | |
| 12 | #include "mal_interpreter.h" |
| 13 | #include "matomic.h" |
| 14 | |
| 15 | #define LONGRUNNING (60 * 1000 * 1000) /* usec , 60 seconds high priority */ |
| 16 | #define TIMESLICE (3 * 1000 * 1000) /* usec , 3 seconds high priority */ |
| 17 | #define DELAYUNIT 2 /* ms delay in parallel processing decisions */ |
| 18 | #define MAX_DELAYS 1000 /* never wait more then 2000 ms */ |
| 19 | |
| 20 | //#define heapinfo(X,Id) (((X) && (X)->base && ((X)->parentid == 0 || (X)->parentid == Id)) ? (X)->free : 0) |
| 21 | #define heapinfo(X,Id) (((X) && (X)->base ) ? (X)->free : 0) |
| 22 | #define hashinfo(X,Id) ((X) && (X) != (Hash *) 1 ? heapinfo(&(X)->heap, Id) : 0) |
| 23 | |
| 24 | mal_export int MALadmission_claim(Client cntxt, MalBlkPtr mb, MalStkPtr stk, InstrPtr pci, lng argclaim); |
| 25 | mal_export void MALadmission_release(Client cntxt, MalBlkPtr mb, MalStkPtr stk, InstrPtr pci, lng argclaim); |
| 26 | |
| 27 | #define FAIRNESS_THRESHOLD (MAX_DELAYS * DELAYUNIT) |
| 28 | |
| 29 | mal_export lng getMemoryClaim(MalBlkPtr mb, MalStkPtr stk, InstrPtr pci, int i, int flag); |
| 30 | |
| 31 | #endif /* _MAL_RESOURCE_H*/ |
| 32 | |