/** * count executions and rest interpreter * */ int app_perl_reset_interpreter(void) { struct timeval t1; struct timeval t2; char *args[] = { NULL }; if(*_ap_reset_cycles==0) return 0; _ap_exec_cycles++; LM_DBG("perl interpreter exec cycle [%d/%d]\n", _ap_exec_cycles, *_ap_reset_cycles); if(_ap_exec_cycles<=*_ap_reset_cycles) return 0; if(perl_destroy_func) call_argv(perl_destroy_func, G_DISCARD | G_NOARGS, args); gettimeofday(&t1, NULL); if (perl_reload()<0) { LM_ERR("perl interpreter cannot be reset [%d/%d]\n", _ap_exec_cycles, *_ap_reset_cycles); return -1; } gettimeofday(&t2, NULL); LM_INFO("perl interpreter has been reset [%d/%d] (%d.%06d => %d.%06d)\n", _ap_exec_cycles, *_ap_reset_cycles, (int)t1.tv_sec, (int)t1.tv_usec, (int)t2.tv_sec, (int)t2.tv_usec); _ap_exec_cycles = 0; return 0; }
/** * count executions and rest interpreter * */ int app_perl_reset_interpreter(void) { struct timeval t1; struct timeval t2; if(*_ap_reset_cycles==0) return 0; _ap_exec_cycles++; LM_DBG("perl interpreter exec cycle [%d/%d]\n", _ap_exec_cycles, *_ap_reset_cycles); if(_ap_exec_cycles<=*_ap_reset_cycles) return 0; gettimeofday(&t1, NULL); if (perl_reload()<0) { LM_ERR("perl interpreter cannot be reset [%d/%d]\n", _ap_exec_cycles, *_ap_reset_cycles); return -1; } gettimeofday(&t2, NULL); LM_INFO("perl interpreter has been reset [%d/%d] (%d.%06d => %d.%06d)\n", _ap_exec_cycles, *_ap_reset_cycles, (int)t1.tv_sec, (int)t1.tv_usec, (int)t2.tv_sec, (int)t2.tv_usec); _ap_exec_cycles = 0; return 0; }
/* * Reinit through fifo. * Currently does not seem to work :(( */ struct mi_root* perl_mi_reload(struct mi_root *cmd_tree, void *param) { if (perl_reload()<0) { return init_mi_tree( 500, "Perl reload failed", 18); } else { return init_mi_tree( 200, MI_OK_S, MI_OK_LEN); } }