home *** CD-ROM | disk | FTP | other *** search
/ H4CK3R 4 / hacker04 / 04_HACK04.ISO / darwin / darwinx86.iso / usr / include / mach / vm_statistics.h < prev    next >
Encoding:
C/C++ Source or Header  |  2001-09-30  |  6.9 KB  |  230 lines

  1. /*
  2.  * Copyright (c) 2000 Apple Computer, Inc. All rights reserved.
  3.  *
  4.  * @APPLE_LICENSE_HEADER_START@
  5.  * 
  6.  * The contents of this file constitute Original Code as defined in and
  7.  * are subject to the Apple Public Source License Version 1.1 (the
  8.  * "License").  You may not use this file except in compliance with the
  9.  * License.  Please obtain a copy of the License at
  10.  * http://www.apple.com/publicsource and read it before using this file.
  11.  * 
  12.  * This Original Code and all software distributed under the License are
  13.  * distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER
  14.  * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
  15.  * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
  16.  * FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT.  Please see the
  17.  * License for the specific language governing rights and limitations
  18.  * under the License.
  19.  * 
  20.  * @APPLE_LICENSE_HEADER_END@
  21.  */
  22. /*
  23.  * @OSF_COPYRIGHT@
  24.  */
  25. /*
  26.  * HISTORY
  27.  * 
  28.  * Revision 1.1.1.1  1998/09/22 21:05:31  wsanchez
  29.  * Import of Mac OS X kernel (~semeria)
  30.  *
  31.  * Revision 1.1.1.1  1998/03/07 02:25:46  wsanchez
  32.  * Import of OSF Mach kernel (~mburg)
  33.  *
  34.  * Revision 1.2.12.2  1995/01/06  19:52:25  devrcs
  35.  *     mk6 CR668 - 1.3b26 merge
  36.  *     added vm stats
  37.  *     [1994/10/14  03:43:30  dwm]
  38.  *
  39.  * Revision 1.2.12.1  1994/09/23  02:44:40  ezf
  40.  *     change marker to not FREE
  41.  *     [1994/09/22  21:43:49  ezf]
  42.  * 
  43.  * Revision 1.2.4.4  1993/08/03  18:30:01  gm
  44.  *     CR9596: Change KERNEL to MACH_KERNEL.
  45.  *     [1993/08/02  18:58:32  gm]
  46.  * 
  47.  * Revision 1.2.4.3  1993/06/15  20:28:27  brezak
  48.  *     Make xxx_vm_statistic for now.
  49.  *     [1993/06/14  14:11:07  brezak]
  50.  * 
  51.  * Revision 1.2.2.2  1993/06/08  19:03:02  brezak
  52.  *     Remove page_size from vm_statistics.
  53.  * 
  54.  * Revision 1.1.4.2  1993/06/02  23:49:41  jeffc
  55.  *     Added to OSF/1 R1.3 from NMK15.0.
  56.  *     [1993/06/02  21:18:54  jeffc]
  57.  * 
  58.  * Revision 1.2  1993/04/19  16:40:55  devrcs
  59.  *     ansi C conformance changes
  60.  *     [1993/02/02  18:55:38  david]
  61.  * 
  62.  * Revision 1.1  1992/09/30  02:32:30  robert
  63.  *     Initial revision
  64.  * 
  65.  * $EndLog$
  66.  */
  67. /* CMU_HIST */
  68. /*
  69.  * Revision 2.3  91/05/14  17:03:07  mrt
  70.  *     Correcting copyright
  71.  * 
  72.  * Revision 2.2  91/02/05  17:37:41  mrt
  73.  *     Changed to new Mach copyright
  74.  *     [91/02/01  17:22:49  mrt]
  75.  * 
  76.  * Revision 2.1  89/08/03  16:06:55  rwd
  77.  * Created.
  78.  * 
  79.  * Revision 2.4  89/02/25  18:42:35  gm0w
  80.  *     Changes for cleanup.
  81.  * 
  82.  * Revision 2.3  89/02/07  00:54:39  mwyoung
  83.  * Relocated from sys/vm_statistics.h
  84.  * 
  85.  * Revision 2.2  89/01/30  22:08:54  rpd
  86.  *     Made variable declarations use "extern".
  87.  *     [89/01/25  15:26:30  rpd]
  88.  * 
  89.  * 30-Sep-86  Avadis Tevanian (avie) at Carnegie-Mellon University
  90.  *    Changed "reclaim" to "inactive."
  91.  *
  92.  * 22-Aug-86  Michael Young (mwyoung) at Carnegie-Mellon University
  93.  *    Made vm_stat structure kernel-only.
  94.  *
  95.  * 22-May-86  Avadis Tevanian (avie) at Carnegie-Mellon University
  96.  *    Defined vm_statistics_data_t as a real typedef so that
  97.  *    MatchMaker can deal with it.
  98.  *
  99.  * 14-Feb-86  Avadis Tevanian (avie) at Carnegie-Mellon University
  100.  *    Created.
  101.  *
  102.  */
  103. /* CMU_ENDHIST */
  104. /* 
  105.  * Mach Operating System
  106.  * Copyright (c) 1991,1990,1989,1988,1987 Carnegie Mellon University
  107.  * All Rights Reserved.
  108.  * 
  109.  * Permission to use, copy, modify and distribute this software and its
  110.  * documentation is hereby granted, provided that both the copyright
  111.  * notice and this permission notice appear in all copies of the
  112.  * software, derivative works or modified versions, and any portions
  113.  * thereof, and that both notices appear in supporting documentation.
  114.  * 
  115.  * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
  116.  * CONDITION.  CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
  117.  * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
  118.  * 
  119.  * Carnegie Mellon requests users of this software to return to
  120.  * 
  121.  *  Software Distribution Coordinator  or  Software.Distribution@CS.CMU.EDU
  122.  *  School of Computer Science
  123.  *  Carnegie Mellon University
  124.  *  Pittsburgh PA 15213-3890
  125.  * 
  126.  * any improvements or extensions that they make and grant Carnegie Mellon
  127.  * the rights to redistribute these changes.
  128.  */
  129. /*
  130.  */
  131. /*
  132.  *    File:    mach/vm_statistics.h
  133.  *    Author:    Avadis Tevanian, Jr., Michael Wayne Young, David Golub
  134.  *
  135.  *    Virtual memory statistics structure.
  136.  *
  137.  */
  138.  
  139. #ifndef    VM_STATISTICS_H_
  140. #define    VM_STATISTICS_H_
  141.  
  142. #include <mach/machine/vm_types.h>
  143.  
  144. struct vm_statistics {
  145.     integer_t    free_count;        /* # of pages free */
  146.     integer_t    active_count;        /* # of pages active */
  147.     integer_t    inactive_count;        /* # of pages inactive */
  148.     integer_t    wire_count;        /* # of pages wired down */
  149.     integer_t    zero_fill_count;    /* # of zero fill pages */
  150.     integer_t    reactivations;        /* # of pages reactivated */
  151.     integer_t    pageins;        /* # of pageins */
  152.     integer_t    pageouts;        /* # of pageouts */
  153.     integer_t    faults;            /* # of faults */
  154.     integer_t    cow_faults;        /* # of copy-on-writes */
  155.     integer_t    lookups;        /* object cache lookups */
  156.     integer_t    hits;            /* object cache hits */
  157. };
  158.  
  159. typedef struct vm_statistics    *vm_statistics_t;
  160. typedef struct vm_statistics    vm_statistics_data_t;
  161.  
  162.  
  163. /* included for the vm_map_page_query call */
  164.  
  165. #define VM_PAGE_QUERY_PAGE_PRESENT      0x1
  166. #define VM_PAGE_QUERY_PAGE_FICTITIOUS   0x2
  167. #define VM_PAGE_QUERY_PAGE_REF          0x4
  168. #define VM_PAGE_QUERY_PAGE_DIRTY        0x8
  169.  
  170.  
  171. /*
  172.  *    Each machine dependent implementation is expected to
  173.  *    keep certain statistics.  They may do this anyway they
  174.  *    so choose, but are expected to return the statistics
  175.  *    in the following structure.
  176.  */
  177.  
  178. struct pmap_statistics {
  179.     integer_t    resident_count;    /* # of pages mapped (total)*/
  180.     integer_t    wired_count;    /* # of pages wired */
  181. };
  182.  
  183. typedef struct pmap_statistics    *pmap_statistics_t;
  184.  
  185. #define VM_FLAGS_FIXED        0x0
  186. #define VM_FLAGS_ANYWHERE    0x1
  187. #define VM_FLAGS_ALIAS_MASK    0xFF000000
  188. #define VM_GET_FLAGS_ALIAS(flags, alias)            \
  189.         (alias) = ((flags) & VM_FLAGS_ALIAS_MASK) >> 24    
  190. #define VM_SET_FLAGS_ALIAS(flags, alias)            \
  191.         (flags) = (((flags) & ~VM_FLAGS_ALIAS_MASK) |    \
  192.         (((alias) & ~VM_FLAGS_ALIAS_MASK) << 24))
  193.  
  194. #define VM_MEMORY_MALLOC 1
  195. #define VM_MEMORY_MALLOC_SMALL 2
  196. #define VM_MEMORY_MALLOC_LARGE 3
  197. #define VM_MEMORY_MALLOC_HUGE 4
  198. #define VM_MEMORY_SBRK 5// uninteresting -- no one should call
  199.  
  200. #define VM_MEMORY_ANALYSIS_TOOL 10
  201.  
  202. #define VM_MEMORY_MACH_MSG 20
  203. #define VM_MEMORY_IOKIT    21
  204. #define VM_MEMORY_STACK  30
  205. #define VM_MEMORY_GUARD  31
  206. #define    VM_MEMORY_SHARED_PMAP 32
  207. /* memory containing a dylib */
  208. #define VM_MEMORY_DYLIB    33
  209.  
  210. // Placeholders for now -- as we analyze the libraries and find how they
  211. // use memory, we can make these labels more specific.
  212. #define VM_MEMORY_APPKIT 40
  213. #define VM_MEMORY_FOUNDATION 41
  214. #define VM_MEMORY_COREGRAPHICS 42
  215. #define VM_MEMORY_CARBON 43
  216. #define VM_MEMORY_ATS 50
  217.  
  218.  
  219. /* memory allocated by the dynamic loader for itself */
  220. #define VM_MEMORY_DYLD 60
  221. /* malloc'd memory created by dyld */
  222. #define VM_MEMORY_DYLD_MALLOC 61
  223.  
  224. /* Reserve 240-255 for application */
  225. #define VM_MEMORY_APPLICATION_SPECIFIC_1 240
  226. #define VM_MEMORY_APPLICATION_SPECIFIC_16 255
  227.  
  228. #define VM_MAKE_TAG(tag) (tag<<24)
  229. #endif    /* VM_STATISTICS_H_ */
  230.