Kaynağa Gözat

kex Fix spelling error and add "core" as an example of a module name

Olle E. Johansson 9 yıl önce
ebeveyn
işleme
b5ef63f447
2 değiştirilmiş dosya ile 207 ekleme ve 81 silme
  1. 203 78
      modules/kex/README
  2. 4 3
      modules/kex/doc/kex_admin.xml

+ 203 - 78
modules/kex/README

@@ -21,56 +21,57 @@ Ovidiu Sas
 
 
    <[email protected]>
    <[email protected]>
 
 
-   Copyright © 2009 Daniel-Constantin Mierla
+   Copyright © 2009 Daniel-Constantin Mierla
 
 
-   Copyright © 2014 VoIP Embedded, Inc.
+   Copyright © 2014 VoIP Embedded, Inc.
      __________________________________________________________________
      __________________________________________________________________
 
 
    Table of Contents
    Table of Contents
 
 
    1. Admin Guide
    1. Admin Guide
 
 
-        1.1. Overview
-        1.2. Dependencies
-
-              1.2.1. Kamailio Modules
-              1.2.2. External Libraries or Applications
-
-        1.3. Functions
-
-              1.3.1. setsflag(flag)
-              1.3.2. issflagset(flag)
-              1.3.3. resetsflag(flag)
-              1.3.4. setbflag(flag [, branch])
-              1.3.5. isbflagset(flag [, branch])
-              1.3.6. resetbflag(flag [, branch])
-              1.3.7. setdsturi(uri)
-              1.3.8. resetdsturi()
-              1.3.9. isdsturiset()
-              1.3.10. pv_printf(var, str)
-              1.3.11. is_myself(uri)
-              1.3.12. setdebug(level)
-              1.3.13. resetdebug()
-              1.3.14. km_append_branch([uri])
-
-        1.4. MI Commands
-
-              1.4.1. arg
-              1.4.2. kill
-              1.4.3. pwd
-              1.4.4. uptime
-              1.4.5. version
-              1.4.6. which
-              1.4.7. get_statistics
-              1.4.8. reset_statistics
-              1.4.9. clear_statistics
-
-        1.5. RPC Commands
-
-              1.5.1. pkg.stats
-              1.5.2. stats.get_statistics
-              1.5.3. stats.reset_statistics
-              1.5.4. stats.clear_statistics
+        1. Overview
+        2. Dependencies
+
+              2.1. Kamailio Modules
+              2.2. External Libraries or Applications
+
+        3. Functions
+
+              3.1. setsflag(flag)
+              3.2. issflagset(flag)
+              3.3. resetsflag(flag)
+              3.4. setbflag(flag [, branch])
+              3.5. isbflagset(flag [, branch])
+              3.6. resetbflag(flag [, branch])
+              3.7. setdsturi(uri)
+              3.8. resetdsturi()
+              3.9. isdsturiset()
+              3.10. pv_printf(var, str)
+              3.11. is_myself(uri)
+              3.12. setdebug(level)
+              3.13. resetdebug()
+              3.14. km_append_branch([uri])
+
+        4. MI Commands
+
+              4.1. arg
+              4.2. kill
+              4.3. pwd
+              4.4. uptime
+              4.5. version
+              4.6. which
+              4.7. get_statistics
+              4.8. reset_statistics
+              4.9. clear_statistics
+
+        5. RPC Commands
+
+              5.1. pkg.stats
+              5.2. stats.get_statistics
+              5.3. stats.reset_statistics
+              5.4. stats.clear_statistics
+              5.5. mod.stats module_name/all pkg/shm/all
 
 
    List of Examples
    List of Examples
 
 
@@ -90,28 +91,91 @@ Ovidiu Sas
 
 
 Chapter 1. Admin Guide
 Chapter 1. Admin Guide
 
 
