|
|
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) 1990 NeXT, Inc. ! 27: * ! 28: * This file is the single kernel kernel include file for the pmon interface. ! 29: * ! 30: * HISTORY ! 31: * ! 32: * 1-Mar-90 Brian Pinkerton at NeXT ! 33: * Created ! 34: * ! 35: */ ! 36: ! 37: #ifdef DEBUG ! 38: ! 39: #define PMON 1 /* make PMON conditional on DEBUG */ ! 40: ! 41: #import <sys/types.h> ! 42: #import <sys/proc.h> ! 43: #import <sys/time_stamp.h> ! 44: #import <machine/eventc.h> ! 45: #import <machine/pmon.h> /* generic pmon interface */ ! 46: #import <machine/pmon_targets.h> /* list of kernel pmon targets */ ! 47: ! 48: ! 49: extern int pmon_flags[]; /* currently enabled event masks */ ! 50: extern void(*pmon_event_log_p)(); /* pointer to pmon_event_log() ! 51: (set by the kern_loader) */ ! 52: ! 53: ! 54: /* ! 55: * This is the usual interface to pmon in the kernel. It just checks to ! 56: * see if the source,event_type pair is enabled, and if so, grabs the ! 57: * current clock and logs the event. ! 58: */ ! 59: ! 60: static inline void pmon_log_event(source, event_type, data1, data2, data3) ! 61: int source, event_type; ! 62: int data1, data2, data3; ! 63: { ! 64: if (pmon_flags[source] & event_type) { ! 65: struct tsval event_timestamp; ! 66: ! 67: event_set_ts(&event_timestamp); ! 68: (*pmon_event_log_p)(source, ! 69: event_type, ! 70: &event_timestamp, ! 71: data1, ! 72: data2, ! 73: data3); ! 74: } ! 75: } ! 76: ! 77: #else /* DEBUG */ ! 78: ! 79: ! 80: /* ! 81: * If we don't have a debug kernel, make sure to turn off pmon event ! 82: * logging. We import the definitions anyway, so nothing will be undefined. ! 83: */ ! 84: ! 85: #import <machine/pmon.h> /* generic pmon interface */ ! 86: #import <machine/pmon_targets.h> /* list of kernel pmon targets */ ! 87: ! 88: #define pmon_log_event(source, event_type, data1, data2, data3) ! 89: ! 90: #endif /* DEBUG */ ! 91: ! 92: ! 93:
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.