本文整理汇总了C++中TRACE_OUT函数的典型用法代码示例。如果您正苦于以下问题:C++ TRACE_OUT函数的具体用法?C++ TRACE_OUT怎么用?C++ TRACE_OUT使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了TRACE_OUT函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: on_mp_read_session_read_response_write2
static int
on_mp_read_session_read_response_write2(struct query_state *qstate)
{
struct cache_mp_read_session_read_response *read_response;
ssize_t result;
TRACE_IN(on_mp_read_session_read_response_write2);
read_response = get_cache_mp_read_session_read_response(
&qstate->response);
result = qstate->write_func(qstate, read_response->data,
read_response->data_size);
if (result < 0 || (size_t)result != qstate->kevent_watermark) {
LOG_ERR_3("on_mp_read_session_read_response_write2",
"write failed");
TRACE_OUT(on_mp_read_session_read_response_write2);
return (-1);
}
finalize_comm_element(&qstate->request);
finalize_comm_element(&qstate->response);
qstate->kevent_watermark = sizeof(int);
qstate->process_func = on_mp_read_session_mapper;
qstate->kevent_filter = EVFILT_READ;
TRACE_OUT(on_mp_read_session_read_response_write2);
return (0);
}
示例2: on_rw_mapper
/*
* on_rw_mapper is used to process multiple read/write requests during
* one connection session. It's never called in the beginning (on query_state
* creation) as it does not process the multipart requests and does not
* receive credentials
*/
static int
on_rw_mapper(struct query_state *qstate)
{
ssize_t result;
int elem_type;
TRACE_IN(on_rw_mapper);
if (qstate->kevent_watermark == 0) {
qstate->kevent_watermark = sizeof(int);
} else {
result = qstate->read_func(qstate, &elem_type, sizeof(int));
if (result != sizeof(int)) {
TRACE_OUT(on_rw_mapper);
return (-1);
}
switch (elem_type) {
case CET_WRITE_REQUEST:
qstate->kevent_watermark = sizeof(size_t);
qstate->process_func = on_write_request_read1;
break;
case CET_READ_REQUEST:
qstate->kevent_watermark = sizeof(size_t);
qstate->process_func = on_read_request_read1;
break;
default:
TRACE_OUT(on_rw_mapper);
return (-1);
break;
}
}
TRACE_OUT(on_rw_mapper);
return (0);
}
示例3: __post_summary_for_contest
static int __post_summary_for_contest(unsigned int contestid)
{
u32 iterhi, iterlo; int rc = -1;
unsigned int packets, swucount;
struct timeval ttime;
TRACE_OUT((+1,"__post_summary_for_contest(%u)\n",contestid));
if (CliGetContestInfoSummaryData( contestid, &packets, &iterhi, &iterlo,
&ttime, &swucount ) == 0)
{
if (packets)
{
char ratebuf[15];
TRACE_OUT((0,"pkts=%u, iter=%u:%u, time=%lu:%lu, swucount=%u\n", packets,
iterhi, iterlo, ttime.tv_sec, ttime.tv_usec, swucount ));
Log("%s: Summary: %u packet%s (%u.%02u stats units)\n%s%c- [%s/s]\n",
CliGetContestNameFromID(contestid),
packets, ((packets==1)?(""):("s")),
swucount/100, swucount%100,
CliGetTimeString(&ttime,2), ((packets)?(' '):(0)),
ProblemComputeRate( contestid, ttime.tv_sec, ttime.tv_usec,
iterhi, iterlo, 0, 0, ratebuf, sizeof(ratebuf)) );
}
rc = 0;
}
TRACE_OUT((-1,"__post_summary_for_contest()\n"));
return rc;
}
示例4: on_write_response_write1
static int
on_write_response_write1(struct query_state *qstate)
{
struct cache_write_response *write_response;
ssize_t result;
TRACE_IN(on_write_response_write1);
write_response = get_cache_write_response(&qstate->response);
result = qstate->write_func(qstate, &write_response->error_code,
sizeof(int));
if (result != sizeof(int)) {
TRACE_OUT(on_write_response_write1);
return (-1);
}
finalize_comm_element(&qstate->request);
finalize_comm_element(&qstate->response);
qstate->kevent_watermark = sizeof(int);
qstate->kevent_filter = EVFILT_READ;
qstate->process_func = on_rw_mapper;
TRACE_OUT(on_write_response_write1);
return (0);
}
示例5: on_write_request_read2
static int
on_write_request_read2(struct query_state *qstate)
{
struct cache_write_request *write_request;
ssize_t result;
TRACE_IN(on_write_request_read2);
write_request = get_cache_write_request(&qstate->request);
result = qstate->read_func(qstate, write_request->entry,
write_request->entry_length);
result += qstate->read_func(qstate, write_request->cache_key +
qstate->eid_str_length, write_request->cache_key_size);
if (write_request->data_size != 0)
result += qstate->read_func(qstate, write_request->data,
write_request->data_size);
if (result != qstate->kevent_watermark) {
TRACE_OUT(on_write_request_read2);
return (-1);
}
write_request->cache_key_size += qstate->eid_str_length;
qstate->kevent_watermark = 0;
if (write_request->data_size != 0)
qstate->process_func = on_write_request_process;
else
qstate->process_func = on_negative_write_request_process;
TRACE_OUT(on_write_request_read2);
return (0);
}
示例6: on_read_request_read2
static int
on_read_request_read2(struct query_state *qstate)
{
struct cache_read_request *read_request;
ssize_t result;
TRACE_IN(on_read_request_read2);
read_request = get_cache_read_request(&qstate->request);
result = qstate->read_func(qstate, read_request->entry,
read_request->entry_length);
result += qstate->read_func(qstate,
read_request->cache_key + qstate->eid_str_length,
read_request->cache_key_size);
if (result != qstate->kevent_watermark) {
TRACE_OUT(on_read_request_read2);
return (-1);
}
read_request->cache_key_size += qstate->eid_str_length;
qstate->kevent_watermark = 0;
qstate->process_func = on_read_request_process;
TRACE_OUT(on_read_request_read2);
return (0);
}
示例7: on_read_response_write1
static int
on_read_response_write1(struct query_state *qstate)
{
struct cache_read_response *read_response;
ssize_t result;
TRACE_IN(on_read_response_write1);
read_response = get_cache_read_response(&qstate->response);
result = qstate->write_func(qstate, &read_response->error_code,
sizeof(int));
if (read_response->error_code == 0) {
result += qstate->write_func(qstate, &read_response->data_size,
sizeof(size_t));
if (result != qstate->kevent_watermark) {
TRACE_OUT(on_read_response_write1);
return (-1);
}
qstate->kevent_watermark = read_response->data_size;
qstate->process_func = on_read_response_write2;
} else {
if (result != qstate->kevent_watermark) {
TRACE_OUT(on_read_response_write1);
return (-1);
}
qstate->kevent_watermark = 0;
qstate->process_func = NULL;
}
TRACE_OUT(on_read_response_write1);
return (0);
}
示例8: on_read_response_write2
static int
on_read_response_write2(struct query_state *qstate)
{
struct cache_read_response *read_response;
ssize_t result;
TRACE_IN(on_read_response_write2);
read_response = get_cache_read_response(&qstate->response);
if (read_response->data_size > 0) {
result = qstate->write_func(qstate, read_response->data,
read_response->data_size);
if (result != qstate->kevent_watermark) {
TRACE_OUT(on_read_response_write2);
return (-1);
}
}
finalize_comm_element(&qstate->request);
finalize_comm_element(&qstate->response);
qstate->kevent_watermark = sizeof(int);
qstate->kevent_filter = EVFILT_READ;
qstate->process_func = on_rw_mapper;
TRACE_OUT(on_read_response_write2);
return (0);
}
示例9: on_write_request_read1
/*
* The functions below are used to process write requests.
* - on_write_request_read1 and on_write_request_read2 read the request itself
* - on_write_request_process processes it (if the client requests to
* cache the negative result, the on_negative_write_request_process is used)
* - on_write_response_write1 sends the response
*/
static int
on_write_request_read1(struct query_state *qstate)
{
struct cache_write_request *write_request;
ssize_t result;
TRACE_IN(on_write_request_read1);
if (qstate->kevent_watermark == 0)
qstate->kevent_watermark = sizeof(size_t) * 3;
else {
init_comm_element(&qstate->request, CET_WRITE_REQUEST);
write_request = get_cache_write_request(&qstate->request);
result = qstate->read_func(qstate, &write_request->entry_length,
sizeof(size_t));
result += qstate->read_func(qstate,
&write_request->cache_key_size, sizeof(size_t));
result += qstate->read_func(qstate,
&write_request->data_size, sizeof(size_t));
if (result != sizeof(size_t) * 3) {
TRACE_OUT(on_write_request_read1);
return (-1);
}
if (BUFSIZE_INVALID(write_request->entry_length) ||
BUFSIZE_INVALID(write_request->cache_key_size) ||
(BUFSIZE_INVALID(write_request->data_size) &&
(write_request->data_size != 0))) {
TRACE_OUT(on_write_request_read1);
return (-1);
}
write_request->entry = (char *)calloc(1,
write_request->entry_length + 1);
assert(write_request->entry != NULL);
write_request->cache_key = (char *)calloc(1,
write_request->cache_key_size +
qstate->eid_str_length);
assert(write_request->cache_key != NULL);
memcpy(write_request->cache_key, qstate->eid_str,
qstate->eid_str_length);
if (write_request->data_size != 0) {
write_request->data = (char *)calloc(1,
write_request->data_size);
assert(write_request->data != NULL);
}
qstate->kevent_watermark = write_request->entry_length +
write_request->cache_key_size +
write_request->data_size;
qstate->process_func = on_write_request_read2;
}
TRACE_OUT(on_write_request_read1);
return (0);
}
示例10: TRACE_OUT
bool Pattern::Compare(const wchar_t* wildStr, int wildOff, const wchar_t* rawStr, int rawOff)
{
#ifdef TRACING
std::wcout << std::endl << "\tCompare: " << TRACE_OUT(wildStr) << TRACE_OUT(wildOff) << TRACE_OUT(rawStr) << TRACE_OUT(rawOff) << std::endl;
#endif
const wchar_t EOS = L'\0';
while (wildStr[wildOff])
{
if (rawStr[rawOff] == EOS)
return (wcscmp(wildStr+wildOff, L"*") == 0);
if (wildStr[wildOff] == L'*')
{
if (wildStr[wildOff + 1] == EOS)
return true;
do
{
// Find match with char after '*'
while (rawStr[rawOff] &&
!Pattern::ChrCmp(rawStr[rawOff], wildStr[wildOff+1]))
rawOff++;
if (rawStr[rawOff] &&
Compare(wildStr, wildOff + 1, rawStr, rawOff))
return true;
if (rawStr[rawOff])
++rawOff;
} while (rawStr[rawOff]);
if (rawStr[rawOff] == EOS)
return (wcscmp(wildStr+wildOff+1, L"*") == 0);
}
else if (wildStr[wildOff] == L'?')
{
if (rawStr[rawOff] == EOS)
return false;
rawOff++;
}
else
{
if (!Pattern::ChrCmp(rawStr[rawOff], wildStr[wildOff]))
return false;
if (wildStr[wildOff] == EOS)
return true;
++rawOff;
}
++wildOff;
}
return (wildStr[wildOff] == rawStr[rawOff]);
}
示例11: on_transform_request_read1
/*
* The functions below are used to process write requests.
* - on_transform_request_read1 and on_transform_request_read2 read the
* request itself
* - on_transform_request_process processes it
* - on_transform_response_write1 sends the response
*/
static int
on_transform_request_read1(struct query_state *qstate)
{
struct cache_transform_request *transform_request;
ssize_t result;
TRACE_IN(on_transform_request_read1);
if (qstate->kevent_watermark == 0)
qstate->kevent_watermark = sizeof(size_t) + sizeof(int);
else {
init_comm_element(&qstate->request, CET_TRANSFORM_REQUEST);
transform_request =
get_cache_transform_request(&qstate->request);
result = qstate->read_func(qstate,
&transform_request->entry_length, sizeof(size_t));
result += qstate->read_func(qstate,
&transform_request->transformation_type, sizeof(int));
if (result != sizeof(size_t) + sizeof(int)) {
TRACE_OUT(on_transform_request_read1);
return (-1);
}
if ((transform_request->transformation_type != TT_USER) &&
(transform_request->transformation_type != TT_ALL)) {
TRACE_OUT(on_transform_request_read1);
return (-1);
}
if (transform_request->entry_length != 0) {
if (BUFSIZE_INVALID(transform_request->entry_length)) {
TRACE_OUT(on_transform_request_read1);
return (-1);
}
transform_request->entry = (char *)calloc(1,
transform_request->entry_length + 1);
assert(transform_request->entry != NULL);
qstate->process_func = on_transform_request_read2;
} else
qstate->process_func = on_transform_request_process;
qstate->kevent_watermark = transform_request->entry_length;
}
TRACE_OUT(on_transform_request_read1);
return (0);
}
示例12: on_read_request_read1
/*
* The functions below are used to process read requests.
* - on_read_request_read1 and on_read_request_read2 read the request itself
* - on_read_request_process processes it
* - on_read_response_write1 and on_read_response_write2 send the response
*/
static int
on_read_request_read1(struct query_state *qstate)
{
struct cache_read_request *read_request;
ssize_t result;
TRACE_IN(on_read_request_read1);
if (qstate->kevent_watermark == 0)
qstate->kevent_watermark = sizeof(size_t) * 2;
else {
init_comm_element(&qstate->request, CET_READ_REQUEST);
read_request = get_cache_read_request(&qstate->request);
result = qstate->read_func(qstate,
&read_request->entry_length, sizeof(size_t));
result += qstate->read_func(qstate,
&read_request->cache_key_size, sizeof(size_t));
if (result != sizeof(size_t) * 2) {
TRACE_OUT(on_read_request_read1);
return (-1);
}
if (BUFSIZE_INVALID(read_request->entry_length) ||
BUFSIZE_INVALID(read_request->cache_key_size)) {
TRACE_OUT(on_read_request_read1);
return (-1);
}
read_request->entry = (char *)calloc(1,
read_request->entry_length + 1);
assert(read_request->entry != NULL);
read_request->cache_key = (char *)calloc(1,
read_request->cache_key_size +
qstate->eid_str_length);
assert(read_request->cache_key != NULL);
memcpy(read_request->cache_key, qstate->eid_str,
qstate->eid_str_length);
qstate->kevent_watermark = read_request->entry_length +
read_request->cache_key_size;
qstate->process_func = on_read_request_read2;
}
TRACE_OUT(on_read_request_read1);
return (0);
}
示例13: cache_lfu_policy_get_next_item
static struct cache_policy_item_ *
cache_lfu_policy_get_next_item(struct cache_policy_ *policy,
struct cache_policy_item_ *item)
{
struct cache_lfu_policy_ *lfu_policy;
struct cache_lfu_policy_item_ *lfu_item;
int i;
TRACE_IN(cache_lfu_policy_get_next_item);
lfu_policy = (struct cache_lfu_policy_ *)policy;
lfu_item = TAILQ_NEXT((struct cache_lfu_policy_item_ *)item, entries);
if (lfu_item == NULL)
{
for (i = ((struct cache_lfu_policy_item_ *)item)->frequency + 1;
i < CACHELIB_MAX_FREQUENCY; ++i) {
if (!TAILQ_EMPTY(&(lfu_policy->groups[i]))) {
lfu_item = TAILQ_FIRST(&(lfu_policy->groups[i]));
break;
}
}
}
TRACE_OUT(cache_lfu_policy_get_next_item);
return ((struct cache_policy_item_ *)lfu_item);
}
示例14: clear_config_entry
/*
* Clears the specified configuration entry (clears the cache for positive and
* and negative entries) and also for all multipart entries.
*/
static void
clear_config_entry(struct configuration_entry *config_entry)
{
size_t i;
TRACE_IN(clear_config_entry);
configuration_lock_entry(config_entry, CELT_POSITIVE);
if (config_entry->positive_cache_entry != NULL)
transform_cache_entry(
config_entry->positive_cache_entry,
CTT_CLEAR);
configuration_unlock_entry(config_entry, CELT_POSITIVE);
configuration_lock_entry(config_entry, CELT_NEGATIVE);
if (config_entry->negative_cache_entry != NULL)
transform_cache_entry(
config_entry->negative_cache_entry,
CTT_CLEAR);
configuration_unlock_entry(config_entry, CELT_NEGATIVE);
configuration_lock_entry(config_entry, CELT_MULTIPART);
for (i = 0; i < config_entry->mp_cache_entries_size; ++i)
transform_cache_entry(
config_entry->mp_cache_entries[i],
CTT_CLEAR);
configuration_unlock_entry(config_entry, CELT_MULTIPART);
TRACE_OUT(clear_config_entry);
}
示例15: cache_lfu_policy_get_prev_item
static struct cache_policy_item_ *
cache_lfu_policy_get_prev_item(struct cache_policy_ *policy,
struct cache_policy_item_ *item)
{
struct cache_lfu_policy_ *lfu_policy;
struct cache_lfu_policy_item_ *lfu_item;
int i;
TRACE_IN(cache_lfu_policy_get_prev_item);
lfu_policy = (struct cache_lfu_policy_ *)policy;
lfu_item = TAILQ_PREV((struct cache_lfu_policy_item_ *)item,
cache_lfu_policy_group_, entries);
if (lfu_item == NULL)
{
for (i = ((struct cache_lfu_policy_item_ *)item)->frequency - 1;
i >= 0; --i)
if (!TAILQ_EMPTY(&(lfu_policy->groups[i]))) {
lfu_item = TAILQ_LAST(&(lfu_policy->groups[i]),
cache_lfu_policy_group_);
break;
}
}
TRACE_OUT(cache_lfu_policy_get_prev_item);
return ((struct cache_policy_item_ *)lfu_item);
}