-1.1. Overview
+   Table of Contents
+
+   1. Overview
+   2. Dependencies
+
+        2.1. Kamailio Modules
+        2.2. External Libraries or Applications
+
+   3. Functions
+
+        3.1. setsflag(flag)
+        3.2. issflagset(flag)
+        3.3. resetsflag(flag)
+        3.4. setbflag(flag [, branch])
+        3.5. isbflagset(flag [, branch])
+        3.6. resetbflag(flag [, branch])
+        3.7. setdsturi(uri)
+        3.8. resetdsturi()
+        3.9. isdsturiset()
+        3.10. pv_printf(var, str)
+        3.11. is_myself(uri)
+        3.12. setdebug(level)
+        3.13. resetdebug()
+        3.14. km_append_branch([uri])
+
+   4. MI Commands
+
+        4.1. arg
+        4.2. kill
+        4.3. pwd
+        4.4. uptime
+        4.5. version
+        4.6. which
+        4.7. get_statistics
+        4.8. reset_statistics
+        4.9. clear_statistics
+
+   5. RPC Commands
+
+        5.1. pkg.stats
+        5.2. stats.get_statistics
+        5.3. stats.reset_statistics
+        5.4. stats.clear_statistics
+        5.5. mod.stats module_name/all pkg/shm/all
+
+1. Overview
 
 
    This module collects extensions from Kamailio core.
    This module collects extensions from Kamailio core.
 
 
    Kamailio Core CookBook is available at: http://kamailio.org/dokuwiki/
    Kamailio Core CookBook is available at: http://kamailio.org/dokuwiki/
 
 
-1.2. Dependencies
+2. Dependencies
+
+   2.1. Kamailio Modules
+   2.2. External Libraries or Applications
 
 
-1.2.1. Kamailio Modules
+2.1. Kamailio Modules
 
 
    The following modules must be loaded before this module:
    The following modules must be loaded before this module:
      * No dependencies on other Kamailio modules.
      * No dependencies on other Kamailio modules.
 
 
-1.2.2. External Libraries or Applications
+2.2. External Libraries or Applications
 
 
    The following libraries or applications must be installed before
    The following libraries or applications must be installed before
    running Kamailio with this module loaded:
    running Kamailio with this module loaded:
      * None.
      * None.
 
 
-1.3. Functions
-
-1.3.1. setsflag(flag)
+3. Functions
+
+   3.1. setsflag(flag)
+   3.2. issflagset(flag)
+   3.3. resetsflag(flag)
+   3.4. setbflag(flag [, branch])
+   3.5. isbflagset(flag [, branch])
+   3.6. resetbflag(flag [, branch])
+   3.7. setdsturi(uri)
+   3.8. resetdsturi()
+   3.9. isdsturiset()
+   3.10. pv_printf(var, str)
+   3.11. is_myself(uri)
+   3.12. setdebug(level)
+   3.13. resetdebug()
+   3.14. km_append_branch([uri])
+
+3.1. setsflag(flag)
 
 
    Set the script flag.
    Set the script flag.
 
 
@@ -129,7 +193,7 @@ $var(flag) = 11;
 setsflag("$var(flag)");
 setsflag("$var(flag)");
 ...
 ...
 
 
-1.3.2. issflagset(flag)
+3.2. issflagset(flag)
 
 
    Return true of the script flag is set.
    Return true of the script flag is set.
 
 
@@ -147,7 +211,7 @@ if(issflagset("1"))
 }
 }
 ...
 ...
 
 
-1.3.3. resetsflag(flag)
+3.3. resetsflag(flag)
 
 
    Reset the script flag.
    Reset the script flag.
 
 
@@ -162,7 +226,7 @@ if(issflagset("1"))
 resetsflag("1");
 resetsflag("1");
 ...
 ...
 
 
-1.3.4. setbflag(flag [, branch])
+3.4. setbflag(flag [, branch])
 
 
    Set the branch flag.
    Set the branch flag.
 
 
@@ -183,7 +247,7 @@ $var(flag) = 11;
 setbflag("$var(flag)", "1");
 setbflag("$var(flag)", "1");
 ...
 ...
 
 
