[sr-dev] git:master:1fdabbf5: app_perl: log the number of reset cycles in debug message

Daniel-Constantin Mierla miconda at gmail.com
Fri Sep 27 12:23:35 CEST 2019


Module: kamailio
Branch: master
Commit: 1fdabbf5ce5fd218a47b7d147ebec5c6c45c1cce
URL: https://github.com/kamailio/kamailio/commit/1fdabbf5ce5fd218a47b7d147ebec5c6c45c1cce

Author: Daniel-Constantin Mierla <miconda at gmail.com>
Committer: Daniel-Constantin Mierla <miconda at gmail.com>
Date: 2019-09-27T12:23:05+02:00

app_perl: log the number of reset cycles in debug message

---

Modified: src/modules/app_perl/app_perl_mod.c

---

Diff:  https://github.com/kamailio/kamailio/commit/1fdabbf5ce5fd218a47b7d147ebec5c6c45c1cce.diff
Patch: https://github.com/kamailio/kamailio/commit/1fdabbf5ce5fd218a47b7d147ebec5c6c45c1cce.patch

---

diff --git a/src/modules/app_perl/app_perl_mod.c b/src/modules/app_perl/app_perl_mod.c
index 2fb711706c..942581c6d6 100644
--- a/src/modules/app_perl/app_perl_mod.c
+++ b/src/modules/app_perl/app_perl_mod.c
@@ -201,7 +201,7 @@ PerlInterpreter *parser_init(void) {
 	perl_construct(new_perl);
 
 	argv[0] = ""; argc++; /* First param _needs_ to be empty */
-	
+
 	 /* Possible Include path extension by modparam */
 	if (modpath && (strlen(modpath) > 0)) {
 		modpathset_start = argc;
@@ -380,6 +380,7 @@ static void destroy(void)
 }
 
 
+static int app_perl_reset_n = 0;
 /**
  * count executions and rest interpreter
  *
@@ -400,8 +401,10 @@ int app_perl_reset_interpreter(void)
 	if(_ap_exec_cycles<=*_ap_reset_cycles)
 		return 0;
 
-	if(perl_destroy_func)
+	if(perl_destroy_func) {
 		call_argv(perl_destroy_func, G_DISCARD | G_NOARGS | G_EVAL, args);
+		LM_DBG("perl destroy function executed\n");
+	}
 
 	gettimeofday(&t1, NULL);
 	if (perl_reload()<0) {
@@ -411,10 +414,11 @@ int app_perl_reset_interpreter(void)
 	}
 	gettimeofday(&t2, NULL);
 
-	LM_INFO("perl interpreter has been reset [%d/%d] (%d.%06d => %d.%06d)\n",
+	app_perl_reset_n++;
+	LM_INFO("perl interpreter has been reset [%d/%d] (%d.%06d => %d.%06d) (n: %d)\n",
 				_ap_exec_cycles, *_ap_reset_cycles,
 				(int)t1.tv_sec, (int)t1.tv_usec,
-				(int)t2.tv_sec, (int)t2.tv_usec);
+				(int)t2.tv_sec, (int)t2.tv_usec, app_perl_reset_n);
 	_ap_exec_cycles = 0;
 
 	return 0;




More information about the sr-dev mailing list