00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032 #include "P_Net.h"
00033
00034 RecRawStatBlock *net_rsb = NULL;
00035 int net_config_poll_timeout = -1;
00036
00037 static inline void
00038 configure_net(void)
00039 {
00040 REC_RegisterConfigUpdateFunc("proxy.config.net.connections_throttle", change_net_connections_throttle, NULL);
00041 REC_ReadConfigInteger(fds_throttle, "proxy.config.net.connections_throttle");
00042 }
00043
00044
00045 static inline void
00046 register_net_stats()
00047 {
00048
00049
00050
00051 RecRegisterRawStat(net_rsb, RECT_PROCESS, "proxy.process.net.net_handler_run",
00052 RECD_INT, RECP_PERSISTENT, (int) net_handler_run_stat, RecRawStatSyncSum);
00053 NET_CLEAR_DYN_STAT(net_handler_run_stat);
00054
00055 RecRegisterRawStat(net_rsb, RECT_PROCESS, "proxy.process.net.read_bytes",
00056 RECD_INT, RECP_PERSISTENT, (int) net_read_bytes_stat, RecRawStatSyncSum);
00057
00058 RecRegisterRawStat(net_rsb, RECT_PROCESS, "proxy.process.net.write_bytes",
00059 RECD_INT, RECP_PERSISTENT, (int) net_write_bytes_stat, RecRawStatSyncSum);
00060
00061 RecRegisterRawStat(net_rsb, RECT_PROCESS, "proxy.process.net.connections_currently_open",
00062 RECD_INT, RECP_NON_PERSISTENT, (int) net_connections_currently_open_stat, RecRawStatSyncSum);
00063 NET_CLEAR_DYN_STAT(net_connections_currently_open_stat);
00064
00065 RecRegisterRawStat(net_rsb, RECT_PROCESS, "proxy.process.net.accepts_currently_open",
00066 RECD_INT, RECP_NON_PERSISTENT, (int) net_accepts_currently_open_stat, RecRawStatSyncSum);
00067 NET_CLEAR_DYN_STAT(net_accepts_currently_open_stat);
00068
00069 RecRegisterRawStat(net_rsb, RECT_PROCESS, "proxy.process.net.calls_to_readfromnet",
00070 RECD_INT, RECP_PERSISTENT, (int) net_calls_to_readfromnet_stat, RecRawStatSyncSum);
00071 NET_CLEAR_DYN_STAT(net_calls_to_readfromnet_stat);
00072
00073 RecRegisterRawStat(net_rsb, RECT_PROCESS, "proxy.process.net.calls_to_readfromnet_afterpoll",
00074 RECD_INT, RECP_PERSISTENT, (int) net_calls_to_readfromnet_afterpoll_stat, RecRawStatSyncSum);
00075 NET_CLEAR_DYN_STAT(net_calls_to_readfromnet_afterpoll_stat);
00076
00077 RecRegisterRawStat(net_rsb, RECT_PROCESS, "proxy.process.net.calls_to_read",
00078 RECD_INT, RECP_PERSISTENT, (int) net_calls_to_read_stat, RecRawStatSyncSum);
00079 NET_CLEAR_DYN_STAT(net_calls_to_read_stat);
00080
00081 RecRegisterRawStat(net_rsb, RECT_PROCESS, "proxy.process.net.calls_to_read_nodata",
00082 RECD_INT, RECP_PERSISTENT, (int) net_calls_to_read_nodata_stat, RecRawStatSyncSum);
00083 NET_CLEAR_DYN_STAT(net_calls_to_read_nodata_stat);
00084
00085 RecRegisterRawStat(net_rsb, RECT_PROCESS, "proxy.process.net.calls_to_writetonet",
00086 RECD_INT, RECP_PERSISTENT, (int) net_calls_to_writetonet_stat, RecRawStatSyncSum);
00087 NET_CLEAR_DYN_STAT(net_calls_to_writetonet_stat);
00088
00089 RecRegisterRawStat(net_rsb, RECT_PROCESS, "proxy.process.net.calls_to_writetonet_afterpoll",
00090 RECD_INT, RECP_PERSISTENT, (int) net_calls_to_writetonet_afterpoll_stat, RecRawStatSyncSum);
00091 NET_CLEAR_DYN_STAT(net_calls_to_writetonet_afterpoll_stat);
00092
00093 RecRegisterRawStat(net_rsb, RECT_PROCESS, "proxy.process.net.calls_to_write",
00094 RECD_INT, RECP_PERSISTENT, (int) net_calls_to_write_stat, RecRawStatSyncSum);
00095 NET_CLEAR_DYN_STAT(net_calls_to_write_stat);
00096
00097 RecRegisterRawStat(net_rsb, RECT_PROCESS, "proxy.process.net.calls_to_write_nodata",
00098 RECD_INT, RECP_PERSISTENT, (int) net_calls_to_write_nodata_stat, RecRawStatSyncSum);
00099 NET_CLEAR_DYN_STAT(net_calls_to_write_nodata_stat);
00100
00101 RecRegisterRawStat(net_rsb, RECT_PROCESS, "proxy.process.socks.connections_successful",
00102 RECD_INT, RECP_PERSISTENT, (int) socks_connections_successful_stat, RecRawStatSyncSum);
00103
00104 RecRegisterRawStat(net_rsb, RECT_PROCESS, "proxy.process.socks.connections_unsuccessful",
00105 RECD_INT, RECP_PERSISTENT, (int) socks_connections_unsuccessful_stat, RecRawStatSyncSum);
00106
00107 RecRegisterRawStat(net_rsb, RECT_PROCESS, "proxy.process.socks.connections_currently_open",
00108 RECD_INT, RECP_NON_PERSISTENT, (int) socks_connections_currently_open_stat, RecRawStatSyncSum);
00109 NET_CLEAR_DYN_STAT(socks_connections_currently_open_stat);
00110
00111 RecRegisterRawStat(net_rsb, RECT_PROCESS, "proxy.process.net.inactivity_cop_lock_acquire_failure",
00112 RECD_INT, RECP_PERSISTENT, (int) inactivity_cop_lock_acquire_failure_stat,
00113 RecRawStatSyncSum);
00114 }
00115
00116 void
00117 ink_net_init(ModuleVersion version)
00118 {
00119 static int init_called = 0;
00120
00121 ink_release_assert(!checkModuleVersion(version, NET_SYSTEM_MODULE_VERSION));
00122 if (!init_called) {
00123
00124
00125 net_rsb = RecAllocateRawStatBlock((int) Net_Stat_Count);
00126 configure_net();
00127 register_net_stats();
00128 }
00129
00130 init_called = 1;
00131 }