xref: /titanic_51/usr/src/uts/common/smbsrv/smb_kstat.h (revision a90cf9f29973990687fa61de9f1f6ea22e924e40)
16537f381Sas200622 /*
26537f381Sas200622  * CDDL HEADER START
36537f381Sas200622  *
46537f381Sas200622  * The contents of this file are subject to the terms of the
56537f381Sas200622  * Common Development and Distribution License (the "License").
66537f381Sas200622  * You may not use this file except in compliance with the License.
76537f381Sas200622  *
86537f381Sas200622  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
96537f381Sas200622  * or http://www.opensolaris.org/os/licensing.
106537f381Sas200622  * See the License for the specific language governing permissions
116537f381Sas200622  * and limitations under the License.
126537f381Sas200622  *
136537f381Sas200622  * When distributing Covered Code, include this CDDL HEADER in each
146537f381Sas200622  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
156537f381Sas200622  * If applicable, add the following below this CDDL HEADER, with the
166537f381Sas200622  * fields enclosed by brackets "[]" replaced with your own identifying
176537f381Sas200622  * information: Portions Copyright [yyyy] [name of copyright owner]
186537f381Sas200622  *
196537f381Sas200622  * CDDL HEADER END
206537f381Sas200622  */
216537f381Sas200622 /*
22148c5f43SAlan Wright  * Copyright (c) 2007, 2010, Oracle and/or its affiliates. All rights reserved.
23*a90cf9f2SGordon Ross  * Copyright 2013 Nexenta Systems, Inc.  All rights reserved.
246537f381Sas200622  */
256537f381Sas200622 
266537f381Sas200622 /*
276537f381Sas200622  * Kstat definitions for the SMB server module.
286537f381Sas200622  */
296537f381Sas200622 #ifndef _SMBSRV_SMB_KSTAT_H
306537f381Sas200622 #define	_SMBSRV_SMB_KSTAT_H
316537f381Sas200622 
32148c5f43SAlan Wright #include	<smbsrv/smb.h>
33*a90cf9f2SGordon Ross #include	<smbsrv/smb2.h>
34148c5f43SAlan Wright 
356537f381Sas200622 #ifdef	__cplusplus
366537f381Sas200622 extern "C" {
376537f381Sas200622 #endif
386537f381Sas200622 
39148c5f43SAlan Wright #define	SMBSRV_KSTAT_PROCESS		"smbd"
406537f381Sas200622 #define	SMBSRV_KSTAT_MODULE		"smbsrv"
416537f381Sas200622 #define	SMBSRV_KSTAT_CLASS		"net"
426537f381Sas200622 #define	SMBSRV_KSTAT_NAME		"smbsrv"
436537f381Sas200622 #define	SMBSRV_KSTAT_NAME_CMDS		"smbsrv_commands"
4421b7895dSjb150015 #define	SMBSRV_KSTAT_TXRCACHE		"smb_txreq"
452c2961f8Sjose borrego #define	SMBSRV_KSTAT_REQUEST_CACHE	"smb_request_cache"
462c2961f8Sjose borrego #define	SMBSRV_KSTAT_SESSION_CACHE	"smb_session_cache"
472c2961f8Sjose borrego #define	SMBSRV_KSTAT_USER_CACHE		"smb_user_cache"
482c2961f8Sjose borrego #define	SMBSRV_KSTAT_TREE_CACHE		"smb_tree_cache"
492c2961f8Sjose borrego #define	SMBSRV_KSTAT_OFILE_CACHE	"smb_ofile_cache"
502c2961f8Sjose borrego #define	SMBSRV_KSTAT_ODIR_CACHE		"smb_odir_cache"
512c2961f8Sjose borrego #define	SMBSRV_KSTAT_NODE_CACHE		"smb_node_cache"
522c2961f8Sjose borrego #define	SMBSRV_KSTAT_MBC_CACHE		"smb_mbc_cache"
53148c5f43SAlan Wright #define	SMBSRV_KSTAT_STATISTICS		"smbsrv_statistics"
54148c5f43SAlan Wright #define	SMBSRV_KSTAT_UNSUPPORTED	"Unsupported"
55148c5f43SAlan Wright #define	SMBSRV_KSTAT_WORKERS		"smb_workers"
56148c5f43SAlan Wright 
57148c5f43SAlan Wright #pragma pack(1)
58148c5f43SAlan Wright 
59148c5f43SAlan Wright typedef struct smb_kstat_utilization {
60148c5f43SAlan Wright 	hrtime_t	ku_wtime;
61148c5f43SAlan Wright 	hrtime_t	ku_wlentime;
62148c5f43SAlan Wright 	hrtime_t	ku_rtime;
63148c5f43SAlan Wright 	hrtime_t	ku_rlentime;
64148c5f43SAlan Wright } smb_kstat_utilization_t;
65148c5f43SAlan Wright 
66148c5f43SAlan Wright typedef struct smb_kstat_req {
67148c5f43SAlan Wright 	char		kr_name[KSTAT_STRLEN];
68cb174861Sjoyce mcintosh 	char		kr_pad[(~(KSTAT_STRLEN & 0x07) + 1) & 0x07];
69148c5f43SAlan Wright 	uint64_t	kr_sum;
70148c5f43SAlan Wright 	uint64_t	kr_txb;
71148c5f43SAlan Wright 	uint64_t	kr_rxb;
72148c5f43SAlan Wright 	uint64_t	kr_nreq;
73148c5f43SAlan Wright 	uint64_t	kr_a_mean;
74148c5f43SAlan Wright 	uint64_t	kr_a_stddev;
75148c5f43SAlan Wright 	uint64_t	kr_d_mean;
76148c5f43SAlan Wright 	uint64_t	kr_d_stddev;
77148c5f43SAlan Wright } smb_kstat_req_t;
78148c5f43SAlan Wright 
79148c5f43SAlan Wright typedef struct smbsrv_kstats {
80148c5f43SAlan Wright 	hrtime_t		ks_start_time;
81148c5f43SAlan Wright 	uint64_t		ks_txb;		/* Bytes transmitted */
82148c5f43SAlan Wright 	uint64_t		ks_rxb;		/* Bytes received */
83148c5f43SAlan Wright 	uint64_t		ks_nreq;	/* Requests treated */
84148c5f43SAlan Wright 	smb_kstat_utilization_t	ks_utilization;
85*a90cf9f2SGordon Ross 	smb_kstat_req_t		ks_reqs1[SMB_COM_NUM];
86*a90cf9f2SGordon Ross 	smb_kstat_req_t		ks_reqs2[SMB2__NCMDS];
87148c5f43SAlan Wright 	uint32_t		ks_nbt_sess;	/* NBT sessions */
88148c5f43SAlan Wright 	uint32_t		ks_tcp_sess;	/* TCP sessions */
89148c5f43SAlan Wright 	uint32_t		ks_users;	/* Users logged in */
90148c5f43SAlan Wright 	uint32_t		ks_trees;	/* Trees connected */
91148c5f43SAlan Wright 	uint32_t		ks_files;	/* Open files */
92148c5f43SAlan Wright 	uint32_t		ks_pipes;	/* Open pipes */
93148c5f43SAlan Wright 	uint32_t		ks_maxreqs;	/* Max number of reqs */
94148c5f43SAlan Wright 	uint32_t		ks_padding;
95148c5f43SAlan Wright } smbsrv_kstats_t;
96148c5f43SAlan Wright 
97148c5f43SAlan Wright #pragma pack()
986537f381Sas200622 
996537f381Sas200622 #ifdef	__cplusplus
1006537f381Sas200622 }
1016537f381Sas200622 #endif
1026537f381Sas200622 
1036537f381Sas200622 #endif /* _SMBSRV_SMB_KSTAT_H */
104