• Main Page
  • Related Pages
  • Namespaces
  • Data Structures
  • Files
  • File List
  • Globals

Net.cc

Go to the documentation of this file.
00001 /** @file
00002 
00003   A brief file description
00004 
00005   @section license License
00006 
00007   Licensed to the Apache Software Foundation (ASF) under one
00008   or more contributor license agreements.  See the NOTICE file
00009   distributed with this work for additional information
00010   regarding copyright ownership.  The ASF licenses this file
00011   to you under the Apache License, Version 2.0 (the
00012   "License"); you may not use this file except in compliance
00013   with the License.  You may obtain a copy of the License at
00014 
00015       http://www.apache.org/licenses/LICENSE-2.0
00016 
00017   Unless required by applicable law or agreed to in writing, software
00018   distributed under the License is distributed on an "AS IS" BASIS,
00019   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
00020   See the License for the specific language governing permissions and
00021   limitations under the License.
00022  */
00023 
00024 
00025 /************************************************************************
00026 
00027    Net.cc
00028 
00029 
00030 ************************************************************************/
00031 
00032 #include "P_Net.h"
00033 
00034 RecRawStatBlock *net_rsb = NULL;
00035 int net_config_poll_timeout = -1; // This will get set via either command line or records.config.
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   // Register statistics
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     // do one time stuff
00124     // create a stat block for NetStats
00125     net_rsb = RecAllocateRawStatBlock((int) Net_Stat_Count);
00126     configure_net();
00127     register_net_stats();
00128   }
00129 
00130   init_called = 1;
00131 }

Generated by  doxygen 1.7.1