-1.3.5. isbflagset(flag [, branch])
+3.5. isbflagset(flag [, branch])
 
 
    Return true of the branch flag is set.
    Return true of the branch flag is set.
 
 
@@ -204,7 +268,7 @@ if(isbflagset("1"))
 }
 }
 ...
 ...
 
 
-1.3.6. resetbflag(flag [, branch])
+3.6. resetbflag(flag [, branch])
 
 
    Reset the branch flag.
    Reset the branch flag.
 
 
@@ -222,7 +286,7 @@ if(isbflagset("1"))
 resetbflag("1");
 resetbflag("1");
 ...
 ...
 
 
-1.3.7. setdsturi(uri)
+3.7. setdsturi(uri)
 
 
    Set the destination address URI (outbound proxy address).
    Set the destination address URI (outbound proxy address).
 
 
@@ -239,7 +303,7 @@ resetbflag("1");
 setdsturi("sip:10.0.0.10");
 setdsturi("sip:10.0.0.10");
 ...
 ...
 
 
-1.3.8. resetdsturi()
+3.8. resetdsturi()
 
 
    Reset the destination address URI (outbound proxy address).
    Reset the destination address URI (outbound proxy address).
 
 
@@ -250,7 +314,7 @@ setdsturi("sip:10.0.0.10");
 resetdsturi();
 resetdsturi();
 ...
 ...
 
 
-1.3.9. isdsturiset()
+3.9. isdsturiset()
 
 
    Check if the destination address URI (outbound proxy address) is set.
    Check if the destination address URI (outbound proxy address) is set.
 
 
@@ -264,7 +328,7 @@ if(isdsturiset())
 }
 }
 ...
 ...
 
 
-1.3.10. pv_printf(var, str)
+3.10. pv_printf(var, str)
 
 
    Evalues the str and sets the resulting value to variable var. For
    Evalues the str and sets the resulting value to variable var. For
    backward compatibility reasons, the same function can be executed via
    backward compatibility reasons, the same function can be executed via
@@ -283,7 +347,7 @@ pv_printf("$ru", "sip:$rU@$fd");
 pv_printf("$avp(x)", "From: $fU - To: $tU");
 pv_printf("$avp(x)", "From: $fU - To: $tU");
 ...
 ...
 
 
-1.3.11. is_myself(uri)
+3.11. is_myself(uri)
 
 
    Check if the parameter matches the 'myself' condition (i.e., is a local
    Check if the parameter matches the 'myself' condition (i.e., is a local
    IP or domain).
    IP or domain).
@@ -302,7 +366,7 @@ if(is_myself("$fu")) {
 }
 }
 ...
 ...
 
 
-1.3.12. setdebug(level)
+3.12. setdebug(level)
 
 
    Set the debug log level per process.
    Set the debug log level per process.
 
 
@@ -320,7 +384,7 @@ $var(level) = 2;
 setdebug("$var(level)");
 setdebug("$var(level)");
 ...
 ...
 
 
-1.3.13. resetdebug()
+3.13. resetdebug()
 
 
    Reset the local debug log level back to the value of core parameter
    Reset the local debug log level back to the value of core parameter
    'debug'.
    'debug'.
@@ -332,14 +396,24 @@ setdebug("$var(level)");
 resetdebug();
 resetdebug();
 ...
 ...
 
 
-1.3.14. km_append_branch([uri])
+3.14. km_append_branch([uri])
 
 
    This function was replaced by append_branch() from corex module,
    This function was replaced by append_branch() from corex module,
    starting with version 4.0.0.
    starting with version 4.0.0.
 
 
-1.4. MI Commands
+4. MI Commands
+
+   4.1. arg
+   4.2. kill
+   4.3. pwd
+   4.4. uptime
+   4.5. version
+   4.6. which
+   4.7. get_statistics
+   4.8. reset_statistics
+   4.9. clear_statistics
 
 
-1.4.1.  arg
+4.1. arg
 
 
    Print command line arguments.
    Print command line arguments.
 
 
