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


C++ debugTrace函数代码示例

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


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

示例1: sendFileTo

void sendFileTo(char* message, int to, int from){
	char *file_contents;
	long input_file_size;
	//remove \n at end of string
	message[strlen(message)-1]=0;
	FILE* input_file = fopen(message,"r");

	if(input_file != NULL){
		fseek(input_file, 0, SEEK_END);
		input_file_size = ftell(input_file);
		rewind(input_file);
		file_contents = malloc(input_file_size * (sizeof(char)));
		fread(file_contents, sizeof(char), input_file_size, input_file);
		fclose(input_file);

		char* buf;
		int size = input_file_size+sizeof(message)+MAX_USR_LENGTH + 30;
		char tmp[size];
		memset(tmp,0,size);
		strcat(tmp,"ENDOFFILE");
		strcat(tmp," ; ");
		strcat(tmp,file_contents);

		buf = parseMessage(tmp,strlen(tmp));
		printf("N%s\n",buf);
		printf("Envoie au client : %d\n",to);
		if (Writeline(ctx.socketFd[to], buf, strlen(buf)+1) < 0){
			debugTrace("Message issue");
		}
		else {
			debugTrace("Message sent\n");
		}
		free(buf);
	}
}
开发者ID:platonisation,项目名称:server,代码行数:35,代码来源:server.c

示例2: sendAll

void sendAll(unsigned char* message, int actuel){

	int i = 0;
	char* buf;
	int size = strlen((char*)message)+MAX_USR_LENGTH + 20;
	char tmp[size];
	for(i=0;i<LISTENQ;i++){
		memset(tmp,0,size);
		if(ctx.socketFd[i] != -1  && (i != actuel)){
			strcat(tmp,usrDatas[actuel].name);
			strcat(tmp," : ");
			strcat(tmp,(char*)message);
			buf = parseMessage(tmp,strlen(tmp));
			printf("Envoie au client : %d\n",i);
			if (Writeline(ctx.socketFd[i], buf, strlen(buf)+1) < 0){
				debugTrace("Message issue");
			}
			else {
				debugTrace("Message sent\n");
			}
			free(buf);
		}

	}
}
开发者ID:platonisation,项目名称:server,代码行数:25,代码来源:server.c

示例3: isFile

int isFile(int messageSize){

	if(messageSize < 10000000){//10Mo, msg
		debugTrace("This is a message");
		return 1;
	}
	else{
		debugTrace("This is a file");
		return 2;
	}
}
开发者ID:platonisation,项目名称:server,代码行数:11,代码来源:server.c

示例4: printError

void printError(int err){
	switch(err){
		case 0:
			debugTrace("deconnection");
		break;
		case -1:
			debugTrace("Known error");
		break;
		case -2:
			debugTrace("Is this possible ?");
		break;
	}
}
开发者ID:platonisation,项目名称:server,代码行数:13,代码来源:server.c

示例5: moreCapabilities

void
moreCapabilities (nat from USED_IF_THREADS, nat to USED_IF_THREADS)
{
#if defined(THREADED_RTS)
    nat i;
    Capability **old_capabilities = capabilities;

    capabilities = stgMallocBytes(to * sizeof(Capability*), "moreCapabilities");

    if (to == 1) {
        // THREADED_RTS must work on builds that don't have a mutable
        // BaseReg (eg. unregisterised), so in this case
	// capabilities[0] must coincide with &MainCapability.
        capabilities[0] = &MainCapability;
    }

    for (i = 0; i < to; i++) {
        if (i < from) {
            capabilities[i] = old_capabilities[i];
        } else {
            capabilities[i] = stgMallocBytes(sizeof(Capability),
                                             "moreCapabilities");
            initCapability(capabilities[i], i);
        }
    }

    debugTrace(DEBUG_sched, "allocated %d more capabilities", to - from);

    if (old_capabilities != NULL) {
        stgFree(old_capabilities);
    }
#endif
}
开发者ID:AndersKroghDk,项目名称:ghc,代码行数:33,代码来源:Capability.c

示例6: traverseSparkQueue

/* GC for the spark pool, called inside Capability.c for all
   capabilities in turn. Blindly "evac"s complete spark pool. */
