VirtualBox

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

Last change on this file since 22403 was 22403, checked in by vboxsync, 15 years ago

NAT: (de-)register counter macrodifinitions was introduced.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 5.4 KB
Line 
1/** $Id: counters.h 22403 2009-08-24 07:12:48Z 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-2009 Sun Microsystems, Inc.
12 *
13 * This file is part of VirtualBox Open Source Edition (OSE), as
14 * available from http://www.virtualbox.org. This file is free software;
15 * you can redistribute it and/or modify it under the terms of the GNU
16 * General Public License (GPL) as published by the Free Software
17 * Foundation, in version 2 as it comes in the "COPYING" file of the
18 * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
19 * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
20 *
21 * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa
22 * Clara, CA 95054 USA or visit http://www.sun.com if you need
23 * additional information or have any questions.
24 */
25
26/*
27 * COUNTERS_INIT is used before using counters.h to declare helping macro
28 * definitions for (de-)registering counters
29 */
30#ifndef COUNTERS_H
31# define COUNTERS_H
32# if defined(VBOX_WITH_STATISTICS)
33# define REGISTER_COUNTER(name, type, units, dsc) \
34 do { \
35 PDMDrvHlpSTAMRegisterF(pDrvIns, \
36 &pData->Stat ## name, \
37 type, \
38 STAMVISIBILITY_ALWAYS, \
39 units, \
40 dsc, \
41 "/Drivers/NAT%u/" #name, \
42 pDrvIns->iInstance); \
43 } while (0)
44# define DEREGISTER_COUNTER(name) PDMDrvHlpSTAMDeregister(pDrvIns, &pData->Stat ## name)
45# else
46# define REGISTER_COUNTER(name, type, units, dsc) do {} while (0)
47# define DEREGISTER_COUNTER(name) do {} while (0)
48# endif
49#endif
50
51#ifndef COUNTERS_INIT
52# if !defined(PROFILE_COUNTER) && !defined(DRV_PROFILE_COUNTER)
53# error (DRV_)PROFILE_COUNTER is not defied
54# endif
55# if !defined(COUNTING_COUNTER) && !defined(DRV_COUNTING_COUNTER)
56# error (DRV_)COUNTING_COUNTER is not defined
57# endif
58
59/*
60 * DRV_ prefixed are counters used in DrvNAT the rest are used in Slirp
61 */
62# ifdef DRV_PROFILE_COUNTER
63# define PROFILE_COUNTER(name, dsc) do {} while (0)
64# endif
65# ifdef DRV_COUNTING_COUNTER
66# define COUNTING_COUNTER(name, dsc) do {} while (0)
67# endif
68
69# ifdef PROFILE_COUNTER
70# define DRV_PROFILE_COUNTER(name, dsc) do {} while (0)
71# endif
72# ifdef COUNTING_COUNTER
73# define DRV_COUNTING_COUNTER(name, dsc) do {} while (0)
74# endif
75
76PROFILE_COUNTER(Fill, "Profiling slirp fills");
77PROFILE_COUNTER(Poll, "Profiling slirp polls");
78PROFILE_COUNTER(FastTimer, "Profiling slirp fast timer");
79PROFILE_COUNTER(SlowTimer, "Profiling slirp slow timer");
80PROFILE_COUNTER(IOwrite, "Profiling IO sowrite");
81PROFILE_COUNTER(IOread, "Profiling IO soread");
82
83COUNTING_COUNTER(TCP, "TCP sockets");
84COUNTING_COUNTER(TCPHot, "TCP sockets active");
85COUNTING_COUNTER(UDP, "UDP sockets");
86COUNTING_COUNTER(UDPHot, "UDP sockets active");
87
88COUNTING_COUNTER(IORead_in_1, "SB IORead_in_1");
89COUNTING_COUNTER(IORead_in_1_bytes, "SB IORead_in_1_bytes");
90COUNTING_COUNTER(IORead_in_2, "SB IORead_in_2");
91COUNTING_COUNTER(IORead_in_2_1st_bytes, "SB IORead_in_2_1st_bytes");
92COUNTING_COUNTER(IORead_in_2_2nd_bytes, "SB IORead_in_2_2nd_bytes");
93COUNTING_COUNTER(IOWrite_in_1, "SB IOWrite_in_1");
94COUNTING_COUNTER(IOWrite_in_1_bytes, "SB IOWrite_in_1_bytes");
95COUNTING_COUNTER(IOWrite_in_2, "SB IOWrite_in_2");
96COUNTING_COUNTER(IOWrite_in_2_1st_bytes, "SB IOWrite_in_2_1st_bytes");
97COUNTING_COUNTER(IOWrite_in_2_2nd_bytes, "SB IOWrite_in_2_2nd_bytes");
98COUNTING_COUNTER(IOWrite_no_w, "SB IOWrite_no_w");
99COUNTING_COUNTER(IOWrite_rest, "SB IOWrite_rest");
100COUNTING_COUNTER(IOWrite_rest_bytes, "SB IOWrite_rest_bytes");
101
102PROFILE_COUNTER(IOSBAppend_pf, "Profiling sbuf::append common");
103PROFILE_COUNTER(IOSBAppend_pf_wa, "Profiling sbuf::append all writen in network");
104PROFILE_COUNTER(IOSBAppend_pf_wf, "Profiling sbuf::append writen fault");
105PROFILE_COUNTER(IOSBAppend_pf_wp, "Profiling sbuf::append writen partly");
106COUNTING_COUNTER(IOSBAppend, "SB: Append total");
107COUNTING_COUNTER(IOSBAppend_wa, "SB: Append all is written to network ");
108COUNTING_COUNTER(IOSBAppend_wf, "SB: Append nothing is written");
109COUNTING_COUNTER(IOSBAppend_wp, "SB: Append is written partly");
110COUNTING_COUNTER(IOSBAppend_zm, "SB: Append mbuf is zerro or less");
111
112COUNTING_COUNTER(IOSBAppendSB, "SB: AppendSB total");
113COUNTING_COUNTER(IOSBAppendSB_w_l_r, "SB: AppendSB (sb_wptr < sb_rptr)");
114COUNTING_COUNTER(IOSBAppendSB_w_ge_r, "SB: AppendSB (sb_wptr >= sb_rptr)");
115COUNTING_COUNTER(IOSBAppendSB_w_alter, "SB: AppendSB (altering of sb_wptr)");
116
117COUNTING_COUNTER(TCP_retransmit, "TCP::retransmit");
118
119PROFILE_COUNTER(TCP_reassamble, "TCP::reasamble");
120PROFILE_COUNTER(TCP_input, "TCP::input");
121PROFILE_COUNTER(IP_input, "IP::input");
122PROFILE_COUNTER(IP_output, "IP::output");
123PROFILE_COUNTER(IF_encap, "IF::encap");
124PROFILE_COUNTER(ALIAS_input, "ALIAS::input");
125PROFILE_COUNTER(ALIAS_output, "ALIAS::output");
126
127# undef DRV_COUNTING_COUNTER
128# undef DRV_PROFILE_COUNTER
129
130# undef COUNTING_COUNTER
131# undef PROFILE_COUNTER
132#endif /*!COUNTERS_INIT*/
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