VirtualBox

source: vbox/trunk/src/VBox/Devices/Network/slirp/counters.h

Last change on this file was 106061, checked in by vboxsync, 2 months ago

Copyright year updates by scm.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 5.9 KB
Line 
1/** $Id: counters.h 106061 2024-09-16 14:03:52Z vboxsync $ */
2/** @file
3 * Counters macro invocation template.
4 *
5 * This is included with different PROFILE_COUNTER and COUNTING_COUNTER
6 * implementations to instantiate data members, create function prototypes and
7 * implement these prototypes.
8 */
9
10/*
11 * Copyright (C) 2007-2024 Oracle and/or its affiliates.
12 *
13 * This file is part of VirtualBox base platform packages, as
14 * available from https://www.virtualbox.org.
15 *
16 * This program is free software; you can redistribute it and/or
17 * modify it under the terms of the GNU General Public License
18 * as published by the Free Software Foundation, in version 3 of the
19 * License.
20 *
21 * This program is distributed in the hope that it will be useful, but
22 * WITHOUT ANY WARRANTY; without even the implied warranty of
23 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
24 * General Public License for more details.
25 *
26 * You should have received a copy of the GNU General Public License
27 * along with this program; if not, see <https://www.gnu.org/licenses>.
28 *
29 * SPDX-License-Identifier: GPL-3.0-only
30 */
31
32/*
33 * COUNTERS_INIT is used before using counters.h to declare helping macro
34 * definitions for (de-)registering counters
35 */
36#ifndef COUNTERS_H
37# define COUNTERS_H
38# if defined(VBOX_WITH_STATISTICS)
39# define REGISTER_COUNTER(name, storage, type, units, dsc) \
40 do { \
41 PDMDrvHlpSTAMRegisterF(pDrvIns, \
42 &(storage)->Stat ## name, \
43 type, \
44 STAMVISIBILITY_ALWAYS, \
45 units, \
46 dsc, \
47 "/Drivers/NAT%u/" #name, \
48 pDrvIns->iInstance); \
49 } while (0)
50# define DEREGISTER_COUNTER(name, storage) PDMDrvHlpSTAMDeregister(pDrvIns, &(storage)->Stat ## name)
51# else
52# define REGISTER_COUNTER(name, storage, type, units, dsc) do {} while (0)
53# define DEREGISTER_COUNTER(name, storage) do {} while (0)
54# endif
55#else
56# undef COUNTERS_INIT
57#endif
58
59#ifndef COUNTERS_INIT
60# if !defined(PROFILE_COUNTER) && !defined(DRV_PROFILE_COUNTER)
61# error (DRV_)PROFILE_COUNTER is not defied
62# endif
63# if !defined(COUNTING_COUNTER) && !defined(DRV_COUNTING_COUNTER)
64# error (DRV_)COUNTING_COUNTER is not defined
65# endif
66
67/*
68 * DRV_ prefixed are counters used in DrvNAT the rest are used in Slirp
69 */
70
71# if defined(PROFILE_COUNTER) || defined(COUNTING_COUNTER)
72PROFILE_COUNTER(Fill, "Profiling slirp fills");
73PROFILE_COUNTER(Poll, "Profiling slirp polls");
74PROFILE_COUNTER(FastTimer, "Profiling slirp fast timer");
75PROFILE_COUNTER(SlowTimer, "Profiling slirp slow timer");
76PROFILE_COUNTER(IOwrite, "Profiling IO sowrite");
77PROFILE_COUNTER(IOread, "Profiling IO soread");
78
79COUNTING_COUNTER(TCP, "TCP sockets");
80COUNTING_COUNTER(TCPHot, "TCP sockets active");
81COUNTING_COUNTER(UDP, "UDP sockets");
82COUNTING_COUNTER(UDPHot, "UDP sockets active");
83
84COUNTING_COUNTER(IORead_in_1, "SB IORead_in_1");
85COUNTING_COUNTER(IORead_in_1_bytes, "SB IORead_in_1_bytes");
86COUNTING_COUNTER(IORead_in_2, "SB IORead_in_2");
87COUNTING_COUNTER(IORead_in_2_1st_bytes, "SB IORead_in_2_1st_bytes");
88COUNTING_COUNTER(IORead_in_2_2nd_bytes, "SB IORead_in_2_2nd_bytes");
89COUNTING_COUNTER(IOWrite_in_1, "SB IOWrite_in_1");
90COUNTING_COUNTER(IOWrite_in_1_bytes, "SB IOWrite_in_1_bytes");
91COUNTING_COUNTER(IOWrite_in_2, "SB IOWrite_in_2");
92COUNTING_COUNTER(IOWrite_in_2_1st_bytes, "SB IOWrite_in_2_1st_bytes");
93COUNTING_COUNTER(IOWrite_in_2_2nd_bytes, "SB IOWrite_in_2_2nd_bytes");
94COUNTING_COUNTER(IOWrite_no_w, "SB IOWrite_no_w");
95COUNTING_COUNTER(IOWrite_rest, "SB IOWrite_rest");
96COUNTING_COUNTER(IOWrite_rest_bytes, "SB IOWrite_rest_bytes");
97
98PROFILE_COUNTER(IOSBAppend_pf, "Profiling sbuf::append common");
99PROFILE_COUNTER(IOSBAppend_pf_wa, "Profiling sbuf::append all writen in network");
100PROFILE_COUNTER(IOSBAppend_pf_wf, "Profiling sbuf::append writen fault");
101PROFILE_COUNTER(IOSBAppend_pf_wp, "Profiling sbuf::append writen partly");
102COUNTING_COUNTER(IOSBAppend, "SB: Append total");
103COUNTING_COUNTER(IOSBAppend_wa, "SB: Append all is written to network ");
104COUNTING_COUNTER(IOSBAppend_wf, "SB: Append nothing is written");
105COUNTING_COUNTER(IOSBAppend_wp, "SB: Append is written partly");
106COUNTING_COUNTER(IOSBAppend_zm, "SB: Append mbuf is zerro or less");
107
108COUNTING_COUNTER(IOSBAppendSB, "SB: AppendSB total");
109COUNTING_COUNTER(IOSBAppendSB_w_l_r, "SB: AppendSB (sb_wptr < sb_rptr)");
110COUNTING_COUNTER(IOSBAppendSB_w_ge_r, "SB: AppendSB (sb_wptr >= sb_rptr)");
111COUNTING_COUNTER(IOSBAppendSB_w_alter, "SB: AppendSB (altering of sb_wptr)");
112COUNTING_COUNTER(MBufAllocation,"MBUF::shows number of mbufs in used list");
113
114COUNTING_COUNTER(TCP_retransmit, "TCP::retransmit");
115
116PROFILE_COUNTER(TCP_reassamble, "TCP::reasamble");
117PROFILE_COUNTER(TCP_input, "TCP::input");
118PROFILE_COUNTER(IP_input, "IP::input");
119PROFILE_COUNTER(IP_output, "IP::output");
120PROFILE_COUNTER(IF_encap, "IF::encap");
121PROFILE_COUNTER(ALIAS_input, "ALIAS::input");
122PROFILE_COUNTER(ALIAS_output, "ALIAS::output");
123
124# else
125/*DrvNAT.cpp*/
126DRV_COUNTING_COUNTER(NATRecvWakeups, "counting wakeups of NAT RX thread");
127DRV_PROFILE_COUNTER(NATRecv,"Time spent in NATRecv worker");
128DRV_PROFILE_COUNTER(NATRecvWait,"Time spent in NATRecv worker in waiting of free RX buffers");
129DRV_COUNTING_COUNTER(QueuePktSent, "counting packet sent via PDM Queue");
130DRV_COUNTING_COUNTER(QueuePktDropped, "counting packet drops by PDM Queue");
131DRV_COUNTING_COUNTER(ConsumerFalse, "counting consumer's reject number to process the queue's item");
132# endif
133#endif /*!COUNTERS_INIT*/
134
135#ifdef DRV_COUNTING_COUNTER
136# undef DRV_COUNTING_COUNTER
137#endif
138
139#ifdef DRV_PROFILE_COUNTER
140# undef DRV_PROFILE_COUNTER
141#endif
142
143#ifdef COUNTING_COUNTER
144# undef COUNTING_COUNTER
145#endif
146
147#ifdef PROFILE_COUNTER
148# undef PROFILE_COUNTER
149#endif
Note: See TracBrowser for help on using the repository browser.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette