6253 F_GETLK doesn't always return lock owner
[illumos-gate.git] / usr / src / uts / common / tnf / tnf_trace.h
blob13b7a8b98cb1307400caa1f7b7e74eb65009a51c
1 /*
2 * CDDL HEADER START
4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License, Version 1.0 only
6 * (the "License"). You may not use this file except in compliance
7 * with the License.
9 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10 * or http://www.opensolaris.org/os/licensing.
11 * See the License for the specific language governing permissions
12 * and limitations under the License.
14 * When distributing Covered Code, include this CDDL HEADER in each
15 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16 * If applicable, add the following below this CDDL HEADER, with the
17 * fields enclosed by brackets "[]" replaced with your own identifying
18 * information: Portions Copyright [yyyy] [name of copyright owner]
20 * CDDL HEADER END
23 * Copyright (c) 1994, by Sun Microsytems, Inc.
26 #ifndef _TNF_TRACE_H
27 #define _TNF_TRACE_H
29 #pragma ident "%Z%%M% %I% %E% SMI"
31 #include <sys/types.h>
32 #include <sys/time.h>
33 #include <sys/tnf_probe.h>
34 #include <sys/thread.h>
35 #include <sys/processor.h>
37 #include "tnf_buf.h"
38 #include "tnf_types.h"
41 * Minimum and default size of trace file
44 #define TNF_TRACE_FILE_MIN (128 * 1024)
45 #define TNF_TRACE_FILE_DEFAULT (1 * 1024 * 1024)
48 * Specification of index field of probe control block
51 #define PROBE_INDEX_TYPE_MASK 0x3
52 #define PROBE_INDEX_MEM_PTR 0x0 /* index is a normal memory ptr */
53 #define PROBE_INDEX_FILE_PTR 0x1 /* index is a file abs ptr */
54 #define PROBE_INDEX_LOW_MASK 0xffff0000
55 #define PROBE_INDEX_SHIFT 16
57 #define PROBE_IS_FILE_PTR(x) \
58 (((x) & PROBE_INDEX_TYPE_MASK) == PROBE_INDEX_FILE_PTR)
60 #define ATTR_SEPARATOR ';'
61 #define VAL_SEPARATOR ' '
64 * Flags in proc struct
66 #define PROC_F_FILTER 0x1
68 #define PROC_IS_FILTER(pp) ((pp)->p_tnf_flags & PROC_F_FILTER)
69 #define PROC_FILTER_SET(pp) ((pp)->p_tnf_flags |= PROC_F_FILTER)
70 #define PROC_FILTER_CLR(pp) ((pp)->p_tnf_flags &= ~PROC_F_FILTER)
73 * In-memory scheduling info, maintained per thread
76 typedef struct {
77 tnf_record_p record_p;
78 tnf_uint32_t record_gen;
79 hrtime_t time_base;
80 processorid_t cpuid;
81 } tnf_schedule_t;
84 * Per-thread tracing operations and state
87 struct _tnf_ops {
88 char mode; /* allocation mode */
89 tnf_byte_lock_t busy; /* currently in a probe */
90 TNFW_B_WCB wcb; /* write control info */
91 tnf_schedule_t schedule; /* scheduling info */
95 * File layout of a kernel schedule record
98 typedef struct {
99 tnf_tag_t tag;
100 tnf_kthread_id_t tid;
101 tnf_lwpid_t lwpid;
102 tnf_pid_t pid;
104 * time base should be on a double word boundary to avoid pads
106 tnf_time_base_t time_base;
107 tnf_cpuid_t cpuid;
108 } tnf_schedule_prototype_t;
111 * File layout of a probe (event tag) record
114 typedef struct {
115 tnf_tag_t tag;
116 tnf_name_t name;
117 tnf_properties_t properties;
118 tnf_slot_types_t slot_types;
119 tnf_type_size_t type_size;
120 tnf_slot_names_t slot_names;
121 tnf_string_t string; /* XXX detail */
122 } tnf_probe_prototype_t;
125 * Tag data variables
128 extern tnf_tag_data_t *tnf_probe_type_tag_data;
129 extern tnf_tag_data_t *tnf_kernel_schedule_tag_data;
135 extern size_t tnf_trace_file_size;
138 * Function prototypes
141 /* Encoder functions */
143 tnf_record_p tnf_kernel_schedule(tnf_ops_t *, tnf_schedule_t *);
144 uintptr_t tnf_probe_tag(tnf_ops_t *, tnf_probe_control_t *);
146 /* Trace functions */
148 void *tnf_trace_alloc(tnf_ops_t *, tnf_probe_control_t *, tnf_probe_setup_t *);
150 void tnf_trace_commit(tnf_probe_setup_t *);
151 void tnf_trace_rollback(tnf_probe_setup_t *);
153 /* Trace control functions */
155 void tnf_trace_init(void);
156 void tnf_trace_on(void);
157 void tnf_trace_off(void);
159 #endif /* _TNF_TRACE_H */