本文整理汇总了C++中DTRACE函数的典型用法代码示例。如果您正苦于以下问题:C++ DTRACE函数的具体用法?C++ DTRACE怎么用?C++ DTRACE使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了DTRACE函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: _vrpc_server_thread
static int
_vrpc_server_thread (void* data)
{
vrpc_t* vrpc = (vrpc_t*) data;
DTRACE("VLINK %d (%d -> %d) [%s] server thread started\n",
vrpc->vlink->link, vrpc->vlink->c_id, vrpc->vlink->s_id,
(vrpc->my.info ? vrpc->my.info : ""));
for (;;) {
if (wait_event_interruptible(vrpc->wait,
_vrpc_server_thread_wakeup(vrpc))) {
break;
}
if (_aborted || !vrpc->open) {
break;
}
_vrpc_direct_call(vrpc);
}
DTRACE("VLINK %d (%d -> %d) [%s] server thread stopped\n",
vrpc->vlink->link, vrpc->vlink->c_id, vrpc->vlink->s_id,
(vrpc->my.info ? vrpc->my.info : ""));
while (!kthread_should_stop()) {
set_current_state(TASK_INTERRUPTIBLE);
schedule_timeout(1);
}
return 0;
}
示例2: DTRACE
struct thread_read *new_thread_read(const char *url, const char *headers, int flags) {
pthread_t tid;
pthread_attr_t pthread_attr;
struct thread_read *thread;
int ret;
DTRACE();
thread = malloc(sizeof(struct thread_read));
if (!thread) {
return NULL;
}
memset(thread, 0, sizeof(*thread));
DTRACE();
thread->streambuf = streambuf_alloc(0);
if (!thread->streambuf) {
free(thread);
return NULL;
}
DTRACE();
pthread_attr_init(&pthread_attr);
pthread_attr_setstacksize(&pthread_attr, 409600); //default joinable
pthread_mutex_init(&thread->pthread_mutex, NULL);
pthread_cond_init(&thread->pthread_cond, NULL);
thread->url = url;
thread->flags = flags;
thread->headers = headers;
thread->max_read_seek_len = MAX_READ_SEEK;
thread->toreadblocksize=32*1024;
thread->readtotalsize=0;
thread->readcnt=0;
ret = pthread_create(&tid, &pthread_attr, (void*)&thread_read_thread_run, (void*)thread);
thread->pthread_id = tid;
return thread;
}
示例3: DTRACE
AST_Pipeline_t *AST_ParseExpressionOrAssignment(Parser_t *parser)
{
AST_Pipeline_t *pipeline;
Token_t *cmd_or_var;
DTRACE("%s: Start\n", __func__);
if ((pipeline = calloc(1, sizeof(*pipeline))) == NULL) {
return NULL;
}
cmd_or_var = parser->t;
Scanner_TokenAccept(parser);
if (parser->t->type == TOKEN_EQUALS) {
pipeline->assignment = AST_ParseAssignment(parser, cmd_or_var);
} else {
pipeline->expression = AST_ParseExpression(parser, cmd_or_var);
}
if (parser->t->type == TOKEN_SEMICOLON) {
Scanner_TokenConsume(parser);
}
DTRACE("%s: End\n", __func__);
return pipeline;
}
示例4: vaudio_send_data
static int
vaudio_send_data (struct vaudio_stream* s)
{
NkDevRing* ring = s->ring;
const nku32_f oreq = ring->ireq;
const nku32_f nreq = oreq + 1;
const nku32_f mask = ring->imask;
NkRingDesc* desc = s->rbase + (oreq & mask);
bool xirq_trigger = 0;
struct snd_pcm_runtime* runtime = s->stream->runtime;
if ((ring->iresp & mask) == (ring->ireq & mask)) {
DTRACE ("ring empty\n");
xirq_trigger = 1;
}
if ((nreq & mask) == (ring->iresp & mask)) {
DTRACE ("ring full\n");
return -ENOMEM;
}
ring->ireq = nreq;
desc->status = NK_VAUDIO_STATUS_OK;
desc->bufsize = frames_to_bytes(runtime, runtime->period_size);
#ifdef VAUDIO_CONFIG_NK_PMEM
desc->bufaddr = s->stream->dma_buffer.addr + desc->bufsize * s->period;
#else
desc->bufaddr =
nkops.nk_vtop(runtime->dma_area + desc->bufsize * s->period);
#endif
DTRACE ("%x %x\n", desc->bufaddr, desc->bufsize);
s->period++;
s->period %= runtime->periods;
return xirq_trigger;
}
示例5: rsa_test_code
static void rsa_test_code()
{
DTRACE("\n\n== rsa_test_code ==\n");
DTRACE("encrypt public, decrypt private \n");
char *cipher = encrypt_publickey_fromcode(gTestData0);
if (cipher != NULL) {
char *plaintext = decrypt_privatekey_fromcode(cipher);
if (plaintext != NULL) {
DEBUG("The plaintext = %s \n", plaintext);
free(plaintext);
plaintext = NULL;
}
free(cipher);
cipher = NULL;
}
DTRACE("\n\n encrypt private, decrypt public\n");
cipher = encrypt_privatekey_fromcode(gTestData0);
if (cipher != NULL) {
char *plaintext = decrypt_publickey_fromcode(cipher);
if (plaintext != NULL) {
DEBUG("The plaintext = %s \n", plaintext);
free(plaintext);
plaintext = NULL;
}
free(cipher);
cipher = NULL;
}
}
示例6: rsa_test_file
static void rsa_test_file()
{
DEBUG("\n\n== rsa_test_file ==\n");
DTRACE("encrypt public, decrypt private \n");
char *cipher = encrypt_publickey_fromfile(gTestData0, PUBLIC_KEY_FILE);
if (cipher != NULL) {
char *plaintext = decrypt_privatekey_fromfile(cipher, PRIVATE_KEY_FILE);
if (plaintext != NULL) {
DEBUG("The plaintext = %s \n", plaintext);
free(plaintext);
}
free(cipher);
}
DTRACE("\n\n encrypt private, decrypt public\n");
cipher = encrypt_privatekey_fromfile(gTestData0, PRIVATE_KEY_FILE);
if (cipher != NULL) {
char *plaintext = decrypt_publickey_fromfile(cipher, PUBLIC_KEY_FILE);
if (plaintext != NULL) {
DEBUG("The plaintext = %s \n", plaintext);
free(plaintext);
plaintext = NULL;
}
free(cipher);
cipher = NULL;
}
}
示例7: get_bsm
/*******************************************************************************
* Name: get_bsm
*
* Desc: Searches through the BS table and returns a free BS id.
*
* Params:
* avail - pointer to store the free BS id
*
* Returns: SYSCALL
* OK - on success
* SYSERR - on error or if no free BS is available
******************************************************************************/
SYSCALL
get_bsm(int* avail)
{
uint8_t bs_id = 0;
bs_map_t *bsptr = NULL;
STATWORD ps;
disable(ps);
DTRACE_START;
if (NULL == avail) {
DTRACE("DBG$ %d %s> null pointer: avail\n", currpid, __func__);
goto RESTORE_AND_RETURN_ERROR;
}
for (bs_id = 0; bs_id < BS_NUM; ++bs_id) {
if BS_IS_FREE(bs_id) {
DTRACE("DBG$ %d %s> bs id %d is free\n", currpid, __func__, bs_id);
*avail = bs_id;
bsptr = BS_GET_PTR(bs_id);
bsptr->bsm_status = BS_INUSE;
restore(ps);
DTRACE_END;
return OK;
}
}
DTRACE("DBG$ %d %s> no free bs id is available\n", currpid, __func__);
*avail = EMPTY;
RESTORE_AND_RETURN_ERROR:
DTRACE("DBG$ %d %s> returning SYSERR\n", currpid, __func__);
restore(ps);
DTRACE_END;
return SYSERR;
}
示例8: l_is_lid_stale_for_pid
/* Name: l_is_lid_stale_for_pid
*
* Desc: Checks whether the lid is stale for the given pid. This happens when
* a process hasn't acquired a lock after create/release for a long time
* and the lock Id has been overflown in the system.
*
* Params:
* lid - lock ID (as known by the old proc)
* pid - proc ID of the old proc
*
* Returns: int
* TRUE - if the lid has been overflown for the given pid
* FALSE - if the lid is still valid for the given pid
*/
int
l_is_lid_stale_for_pid(lid, pid)
{
STATWORD ps;
disable(ps);
DTRACE_START;
/* Check the pid in the lid's delpidmap. If present, our guy still thinks
* that he owns the lid. Well, he doesn't. Return TRUE.
*/
if (TRUE == l_pidmap_oper(lid, pid, L_MAP_DELETE, L_MAP_CHK)) {
DTRACE("DBG$ %d %s> lid %d is stale for pid %d\n", \
currpid, __func__, lid, pid);;
DTRACE_END;
restore(ps);
return TRUE;
}
DTRACE("DBG$ %d %s> lid %d is not stale for pid %d\n", \
currpid, __func__, lid, pid);;
DTRACE_END;
restore(ps);
return FALSE;
}
示例9: l_new_lid
/* Name: l_new_lid
*
* Desc: Scans the lock table and returns the next available free lock.
*
* Params:
* None
*
* Returns: int
* Next available lock ID on success
* SYSERR on failure.
*/
int
l_new_lid (void)
{
int i = 0;
int ret_lid = 0;
DTRACE_START;
for (i = 0; i < NLOCKS; ++i) {
/* Run thru all available lock IDs until we find one which we can
* use, i.e., a lock whose state is either LS_UNINIT or LS_DELETED.
*/
ret_lid = next_lock--;
if (next_lock < 0) {
DTRACE("DBG$ %d %s> next_lock overflowed.. resetting next_lock"\
" to %d\n", currpid, __func__, (NLOCKS - 1));
next_lock = (NLOCKS - 1);
}
if (LS_UNINIT == L_GET_LSTATE(ret_lid) ||
(LS_DELETED == L_GET_LSTATE(ret_lid))) {
DTRACE("DBG$ %d %s> lid %d state changed from %s to Free %d\n", \
currpid, __func__, ret_lid, L_GET_LSTATESTR(ret_lid));
L_SET_LSTATE(ret_lid, LS_FREE);
DTRACE("DBG$ %d %s> returning lock %d\n", \
currpid, __func__, ret_lid);
DTRACE_END;
return ret_lid;
}
}
DTRACE("DBG$ %d %s> no more free locks\n", currpid, __func__);
DTRACE_END;
return SYSERR;
}
示例10: AST_PrintList
void AST_PrintList(AST_List_t *pipeline_list)
{
int i;
DTRACE("=======================================\n");
for (i = 0; i < pipeline_list->npipelines; i++) {
AST_PrintPipeline(pipeline_list->pipelines[i]);
}
DTRACE("=======================================\n");
}
示例11: pgt_update_all
/*******************************************************************************
* Name: pgt_update_all
*
* Desc: Called when a frame is freed. This routine updates the page tables
* of all the active procs that uses the given frame. It usually clears
* the page table entry for the given frame and records the dirty bit
* value.
*
* Params:
* fr_id - frame id of the frame being paged out/removed
*
* Returns: int
* TRUE - if the dirty bit is set for at least one proc
* FALSE - if the dirty bit is not set for any of the procs
* EMPTY - oops! something went wrong..
******************************************************************************/
int
pgt_update_all(int fr_id)
{
int rc = FALSE;
int pid = 0;
STATWORD ps;
disable(ps);
DTRACE_START;
if (FALSE == FR_IS_ID_VALID(fr_id)) {
DTRACE("DBG$ %d %s> bad fr id %d\n", currpid, __func__, fr_id);
rc = EMPTY;
goto RESTORE_AND_RETURN;
}
/* If the given frame is free, the required pgt's would have been updated
* earlier. Just return.
*/
if (FR_FREE == FR_GET_STATUS(fr_id)) {
DTRACE("DBG$ %d %s> fr id %d is free\n", \
currpid, __func__, fr_id, FR_GET_STATUS(fr_id));
rc = FALSE;
goto RESTORE_AND_RETURN;
}
/* This routine is only to update the page tables when a frame is removed
* or a proc unmaps the frame. So, we only have to bother about data pages.
*/
if (FR_PAGE != FR_GET_TYPE(fr_id)) {
DTRACE("DBG$ %d %s> fr id %d isn't a data frame.. type %d\n", \
currpid, __func__, fr_id, FR_GET_TYPE(fr_id));
rc = FALSE;
goto RESTORE_AND_RETURN;
}
for (pid = 0; pid < NPROC; ++pid) {
if (PRFREE == P_GET_PSTATE(pid)) {
/* Don't bother if a proc isn't present. */
continue;
}
if (TRUE == frm_pidmap_oper(fr_id, pid, FR_OP_PMAP_CHK)) {
DTRACE("DBG$ %d %s> fr id %d is used by pid %d\n",
currpid, __func__, fr_id, pid);
rc |= pgt_update_for_pid(fr_id, pid);
}
}
RESTORE_AND_RETURN:
DTRACE_END;
restore(ps);
return rc;
}
示例12: vpmem_module_init
int
vpmem_module_init (int is_client, vpmem_dev_init_t dev_init)
{
NkPhAddr plink;
NkDevVlink* vlink;
int err = 0;
NkOsId my_id = nkops.nk_id_get();
NkOsId vlink_id;
vpmem_dev_t* vpmem;
int count = 0;
DTRACE("initializing module, my_id %ld\n", (unsigned long)my_id);
plink = 0;
while ((plink = nkops.nk_vlink_lookup(VPMEM_VLINK_NAME, plink)) != 0) {
vlink = nkops.nk_ptov(plink);
vlink_id = is_client ? vlink->c_id : vlink->s_id;
DTRACE("comparing my_id %d to vlink_id %d (c_id %d, s_id %d)\n",
my_id, vlink_id, vlink->c_id, vlink->s_id);
if (vlink_id == my_id) {
vpmem = vpmem_dev_alloc();
if (!vpmem) {
err = -ENOMEM;
break;
}
vpmem->plink = plink;
vpmem->vlink = vlink;
err = dev_init(vpmem);
if (err) {
vpmem_dev_free(vpmem);
break;
}
count++;
DTRACE("device %s is created for OS#%d<-OS#%d link=%d\n",
vpmem->name, vlink->s_id, vlink->c_id, vlink->link);
}
}
DTRACE("module initialized, %u vpmem devices created, err %d\n",
count, err);
return err;
}
示例13: hw_shm_init_data
static void
hw_shm_init_data(device *me)
{
hw_shm_device *shm = (hw_shm_device*)device_data(me);
const device_unit *d;
reg_property_spec reg;
int i;
/* Obtain the Key Value */
if (device_find_property(me, "key") == NULL)
error("shm_init_data() required key property is missing\n");
shm->key = (key_t) device_find_integer_property(me, "key");
DTRACE(shm, ("shm key (0x%08x)\n", shm->key) );
/* Figure out where this memory is in address space and how long it is */
if ( !device_find_reg_array_property(me, "reg", 0, ®) )
error("hw_shm_init_data() no address registered\n");
/* Determine the address and length being as paranoid as possible */
shm->physical_address = 0xffffffff;
shm->sizeof_memory = 0xffffffff;
for ( i=0 ; i<reg.address.nr_cells; i++ ) {
if (reg.address.cells[0] == 0 && reg.size.cells[0] == 0)
continue;
if ( shm->physical_address != 0xffffffff )
device_error(me, "Only single celled address ranges supported\n");
shm->physical_address = reg.address.cells[i];
DTRACE(shm, ("shm physical_address=0x%x\n", shm->physical_address));
shm->sizeof_memory = reg.size.cells[i];
DTRACE(shm, ("shm length=0x%x\n", shm->sizeof_memory));
}
if ( shm->physical_address == 0xffffffff )
device_error(me, "Address not specified\n" );
if ( shm->sizeof_memory == 0xffffffff )
device_error(me, "Length not specified\n" );
/* Now actually attach to or create the shared memory area */
shm->id = shmget(shm->key, shm->sizeof_memory, IPC_CREAT | 0660);
if (shm->id == -1)
error("hw_shm_init_data() shmget failed\n");
shm->shm_address = shmat(shm->id, (char *)0, SHM_RND);
if (shm->shm_address == (void *)-1)
error("hw_shm_init_data() shmat failed\n");
}
示例14: l_get_next_writer
/* Name: l_get_next_writer
*
* Desc: Gets the next writer to whom the write lock should be awarded. It goes
* through the list and makes the proc ready, if any and returns TRUE. If
* eligible writers are not available, it just returns FALSE.
*
* Params:
* lid - read lock ID
*
* Returns: int
* TRUE - if eligible writer is available
* FLASE - otherwise
*/
int
l_get_next_writer(int lid)
{
int next_pid = EMPTY;;
int nextrw = L_GET_NEXTRW(lid);
DTRACE_START;
/* Set the lstate based on the next available waiter. */
if (LT_WRITE == nextrw) {
DTRACE("DBG$ %d %s> lid %d state changed from %s to Write\n", \
currpid, __func__, currpid, L_GET_LSTATESTR(lid));
L_SET_LSTATE(lid, LS_WRITE);
} else if (EMPTY == nextrw) {
DTRACE("DBG$ %d %s> lid %d state changed from %s to Free\n", \
currpid, __func__, currpid, L_GET_LSTATESTR(lid));
L_SET_LSTATE(lid, LS_FREE);
} else {
DTRACE("DBG$ %d %s> bad nextrw %d for lid %d - should have been " \
" WRITE or EMPTY\n", \
currpid, __func__, currpid, lid, next_pid);
ASSERT(0);
goto RETURN_FALSE;
}
if (EMPTY == (next_pid = getlast(L_GET_LWTAIL(lid)))) {
#ifdef DBG_ON
l_print_lock_details(lid);
#endif /* DBG_ON */
DTRACE("DBG$ %d %s> bad pid %d in nextq tail %d for lid %d\n", \
currpid, __func__, next_pid, L_GET_NEXTQ(lid), lid);
ASSERT(0);
goto RETURN_FALSE;
}
L_DEC_NWWRITE(lid);
L_INC_NAWRITE(lid);
/* Enqueue the waiting writer in ready queue. */
ready(next_pid, RESCHNO);
l_pidmap_oper(lid, next_pid, L_MAP_RELEASE, L_MAP_SET);
DTRACE("DBG$ %d %s> lid %d next writer lock for pid %d\n", \
currpid, __func__, lid, next_pid);
l_recal_next(lid);
DTRACE_END;
return TRUE;
RETURN_FALSE:
DTRACE_END;
return FALSE;
}
示例15: hw_sem_init_data
static void
hw_sem_init_data(device *me)
{
hw_sem_device *sem = (hw_sem_device*)device_data(me);
const device_unit *d;
int status;
union semun help;
/* initialize the properties of the sem */
if (device_find_property(me, "key") == NULL)
error("sem_init_data() required key property is missing\n");
if (device_find_property(me, "value") == NULL)
error("sem_init_data() required value property is missing\n");
sem->key = (key_t) device_find_integer_property(me, "key");
DTRACE(sem, ("semaphore key (%d)\n", sem->key) );
sem->initial = (int) device_find_integer_property(me, "value");
DTRACE(sem, ("semaphore initial value (%d)\n", sem->initial) );
d = device_unit_address(me);
sem->physical_address = d->cells[ d->nr_cells-1 ];
DTRACE(sem, ("semaphore physical_address=0x%x\n", sem->physical_address));
/* Now to initialize the semaphore */
if ( sem->initial != -1 ) {
sem->id = semget(sem->key, 1, IPC_CREAT | 0660);
if (sem->id == -1)
error("hw_sem_init_data() semget failed\n");
help.val = sem->initial;
status = semctl( sem->id, 0, SETVAL, help );
if (status == -1)
error("hw_sem_init_data() semctl -- set value failed\n");
} else {
sem->id = semget(sem->key, 1, 0660);
if (sem->id == -1)
error("hw_sem_init_data() semget failed\n");
}
sem->count = semctl( sem->id, 0, GETVAL, help );
if (sem->count == -1)
error("hw_sem_init_data() semctl -- get value failed\n");
DTRACE(sem, ("semaphore OS value (%d)\n", sem->count) );
}