void
traverseSparkQueue (evac_fn evac, void *user, Capability *cap)
{
    StgClosure **sparkp;
    SparkPool *pool;
    StgWord top,bottom, modMask;
    
    pool = cap->sparks;

    ASSERT_WSDEQUE_INVARIANTS(pool);

    top = pool->top;
    bottom = pool->bottom;
    sparkp = (StgClosurePtr*)pool->elements;
    modMask = pool->moduloSize;

    while (top < bottom) {
    /* call evac for all closures in range (wrap-around via modulo)
     * In GHC-6.10, evac takes an additional 1st argument to hold a
     * GC-specific register, see rts/sm/GC.c::mark_root()
     */
      evac( user , sparkp + (top & modMask) ); 
      top++;
    }

    debugTrace(DEBUG_sparks,
               "traversed spark queue, len=%ld; (hd=%ld; tl=%ld)",
               sparkPoolSize(pool), pool->bottom, pool->top);
}
开发者ID:albertz,项目名称:ghc,代码行数:31,代码来源:Sparks.c

示例7: throw

void HttpUpdateDownloader::on(Complete, HttpConnection*, const string&) throw() {
#ifdef _DEBUG
	debugTrace("on(ModeChange)\n");
#endif
	if (!fileError && file != INVALID_HANDLE_VALUE) {
		CloseHandle(file);
		if (m_currentSize != m_fileSize) {
			char buffer[2048];
			snprintf(buffer, sizeof(buffer), "Size mismatch %s (downloaded %d, expected %d)", Util::getFileName(Text::fromT(targetPath)).c_str(), m_currentSize, m_fileSize);
			LOG_MESSAGE(buffer);
			DeleteFile(getTempFile().c_str());
			return;
		}
		const string currentMD5 = m_digest.digestAsString();
		if (Util::stricmp(currentMD5, m_fileMD5) != 0) {
			char buffer[2048];
			snprintf(buffer, sizeof(buffer), "MD5 mismatch %s (downloaded %s, expected %s)", Util::getFileName(Text::fromT(targetPath)).c_str(), currentMD5.c_str(), m_fileMD5.c_str());
			LOG_MESSAGE(buffer);
			DeleteFile(getTempFile().c_str());
			return;
		}
		LOG_MESSAGE("Successfully downloaded " + Text::fromT(targetPath));
		try {
			File::atomicRename(getTempFile(), targetPath);
			// файл скачался
			if (m_listener != NULL) {
				m_listener->onDownloadComplete(this);
			}
		}
		catch (const Exception& e) {
			LOG_MESSAGE("Error updating " + Text::fromT(targetPath) + ": " + e.getError());
		}
	}
}
开发者ID:inetra,项目名称:peers1,代码行数:34,代码来源:HttpUpdateDownloader.cpp

示例8: freeExec

void freeExec (void *addr)
{
    StgPtr p = (StgPtr)addr - 1;
    bdescr *bd = Bdescr((StgPtr)p);

    if ((bd->flags & BF_EXEC) == 0) {
        barf("freeExec: not executable");
    }

    if (*(StgPtr)p == 0) {
        barf("freeExec: already free?");
    }

    ACQUIRE_SM_LOCK;

    bd->gen_no -= *(StgPtr)p;
    *(StgPtr)p = 0;

    if (bd->gen_no == 0) {
        // Free the block if it is empty, but not if it is the block at
        // the head of the queue.
        if (bd != exec_block) {
            debugTrace(DEBUG_gc, "free exec block %p", bd->start);
            dbl_link_remove(bd, &exec_block);
            setExecutable(bd->start, bd->blocks * BLOCK_SIZE, rtsFalse);
            freeGroup(bd);
        } else {
            bd->free = bd->start;
        }
    }

    RELEASE_SM_LOCK
}
开发者ID:LeapYear,项目名称:ghc,代码行数:33,代码来源:Storage.c

示例9: freeTaskManager

nat
freeTaskManager (void)
{
    Task *task, *next;
    nat tasksRunning = 0;

    ACQUIRE_LOCK(&all_tasks_mutex);

    for (task = all_tasks; task != NULL; task = next) {
        next = task->all_next;
        if (task->stopped) {
            freeTask(task);
        } else {
            tasksRunning++;
        }
    }

    debugTrace(DEBUG_sched, "freeing task manager, %d tasks still running",
               tasksRunning);

    all_tasks = NULL;

    RELEASE_LOCK(&all_tasks_mutex);

#if defined(THREADED_RTS)
    closeMutex(&all_tasks_mutex); 
#if !defined(MYTASK_USE_TLV)
    freeThreadLocalKey(&currentTaskKey);
#endif
#endif

    tasksInitialized = 0;

    return tasksRunning;
}
开发者ID:A1kmm,项目名称:ghc,代码行数:35,代码来源:Task.c

