t_stats.h

Go to the documentation of this file.
00001 /*
00002  * $Id: t_stats.h 4518 2008-07-28 15:39:28Z henningw $
00003  *
00004  * Copyright (C) 2006 Voice Sistem
00005  *
00006  * This file is part of Kamailio, a free SIP server.
00007  *
00008  * Kamailio is free software; you can redistribute it and/or modify
00009  * it under the terms of the GNU General Public License as published by
00010  * the Free Software Foundation; either version 2 of the License, or
00011  * (at your option) any later version
00012  *
00013  * Kamailio is distributed in the hope that it will be useful,
00014  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00015  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00016  * GNU General Public License for more details.
00017  *
00018  * You should have received a copy of the GNU General Public License 
00019  * along with this program; if not, write to the Free Software 
00020  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00021  *
00022  * History:
00023  * --------
00024  *  2006-02-07  initial version (bogdan)
00025  *  2006-11-28  modified stats_trans_rpl to track individual message codes
00026  *              (Jeffrey Magder - SOMA Networks)
00027  */
00028 
00029 /*! \file
00030  * \brief TM :: Transaction statistics
00031  *
00032  * \ingroup tm
00033  * - Module: \ref tm
00034  */
00035 
00036 #ifndef _T_STATS_H
00037 #define _T_STATS_H
00038 
00039 #include "../../statistics.h"
00040 
00041 extern int tm_enable_stats;
00042 
00043 
00044 /* statistic variables */
00045 extern stat_var *tm_rcv_rpls;
00046 extern stat_var *tm_rld_rpls;
00047 extern stat_var *tm_loc_rpls;
00048 extern stat_var *tm_uas_trans;
00049 extern stat_var *tm_uac_trans;
00050 extern stat_var *tm_trans_2xx;
00051 extern stat_var *tm_trans_3xx;
00052 extern stat_var *tm_trans_4xx;
00053 extern stat_var *tm_trans_5xx;
00054 extern stat_var *tm_trans_6xx;
00055 extern stat_var *tm_trans_inuse;
00056 
00057 
00058 #ifdef STATISTICS
00059 inline static void stats_trans_rpl( int code, int local ) {
00060 
00061    stat_var *numerical_stat;
00062 
00063    if (tm_enable_stats) {
00064       if (code>=700) {
00065          return;
00066       } else if (code>=600) {
00067          update_stat( tm_trans_6xx, 1);
00068       } else if (code>=500) {
00069          update_stat( tm_trans_5xx, 1);
00070       } else if (code>=400) {
00071          update_stat( tm_trans_4xx, 1);
00072       } else if (code>=300) {
00073          update_stat( tm_trans_3xx, 1);
00074       } else if (code>=200) {
00075          update_stat( tm_trans_2xx, 1);
00076       }
00077       if (local)
00078          update_stat( tm_loc_rpls, 1);
00079       else
00080          update_stat( tm_rld_rpls, 1);
00081 
00082       numerical_stat = 
00083          get_stat_var_from_num_code(code, 1);
00084 
00085       /* Increment the status code. */
00086       if (numerical_stat != NULL)
00087          update_stat(numerical_stat, 1);
00088 
00089    }
00090 }
00091 
00092 inline static void stats_trans_new( int local ) {
00093    if (tm_enable_stats) {
00094       update_stat( tm_trans_inuse, 1 );
00095       if (local)
00096          update_stat( tm_uac_trans, 1 );
00097       else
00098          update_stat( tm_uas_trans, 1 );
00099    }
00100 }
00101 #else
00102    #define stats_trans_rpl( _code , _local )  
00103    #define stats_trans_new( _local )  
00104 #endif
00105 
00106 #endif

Generated on Thu May 24 20:00:32 2012 for Kamailio - The Open Source SIP Server by  doxygen 1.5.6