本文整理汇总了C++中dbg_str函数的典型用法代码示例。如果您正苦于以下问题:C++ dbg_str函数的具体用法?C++ dbg_str怎么用?C++ dbg_str使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了dbg_str函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: cds_alloc_free
void cds_alloc_free(allocator_t *alloc,void *addr)
{
cds_slab_t *slab_list;
struct list_head *new_head;
struct list_head **free_slabs;
uint32_t size;
cds_alloc_t *alloc_p = &alloc->priv.cds_alloc;
dbg_str(DBG_ALLOC_DETAIL,"cds_alloc_free");
if(addr == NULL){
dbg_str(DBG_ALLOC_DETAIL,"release addr is NULL");
return;
}
slab_list = container_of(addr,cds_slab_t,data);
if(slab_list->stat_flag == 0){
dbg_str(DBG_WARNNING,"this addr has been released");
return;
}
dbg_str(DBG_ALLOC_DETAIL,"release slab_list:%p",slab_list);
dbg_str(DBG_ALLOC_DETAIL,"release mem_addr:%p,addr:%p",slab_list->mem_addr,addr);
new_head = &slab_list->list_head;
size = slab_list->size;
free_slabs = alloc_p->free_slabs;
slab_detach_list_from_used_slabs(alloc,
new_head,//struct list_head *del_head,
size);//uint32_t size);
slab_list->stat_flag = 0;
slab_attach_list_to_free_slabs(alloc,
new_head,//struct list_head *new_head,
size);//uint32_t size);
}
示例2: mempool_detach_list
/* not del list,just detach it from one link list */
void mempool_detach_list(struct list_head *del_head,struct list_head *hl_head)
{
cds_mempool_head_list_t *head_list;
cds_mempool_t *mempool_list;
dbg_str(DBG_ALLOC_DETAIL,"mempool_detach_list");
head_list = container_of(hl_head,cds_mempool_head_list_t,list_head);
/*
*pthread_rwlock_wrlock(&head_list->head_lock);
*/
sync_lock(&head_list->head_lock,NULL);
/*
*dbg_str(DBG_ALLOC_DETAIL,"mempool del head:%p, hl_head:%p",del_head,hl_head);
*dbg_str(DBG_ALLOC_DETAIL,"mempool del heads next:%p, prev:%p",del_head->next,del_head->prev);
*/
list_del(del_head);
head_list->count--;
mempool_list = container_of(del_head,cds_mempool_t,list_head);
sync_unlock(&head_list->head_lock);
/*
*pthread_rwlock_unlock(&head_list->head_lock);
*/
dbg_str(DBG_ALLOC_DETAIL,"del_mempool list,list count =%d",head_list->count);
}
示例3: slab_get_slab_index
void *cds_alloc_alloc(allocator_t *alloc,uint32_t size)
{
cds_slab_t *slab_list;
uint32_t index;
index = slab_get_slab_index(alloc,size);
dbg_str(DBG_ALLOC_DETAIL,"size=%d,index=%d,slab_array_max_num=%d",
size,index,alloc->priv.cds_alloc.slab_array_max_num);
if(size > alloc->priv.cds_alloc.mempool_capacity){
dbg_str(DBG_ERROR,"apply szie excess mempool_capacity");
return NULL;
}
if(index >= alloc->priv.cds_alloc.slab_array_max_num){
dbg_str(DBG_ERROR,"apply size:%d too large,max size:%d,excess slab num,"
"please assignd by sys malloc,or reconfig cds_alloc",size,20*8);
return NULL;
}else{
dbg_str(DBG_ALLOC_DETAIL,"cds_alloc_alloc");
slab_list = slab_get_first_list_from_free_slabs(alloc,size);
if(slab_list == NULL){
slab_list = mempool_alloc_slab_list(alloc,size);
}
slab_attach_list_to_used_slabs(alloc,&slab_list->list_head,size);
return slab_list->mem_addr;
}
}
示例4: hexstr2num
int hexstr2num(const char* const_str)
{
uint32_t ret=0;
uint32_t t;
char * str = (char *)const_str;
int len = strlen(str);
if(strncmp(str,"0x",2) && strncmp(str,"0X",2)) {
dbg_str(DBG_ERROR,"not hex data err");
return -1;
};
if(len > 10) {
dbg_str(DBG_ERROR,"str is too long");
return -1;
}
for (str += 2; *str; str++)
{
if (*str>='A' && *str <='F')
t = *str-55;//a-f之间的ascii与对应数值相差55如'A'为65,65-55即为A
else
t = *str-48;
ret <<= 4;
ret |= t;
}
return ret;
}
示例5: vector_push_back
int vector_push_back(vector_t *vector,void *data)
{
uint32_t data_size = vector->data_size;
void *vector_head = vector->vector_head;
uint32_t step = vector->step;
uint32_t capacity = vector->capacity;
uint32_t push_pos = vector->end.vector_pos;
sync_lock(&vector->vector_lock,NULL);
if(push_pos < capacity){
memcpy(vector_head + (push_pos++)*step,data,data_size);
vector_pos_init(&vector->end,push_pos,vector);
}else{
dbg_str(DBG_CONTAINER_WARNNING,"realloc mem");
vector->vector_head = allocator_mem_alloc(
vector->allocator, 2*capacity * (vector->step));
if(vector->vector_head == NULL){
dbg_str(DBG_CONTAINER_ERROR,"vector_push_back,realloc mem");
}
vector->capacity = 2*capacity;
memcpy(vector->vector_head,vector_head,capacity*step);
memcpy(vector->vector_head + (push_pos++)*step,data,data_size);
vector_pos_init(&vector->end,push_pos,vector);
allocator_mem_free(vector->allocator,vector_head);
}
sync_unlock(&vector->vector_lock);
dbg_str(DBG_CONTAINER_DETAIL,"vector_push_back,push_pos=%d,capacity=%d",push_pos,vector->capacity);
return 0;
}
示例6: pa_copy_protocol_format
int pa_copy_protocol_format(struct protocol_analyzer_s *pa)
{
int ret = 0;
if(pa->pf_list_head_p == NULL){
dbg_str(PA_ERROR,"pa_copy_protocol_format,pf_list_head_p == NULL");
return -1;
}
proto_head_list_t *head_list,*head_list_copy;
proto_info_list_t *info_list,*info_list_copy;
struct list_head *hl_head = pa->pf_list_head_p;
struct list_head *pos,*n;
if(hl_head == NULL){
dbg_str(PA_ERROR,"a_copy_protocol_format err,hl_head is NULL");
return -1;
}
head_list = container_of(hl_head,proto_head_list_t,list_head);
head_list_copy = (proto_head_list_t *)allocator_mem_alloc(pa->allocator,sizeof(proto_head_list_t));
memcpy(head_list_copy,head_list,sizeof(proto_head_list_t));
head_list_copy->allocator = pa->allocator;
head_list_copy->list_count = 0;
INIT_LIST_HEAD(&head_list_copy->list_head);
list_for_each_safe(pos, n, hl_head) {
info_list = container_of(pos,proto_info_list_t,list_head);
info_list_copy = (proto_info_list_t *)allocator_mem_alloc(pa->allocator,sizeof(proto_info_list_t));
memcpy(info_list_copy,info_list,sizeof(proto_info_list_t));
pfs_add_list(&info_list_copy->list_head,&head_list_copy->list_head);
}
示例7: __init_window
static int __init_window(Sdl_Graph *graph, void *window)
{
int ret;
Window *w = (Window *)window;
dbg_str(DBG_DETAIL,"Sdl_Graph create window");
dbg_str(DBG_DETAIL,"srceen width=%d, height=%d",w->screen_width,w->screen_height);
//Initialize SDL
if( SDL_Init( SDL_INIT_VIDEO ) < 0 ) {
dbg_str(DBG_ERROR,"SDL could not initialize! SDL_Error: %s", SDL_GetError() );
ret = -1;
} else {
//Create window
graph->window = SDL_CreateWindow("SDL Tutorial",
SDL_WINDOWPOS_UNDEFINED,
SDL_WINDOWPOS_UNDEFINED,
w->screen_width,
w->screen_height,
SDL_WINDOW_SHOWN );
if( graph->window == NULL ) {
dbg_str(DBG_ERROR,"Window could not be created! SDL_Error: %s\n", SDL_GetError() );
ret = -1;
} else {
graph->screen_surface = SDL_GetWindowSurface(graph->window);
ret = 1;
}
}
return ret;
}
示例8: __render_load_text
static void * __render_load_text(Sdl_Graph *graph,void *string,void *font,int r, int g, int b, int a)
{
allocator_t *allocator = ((Obj *)graph)->allocator;
Sdl_Text *text;
Sdl_Font *f = (Sdl_Font *)font;
SDL_Surface* surface = NULL;
SDL_Color textColor = {r, g, b, a };
String *content;
dbg_str(DBG_DETAIL,"Sdl_Text load text");
text = OBJECT_NEW(allocator, Sdl_Text,"");
content = ((Text *)text)->content;
content->assign(content,string);
surface = TTF_RenderText_Solid(f->ttf_font,
((Text *)text)->content->value,
textColor );
if(surface != NULL) {
text->texture = SDL_CreateTextureFromSurface(graph->render, surface);
text->width = surface->w;
text->height = surface->h;
dbg_str(DBG_DETAIL,"width =%d height=%d",text->width, text->height);
SDL_FreeSurface(surface);
}
return text;
}
示例9: __open_window
static int __open_window(Window *window)
{
Graph *g = window->graph;
dbg_str(DBG_DETAIL,"sdl window open_window start");
if(g != NULL) {
g->init_window(g,window);
/*
*background->load_image(background);
*g->draw_image(g,background);
*/
} else {
dbg_str(DBG_ERROR,"window graph is NULL, please check");
return -1;
}
g->render_create(g);
g->render_set_color(g,0xff,0xff,0xff,0xff);
g->render_clear(g);
g->render_present(g);
dbg_str(DBG_DETAIL,"sdl window open_window end");
/*
*g->update_window(g);
*/
}
示例10: args_parse_args
int
args_parse_args(args_processor_t *p,int argc, char *argv[])
{
int i = 0;
cmd_config_t *c;
uint8_t args_count;
for(i = 0; i < argc;){
c = args_find_entry(p,argv[i]);
if(c == NULL){
dbg_str(ARGS_WARNNING,"%s is not valid cmd,please check.We'll skip this cmd",argv[i]);
i++;
continue;
} else {
dbg_str(ARGS_DETAIL,"process cmd %s",argv[i]);
i++;
args_count = c->fn(p->base,argc - i,argv + i);
if(args_count != c->args_count){
dbg_str(ARGS_WARNNING,"the args funtion process args count is not equal the setting,"
"we'll compute by the default setting");
}
i+= c->args_count;
}
}
return 0;
}
示例11: test_datastructure_rbtree_map
int test_datastructure_rbtree_map(void)
{
int ret = 0;
rbtree_map_pos_t it,next,end;
rbtree_map_t *map;
allocator_t *allocator = allocator_get_default_alloc();
pair_t *pair;
struct rbtree_map_node *mnode;
int key_len = 2;
struct A t1 = {1,2};
struct A t2 = {2,2};
struct A t3 = {3,2};
struct A t4 = {4,2};
struct A t5 = {5,2};
dbg_str(DBG_DETAIL,"rbtree allocator addr:%p",allocator);
map = rbtree_map_create(allocator,0);
rbtree_map_init(map,key_len,sizeof(struct A) + key_len,NULL);
dbg_str(DBG_DETAIL,"create_pair");
pair = create_pair(key_len,sizeof(struct A));
make_pair(pair,"44",&t4);
rbtree_map_insert(map,pair->data);
make_pair(pair,"33",&t3);
rbtree_map_insert(map,pair->data);
make_pair(pair,"22",&t2);
rbtree_map_insert(map,pair->data);
make_pair(pair,"11",&t1);
rbtree_map_insert(map,pair->data);
dbg_str(DBG_DETAIL,"foreach ordinal print");
for( rbtree_map_begin(map,&it),rbtree_map_pos_next(&it,&next);
!rbtree_map_pos_equal(&it,rbtree_map_end(map,&end));
it = next,rbtree_map_pos_next(&it,&next))
{
mnode = rb_entry(it.rb_node_p,struct rbtree_map_node,node);
dbg_buf(DBG_DETAIL,"key:",mnode->key,mnode->value_pos);
print_A((struct A*)rbtree_map_pos_get_pointer(&it));
}
dbg_str(DBG_DETAIL,"search node key = 22");
rbtree_map_search(map, (void *)"22",&it);
print_A((struct A*)rbtree_map_pos_get_pointer(&it));
/*
*dbg_str(DBG_DETAIL,"delte node key = 11");
*container_delete(map,&it);
*/
rbtree_map_destroy(map);
allocator_destroy(allocator);
dbg_str(DBG_DETAIL,"map addr =%p",map);
return ret;
}
示例12: lab
int lab()
{
if(check_endian()) {
dbg_str(DBG_DETAIL,"little endian");
} else {
dbg_str(DBG_DETAIL,"big endian");
}
}
示例13: test_pdu_proto_analyzer
int test_pdu_proto_analyzer()
{
protocol_format_set_t *pfs_p;
struct protocol_analyzer_s *pa;
uint32_t ret = 0;
proto_info_list_t *info_list = NULL;
struct proto_analyzer_admin_s *pa_admin = NULL;
allocator = allocator_creator(ALLOCATOR_TYPE_SYS_MALLOC,0);
pfs_p = pfs_create_proto_format_set(allocator);
init_proto_format_set(0x0,100,pfs_p);
pfs_set_pdu_format_ackd(pfs_p);
/*
*pfs_print_proto_link_lists(pfs_p);
*/
/*set and parse test*/
pa = pa_create_protocol_analyzer(allocator);
pa_init_protocol_analyzer(0x8, pfs_p, pa);
/*
*pa = proto_analyer_admin_get_pa(pa_admin,0x3008);
*/
pa_set_value("LB",1,pa);
pa_set_value("PF",1,pa);
pa_set_value("CSBKO",0x2f,pa);
pa_set_value("FID",0x8,pa);
pa_set_value("RI",1,pa);
pa_set_value("ARC",4,pa);
pa_set_value("RSVD",1,pa);
pa_set_value("TADDR",0xfffc001,pa);
pa_set_value("SADDR",0xfffc002,pa);
dbg_str(DBG_IMPORTANT,"print list for each,orinal data");
pfs_print_list_for_each(pa->pa_list_head_p);
pa_generate_protocol_data(pa);
dbg_str(DBG_DETAIL,"pa_parse_protocol_data\n");
pa_parse_protocol_data(pa);
dbg_str(DBG_IMPORTANT,"print list for each after parse");
pfs_print_list_for_each(pa->pa_list_head_p);
dbg_str(DBG_DETAIL,"pa_destroy_protocol_analyzer");
pa_destroy_protocol_analyzer(pa);
dbg_str(DBG_DETAIL,"pfs_destroy_protocol_format_set");
pfs_destroy_protocol_format_set(pfs_p);
return ret;
}
示例14: process_task_callback
static int process_task_callback(client_task_t *task)
{
dbg_str(DBG_DETAIL,"process_task begin,client recv");
/*
*user_t *user = task->client;
*void *opaque = user->opaque;
*/
dbg_buf(DBG_VIP,"task buffer:",task->buffer,task->buffer_len);
dbg_str(DBG_DETAIL,"process_task end");
}
示例15: lab5
void lab5()
{
char *str = "a林能刚";
dbg_str(DBG_DETAIL,"strlen =%d",strlen(str));
dbg_str(DBG_DETAIL,"strlen =%s",str);
dbg_buf(DBG_DETAIL,"buff:",str, strlen(str));
}