xref: /xnu-12377.61.12/bsd/sys/mem_acct_private.h (revision 4d495c6e23c53686cf65f45067f79024cf5dcee8)
1 /*
2  * Copyright (c) 2024 Apple Inc. All rights reserved.
3  *
4  * @APPLE_LICENSE_HEADER_START@
5  *
6  * This file contains Original Code and/or Modifications of Original Code
7  * as defined in and that are subject to the Apple Public Source License
8  * Version 2.0 (the 'License'). You may not use this file except in
9  * compliance with the License. Please obtain a copy of the License at
10  * http://www.opensource.apple.com/apsl/ and read it before using this
11  * file.
12  *
13  * The Original Code and all software distributed under the License are
14  * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
15  * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
16  * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
17  * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
18  * Please see the License for the specific language governing rights and
19  * limitations under the License.
20  *
21  * @APPLE_LICENSE_HEADER_END@
22  */
23 
24 #ifndef _SYS_MEM_ACCT_PRIVATE_H
25 #define _SYS_MEM_ACCT_PRIVATE_H
26 
27 #include <stdint.h>
28 
29 #include <sys/types.h>
30 
31 #define MEM_ACCT_PEAK                       1       /* reset/get peak value for a subsystem */
32 #define MEM_ACCT_SOFT_LIMIT                 2       /* set/get soft limit for a subsystem */
33 #define MEM_ACCT_HARD_LIMIT                 3       /* set/get hard limit for a subsystem */
34 #define MEM_ACCT_ALLOCATED                  4       /* set/get currently allocated memory for a subsystem */
35 #define MEM_ACCT_SUBSYSTEMS                 5       /* get all subsystem names */
36 #define MEM_ACCT_ALL_SUBSYSTEM_STATISTICS   6       /* returns all statistics for all subsystems */
37 #define MEM_ACCT_ALL_STATISTICS             7       /* returns all statistics for a specific subsystem */
38 
39 #define MEM_ACCT_MAX                        8       /* Current maximum number of accounting objects we allow */
40 
41 #define MEM_ACCT_NAME_LENGTH                16      /* max size for subsystem name */
42 
43 struct memacct_statistics {
44 	uint64_t peak;
45 	int64_t allocated;
46 	uint64_t softlimit;
47 	uint64_t hardlimit;
48 	char ma_name[MEM_ACCT_NAME_LENGTH];
49 };
50 
51 #endif /* _SYS_MEM_ACCT_PRIVATE_H */
52