xref: /netbsd-src/sys/dev/tprof/tprof_ioctl.h (revision caba1a6f4751146dacb61d492a3ac7cedc54f91f)
1*caba1a6fSryo /*	$NetBSD: tprof_ioctl.h,v 1.5 2022/12/01 00:32:52 ryo Exp $	*/
248a1e4c2Syamt 
348a1e4c2Syamt /*-
489e330a7Syamt  * Copyright (c)2008,2010 YAMAMOTO Takashi,
548a1e4c2Syamt  * All rights reserved.
648a1e4c2Syamt  *
748a1e4c2Syamt  * Redistribution and use in source and binary forms, with or without
848a1e4c2Syamt  * modification, are permitted provided that the following conditions
948a1e4c2Syamt  * are met:
1048a1e4c2Syamt  * 1. Redistributions of source code must retain the above copyright
1148a1e4c2Syamt  *    notice, this list of conditions and the following disclaimer.
1248a1e4c2Syamt  * 2. Redistributions in binary form must reproduce the above copyright
1348a1e4c2Syamt  *    notice, this list of conditions and the following disclaimer in the
1448a1e4c2Syamt  *    documentation and/or other materials provided with the distribution.
1548a1e4c2Syamt  *
1648a1e4c2Syamt  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
1748a1e4c2Syamt  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
1848a1e4c2Syamt  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
1948a1e4c2Syamt  * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
2048a1e4c2Syamt  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
2148a1e4c2Syamt  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
2248a1e4c2Syamt  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
2348a1e4c2Syamt  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
2448a1e4c2Syamt  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
2548a1e4c2Syamt  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
2648a1e4c2Syamt  * SUCH DAMAGE.
2748a1e4c2Syamt  */
2848a1e4c2Syamt 
2948a1e4c2Syamt #ifndef _DEV_TPROF_TPROF_IOCTL_H_
3048a1e4c2Syamt #define _DEV_TPROF_TPROF_IOCTL_H_
3148a1e4c2Syamt 
3289e330a7Syamt /*
3389e330a7Syamt  * definitions for userland consumer
3489e330a7Syamt  */
3589e330a7Syamt 
3648a1e4c2Syamt #include <sys/ioccom.h>
3748a1e4c2Syamt 
3889e330a7Syamt #include <dev/tprof/tprof_types.h>
3989e330a7Syamt 
40*caba1a6fSryo #define	TPROF_VERSION	5	/* kernel-userland ABI version */
4148a1e4c2Syamt 
42a087cb3cSmaxv struct tprof_info {
43a087cb3cSmaxv 	uint32_t ti_version;
44a087cb3cSmaxv 	uint32_t ti_ident;
4548a1e4c2Syamt };
4648a1e4c2Syamt 
4748a1e4c2Syamt struct tprof_stat {
4848a1e4c2Syamt 	uint64_t ts_sample;	/* samples successfully recorded */
4948a1e4c2Syamt 	uint64_t ts_overflow;	/* samples dropped due to overflow */
5048a1e4c2Syamt 	uint64_t ts_buf;	/* buffers successfully queued for read(2) */
5148a1e4c2Syamt 	uint64_t ts_emptybuf;	/* empty buffers dropped */
5248a1e4c2Syamt 	uint64_t ts_dropbuf;	/* buffers dropped due to the global limit */
5348a1e4c2Syamt 	uint64_t ts_dropbuf_sample; /* samples dropped with ts_dropbuf */
5448a1e4c2Syamt };
55*caba1a6fSryo 
56*caba1a6fSryo #define	TPROF_IOC_GETINFO		_IOR('T', 1, struct tprof_info)
57*caba1a6fSryo #define	TPROF_IOC_START			_IOW('T', 2, tprof_countermask_t)
58*caba1a6fSryo #define	TPROF_IOC_STOP			_IOW('T', 3, tprof_countermask_t)
5948a1e4c2Syamt #define	TPROF_IOC_GETSTAT		_IOR('T', 4, struct tprof_stat)
60*caba1a6fSryo #define	TPROF_IOC_GETNCOUNTERS		_IOR('T', 5, u_int)
61*caba1a6fSryo #define	TPROF_IOC_CONFIGURE_EVENT	_IOW('T', 6, tprof_param_t)
62*caba1a6fSryo #define	TPROF_IOC_GETCOUNTS		_IOWR('T', 7, tprof_counts_t)
6348a1e4c2Syamt 
6448a1e4c2Syamt #endif /* _DEV_TPROF_TPROF_IOCTL_H_ */
65