@@ -351,7 +425,7 @@ resetdebug();
                 :arg:_reply_fifo_file_
                 :arg:_reply_fifo_file_
                 _empty_line_
                 _empty_line_
 
 
-1.4.2.  kill
+4.2. kill
 
 
    Kill the application.
    Kill the application.
 
 
@@ -363,7 +437,7 @@ resetdebug();
                 :kill:_reply_fifo_file_
                 :kill:_reply_fifo_file_
                 _empty_line_
                 _empty_line_
 
 
-1.4.3.  pwd
+4.3. pwd
 
 
    Print working directory.
    Print working directory.
 
 
@@ -375,7 +449,7 @@ resetdebug();
                 :pwd:_reply_fifo_file_
                 :pwd:_reply_fifo_file_
                 _empty_line_
                 _empty_line_
 
 
-1.4.4.  uptime
+4.4. uptime
 
 
    Print uptime.
    Print uptime.
 
 
@@ -387,7 +461,7 @@ resetdebug();
                 :uptime:_reply_fifo_file_
                 :uptime:_reply_fifo_file_
                 _empty_line_
                 _empty_line_
 
 
-1.4.5.  version
+4.5. version
 
 
    Print version information.
    Print version information.
 
 
@@ -399,7 +473,7 @@ resetdebug();
                 :version:_reply_fifo_file_
                 :version:_reply_fifo_file_
                 _empty_line_
                 _empty_line_
 
 
-1.4.6.  which
+4.6. which
 
 
    Print list of available MI commands.
    Print list of available MI commands.
 
 
@@ -411,7 +485,7 @@ resetdebug();
                 :which:_reply_fifo_file_
                 :which:_reply_fifo_file_
                 _empty_line_
                 _empty_line_
 
 
-1.4.7.  get_statistics
+4.7. get_statistics
 
 
    Print the list of available internal statistics.
    Print the list of available internal statistics.
 
 
@@ -427,7 +501,7 @@ resetdebug();
                 _statsid_
                 _statsid_
                 _empty_line_
                 _empty_line_
 
 
-1.4.8.  reset_statistics
+4.8. reset_statistics
 
 
    Reset internal statistics.
    Reset internal statistics.
 
 
@@ -440,7 +514,7 @@ resetdebug();
                 _statsid_
                 _statsid_
                 _empty_line_
                 _empty_line_
 
 
-1.4.9.  clear_statistics
+4.9. clear_statistics
 
 
    Return statistics and reset their value in one command.
    Return statistics and reset their value in one command.
 
 
@@ -453,9 +527,15 @@ resetdebug();
                 _statsid_
                 _statsid_
                 _empty_line_
                 _empty_line_
 
 
-1.5. RPC Commands
+5. RPC Commands
 
 
-1.5.1.  pkg.stats
+   5.1. pkg.stats
+   5.2. stats.get_statistics
+   5.3. stats.reset_statistics
+   5.4. stats.clear_statistics
+   5.5. mod.stats module_name/all pkg/shm/all
+
+5.1. pkg.stats
 
 
    Print private memory (pkg) usage statistics per process. It can take
    Print private memory (pkg) usage statistics per process. It can take
    optinally a filter to print statistics only for a specific process or
    optinally a filter to print statistics only for a specific process or
@@ -473,7 +553,7 @@ resetdebug();
                 kamcmd pkg.stats rank 1
                 kamcmd pkg.stats rank 1
                 kamcmd pkg.stats index 10
                 kamcmd pkg.stats index 10
 
 
-1.5.2.  stats.get_statistics
+5.2. stats.get_statistics
 
 
    Print the list of available internal statistics.
    Print the list of available internal statistics.
 
 
@@ -488,7 +568,7 @@ resetdebug();
                 kamcmd stats.get_statistics unsupported_methods
                 kamcmd stats.get_statistics unsupported_methods
                 kamcmd stats.get_statistics shmem: fwd_requests fwd_replies
                 kamcmd stats.get_statistics shmem: fwd_requests fwd_replies
 
 
