Annotation of kernel/machdep/i386/event_meter.h, revision 1.1

1.1     ! root        1: /*
        !             2:  * Copyright (c) 1999 Apple Computer, Inc. All rights reserved.
        !             3:  *
        !             4:  * @APPLE_LICENSE_HEADER_START@
        !             5:  * 
        !             6:  * Portions Copyright (c) 1999 Apple Computer, Inc.  All Rights
        !             7:  * Reserved.  This file contains Original Code and/or Modifications of
        !             8:  * Original Code as defined in and that are subject to the Apple Public
        !             9:  * Source License Version 1.1 (the "License").  You may not use this file
        !            10:  * except in compliance with the License.  Please obtain a copy of the
        !            11:  * License at http://www.apple.com/publicsource and read it before using
        !            12:  * this file.
        !            13:  * 
        !            14:  * The Original Code and all software distributed under the License are
        !            15:  * distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER
        !            16:  * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
        !            17:  * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
        !            18:  * FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT.  Please see the
        !            19:  * License for the specific language governing rights and limitations
        !            20:  * under the License.
        !            21:  * 
        !            22:  * @APPLE_LICENSE_HEADER_END@
        !            23:  */
        !            24: 
        !            25: /* 
        !            26:  * Copyright (c) 1987, 1988 NeXT, Inc.
        !            27:  *
        !            28:  * HISTORY
        !            29:  * 28-Sep-88  Avadis Tevanian, Jr. (avie) at NeXT
        !            30:  *     Made conditional on eventmeter option.
        !            31:  *
        !            32:  * 07-Mar-88  John Seamons (jks) at NeXT
        !            33:  *     Created.
        !            34:  */
        !            35: 
        !            36: #ifndef        _I386_EM_
        !            37: #define        _I386_EM_
        !            38: 
        !            39: #ifdef KERNEL_BUILD
        !            40: #import <eventmeter.h>
        !            41: #else  /* KERNEL_BUILD */
        !            42: #import <mach/features.h>
        !            43: #endif /* KERNEL_BUILD */
        !            44: 
        !            45: #if    EVENTMETER
        !            46: 
        !            47: #import <mach/vm_statistics.h>
        !            48: #import <bsd/dev/i386/video.h>
        !            49: 
        !            50: /* key codes */
        !            51: #define        EM_KEY_UP       1
        !            52: #define        EM_KEY_DOWN     -1
        !            53: 
        !            54: /* events */
        !            55: #define        EM_INTR         6
        !            56: #define        EM_DMA          5
        !            57: #define EM_DISK                4
        !            58: #define        EM_ENET         3
        !            59: #define        EM_SYSCALL      2
        !            60: #define        EM_PAGER        1
        !            61: #define        EM_PAGE_FAULT   0
        !            62: 
        !            63: /* display geometry */
        !            64: #define        EM_L            30
        !            65: #define        EM_R            (EM_L + 1026)
        !            66: #define        EM_W            1024
        !            67: #define        EM_Y_OD         (VIDEO_H + 43)
        !            68: #define        EM_Y_SD         (VIDEO_H + 59)
        !            69: #define        EM_Y_EVTOP      (VIDEO_H + 25)
        !            70: #define        EM_Y_EVBOT      (VIDEO_H + 25 + 15)
        !            71: 
        !            72: /* states */
        !            73: #define        EM_OFF          0
        !            74: #define        EM_MISC         1
        !            75: #define        EM_VM           2
        !            76: #define        EM_NSTATE       2
        !            77: 
        !            78: /* video "start" values */
        !            79: #define        EM_VID_NORM     0x0
        !            80: #define        EM_VID_UP       0x1b
        !            81: #define        EM_VID_DOWN     0xe5
        !            82: 
        !            83: /* log graph */
        !            84: #define        EM_VMPF         0
        !            85: #define        EM_VMPA         1
        !            86: #define        EM_VMPI         2
        !            87: #define        EM_VMPW         3
        !            88: #define        EM_FAULT        4
        !            89: #define        EM_PAGEIN       5
        !            90: #define        EM_PAGEOUT      6
        !            91: #define        EM_NEVENT       7
        !            92: 
        !            93: /* disk */
        !            94: #define        EM_OD           0
        !            95: #define        EM_SD           1
        !            96: #define        EM_NDISK        2
        !            97: #define        EM_READ         0x30000000
        !            98: #define        EM_WRITE        0x03000000
        !            99: 
        !           100: /* vm */
        !           101: #define        EM_NVM          3
        !           102: 
        !           103: /* misc */
        !           104: #define        EM_RATE         1               /* update rate 1 sec */
        !           105: #define        EM_UPDATE       (hz/EM_RATE)
        !           106: 
        !           107: struct em {
        !           108:        int     state;
        !           109:        int     flags;
        !           110:        int     event_x;
        !           111:        int     last[EM_NEVENT];
        !           112:        int     disk_last[EM_NDISK];
        !           113:        int     disk_rw[EM_NDISK];
        !           114:        vm_statistics_data_t vm_stat;
        !           115:        int     pid[EM_NVM];
        !           116: } em;
        !           117: 
        !           118: /* flags */
        !           119: #define        EMF_LOCK        0x00000001
        !           120: #define        EMF_LEDS        0x00000002
        !           121: 
        !           122: #define        event_meter(event) \
        !           123:        if (em.state == EM_MISC && (em.flags & EMF_LOCK) == 0) { \
        !           124:                em.flags |= EMF_LOCK; \
        !           125:                event_vline (em.event_x, EM_Y_EVTOP, EM_Y_EVBOT, \
        !           126:                        0x44444444 | (3 << (((event) << 2) + 4))); \
        !           127:                event_vline (em.event_x + 1, EM_Y_EVTOP, EM_Y_EVBOT, WHITE); \
        !           128:                if (++em.event_x > EM_R) \
        !           129:                        em.event_x = EM_L; \
        !           130:                em.flags &= ~EMF_LOCK; \
        !           131:        }
        !           132: 
        !           133: #else  /* EVENTMETER */
        !           134: #define        event_meter(event)
        !           135: #endif /* EVENTMETER */
        !           136: #endif /* _I386_EM_ */

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.