8322 nl: misleading-indentation
[unleashed/tickless.git] / usr / src / lib / libtnfprobe / tnf_trace.h
blob7bcf0796658f0b79ffc2b918e91f4c1ca50f449a
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 <tnf/probe.h>
32 #include "tnf_buf.h"
33 #include "tnf_types.h"
35 #ifdef __cplusplus
36 extern "C" {
37 #endif
40 * Size of a TNF buffer block
43 #define TNF_BLOCK_SIZE 512
44 #define TNF_BLOCK_MASK ~(TNF_BLOCK_SIZE - 1)
47 * Size of TNF file directory area
50 #define TNF_DIRECTORY_SIZE (1 << 16)
53 * specification of index field of probe control block
56 #define PROBE_INDEX_TYPE_MASK 0x3
57 #define PROBE_INDEX_MEM_PTR 0x0 /* index is a normal memory ptr */
58 #define PROBE_INDEX_FILE_PTR 0x1 /* index is a file abs ptr */
59 #define PROBE_INDEX_LOW_MASK 0xffff0000
60 #define PROBE_INDEX_SHIFT 16
62 #define PROBE_IS_FILE_PTR(x) \
63 (((x) & PROBE_INDEX_TYPE_MASK) == PROBE_INDEX_FILE_PTR)
65 #define ATTR_SEPARATOR ';'
66 #define VAL_SEPARATOR ' '
68 typedef struct {
69 tnf_record_p record_p;
70 tnf_uint32_t record_gen;
71 unsigned long tid;
72 unsigned long lwpid;
73 long pid;
74 hrtime_t time_base;
75 } tnf_schedule_t;
77 typedef struct {
78 tnf_tag_t tag;
79 tnf_uint32_t tid;
80 tnf_uint32_t lwpid;
81 pid_t pid;
83 * time base should be on a double word boundary to avoid pads
85 tnf_longlong_t time_base;
86 } tnf_schedule_prototype_t;
88 typedef struct {
89 tnf_tag_t tag;
90 tnf_name_t name;
91 tnf_properties_t properties;
92 tnf_slot_types_t slot_types;
93 tnf_type_size_t type_size;
94 tnf_slot_names_t slot_names;
95 tnf_string_t string;
96 } tnf_probe_prototype_t;
99 * TNF output ops
103 * Data structure that is the glue between the tnf layer and the buffering
104 * layer.
106 struct _tnf_ops {
107 /* fields needed by TNF writing layer */
108 enum tnf_alloc_mode mode;
109 void * (*alloc)(TNFW_B_WCB *, size_t, enum tnf_alloc_mode);
110 TNFW_B_STATUS (*commit)(TNFW_B_WCB *);
111 TNFW_B_STATUS (*rollback)(TNFW_B_WCB *);
112 TNFW_B_WCB wcb;
113 /* fields needed by tracing allocation and final function */
114 int busy;
115 tnf_schedule_t schedule;
119 * Tag data variables
121 extern tnf_tag_data_t *tnf_probe_type_tag_data;
122 extern tnf_tag_data_t *tnf_sched_rec_tag_data;
124 tnf_record_p tnf_schedule_write(tnf_ops_t *ops, tnf_schedule_t *sched);
125 uintptr_t tnf_probe_tag(tnf_ops_t *ops, tnf_probe_control_t *probe);
126 void _tnf_sched_init(tnf_schedule_t *, hrtime_t);
127 int _tnf_trace_initialize(void);
128 void _tnf_fork_thread_setup(void);
130 extern char tnf_trace_file_name[];
132 /* PROJECT PRIVATE interfaces between prex and libtnfprobe */
134 void *tnf_trace_alloc(tnf_ops_t *, tnf_probe_control_t *, tnf_probe_setup_t *);
136 void tnf_trace_end(tnf_probe_setup_t *);
138 void tnf_trace_commit(tnf_probe_setup_t *);
140 void tnf_trace_rollback(tnf_probe_setup_t *);
142 void tnf_probe_debug(tnf_probe_setup_t *);
144 #ifdef __cplusplus
146 #endif
148 #endif /* _TNF_TRACE_H */