-1.5.3.  stats.reset_statistics
+5.3. stats.reset_statistics
 
 
    Reset internal statistics.
    Reset internal statistics.
 
 
@@ -500,7 +580,7 @@ resetdebug();
                 kamcmd stats.reset_statistics unsupported_methods
                 kamcmd stats.reset_statistics unsupported_methods
                 kamcmd stats.reset_statistics shmem: fwd_requests fwd_replies
                 kamcmd stats.reset_statistics shmem: fwd_requests fwd_replies
 
 
-1.5.4.  stats.clear_statistics
+5.4. stats.clear_statistics
 
 
    Return statistics and reset their value in one command.
    Return statistics and reset their value in one command.
 
 
@@ -511,3 +591,48 @@ resetdebug();
                 kamcmd stats.reset_statistics core:
                 kamcmd stats.reset_statistics core:
                 kamcmd stats.reset_statistics unsupported_methods
                 kamcmd stats.reset_statistics unsupported_methods
                 kamcmd stats.reset_statistics shmem: fwd_requests fwd_replies
                 kamcmd stats.reset_statistics shmem: fwd_requests fwd_replies
+
+5.5. mod.stats module_name/all pkg/shm/all
+
+   Print private(pkg) or shared(shm) memory currently allocated a given
+   module or by all modules.
+
+   NOTE: Processing is done only when the command is issued and involves
+   iterating throug the list of memory fragments and printing details
+   about them.
+
+   NOTE: Only the module functions that directly calls shm_alloc or
+   pkg_alloc are taken into consideration.
+
+   The first parameter can be one of the following:
+     * module_name - print statistics for specific module. Either a module
+       name (like "usrloc") or "core" for the Kamailio core.
+     * all - print statistics for all modules that uses memory.
+
+   The second parameter can be:
+     * pkg - print private (process) memory statistics.
+     * shm - print shared memory statistics.
+     * all - print both private and shared memory statistics.
+
+   Examples:
+                kamcmd mod.stats core all
+                kamcmd mod.stats userblacklist shm
+                kamcmd mod.stats kex pkg
+                kamcmd mod.stats all all
+
+   Output:
+Module: kex
+{
+    // this is the pkg zone of the module
+    // function_name(line_where_pkg_malloc_was_called): size_alloc'ed_by_pkg_mal
+loc
+    init_mi_uptime(74): 56
+    Total: 56
+}
+{
+    // this is the shm zone of the module
+    // function_name(line_where_shm_malloc_was_called): size_alloc'ed_by_shm_mal
+loc
+    pkg_proc_stats_init(79): 864
+    Total: 864
+}

+ 4 - 3
modules/kex/doc/kex_admin.xml

@@ -728,11 +728,12 @@ resetdebug();
 			NOTE: Only the module functions that <emphasis>directly</emphasis> calls shm_alloc or
 			NOTE: Only the module functions that <emphasis>directly</emphasis> calls shm_alloc or
             pkg_alloc are taken into consideration.
             pkg_alloc are taken into consideration.
 		</para>
 		</para>
-		<para>The firt parameter can be:</para>
+		<para>The first parameter can be one of the following:</para>
 		<itemizedlist>
 		<itemizedlist>
 		<listitem>
 		<listitem>
 			<para>
 			<para>
-				<emphasis>module_name</emphasis> - print statistics for specific module.
+				<emphasis>module_name</emphasis> - print statistics for specific module. Either 
+				a module name (like "usrloc") or "core" for the &kamailio; core.
 			</para>
 			</para>
 		</listitem>
 		</listitem>
 		<listitem>
 		<listitem>
@@ -746,7 +747,7 @@ resetdebug();
 		<itemizedlist>
 		<itemizedlist>
 		<listitem>
 		<listitem>
 			<para>
 			<para>
-				<emphasis>pkg</emphasis> - print private memory statistics.
+				<emphasis>pkg</emphasis> - print private (process) memory statistics.
 			</para>
 			</para>
 		</listitem>
 		</listitem>
 		<listitem>
 		<listitem>