浏览代码

- added description of $BM_time_diff PV
- handler function for $BM_time_diff using PV helper function


git-svn-id: https://openser.svn.sourceforge.net/svnroot/openser/trunk@3903 689a6050-402a-0410-94f2-e92a70836424

Daniel-Constantin Mierla 17 年之前
父节点
当前提交
4db69b655f

+ 31 - 12
modules_k/benchmark/README

@@ -3,13 +3,18 @@ Benchmark Module
 Bastian Friedrich
 Bastian Friedrich
 
 
    Collax GmbH
    Collax GmbH
+   <[email protected]>
 
 
 Daniel-Constantin Mierla
 Daniel-Constantin Mierla
 
 
+   <[email protected]>
+
 Edited by
 Edited by
 
 
 Bastian Friedrich
 Bastian Friedrich
 
 
+   <[email protected]>
+
    Copyright © 2007 Collax GmbH
    Copyright © 2007 Collax GmbH
 
 
    Copyright © 2007 Voice System SRL
    Copyright © 2007 Voice System SRL
@@ -39,14 +44,18 @@ Bastian Friedrich
               1.4.1. bm_start_timer(name)
               1.4.1. bm_start_timer(name)
               1.4.2. bm_log_timer(name)
               1.4.2. bm_log_timer(name)
 
 
-        1.5. Exported MI Functions
+        1.5. Exported pseudo-variables
+
+              1.5.1. $BM_time_diff
+
+        1.6. Exported MI Functions
 
 
-              1.5.1. bm_enable_global
-              1.5.2. bm_enable_timer
-              1.5.3. bm_granularity
-              1.5.4. bm_loglevel
+              1.6.1. bm_enable_global
+              1.6.2. bm_enable_timer
+              1.6.3. bm_granularity
+              1.6.4. bm_loglevel
 
 
-        1.6. Example of usage
+        1.7. Example of usage
 
 
    2. Developer's Guide
    2. Developer's Guide
 
 
@@ -194,14 +203,24 @@ bm_start_timer("test");
 bm_log_timer("test");
 bm_log_timer("test");
 ...
 ...
 
 
-1.5. Exported MI Functions
+1.5. Exported pseudo-variables
+
+   Exported pseudo-variables are listed in the next sections.
+
+1.5.1. $BM_time_diff
+
+   $BM_time_diff - the time difference elapsed between calls of
+   bm_start_timer(name) and bm_log_timer(name). The value is 0 if
+   no bm_log_timer() was called.
+
+1.6. Exported MI Functions
 
 
-1.5.1. bm_enable_global
+1.6.1. bm_enable_global
 
 
    Enables/disables the module. Parameter may be -1, 0 or 1. See
    Enables/disables the module. Parameter may be -1, 0 or 1. See
    discription of "enable" parameter.
    discription of "enable" parameter.
 
 
-1.5.2. bm_enable_timer
+1.6.2. bm_enable_timer
 
 
    Enable or disable a single timer. The following example enables
    Enable or disable a single timer. The following example enables
    timer "test" (the second parameter must be 0 to disable):
    timer "test" (the second parameter must be 0 to disable):
@@ -211,16 +230,16 @@ bm_log_timer("test");
 openserctl fifo bm_enable_timer test 1
 openserctl fifo bm_enable_timer test 1
 ...
 ...
 
 
-1.5.3. bm_granularity
+1.6.3. bm_granularity
 
 
    Modifies the benchmarking granularity. See "granularity"
    Modifies the benchmarking granularity. See "granularity"
    variable.
    variable.
 
 
-1.5.4. bm_loglevel
+1.6.4. bm_loglevel
 
 
    Modifies the module log level. See "loglevel" variable.
    Modifies the module log level. See "loglevel" variable.
 
 
-1.6. Example of usage
+1.7. Example of usage
 
 
    Measure the duration of user location lookup.
    Measure the duration of user location lookup.
 
 

+ 2 - 14
modules_k/benchmark/benchmark.c

@@ -608,21 +608,9 @@ struct mi_root* mi_bm_loglevel(struct mi_root *cmd, void *param)
 static int bm_get_time_diff(struct sip_msg *msg, pv_param_t *param,
 static int bm_get_time_diff(struct sip_msg *msg, pv_param_t *param,
 		pv_value_t *res)
 		pv_value_t *res)
 {
 {
-	int l = 0;
-	char *ch = NULL;
-
-	if(msg==NULL || res==NULL)
+	if(msg==NULL)
 		return -1;
 		return -1;
-	
-	ch = int2str(_bm_last_time_diff, &l);
-
-	res->rs.s = ch;
-	res->rs.len = l;
-
-	res->ri = _bm_last_time_diff;
-	res->flags = PV_VAL_STR|PV_VAL_INT|PV_TYPE_INT;
-
-	return 0;
+	return pv_get_sintval(msg, param, res, _bm_last_time_diff);
 }
 }
 
 
 
 

+ 0 - 6
modules_k/benchmark/doc/benchmark.xml

@@ -22,23 +22,17 @@
 		<firstname>Bastian</firstname>
 		<firstname>Bastian</firstname>
 		<surname>Friedrich</surname>
 		<surname>Friedrich</surname>
 		<affiliation><orgname>Collax GmbH</orgname></affiliation>
 		<affiliation><orgname>Collax GmbH</orgname></affiliation>
-		<address>
 		    <email>[email protected]</email>
 		    <email>[email protected]</email>
-		</address>
 	    </author>
 	    </author>
 	    <author>
 	    <author>
 		<firstname>Daniel-Constantin</firstname>
 		<firstname>Daniel-Constantin</firstname>
 		<surname>Mierla</surname>
 		<surname>Mierla</surname>
-		<address>
 		    <email>[email protected]</email>
 		    <email>[email protected]</email>
-		</address>
 	    </author>
 	    </author>
 	    <editor>
 	    <editor>
 		<firstname>Bastian</firstname>
 		<firstname>Bastian</firstname>
 		<surname>Friedrich</surname>
 		<surname>Friedrich</surname>
-		<address>
 		    <email>[email protected]</email>
 		    <email>[email protected]</email>
-		</address>
 	    </editor>
 	    </editor>
 	</authorgroup>
 	</authorgroup>
 	<copyright>
 	<copyright>

+ 16 - 0
modules_k/benchmark/doc/benchmark_admin.xml

@@ -245,6 +245,22 @@ bm_log_timer("test");
 	</section>
 	</section>
 	</section>
 	</section>
 
 
+	<section>
+		<title>Exported pseudo-variables</title>
+		<para>
+		Exported pseudo-variables are listed in the next sections.
+		</para>
+		<section>
+		<title>$BM_time_diff</title>
+			<para>
+			<emphasis>$BM_time_diff</emphasis> - the time difference
+			elapsed between calls of bm_start_timer(name) and
+			bm_log_timer(name). The value is 0 if no bm_log_timer()
+			was called.
+			</para>
+		</section>
+	</section>
+
 	<section>
 	<section>
 		<title>Exported MI Functions</title>
 		<title>Exported MI Functions</title>
 		<section>
 		<section>