FreeBSD/Linux Kernel Cross Reference
sys/kern/pc_sample.h
1 /*
2 * Mach Operating System
3 * Copyright (c) 1993 Carnegie Mellon University
4 * All Rights Reserved.
5 *
6 * Permission to use, copy, modify and distribute this software and its
7 * documentation is hereby granted, provided that both the copyright
8 * notice and this permission notice appear in all copies of the
9 * software, derivative works or modified versions, and any portions
10 * thereof, and that both notices appear in supporting documentation.
11 *
12 * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
13 * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
14 * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
15 *
16 * Carnegie Mellon requests users of this software to return to
17 *
18 * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
19 * School of Computer Science
20 * Carnegie Mellon University
21 * Pittsburgh PA 15213-3890
22 *
23 * any improvements or extensions that they make and grant Carnegie Mellon
24 * the rights to redistribute these changes.
25 */
26 /*
27 * HISTORY
28 * $Log: pc_sample.h,v $
29 * Revision 2.2 93/11/17 19:06:01 dbg
30 * Moved kernel internal definitions here from mach/pc_sample.h.
31 * [93/09/24 dbg]
32 *
33 */
34
35 /*
36 * Kernel definitions for PC sampling.
37 */
38 #ifndef _KERN_PC_SAMPLE_H_
39 #define _KERN_PC_SAMPLE_H_
40
41 #include <mach/pc_sample.h>
42 #include <mach/machine/vm_types.h>
43 #include <kern/kern_types.h>
44 #include <kern/macro_help.h>
45
46 /*
47 * Control structure for sampling, included in
48 * threads and tasks. If sampletypes is 0, no
49 * sampling is done.
50 */
51
52 struct sample_control {
53 vm_offset_t buffer;
54 unsigned int seqno;
55 sampled_pc_flavor_t sampletypes;
56 };
57
58 typedef struct sample_control sample_control_t;
59
60 /*
61 * Routines to take PC samples.
62 */
63 extern void take_pc_sample(
64 thread_t thread,
65 sample_control_t *cp,
66 sampled_pc_flavor_t flavor);
67
68 /*
69 * Macro to do quick flavor check for sampling,
70 * on both threads and tasks.
71 */
72 #define take_pc_sample_macro(thread, flavor) \
73 MACRO_BEGIN \
74 task_t task; \
75 \
76 if ((thread)->pc_sample.sampletypes & (flavor)) \
77 take_pc_sample((thread), &(thread)->pc_sample, (flavor)); \
78 \
79 task = (thread)->task; \
80 if (task->pc_sample.sampletypes & (flavor)) \
81 take_pc_sample((thread), &task->pc_sample, (flavor)); \
82 MACRO_END
83
84 #endif /* _KERN_PC_SAMPLE_H_ */
Cache object: 61ef1dcac25e007a618f520b16719e25
|