当前位置: 首页>>代码示例>>C++>>正文


C++ LM_GEN1函数代码示例

本文整理汇总了C++中LM_GEN1函数的典型用法代码示例。如果您正苦于以下问题:C++ LM_GEN1函数的具体用法?C++ LM_GEN1怎么用?C++ LM_GEN1使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了LM_GEN1函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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


注:本文中的LM_GEN1函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。