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


C++ pmesg函数代码示例

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


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

示例1: oph_id_to_index

long long oph_id_to_index(UDF_INIT * initid, UDF_ARGS * args, char *is_null, char *error)
{
	long long size, id = *((long long *) args->args[0]) - 1, index = id;
	if (id < 0) {
		pmesg(LOG_ERROR, __FILE__, __LINE__, "Invalid value %d\n", id);
		*is_null = 0;
		*error = 1;
		return -1;
	}
	unsigned int counter = 1;
	while (counter < args->arg_count) {
		size = *((long long *) args->args[counter++]);
		index = id % size;
		id = (id - index) / size;
	}
	*is_null = 0;
	*error = 0;
	return index + 1;
}
开发者ID:indigo-dc,项目名称:ophidia-primitives,代码行数:19,代码来源:oph_id_to_index.c

示例2: latestForwardedTableFind

/* Returns the latestForwarded_table_entry pointer to the latestForwardedTable
*  entry representing the neighbor node address passed as a parameter. If
*  no such neighbor exists, returns NULL.
*/
latestForwarded_table_entry* latestForwardedTableFind(rimeaddr_t *neighbor_p) {
	pmesg(200, "%s :: %s :: Line #%d\n", __FILE__, __func__, __LINE__);
	static uint8_t i = 0;
	static bool isBroadcast = 0;
  
  isBroadcast = rimeaddr_cmp(packetbuf_addr(PACKETBUF_ADDR_RECEIVER),
                                &rimeaddr_null);
	if (isBroadcast)
		return NULL;

	for (i = 0; i < latestForwardedTableActive; i++) {
		if (rimeaddr_cmp(&(latestForwardedTable[i].neighbor), neighbor_p))
		break;
	}

	if(i == latestForwardedTableActive)
		return NULL;

	return &(latestForwardedTable[i]);
}
开发者ID:RanHuang,项目名称:nick-project-contiki,代码行数:24,代码来源:BcpForwardingEngine.c

示例3: conditionalFQDiscard

void conditionalFQDiscard() {
	pmesg(200, "%s :: %s :: Line #%d\n", __FILE__, __func__, __LINE__);

	static fe_queue_entry_t* discardQe;// = memb_alloc(&send_stack_mem); 

	if(list_length(send_stack) >= SEND_STACK_SIZE) {

		discardQe = list_chop(send_stack);
		list_remove(message_pool, discardQe -> msg);
		memb_free(&message_pool_mem, discardQe -> msg);

		list_remove(q_entry_pool, discardQe);
		memb_free(&q_entry_pool_mem, discardQe);

#ifdef VIRTQ 
		//	Dropped a data packet, increase virtual queue size
		virtualQueueSize++;
#endif
	}
}
开发者ID:RanHuang,项目名称:nick-project-contiki,代码行数:20,代码来源:BcpForwardingEngine.c

示例4: oph_hier_get_attribute