示例10: resizeNurseriesEach

//
// Resize each of the nurseries to the specified size.
//
static void
resizeNurseriesEach (W_ blocks)
{
    uint32_t i, node;
    bdescr *bd;
    W_ nursery_blocks;
    nursery *nursery;

    for (i = 0; i < n_nurseries; i++) {
        nursery = &nurseries[i];
        nursery_blocks = nursery->n_blocks;
        if (nursery_blocks == blocks) continue;

        node = capNoToNumaNode(i);
        if (nursery_blocks < blocks) {
            debugTrace(DEBUG_gc, "increasing size of nursery to %d blocks",
                       blocks);
            nursery->blocks = allocNursery(node, nursery->blocks,
                                           blocks-nursery_blocks);
        }
        else
        {
            bdescr *next_bd;

            debugTrace(DEBUG_gc, "decreasing size of nursery to %d blocks",
                       blocks);

            bd = nursery->blocks;
            while (nursery_blocks > blocks) {
                next_bd = bd->link;
                next_bd->u.back = NULL;
                nursery_blocks -= bd->blocks; // might be a large block
                freeGroup(bd);
                bd = next_bd;
            }
            nursery->blocks = bd;
            // might have gone just under, by freeing a large block, so make
            // up the difference.
            if (nursery_blocks < blocks) {
                nursery->blocks = allocNursery(node, nursery->blocks,
                                               blocks-nursery_blocks);
            }
        }
        nursery->n_blocks = blocks;
        ASSERT(countBlocks(nursery->blocks) == nursery->n_blocks);
    }
}
开发者ID:alexbiehl,项目名称:ghc,代码行数:50,代码来源:Storage.c

示例11: openFloppy

/*
 * Open the floppy image file
 */
static void openFloppy() {
    fimage = fopen("floppy.bin", "rw");
    if (fimage == NULL) {
        fprintf(stderr, "Can't find 'floppy.bin'\n");
        debugTrace();
        exit(1);
    }
}
开发者ID:ahua,项目名称:java,代码行数:11,代码来源:test.c

示例12: interruptWorkerTask

void
interruptWorkerTask (Task *task)
{
  ASSERT(osThreadId() != task->id);    // seppuku not allowed
  ASSERT(task->incall->suspended_tso); // use this only for FFI calls
  interruptOSThread(task->id);
  debugTrace(DEBUG_sched, "interrupted worker task %p", taskId(task));
}
开发者ID:Eufavn,项目名称:ghc,代码行数:8,代码来源:Task.c

示例13: failure

failure(char *msg) {
  debugTrace(DEBUG_hpc,"hpc failure: %s\n",msg);
  fprintf(stderr,"Hpc failure: %s\n",msg);
  if (tixFilename) {
    fprintf(stderr,"(perhaps remove %s file?)\n",tixFilename);
  } else {
    fprintf(stderr,"(perhaps remove .tix file?)\n");
  }
  stg_exit(1);
}
开发者ID:alexbiehl,项目名称:ghc,代码行数:10,代码来源:Hpc.c

示例14: debugTrace

void GInputPool::putToPool(const GInputData & inputData)
{
	if(this->pool->isFull()) {
		debugTrace("Input pool is full!!!");

		return;
	}

	this->pool->requireNext() = inputData;
}
开发者ID:Remscar,项目名称:cpgf,代码行数:10,代码来源:ginput.cpp

示例15: sendTo

void sendTo(char* message, int to, int from){

	char* buf;
	int size = strlen((char*)message)+MAX_USR_LENGTH + 20;
	char tmp[size];
	memset(tmp,0,size);
	strcat(tmp,usrDatas[from].name);
	strcat(tmp," : ");
	strcat(tmp,(char*)message);
	buf = parseMessage(tmp,strlen(tmp));
	printf("Envoie au client : %d\n",to);
	if (Writeline(ctx.socketFd[to], buf, strlen(buf)+1) < 0){
		debugTrace("Message issue");
	}
	else {
		debugTrace("Message sent\n");
	}
	free(buf);
}
开发者ID:platonisation,项目名称:server,代码行数:19,代码来源:server.c


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