本文整理汇总了C++中LM_GEN1函数的典型用法代码示例。如果您正苦于以下问题:C++ LM_GEN1函数的具体用法?C++ LM_GEN1怎么用?C++ LM_GEN1使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了LM_GEN1函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: b2bl_print_tuple
void b2bl_print_tuple(b2bl_tuple_t* tuple, int log_level)
{
int index;
b2bl_entity_id_t* e;
if(tuple)
{
LM_GEN1(log_level, "[%p]->[%.*s] to_del=[%d] lifetime=[%d]"
" bridge_entities[%p][%p][%p]\n",
tuple, tuple->key->len, tuple->key->s,
tuple->to_del, tuple->lifetime,
tuple->bridge_entities[0], tuple->bridge_entities[1],
tuple->bridge_entities[2]);
for (index = 0; index < MAX_B2BL_ENT; index++)
{
e = tuple->servers[index];
if (e) _print_entity(index, e, log_level);
}
for (index = 0; index < MAX_B2BL_ENT; index++)
{
e = tuple->clients[index];
if (e) _print_entity(index, e, log_level);
}
for (index = 0; index < MAX_BRIDGE_ENT; index++)
{
e = tuple->bridge_entities[index];
if (e)
LM_GEN1(log_level, ".type=[%d] index=[%d] [%p]"
" peer=[%p] prev:next=[%p][%p]\n",
e->type, index, e, e->peer, e->prev, e->next);
}
}
}
开发者ID:dynamicpacket-public,项目名称:opensips17,代码行数:33,代码来源:records.c
示例2: cleanup
/**
* Clean up on exit. This should be called before exiting.
* \param show_status set to one to display the mem status
*/
void cleanup(int show_status)
{
LM_INFO("cleanup\n");
/*clean-up*/
/* hack: force-unlock the shared memory lock in case
some process crashed and let it locked; this will
allow an almost gracious shutdown */
if (mem_lock)
#ifdef HP_MALLOC
{
int i;
for (i = 0; i < HP_HASH_SIZE; i++)
shm_unlock(i);
}
#else
shm_unlock();
#endif
handle_ql_shutdown();
destroy_modules();
#ifdef USE_TCP
destroy_tcp();
#endif
#ifdef USE_TLS
destroy_tls();
#endif
destroy_timer();
destroy_stats_collector();
destroy_script_cb();
pv_free_extra_list();
destroy_argv_list();
destroy_black_lists();
#ifdef PKG_MALLOC
if (show_status){
LM_GEN1(memdump, "Memory status (pkg):\n");
pkg_status();
}
#endif
#ifdef SHM_MEM
cleanup_debug();
if (pt) shm_free(pt);
pt=0;
if (show_status){
LM_GEN1(memdump, "Memory status (shm):\n");
shm_status();
}
/* zero all shmem alloc vars that we still use */
shm_mem_destroy();
#endif
if (pid_file) unlink(pid_file);
if (pgid_file) unlink(pgid_file);
}
开发者ID:zhangzheyuk,项目名称:opensips,代码行数:60,代码来源:main.c
示例3: fm_free
void fm_free(struct fm_block* qm, void* p)
#endif
{
struct fm_frag* f,*n;
#ifdef DBG_MALLOC
LM_GEN1(memlog, "%s_free(%p), called from %s: %s(%d)\n", qm->name, p, file,
func, line);
if (p && (p > (void *)qm->last_frag || p < (void *)qm->first_frag)) {
LM_CRIT("bad pointer %p (out of memory block!) - aborting\n", p);
abort();
}
#endif
if (p==0) {
LM_GEN1(memlog, "free(0) called\n");
return;
}
f=(struct fm_frag*) ((char*)p-sizeof(struct fm_frag));
#ifdef DBG_MALLOC
LM_GEN1(memlog, "freeing block alloc'ed from %s: %s(%ld)\n", f->file, f->func,
f->line);
#endif
join:
if( qm->large_limit < qm->large_space )
goto no_join;
n = FRAG_NEXT(f);
if (((char*)n < (char*)qm->last_frag) && n->prev )
{
fm_remove_free(qm, n);
/* join */
f->size += n->size + FRAG_OVERHEAD;
#if defined(DBG_MALLOC) || defined(STATISTICS)
//qm->real_used -= FRAG_OVERHEAD;
qm->used += FRAG_OVERHEAD;
#endif
goto join;
}
no_join:
fm_insert_free(qm, f);
#if defined(DBG_MALLOC) || defined(STATISTICS)
qm->fragments -= 1;
#endif
pkg_threshold_check();
}
开发者ID:OpenSIPS,项目名称:opensips,代码行数:54,代码来源:f_malloc.c
示例4: dump_frag
void dump_frag( struct vqm_frag* f, int i )
{
LM_GEN1(memdump, " %3d. address=%p real size=%d bucket=%d\n", i,
(char*)f+sizeof(struct vqm_frag), f->size, f->u.inuse.bucket);
#ifdef DBG_QM_MALLOC
LM_GEN1(memdump, " demanded size=%d\n", f->demanded_size );
LM_GEN1(memdump, " alloc'd from %s: %s(%d)\n",
f->file, f->func, f->line);
LM_GEN1(memdump, " start check=%x, end check= %.*s\n",
f->check, END_CHECK_PATTERN_LEN, f->end_check );
#endif
}
开发者ID:bluemutedwisdom,项目名称:OpenSIPS,代码行数:12,代码来源:vq_malloc.c
示例5: sig_usr
/**
* Exit regulary on a specific signal.
* This is good for profiling which only works if exited regularly
* and not by default signal handlers
* \param signo The signal that should be handled
*/
static void sig_usr(int signo)
{
int status;
pid_t pid;
UNUSED(pid);
if (is_main){
if (sig_flag==0) sig_flag=signo;
else /* previous sig. not processed yet, ignoring? */
return; ;
if (dont_fork)
/* only one proc, doing everything from the sig handler,
unsafe, but this is only for debugging mode*/
handle_sigs();
}else{
/* process the important signals */
switch(signo){
case SIGPIPE:
LM_INFO("signal %d received\n", signo);
break;
case SIGINT:
case SIGTERM:
LM_INFO("signal %d received\n", signo);
/* print memory stats for non-main too */
#ifdef PKG_MALLOC
LM_GEN1(memdump, "Memory status (pkg):\n");
pkg_status();
#endif
exit(0);
break;
case SIGUSR1:
/* statistics -> show only pkg mem */
#ifdef PKG_MALLOC
LM_GEN1(memdump, "Memory status (pkg):\n");
pkg_status();
#endif
break;
case SIGUSR2:
#ifdef PKG_MALLOC
set_pkg_stats( get_pkg_status_holder(process_no) );
#endif
break;
case SIGHUP:
/* ignored*/
break;
case SIGCHLD:
pid = waitpid(-1, &status, WNOHANG);
LM_DBG("SIGCHLD received from %ld (status=%d), ignoring\n",
(long)pid,status);
}
}
}
开发者ID:dbeskoek,项目名称:opensips,代码行数:58,代码来源:main.c
示例6: cleanup
/**
* Clean up on exit. This should be called before exiting.
* \param show_status set to one to display the mem status
*/
void cleanup(int show_status)
{
LM_INFO("cleanup\n");
/*clean-up*/
if (mem_lock)
shm_unlock(); /* hack: force-unlock the shared memory lock in case
some process crashed and let it locked; this will
allow an almost gracious shutdown */
handle_ql_shutdown();
destroy_modules();
#ifdef USE_TCP
destroy_tcp();
#endif
#ifdef USE_TLS
destroy_tls();
#endif
destroy_timer();
destroy_stats_collector();
destroy_script_cb();
pv_free_extra_list();
destroy_argv_list();
destroy_black_lists();
#ifdef CHANGEABLE_DEBUG_LEVEL
if (debug!=&debug_init) {
reset_proc_debug_level();
debug_init = *debug;
shm_free(debug);
debug = &debug_init;
}
#endif
#ifdef PKG_MALLOC
if (show_status){
LM_GEN1(memdump, "Memory status (pkg):\n");
pkg_status();
}
#endif
#ifdef SHM_MEM
if (pt) shm_free(pt);
pt=0;
if (show_status){
LM_GEN1(memdump, "Memory status (shm):\n");
shm_status();
}
/* zero all shmem alloc vars that we still use */
shm_mem_destroy();
#endif
if (pid_file) unlink(pid_file);
if (pgid_file) unlink(pgid_file);
}
开发者ID:bluemutedwisdom,项目名称:OpenSIPS,代码行数:53,代码来源:main.c
示例7: siplua_log
void siplua_log(int lev, const char *format, ...)
{
va_list ap;
char *ret;
int priority;
if (!format)
return;
if (!(is_printable(lev) | lua_user_debug))
return;
va_start(ap, format);
vasprintf(&ret, format, ap);
va_end(ap);
LM_GEN1(lev, "siplua: %s", ret);
if (lua_user_debug)
{
switch (lev)
{
case L_ALERT: priority = LOG_ALERT; break;
case L_CRIT: priority = LOG_CRIT; break;
case L_ERR: priority = LOG_ERR; break;
case L_WARN: priority = LOG_WARNING; break;
case L_NOTICE: priority = LOG_NOTICE; break;
case L_INFO: priority = LOG_INFO; break;
case L_DBG: priority = LOG_DEBUG; break;
default: /* should not happen, no execution path permits it */
priority = LOG_ERR;
}
syslog(LOG_USER | priority, "siplua: %s", ret);
}
free(ret);
}
开发者ID:GeorgeShaw,项目名称:opensips,代码行数:32,代码来源:sipluafunc.c
示例8: xlog_2
int xlog_2(struct sip_msg* msg, char* lev, char* frm)
{
int log_len;
long level;
xl_level_p xlp;
pv_value_t value;
xlp = (xl_level_p)lev;
if(xlp->type==1)
{
if(pv_get_spec_value(msg, &xlp->v.sp, &value)!=0
|| value.flags&PV_VAL_NULL || !(value.flags&PV_VAL_INT))
{
LM_ERR("invalid log level value [%d]\n", value.flags);
return -1;
}
level = (long)value.ri;
} else {
level = xlp->v.level;
}
if(!is_printable((int)level))
return 1;
log_len = xlog_buf_size;
if(xl_print_log(msg, (pv_elem_t*)frm, &log_len)<0)
return -1;
/* log_buf[log_len] = '\0'; */
LM_GEN1((int)level, "%.*s", log_len, log_buf);
return 1;
}
开发者ID:ZRouter,项目名称:ZRouter,代码行数:34,代码来源:xlog.c
示例9: vqm_status
void vqm_status(struct vqm_block* qm)
{
struct vqm_frag* f;
unsigned int i,on_list;
LM_GEN1(memdump, "vqm_status (%p):\n", qm);
if (!qm) return;
LM_GEN1(memdump, " heap size= %d, available: %d\n",
qm->core_end-qm->init_core, qm->free_core );
LM_GEN1(memdump, "dumping unfreed fragments:\n");
for (f=(struct vqm_frag*)qm->init_core, i=0;(char*)f<(char*)qm->core;
f=FRAG_NEXT(f) ,i++) if ( FRAG_ISUSED(f) ) dump_frag(f, i);
LM_GEN1(memdump, "dumping unfreed big fragments:\n");
for (f=(struct vqm_frag*)qm->big_chunks,i=0;(char*)f<(char*)qm->core_end;
f=FRAG_NEXT(f) ,i++) if ( FRAG_ISUSED(f) ) dump_frag( f, i );
#ifdef DBG_QM_MALLOC
LM_GEN1(memdump,"dumping bucket statistics:\n");
for (i=0; i<=BIG_BUCKET(qm); i++) {
for(on_list=0, f=qm->next_free[i]; f; f=f->u.nxt_free ) on_list++;
LM_GEN1(memdump," %3d. bucket: in use: %ld, on free list: %d\n",
i, qm->usage[i], on_list );
}
#endif
LM_GEN1(memdump, "-----------------------------\n");
}
开发者ID:bluemutedwisdom,项目名称:OpenSIPS,代码行数:28,代码来源:vq_malloc.c
示例10: _print_entity
static void _print_entity(int index, b2bl_entity_id_t* e, int log_level)
{
b2bl_entity_id_t* c = e;
while (c)
{
LM_GEN1(log_level, ".type=[%d] index=[%d] [%p]->[%.*s] state=%d no=%d"
" dlginfo=[%p] peer=[%p] prev:next=[%p][%p]\n",
c->type, index, c, c->key.len, c->key.s, c->state, c->no,
c->dlginfo, c->peer, c->prev, c->next);
if (c->dlginfo)
LM_GEN1(log_level, "..........dlginfo=[%p]->[%.*s][%.*s][%.*s]\n",
c->dlginfo, c->dlginfo->callid.len, c->dlginfo->callid.s,
c->dlginfo->fromtag.len, c->dlginfo->fromtag.s,
c->dlginfo->totag.len, c->dlginfo->totag.s);
c = c->next;
}
}
开发者ID:dynamicpacket-public,项目名称:opensips17,代码行数:18,代码来源:records.c
示例11: hp_status
void hp_status(struct hp_block *qm)
{
struct hp_frag* f;
unsigned int i,j;
unsigned int h;
int unused;
unsigned long size;
LM_GEN1(memdump, "hp_status (%p):\n", qm);
if (!qm) return;
LM_GEN1(memdump, " heap size= %ld\n", qm->size);
#ifdef STATISTICS
LM_GEN1(memdump, " used= %lu, used+overhead=%lu, free=%lu\n",
qm->used, qm->real_used, qm->size-qm->used);
LM_GEN1(memdump, " max used (+overhead)= %lu\n", qm->max_real_used);
#endif
LM_GEN1(memdump, "dumping free list:\n");
for(h=0,i=0,size=0; h<HP_HASH_SIZE; h++) {
unused=0;
for (f=qm->free_hash[h].first,j=0; f;
size+=f->size,f=f->u.nxt_free,i++,j++) { }
if (j) LM_GEN1(memdump,"hash = %3d fragments no.: %5d, unused: %5d\n\t\t"
" bucket size: %9lu - %9lu (first %9lu)\n",
h, j, unused, UN_HASH(h),
((h<=HP_MALLOC_OPTIMIZE/ROUNDTO)?1:2)* UN_HASH(h),
qm->free_hash[h].first->size
);
if (j!=qm->free_hash[h].no) {
LM_CRIT("different free frag. count: %d!=%ld"
" for hash %3d\n", j, qm->free_hash[h].no, h);
}
}
LM_GEN1(memdump, "TOTAL: %6d free fragments = %6lu free bytes\n", i, size);
LM_GEN1(memdump, "TOTAL: %ld large bytes\n", qm->large_space );
LM_GEN1(memdump, "TOTAL: %u overhead\n", (unsigned int)FRAG_OVERHEAD );
LM_GEN1(memdump, "-----------------------------\n");
}
开发者ID:austin98x,项目名称:opensips,代码行数:41,代码来源:hp_malloc.c
示例12: refresh_node
static inline void refresh_node( struct ip_node *node)
{
for( ; node ; node=node->next ) {
node->hits[PREV_POS] = node->hits[CURR_POS];
node->hits[CURR_POS] = 0;
node->leaf_hits[PREV_POS] = node->leaf_hits[CURR_POS];
node->leaf_hits[CURR_POS] = 0;
if ( node->flags&NODE_ISRED_FLAG && !is_node_hot_leaf(node) ) {
node->flags &= ~(NODE_ISRED_FLAG);
LM_GEN1( pike_log_level,"PIKE - UNBLOCKing node %p\n",node);
}
if (node->kids)
refresh_node( node->kids );
}
}
开发者ID:GeorgeShaw,项目名称:opensips,代码行数:15,代码来源:pike_funcs.c
示例13: xdbg
int xdbg(struct sip_msg* msg, char* frm, char* str2)
{
int log_len;
if(!is_printable(L_DBG))
return 1;
log_len = xlog_buf_size;
if(xl_print_log(msg, (pv_elem_t*)frm, &log_len)<0)
return -1;
/* log_buf[log_len] = '\0'; */
LM_GEN1(L_DBG, "%.*s", log_len, log_buf);
return 1;
}
开发者ID:ZRouter,项目名称:ZRouter,代码行数:17,代码来源:xlog.c
示例14: sng_logger
static int sng_logger(int level, char *fmt, ...)
{
va_list args;
static char buffer[256];
va_start(args, fmt);
vsnprintf(buffer, 256, fmt, args);
switch (level) {
case SNGTC_LOGLEVEL_DEBUG:
LM_GEN1(L_DBG, fmt, args);
LM_DBG("%s\n", buffer);
break;
case SNGTC_LOGLEVEL_WARN:
LM_GEN1(L_WARN, fmt, args);
LM_WARN("%s\n", buffer);
break;
case SNGTC_LOGLEVEL_INFO:
LM_GEN1(L_INFO, fmt, args);
LM_INFO("%s\n", buffer);
break;
case SNGTC_LOGLEVEL_STATS:
LM_GEN1(L_INFO, fmt, args);
LM_INFO("%s\n", buffer);
break;
case SNGTC_LOGLEVEL_ERROR:
LM_GEN1(L_ERR, fmt, args);
LM_ERR("%s\n", buffer);
break;
case SNGTC_LOGLEVEL_CRIT:
LM_GEN1(L_CRIT, fmt, args);
LM_CRIT("%s\n", buffer);
break;
default:
LM_GEN1(L_WARN, fmt, args);
}
va_end(args);
return 0;
}
开发者ID:Distrotech,项目名称:opensips,代码行数:43,代码来源:sngtc.c
示例15: fm_status
void fm_status(struct fm_block* qm)
{
struct fm_frag* f;
unsigned int i,j;
unsigned int h;
int unused;
unsigned long size;
#ifdef DBG_MALLOC
mem_dbg_htable_t allocd;
struct mem_dbg_entry *it;
#endif
LM_GEN1(memdump, "fm_status (%p):\n", qm);
if (!qm) return;
LM_GEN1(memdump, " heap size= %ld\n", qm->size);
#if defined(DBG_MALLOC) || defined(STATISTICS)
LM_GEN1(memdump, " used= %lu, used+overhead=%lu, free=%lu\n",
qm->used, qm->real_used, qm->size-qm->used);
LM_GEN1(memdump, " max used (+overhead)= %lu\n", qm->max_real_used);
#endif
#if defined(DBG_MALLOC)
dbg_ht_init(allocd);
for (f=qm->first_frag; (char*)f<(char*)qm->last_frag; f=FRAG_NEXT(f))
if (!f->is_free)
if (dbg_ht_update(allocd, f->file, f->func, f->line, f->size) < 0) {
LM_ERR("Unable to update alloc'ed. memory summary\n");
dbg_ht_free(allocd);
return;
}
LM_GEN1(memdump, " dumping summary of all alloc'ed. fragments:\n");
for(i=0; i < DBG_HASH_SIZE; i++) {
it = allocd[i];
while (it) {
LM_GEN1(memdump, " %10lu : %lu x [%s: %s, line %lu]\n",
it->size, it->no_fragments, it->file, it->func, it->line);
it = it->next;
}
}
dbg_ht_free(allocd);
#endif
LM_GEN1(memdump, "dumping free list:\n");
for(h=0,i=0,size=0; h<F_HASH_SIZE; h++) {
unused=0;
for (f=qm->free_hash[h].first,j=0; f;
size+=f->size,f=f->u.nxt_free,i++,j++) { }
if (j) LM_GEN1(memdump,"hash = %3d fragments no.: %5d, unused: %5d\n\t\t"
" bucket size: %9lu - %9lu (first %9lu)\n",
h, j, unused, UN_HASH(h),
((h<=F_MALLOC_OPTIMIZE/ROUNDTO)?1:2)* UN_HASH(h),
qm->free_hash[h].first->size
);
if (j!=qm->free_hash[h].no) {
LM_CRIT("different free frag. count: %d!=%ld"
" for hash %3d\n", j, qm->free_hash[h].no, h);
}
}
LM_GEN1(memdump, "TOTAL: %6d free fragments = %6lu free bytes\n", i, size);
LM_GEN1(memdump, "TOTAL: %ld large bytes\n", qm->large_space );
LM_GEN1(memdump, "TOTAL: %u overhead\n", (unsigned int)FRAG_OVERHEAD );
LM_GEN1(memdump, "-----------------------------\n");
}
开发者ID:OpenSIPS,项目名称:opensips,代码行数:69,代码来源:f_malloc.c
示例16: print_action
void print_action(struct action* t)
{
switch(t->type){
case FORWARD_T:
LM_GEN1(L_DBG, "forward(");
break;
case SEND_T:
LM_GEN1(L_DBG, "send(");
break;
case ASSERT_T:
LM_GEN1(L_DBG, "assert(");
break;
case DROP_T:
LM_GEN1(L_DBG, "drop(");
break;
case LOG_T:
LM_GEN1(L_DBG, "log(");
break;
case ERROR_T:
LM_GEN1(L_DBG, "error(");
break;
case ROUTE_T:
LM_GEN1(L_DBG, "route(");
break;
case EXEC_T:
LM_GEN1(L_DBG, "exec(");
break;
case REVERT_URI_T:
LM_GEN1(L_DBG, "revert_uri(");
break;
case STRIP_T:
LM_GEN1(L_DBG, "strip(");
break;
case APPEND_BRANCH_T:
LM_GEN1(L_DBG, "append_branch(");
break;
case PREFIX_T:
LM_GEN1(L_DBG, "prefix(");
break;
case LEN_GT_T:
LM_GEN1(L_DBG, "len_gt(");
break;
case SET_DEBUG_T:
LM_GEN1(L_DBG, "setdebug(");
break;
case SETFLAG_T:
LM_GEN1(L_DBG, "setflag(");
break;
case RESETFLAG_T:
LM_GEN1(L_DBG, "resetflag(");
break;
case ISFLAGSET_T:
LM_GEN1(L_DBG, "isflagset(");
break;
case SETBFLAG_T:
LM_GEN1(L_DBG, "setbflag(");
break;
case RESETBFLAG_T:
LM_GEN1(L_DBG, "resetbflag(");
break;
case ISBFLAGSET_T:
LM_GEN1(L_DBG, "isbflagset(");
break;
case SETSFLAG_T:
LM_GEN1(L_DBG, "setsflag(");
break;
case RESETSFLAG_T:
LM_GEN1(L_DBG, "resetsflag(");
break;
case ISSFLAGSET_T:
LM_GEN1(L_DBG, "issflagset(");
break;
case SET_HOST_T:
LM_GEN1(L_DBG, "sethost(");
break;
case SET_HOSTPORT_T:
LM_GEN1(L_DBG, "sethostport(");
break;
case SET_USER_T:
LM_GEN1(L_DBG, "setuser(");
break;
case SET_USERPASS_T:
LM_GEN1(L_DBG, "setuserpass(");
break;
case SET_PORT_T:
LM_GEN1(L_DBG, "setport(");
break;
case SET_URI_T:
LM_GEN1(L_DBG, "seturi(");
break;
case IF_T:
LM_GEN1(L_DBG, "if (");
break;
case WHILE_T:
LM_GEN1(L_DBG, "while (");
break;
case MODULE_T:
LM_GEN1(L_DBG, " external_module_call(");
break;
case FORCE_RPORT_T:
//.........这里部分代码省略.........
开发者ID:Gitlab11,项目名称:opensips,代码行数:101,代码来源:route_struct.c
示例17: _bm_log_timer
static int _bm_log_timer(unsigned int id)
{
/* BM_CLOCK_REALTIME */
bm_timeval_t now;
unsigned long long tdiff;
benchmark_timer_t *timer;
if (!timer_active(id))
return 1;
if(bm_get_time(&now)<0)
{
LM_ERR("error getting current time\n");
return -1;
}
timer = bm_mycfg->tindex[id];
tdiff = bm_diff_time(timer->start, &now);
_bm_last_time_diff = (int)tdiff;
/* What to do
* - update min, max, sum
* - if granularity hit: Log, reset min/max
*/
lock_get(timer->lock);
timer->sum += tdiff;
timer->last_sum += tdiff;
timer->calls++;
timer->global_calls++;
if (tdiff < timer->last_min)
timer->last_min = tdiff;
if (tdiff > timer->last_max)
timer->last_max = tdiff;
if (tdiff < timer->global_min)
timer->global_min = tdiff;
if (tdiff > timer->global_max)
timer->global_max = tdiff;
if (bm_mycfg->granularity > 0 && timer->calls >= bm_mycfg->granularity)
{
LM_GEN1(bm_mycfg->loglevel, "benchmark (timer %s [%d]): %llu ["
" msgs/total/min/max/avg - LR:"
" %i/%lld/%lld/%lld/%f | GB: %lld/%lld/%lld/%lld/%f]\n",
timer->name,
id,
tdiff,
timer->calls,
timer->last_sum,
timer->last_min,
timer->last_max,
((double)timer->last_sum)/bm_mycfg->granularity,
timer->global_calls,
timer->sum,
timer->global_min,
timer->global_max,
((double)timer->sum)/timer->global_calls);
soft_reset_timer(timer);
}
lock_release(timer->lock);
return 1;
}
开发者ID:Distrotech,项目名称:opensips,代码行数:71,代码来源:benchmark.c
示例18: pike_check_req
int pike_check_req(struct sip_msg *msg)
{
struct ip_node *node;
struct ip_node *father;
unsigned char flags;
struct ip_addr* ip;
#ifdef _test
/* get the ip address from second via */
if (parse_headers(msg, HDR_VIA1_F, 0)!=0 )
return -1;
if (msg->via1==0 )
return -1;
/* convert from string to ip_addr */
ip = str2ip( &msg->via1->host );
if (ip==0)
return -1;
#else
ip = &(msg->rcv.src_ip);
#endif
/* first lock the proper tree branch and mark the IP with one more hit*/
lock_tree_branch( ip->u.addr[0] );
node = mark_node( ip->u.addr, ip->len, &father, &flags);
if (node==0) {
unlock_tree_branch( ip->u.addr[0] );
/* even if this is an error case, we return true in script to avoid
* considering the IP as marked (bogdan) */
return 1;
}
LM_DBG("src IP [%s],node=%p; hits=[%d,%d],[%d,%d] node_flags=%d"
" func_flags=%d\n", ip_addr2a( ip ), node,
node->hits[PREV_POS],node->hits[CURR_POS],
node->leaf_hits[PREV_POS],node->leaf_hits[CURR_POS],
node->flags, flags);
/* update the timer */
lock_get(timer_lock);
if ( flags&NEW_NODE ) {
/* put this node into the timer list and remove its
father only if this has one kid and is not a LEAF_NODE*/
node->expires = get_ticks() + timeout;
append_to_timer( timer, &(node->timer_ll) );
node->flags |= NODE_INTIMER_FLAG;
if (father) {
LM_DBG("father %p: flags=%d kids->next=%p\n",
father,father->flags,father->kids->next);
if (!(father->flags&NODE_IPLEAF_FLAG) && !father->kids->next){
/* debug */
assert( has_timer_set(&(father->timer_ll))
&& (father->flags&(NODE_EXPIRED_FLAG|NODE_INTIMER_FLAG)) );
/* if the node is maked as expired by timer, let the timer
* to finish and remove the node */
if ( !(father->flags&NODE_EXPIRED_FLAG) ) {
remove_from_timer( timer, &(father->timer_ll) );
father->flags &= ~NODE_INTIMER_FLAG;
} else {
father->flags &= ~NODE_EXPIRED_FLAG;
}
}
}
} else {
/* update the timer -> in timer can be only nodes
* as IP-leaf(complete address) or tree-leaf */
if (node->flags&NODE_IPLEAF_FLAG || node->kids==0) {
/* tree leafs which are not potential red nodes are not update in
* order to make them to expire */
/* debug */
assert( has_timer_set(&(node->timer_ll))
&& (node->flags&(NODE_EXPIRED_FLAG|NODE_INTIMER_FLAG)) );
/* if node exprired, ignore the current hit and let is
* expire in timer process */
if ( !(flags&NO_UPDATE) && !(node->flags&NODE_EXPIRED_FLAG) ) {
node->expires = get_ticks() + timeout;
update_in_timer( timer, &(node->timer_ll) );
}
} else {
/* debug */
assert( !has_timer_set(&(node->timer_ll))
&& !(node->flags&(NODE_INTIMER_FLAG|NODE_EXPIRED_FLAG)) );
/* debug */
assert( !(node->flags&NODE_IPLEAF_FLAG) && node->kids );
}
}
/*print_timer_list( timer );*/ /* debug*/
lock_release(timer_lock);
unlock_tree_branch( ip->u.addr[0] );
/*print_tree( 0 );*/ /* debug */
if (flags&RED_NODE) {
if (flags&NEWRED_NODE) {
LM_GEN1( pike_log_level,
"PIKE - BLOCKing ip %s, node=%p\n",ip_addr2a(ip),node);
pike_raise_event(ip_addr2a(ip));
return -2;
}
//.........这里部分代码省略.........
开发者ID:GeorgeShaw,项目名称:opensips,代码行数:101,代码来源:pike_funcs.c
示例19: vqm_free
void vqm_free(struct vqm_block* qm, void* p)
#endif
{
struct vqm_frag *f, *next, *prev, *first_big;
unsigned char b;
#ifdef DBG_QM_MALLOC
LM_GEN1(memlog,"params (%p, %p), called from %s: %s(%d)\n",
qm, p, file, func, line);
if (p>(void *)qm->core_end || p<(void*)qm->init_core){
LM_CRIT("bad pointer %p (out of memory block!) - aborting\n", p);
abort();
}
#endif
if (p==0) {
LM_WARN("free(0) called\n");
return;
}
f=(struct vqm_frag*) ((char*)p-sizeof(struct vqm_frag));
b=f->u.inuse.bucket;
#ifdef DBG_QM_MALLOC
VQM_DEBUG_FRAG(qm, f);
if ( ! FRAG_ISUSED(f) ) {
LM_CRIT("freeing already freed pointer, first freed: %s: %s(%d) "
"- aborting\n", f->file, f->func, f->line);
abort();
}
if ( b>MAX_BUCKET ) {
LM_CRIT("fragment with too high bucket nr: "
"%d, allocated: %s: %s(%d) - aborting\n",
b, f->file, f->func, f->line);
abort();
}
LM_GEN1(memlog,"freeing %d bucket block alloc'ed from %s: %s(%d)\n",
f->u.inuse.bucket, f->file, f->func, f->line);
f->file=file; f->func=func; f->line=line;
qm->usage[ f->u.inuse.bucket ]--;
#endif
if (IS_BIGBUCKET(qm,b)) {
next=FRAG_NEXT(f);
if ((char *)next +sizeof( struct vqm_frag) < qm->core_end) {
VQM_DEBUG_FRAG(qm, next);
if (! FRAG_ISUSED(next)) { /* coalesce with next fragment */
LM_DBG("coalesced with next\n");
vqm_detach_free(qm, next);
f->size+=next->size;
FRAG_END(f)->size=f->size;
}
}
first_big = qm->next_free[b];
if (first_big && f>first_big) {
prev=FRAG_PREV(f);
VQM_DEBUG_FRAG(qm, prev);
if (!FRAG_ISUSED(prev)) { /* coalesce with prev fragment */
LM_DBG("coalesced with prev\n");
vqm_detach_free(qm, prev );
prev->size+=f->size;
f=prev;
FRAG_END(f)->size=f->size;
}
}
if ((char *)f==qm->big_chunks) { /* release unused core */
LM_DBG("big chunk released\n");
qm->free_core+=f->size;
qm->big_chunks+=f->size;
return;
}
first_big = qm->next_free[b];
/* fix reverse link (used only for BIG_BUCKET */
if (first_big) FRAG_END(first_big)->prv_free=f;
FRAG_END(f)->prv_free=0;
} else first_big = qm->next_free[b];
f->u.nxt_free = first_big; /* also clobbers magic */
qm->next_free[b] = f;
}
开发者ID:bluemutedwisdom,项目名称:OpenSIPS,代码行数:75,代码来源:vq_malloc.c
示例20: print_expr
void print_expr(struct expr* exp)
{
if (exp==0){
LM_CRIT("null expression!\n");
return;
}
if (exp->type==ELEM_T){
switch(exp->left.type){
case METHOD_O:
LM_GEN1(L_DBG, "method");
break;
case URI_O:
LM_GEN1(L_DBG, "uri");
break;
case FROM_URI_O:
LM_GEN1(L_DBG, "from_uri");
break;
case TO_URI_O:
LM_GEN1(L_DBG, "to_uri");
break;
case SRCIP_O:
LM_GEN1(L_DBG, "srcip");
break;
case SRCPORT_O:
LM_GEN1(L_DBG, "srcport");
break;
case DSTIP_O:
LM_GEN1(L_DBG, "dstip");
break;
case DSTPORT_O:
LM_GEN1(L_DBG, "dstport");
break;
case SCRIPTVAR_O:
LM_GEN1(L_DBG, "scriptvar[%d]",
(exp->left.v.spec)?exp->left.v.spec->type:0);
break;
case NUMBER_O:
case NUMBERV_O:
LM_GEN1(L_DBG, "%d",exp->left.v.n);
break;
case STRINGV_O:
LM_GEN1(L_DBG, "\"%s\"", ZSW((char*)exp->left.v.data));
break;
case ACTION_O:
break;
case EXPR_O:
print_expr((struct expr*)exp->left.v.data);
break;
default:
LM_GEN1(L_DBG, "UNKNOWN[%d]", exp->left.type);
}
switch(exp->op){
case EQUAL_OP:
LM_GEN1(L_DBG, "==");
break;
case MATCHD_OP:
case MATCH_OP:
LM_GEN1(L_DBG, "=~");
break;
case NOTMATCHD_OP:
case NOTMATCH_OP:
LM_GEN1(L_DBG, "!~");
break;
case GT_OP:
LM_GEN1(L_DBG, ">");
break;
case GTE_OP:
LM_GEN1(L_DBG, ">=");
break;
case LT_OP:
LM_GEN1(L_DBG, "<");
break;
case LTE_OP:
LM_GEN1(L_DBG, "<=");
break;
case DIFF_OP:
LM_GEN1(L_DBG, "!=");
break;
case PLUS_OP:
LM_GEN1(L_DBG, "+");
break;
case MINUS_OP:
LM_GEN1(L_DBG, "-");
break;
case DIV_OP:
LM_GEN1(L_DBG, "/");
break;
case MULT_OP:
LM_GEN1(L_DBG, "*");
break;
case MODULO_OP:
LM_GEN1(L_DBG, " mod ");
break;
case BAND_OP:
LM_GEN1(L_DBG, "&");
break;
case BOR_OP:
LM_GEN1(L_DBG, "|");
break;
case BXOR_OP:
//.........这里部分代码省略.........
开发者ID:Gitlab11,项目名称:opensips,代码行数:101,代码来源:route_struct.c
注:本文中的LM_GEN1函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论