int oph_hier_get_attribute(const char *name, oph_hier_attribute * attribute, const char *hierarchy, oph_hier_document * document)
{
	if (!name || !strlen(name)) {
		pmesg(LOG_ERROR, __FILE__, __LINE__, "Property '%s' not given\n", OPH_HIER_STR_NAME);
		return OPH_HIER_DATA_ERR;
	}
	if (!hierarchy || !strlen(hierarchy))
		pmesg(LOG_WARNING, __FILE__, __LINE__, "Hierarchy not given\n", OPH_HIER_STR_NAME);
	int result;
	if ((result = oph_hier_basic_control(document)) != OPH_HIER_OK)
		return result;
	xmlXPathContextPtr context = xmlXPathNewContext(document->document);
	if (!context) {
		pmesg(LOG_ERROR, __FILE__, __LINE__, "Context is not gettable\n");
		return OPH_HIER_SYSTEM_ERR;
	}
	char target[OPH_HIER_MAX_STRING_LENGTH];
	if (hierarchy && (strlen(hierarchy) > 0))
		sprintf(target, "//%s[@%s='%s']/%s[@%s='%s']", OPH_HIER_STR_HIERARCHY, OPH_HIER_STR_NAME, hierarchy, OPH_HIER_STR_ATTRIBUTE, OPH_HIER_STR_LONG_NAME, name);
	else
		sprintf(target, "//%s[@%s()='%s']", OPH_HIER_STR_ATTRIBUTE, OPH_HIER_STR_LONG_NAME, name);
	xmlXPathObjectPtr object = xmlXPathEvalExpression((xmlChar *) target, context);
	if (!object) {
		xmlXPathFreeContext(context);
		pmesg(LOG_ERROR, __FILE__, __LINE__, "XPath error\n");
		return OPH_HIER_SYSTEM_ERR;
	}
	xmlNodeSetPtr nodeset = object->nodesetval;
	if (!nodeset || !nodeset->nodeNr) {
		pmesg(LOG_ERROR, __FILE__, __LINE__, "No attribute '%s'\n", name);
		result = OPH_HIER_DATA_ERR;
	} else if ((nodeset->nodeNr > 1) && hierarchy && (strlen(hierarchy) > 0)) {
		pmesg(LOG_ERROR, __FILE__, __LINE__, "Malformed file\n");
		result = OPH_HIER_XML_ERR;
	} else
		result = _oph_hier_get_attribute(nodeset->nodeTab[0], attribute);
	xmlXPathFreeObject(object);
	xmlXPathFreeContext(context);
	if (result == OPH_HIER_OK)
		pmesg(LOG_DEBUG, __FILE__, __LINE__, "Attribute '%s' read\n", name);
	return result;
}
开发者ID:indigo-dc,项目名称:ophidia-analytics-framework,代码行数:42,代码来源:oph_hierarchy_library.c

示例5: memory_check

int memory_check() // Check for memory swap
{
	struct sysinfo info;

	if (pthread_rwlock_wrlock(&syslock)) return OPH_SERVER_UTIL_ERROR;

	if (sysinfo(&info))
	{
		pthread_rwlock_unlock(&syslock);
		return OPH_SERVER_UTIL_ERROR;
	}

	if (pthread_rwlock_unlock(&syslock)) return OPH_SERVER_UTIL_ERROR;

	if ((info.freeram + info.bufferram < OPH_MIN_MEMORY) && (info.totalswap - info.freeswap > OPH_MIN_MEMORY))
	{
		pmesg(LOG_ERROR, __FILE__, __LINE__, "Out of memory\n");
		return OPH_SERVER_UTIL_ERROR;
	}

	return OPH_SERVER_UTIL_SUCCESS;
}
开发者ID:AAmedeo,项目名称:ophidia-io-server,代码行数:22,代码来源:oph_server_utility.c

示例6: _oph_odb_update_session_label

int _oph_odb_update_session_label(ophidiadb * oDB, const char *sessionid, char *label, pthread_mutex_t * flag)
{
	if (!oDB || !sessionid) {
		pmesg_safe(flag, LOG_ERROR, __FILE__, __LINE__, "Null input parameter\n");
		return OPH_ODB_NULL_PARAM;
	}

	if (oph_odb_check_connection_to_ophidiadb(oDB)) {
		pmesg_safe(flag, LOG_ERROR, __FILE__, __LINE__, "Unable to reconnect to OphidiaDB.\n");
		return OPH_ODB_MYSQL_ERROR;
	}

	int id_session;
	if (_oph_odb_retrieve_session_id(oDB, sessionid, &id_session, flag)) {
		pmesg_safe(flag, LOG_ERROR, __FILE__, __LINE__, "Unable to retrieve session id\n");
		return OPH_ODB_MYSQL_ERROR;
	}

	char insertQuery[MYSQL_BUFLEN];
	int n = snprintf(insertQuery, MYSQL_BUFLEN, MYSQL_QUERY_UPDATE_OPHIDIADB_SESSION_LABEL, label ? label : "", id_session);

	if (n >= MYSQL_BUFLEN) {
		pmesg_safe(flag, LOG_ERROR, __FILE__, __LINE__, "Size of query exceed query limit.\n");
		return OPH_ODB_STR_BUFF_OVERFLOW;
	}

	if (mysql_set_server_option(oDB->conn, MYSQL_OPTION_MULTI_STATEMENTS_ON)) {
		pmesg(LOG_ERROR, __FILE__, __LINE__, "MySQL query error: %s\n", mysql_error(oDB->conn));
		return OPH_ODB_MYSQL_ERROR;
	}

	if (mysql_query(oDB->conn, insertQuery)) {
		pmesg_safe(flag, LOG_ERROR, __FILE__, __LINE__, "MySQL query error: %s\n", mysql_error(oDB->conn));
		return OPH_ODB_MYSQL_ERROR;
	}

	return OPH_ODB_SUCCESS;
}
开发者ID:indigo-dc,项目名称:ophidia-server,代码行数:38,代码来源:oph_odb_job.c

示例7: chooseAdvertiseTime

/*---------------------------------------------------------------------------*/
void chooseAdvertiseTime() {

	pmesg(200, "%s :: %s :: Line #%d\n", __FILE__, __func__, __LINE__);
	static uint32_t rand =0;	

	//Create a 32bit pseudo random number
	rand = ((uint32_t)random_rand());
	rand = rand << 16;
	rand = rand | ((uint32_t)random_rand());

	t = currentInterval;
	t /= 2;
	t += rand % t;
	tHasPassed = false;
	isBeaconTimerPeriodic = false;
	ctimer_stop(&beacon_timer);

	#ifdef BEACON_ONLY
	timer_set(&beacon_timerTime, ULONG_MAX);
	#endif
	ctimer_set(&beacon_timer, t, beacon_timer_fired, 0);
  	timer_reset(&beacon_timerTime);  // Reset the tandem timer
}
开发者ID:RanHuang,项目名称:nick-project-contiki,代码行数:24,代码来源:BcpForwardingEngine.c

示例8: oph_http_get

// Thread unsafe
int oph_http_get(struct soap *soap)
{
	pmesg(LOG_DEBUG, __FILE__, __LINE__, "Received a HTTP GET Request\n");
	if (!oph_server_protocol || !oph_server_host || !oph_server_port) {
		pmesg(LOG_DEBUG, __FILE__, __LINE__, "Return SOAP Fault\n");
		return SOAP_GET_METHOD;
	}
	FILE *fd = NULL;
	char buffer[OPH_MAX_STRING_SIZE] = { '\0' }, *s = strchr(soap->path, '?');
	if (!s) {
		snprintf(buffer, OPH_MAX_STRING_SIZE, OPH_SERVER_STD_HTTP_RESPONSE, oph_server_protocol, oph_server_host, oph_server_port, oph_server_protocol, oph_server_host, oph_server_port,
			 oph_server_protocol, oph_server_host, oph_server_port);
		soap->http_content = "text/html";
		pmesg(LOG_DEBUG, __FILE__, __LINE__, "Return HTML description of web service\n");
	} else if (strcmp(s, "?wsdl")) {
		pmesg(LOG_DEBUG, __FILE__, __LINE__, "Return SOAP Fault\n");
		return SOAP_GET_METHOD;
	} else {
		snprintf(buffer, OPH_MAX_STRING_SIZE, OPH_SERVER_WSDL, oph_server_location);
		fd = fopen(buffer, "rb");
		if (!fd) {
			pmesg(LOG_DEBUG, __FILE__, __LINE__, "Return HTTP 'Not Found' error\n");
			return 404;
		}
		soap->http_content = "text/xml";
		pmesg(LOG_DEBUG, __FILE__, __LINE__, "Return WSDL description of web service\n");
	}
	soap_response(soap, SOAP_FILE);
	size_t r;
	if (fd) {
		for (;;) {
			r = fread(soap->tmpbuf, 1, sizeof(soap->tmpbuf), fd);
			if (!r)
				break;
			if (soap_send_raw(soap, soap->tmpbuf, r))
				break;
		}
		fclose(fd);
	} else {
		r = snprintf(soap->tmpbuf, sizeof(soap->tmpbuf), "%s", buffer);
		soap_send_raw(soap, soap->tmpbuf, r);
	}
	soap_end_send(soap);
	return SOAP_OK;
}
开发者ID:OphidiaBigData,项目名称:ophidia-server,代码行数:46,代码来源:oph_utils.c

示例9: _memory_get_frag

int _memory_get_frag(oph_iostore_handler * handle, oph_iostore_resource_id * res_id, oph_iostore_frag_record_set ** frag_record)
{
	if (!handle || !res_id || !res_id->id || !frag_record) {
		pmesg(LOG_ERROR, __FILE__, __LINE__, MEMORY_LOG_NULL_INPUT_PARAM);
		logging(LOG_ERROR, __FILE__, __LINE__, MEMORY_LOG_NULL_INPUT_PARAM);
		return MEMORY_DEV_NULL_PARAM;
	}

	*frag_record = NULL;

	//Read resource id
	oph_iostore_frag_record_set *internal_record = *((oph_iostore_frag_record_set **) res_id->id);

	//Get in-memory copy of frag
/*  if(_memory_copy_frag_record_set(internal_record, frag_record) || frag_record == NULL){
    pmesg(LOG_ERROR, __FILE__, __LINE__, MEMORY_LOG_MEMORY_ERROR);
    logging(LOG_ERROR, __FILE__, __LINE__, MEMORY_LOG_MEMORY_ERROR);        
    return MEMORY_DEV_ERROR;
  }*/
	*frag_record = internal_record;

	return MEMORY_DEV_SUCCESS;
}
开发者ID:OphidiaBigData,项目名称:ophidia-io-server,代码行数:23,代码来源:MEMORY_device.c

示例10: stack_check_timer_fired

void stack_check_timer_fired(void){
	pmesg(200, "%s :: %s :: Line #%d\n", __FILE__, __func__, __LINE__);
	static bool bpIncrease = false;
	static uint16_t diffBackpressure =0;
	static uint16_t newLocalBackpressure =0;
	static uint32_t beacon_time =0;

	beacon_time = ULONG_MAX - (uint32_t)timer_remaining(&beacon_timerTime);
	newLocalBackpressure = list_length(send_stack) + sendQeOccupied + virtualQueueSize;

	if(beacon_time >= BEACON_TH_INTERVAL){ //recently we have not broadcast a beacon
	//update backpressure to other nodes
	if(oldLocalBackpressure < newLocalBackpressure) 
	  bpIncrease = true;

	if(bpIncrease)
	  diffBackpressure = newLocalBackpressure - oldLocalBackpressure;
	else
	  diffBackpressure = oldLocalBackpressure - newLocalBackpressure;  


	if(diffBackpressure>=DIFF_QUEUE_TH){       	
	  if( extraBeaconSending == false){ 
	    extraBeaconSending = true;
	  } else { return; }
	  beaconType = NORMAL_BEACON;
	  process_post(&sendBeaconTask, NULL, NULL);
	  skipExtraBeaconCnt=3;
	}
	} else {
	  if(skipExtraBeaconCnt>0) {
	    skipExtraBeaconCnt--;
	  }
	}

	oldLocalBackpressure = newLocalBackpressure;
}
开发者ID:RanHuang,项目名称:nick-project-contiki,代码行数:37,代码来源:BcpForwardingEngine.c

示例11: beacon_timer_fired

/*---------------------------------------------------------------------------*/
void beacon_timer_fired(){
	pmesg(200, "%s :: %s :: Line #%d\n", __FILE__, __func__, __LINE__);
	#ifdef BEACON_ONLY    
	//	check stack size timer
 	if(ctimer_expired(&stack_check_timer)) {
		ctimer_set(&stack_check_timer, (clock_time_t)STACK_CHECK_INTERVAL, stack_check_timer_fired, NULL);
 	}
	#endif
	if (isRunningForwardingEngine) {
		if (!tHasPassed) {
			beaconType = NORMAL_BEACON;
			process_post(&sendBeaconTask, NULL, NULL);
 			remainingInterval();
		}
		else {
			decayInterval();
		}
 	}

	if(isBeaconTimerPeriodic == true){
		ctimer_set(&beacon_timer, BEACON_TIME, beacon_timer_fired, NULL);
    	timer_reset(&beacon_timerTime);  // Reset the tandem timer
  }
}
开发者ID:RanHuang,项目名称:nick-project-contiki,代码行数:25,代码来源:BcpForwardingEngine.c

示例12: malloc

char *oph_sum_array_r(UDF_INIT * initid, UDF_ARGS * args, char *result, unsigned long *length, char *is_null, char *error)
{

	// Allocate space for the result_array; result_array[i] = measurea[i] + measureb[i]
	//initid->ptr=(char *)malloc(*(measure.length) * (core_sizeof(measure.type))); 
	if (!initid->ptr) {
		initid->ptr = (char *) malloc(args->lengths[0]);
		if (!initid->ptr) {
			pmesg(1, __FILE__, __LINE__, "Error allocating result string\n");
			*length = 0;
			*is_null = 1;
			*error = 1;
			return NULL;
		}
	}

	barrier_wait(&(((th_data *) (initid->extension))->barr_start));
	barrier_wait(&(((th_data *) (initid->extension))->barr_end));

	*length = args->lengths[0];
	*error = 0;
	*is_null = 0;
	return initid->ptr;
}
开发者ID:indigo-dc,项目名称:ophidia-primitives,代码行数:24,代码来源:oph_sum_array_r.c

示例13: core_oph_roll_up

int core_oph_roll_up(oph_roll_up_param* param)
{
	if (param->rows < param->size)
	{
		oph_string* measure = (oph_string*)param->measure;
		unsigned long row_size = measure->numelem * param->result_elemsize;
		if (param->result_type != measure->type)
		{
			unsigned long i;
			char *input_ptr = measure->content, *output_ptr = param->result + param->rows*row_size;
			for (i=0; i<measure->numelem; ++i, input_ptr += measure->elemsize, output_ptr += param->result_elemsize)
			{
				if(core_oph_type_cast(input_ptr, output_ptr, measure->type, param->result_type))
				{
					pmesg(1,  __FILE__, __LINE__, "Unable to find result\n");
					return 1;
				}
			}
		}
		else memcpy(param->result + param->rows*row_size, measure->content, row_size);
		param->rows++;
	}
	return 0;
}
开发者ID:OphidiaBigData,项目名称:ophidia-primitives,代码行数:24,代码来源:oph_roll_up.c

示例14: oph_subset_size

int oph_subset_size(oph_subset* subset, unsigned long long initial_size, unsigned long long* final_size, unsigned long long* sizes, int size_number)
{
	if (!subset)
	{
		pmesg(LOG_ERROR, __FILE__, __LINE__, "Null pointer\n");
		return OPH_SUBSET_LIB_NULL_POINTER_ERR;
	}

	*final_size=0;
	unsigned long long j;

	if (!sizes || !size_number)
	{
		for (j=1; j<=initial_size; ++j) // It is not C-like indexing
			if (oph_subset_index_is_in_subset(j, subset)) (*final_size)++;
	}
	else
	{
		for (j=1; j<=initial_size; ++j) // It is not C-like indexing
			if (oph_subset_id_is_in_subset(j, subset, sizes, size_number)) (*final_size)++;
	}

	return OPH_SUBSET_LIB_OK;
}
开发者ID:OphidiaBigData,项目名称:ophidia-analytics-framework,代码行数:24,代码来源:oph_subset_library.c

示例15: pmesg

char *oph_predicate2(UDF_INIT * initid, UDF_ARGS * args, char *result, unsigned long *length, char *is_null, char *error)
{
	oph_string measure;
	char *buffer;
	char **names;
	int count;
	oph_predicate2_param *param;

	int i = 0;

	if (core_set_type(&(measure), args->args[0], &(args->lengths[0]))) {
		pmesg(1, __FILE__, __LINE__, "Type not recognized\n");
		*length = 0;
		*is_null = 0;
		*error = 1;
		return NULL;
	}

	measure.content = args->args[2];
	measure.length = &(args->lengths[2]);
	measure.missingvalue = NULL;

	core_set_elemsize(&(measure));

	if (core_set_numelem(&(measure))) {
		pmesg(1, __FILE__, __LINE__, "Error on counting elements\n");
		*length = 0;
		*is_null = 0;
		*error = 1;
		return NULL;
	}

	if (!initid->ptr) {
		initid->ptr = (char *) malloc(sizeof(oph_predicate2_param));
		if (!initid->ptr) {
			pmesg(1, __FILE__, __LINE__, "Error allocating result string\n");
			*length = 0;
			*is_null = 0;
			*error = 1;
			return NULL;
		}
		param = (oph_predicate2_param *) initid->ptr;

		for (i = 0; i < 4; ++i)
			param->f[i] = NULL;
		param->occurrence = 0;	// ALL

		buffer = (char *) malloc(1 + args->lengths[3]);
		strncpy(buffer, args->args[3], args->lengths[3]);
		buffer[args->lengths[3]] = '\0';
		pthread_rwlock_wrlock(&lock);
		param->f[1] = evaluator_create(buffer);
		pthread_rwlock_unlock(&lock);
		free(buffer);
		if (!param->f[1]) {
			pmesg(1, __FILE__, __LINE__, "Error allocating evaluator\n");
			*length = 0;
			*is_null = 0;
			*error = 1;
			return NULL;
		}
		evaluator_get_variables(param->f[1], &names, &count);
		if (count > 1) {
			pmesg(1, __FILE__, __LINE__, "Too variables in expression\n");
			*length = 0;
			*is_null = 0;
			*error = 1;
			return NULL;
		}
		// Comparison operator
		if (core_set_comp(&param->op, args->args[4], &(args->lengths[4]))) {
			pmesg(1, __FILE__, __LINE__, "Comparison operator not recognized\n");
			*length = 0;
			*is_null = 0;
			*error = 1;
			return NULL;
		}

		if (args->args[5] && args->lengths[5]) {
			buffer = (char *) malloc(1 + args->lengths[5]);
			core_strncpy(buffer, args->args[5], &(args->lengths[5]));
			if (!strcasecmp(buffer, "nan"))
				sprintf(buffer, "0/0");
		} else
			buffer = strdup("0/0");
		pthread_rwlock_wrlock(&lock);
		param->f[2] = evaluator_create(buffer);
		pthread_rwlock_unlock(&lock);
		free(buffer);
		if (!param->f[2]) {
			pmesg(1, __FILE__, __LINE__, "Error allocating evaluator\n");
			*length = 0;
			*is_null = 0;
			*error = 1;
			return NULL;
		}
		evaluator_get_variables(param->f[2], &names, &count);
		if (count > 1) {
			pmesg(1, __FILE__, __LINE__, "Too variables in expression\n");
			*length = 0;
//.........这里部分代码省略.........
开发者ID:indigo-dc,项目名称:ophidia-primitives,代码行数:101,代码来源:oph_predicate2.c


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