本文整理汇总了C++中printc函数的典型用法代码示例。如果您正苦于以下问题:C++ printc函数的具体用法?C++ printc怎么用?C++ printc使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了printc函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: to_data_new
static void
to_data_new(struct tor_conn *tc)
{
int from, to, amnt;
char *buf;
cbuf_t cb;
from = tc->from;
to = tc->to;
while (1) {
int ret;
if (!(buf = cbuf_alloc_ext(BUFF_SZ, &cb, CBUF_TMEM))) BUG();
amnt = tread(cos_spd_id(), to, cb, BUFF_SZ-1);
if (0 == amnt) break;
else if (-EPIPE == amnt) {
goto close;
} else if (amnt < 0) {
printc("read from fd %d produced %d.\n", from, amnt);
BUG();
}
assert(amnt <= BUFF_SZ);
if (amnt != (ret = from_twrite(cos_spd_id(), from, cb, amnt))) {
printc("conn_mgr: write failed w/ %d of %d on fd %d\n",
ret, amnt, to);
goto close;
}
cbuf_free(cb);
}
done:
cbuf_free(cb);
return;
close:
mapping_remove(from, to, tc->feid, tc->teid);
from_trelease(cos_spd_id(), from);
trelease(cos_spd_id(), to);
assert(tc->feid && tc->teid);
evt_put(tc->feid);
evt_put(tc->teid);
goto done;
}
示例2: timer_info
static int timer_info(struct simio_device *dev)
{
struct timer *tr = (struct timer *)dev;
int i;
printc("Base address: 0x%04x\n", tr->base_addr);
printc("IV address: 0x%04x\n", tr->iv_addr);
printc("IRQ0: %d\n", tr->irq0);
printc("IRQ1: %d\n", tr->irq1);
printc("\n");
printc("TACTL: 0x%04x\n", tr->tactl);
printc("TAR: 0x%04x\n", tr->tar);
printc("TAIV: 0x%02x\n", calc_iv(tr, 0));
printc("\n");
for (i = 0; i < tr->size; i++)
printc("Channel %2d, TACTL = 0x%04x, TACCR = 0x%04x\n",
i, tr->ctls[i], tr->ccrs[i]);
return 0;
}
示例3: lock_print_all
static void lock_print_all(void)
{
struct meta_lock *ml;
for (ml = FIRST_LIST(&locks, next, prev) ;
ml != &locks ; // && ml != FIRST_LIST(ml, next, prev) ;
ml = FIRST_LIST(ml, next, prev)) {
printc("lock @ %p (next %p, prev %p), id %d, spdid %d\n",
ml, ml->next, ml->prev, (unsigned int)ml->lock_id, ml->spd);
}
prints("\n");
}
示例4: printarg
/* print an argument.
*/
void
printarg(FILE *out)
{
int i;
if ( counter > 1 )
printc(outputdelim, out);
if ( numbered )
printfmt(out, "%d\t", counter);
for (i=0; i < S(arg); i++)
outc(T(arg)[i], out);
}
示例5: printfmt
/* write a character (in some arbitrary printf format)
* to the output buffer
*/
void
printfmt(FILE *out, char *fmt, unsigned char arg)
{
int i;
static Cstring Ppbuf = { 0 };
S(Ppbuf) = 0;
Cprintf(&Ppbuf, fmt, arg);
for (i=0; i < S(Ppbuf); i++)
printc(T(Ppbuf)[i], out);
}
示例6: cos_init
void cos_init(void *arg)
{
cos_map_init_static(&conn_map);
while (1) {
timed_event_block(cos_spd_id(), HTTP_REPORT_FREQ);
printc("HTTP conns %ld, reqs %ld\n", http_conn_cnt, http_req_cnt);
http_conn_cnt = http_req_cnt = 0;
}
return;
}
示例7: keyboard_service_routine
}
void keyboard_service_routine() {
int bits_mask;
bits_mask = inb(0x60);
int mask_result = bits_mask&10000000; // break == released
// make == pressed
if (mask_result == 0) {
int letter_map = bits_mask%10000000; // 10 Millons
int character_to_print = char_map[letter_map];
if (character_to_print != '\0') character_to_print = 'C';
printc(character_to_print);
示例8: trans_recv_lo
//static volatile int cur_itr = 0;
void trans_recv_lo(void)
{
unsigned int amnt_lo = 1;
long evt_lo;
td_t td_lo;
char *params_lo = "8";
printc("***LOW PRIO RECV STARTING***\n");
evt_lo = evt_split(cos_spd_id(), 0, 0);
assert(evt_lo > 0);
td_lo = tsplit(cos_spd_id(), td_root, params_lo, strlen(params_lo), TOR_READ, evt_lo);
printc("EVT_LO (%ld) TD_LO (%d)\n", evt_lo, td_lo);
do {
evt_wait(cos_spd_id(), evt_lo);
// if((amnt_lo++ % 1000) == 0)
printc("lo prio count (%u) spd(%d) tid(%d)\n", amnt_lo++, cos_spd_id(), cos_get_thd_id());
} while (1);//cur_itr++ < ITR);
return;
}
示例9: main
void main()
{
trisb=0x00;
delay_ms(10);
lcdinit();
delay_ms(1000);
while(1)
{
printc("Ganesh");
delay_ms(1000);
}
}
示例10: fault_page_fault_handler
int fault_page_fault_handler(spdid_t spdid, void *fault_addr, int flags, void *ip)
{
if (regs_active) BUG();
regs_active = 1;
cos_regs_save(cos_get_thd_id(), spdid, fault_addr, ®s);
printc("Thread %d faults in spd %d @ %p\n",
cos_get_thd_id(), spdid, fault_addr);
cos_regs_print(®s);
BUG(); /* no fault is a good fault currently */
// sched_block(spdid, 0);
return 0;
}
示例11: usbutil_list
void usbutil_list(void)
{
const struct usb_bus *bus;
for (bus = usb_get_busses(); bus; bus = bus->next) {
const struct usb_device *dev;
int busnum = atoi(bus->dirname);
printc("Devices on bus %03d:\n", busnum);
for (dev = bus->devices; dev; dev = dev->next) {
int devnum = atoi(dev->filename);
printc(" %03d:%03d %04x:%04x %s\n",
busnum, devnum,
dev->descriptor.idVendor,
dev->descriptor.idProduct,
device_help(dev));
}
}
}
示例12: fault_page_fault_handler
int fault_page_fault_handler(spdid_t spdid, void *fault_addr, int flags, void *ip)
{
unsigned long r_ip; /* the ip to return to */
int tid = cos_get_thd_id();
int i;
/* START UNCOMMENT FOR FAULT INFO */
if (regs_active) BUG();
regs_active = 1;
cos_regs_save(tid, spdid, fault_addr, ®s);
printc("Thread %d faults in spd %d @ %p\n",
tid, spdid, fault_addr);
cos_regs_print(®s);
regs_active = 0;
for (i = 0 ; i < 5 ; i++)
printc("Frame ip:%lx, sp:%lx\n",
cos_thd_cntl(COS_THD_INVFRM_IP, tid, i, 0),
cos_thd_cntl(COS_THD_INVFRM_SP, tid, i, 0));
/* END UNCOMMENT FOR FAULT INFO */
/* remove from the invocation stack the faulting component! */
assert(!cos_thd_cntl(COS_THD_INV_FRAME_REM, tid, 1, 0));
/* Manipulate the return address of the component that called
* the faulting component... */
assert(r_ip = cos_thd_cntl(COS_THD_INVFRM_IP, tid, 1, 0));
/* ...and set it to its value -8, which is the fault handler
* of the stub. */
assert(!cos_thd_cntl(COS_THD_INVFRM_SET_IP, tid, 1, r_ip-8));
/*
* Look at the booter: when recover is happening, the sstub is
* set to 0x1, thus we should just wait till recovery is done.
*/
if ((int)ip == 1) failure_notif_wait(cos_spd_id(), spdid);
else failure_notif_fail(cos_spd_id(), spdid);
return 0;
}
示例13: search_cmd_sub
static int
search_cmd_sub(int cmd_id, int *pmatch_sub_id, char *sub_name, int is_print)
{
int cmd_sub_no, pmatch_sub_nr = 0, fmatch_sub_save = GCMD_DESC_NO_MATCH;
*pmatch_sub_id = GCMD_DESC_NO_MATCH;
/*search for full matched */
for (cmd_sub_no = 0; GCMD_SUB_DESC_VALID(cmd_id, cmd_sub_no); cmd_sub_no++) {
if (!GCMD_SUB_NAME(cmd_id, cmd_sub_no))
continue;
if (!strcasecmp(sub_name, GCMD_SUB_NAME(cmd_id, cmd_sub_no))) {
/*full matched */
printc(is_print, "%-10s\t%s\n", GCMD_SUB_ACT(cmd_id, cmd_sub_no), GCMD_SUB_MEMO(cmd_id, cmd_sub_no));
//*pmatch_sub_id = cmd_sub_no;
if(fmatch_sub_save == GCMD_DESC_NO_MATCH) {
*pmatch_sub_id = fmatch_sub_save = cmd_sub_no;
}
} else if (!strncasecmp(sub_name, GCMD_SUB_NAME(cmd_id, cmd_sub_no), strlen(sub_name))) {
if(fmatch_sub_save != GCMD_DESC_NO_MATCH)
continue;
/*partly matched */
if (*pmatch_sub_id == GCMD_DESC_NO_MATCH || (GCMD_SUB_NAME(cmd_id, cmd_sub_no-1) &&
strcasecmp(GCMD_SUB_NAME(cmd_id, cmd_sub_no), GCMD_SUB_NAME(cmd_id, cmd_sub_no-1)))) {
printc(is_print, "%-10s\t", GCMD_SUB_NAME(cmd_id, cmd_sub_no));
pmatch_sub_nr++;
*pmatch_sub_id = cmd_sub_no;
}
}
}
if (pmatch_sub_nr > 1)
printc(is_print, "\n");
return pmatch_sub_nr;
}
示例14: namelist_print
void namelist_print(struct vector *v)
{
int i;
int max_len = 0;
int rows, cols;
qsort(v->ptr, v->size, v->elemsize, namelist_cmp);
for (i = 0; i < v->size; i++) {
const char *text = VECTOR_AT(*v, i, const char *);
int len = strlen(text);
if (len > max_len)
max_len = len;
}
max_len += 2;
cols = 72 / max_len;
rows = (v->size + cols - 1) / cols;
for (i = 0; i < rows; i++) {
int j;
printc(" ");
for (j = 0; j < cols; j++) {
int k = j * rows + i;
const char *text;
if (k >= v->size)
break;
text = VECTOR_AT(*v, k, const char *);
printc("%s", text);
for (k = strlen(text); k < max_len; k++)
printc(" ");
}
printc("\n");
}
}
示例15: cos_init
void cos_init(void)
{
u64_t start, end, avg, tot = 0, dev = 0;
int i, j;
call(); /* get stack */
printc("cpu %ld, thd %d from ping\n",cos_cpuid(), cos_get_thd_id());
printc("Starting %d Invocations.\n", ITER);
for (i = 0 ; i < ITER ; i++) {
rdtscll(start);
// cos_send_ipi(i, 0, 0, 0);
call();
rdtscll(end);
meas[i] = end-start;
}
for (i = 0 ; i < ITER ; i++) tot += meas[i];
avg = tot/ITER;
printc("avg %lld\n", avg);
for (tot = 0, i = 0, j = 0 ; i < ITER ; i++) {
if (meas[i] < avg*2) {
tot += meas[i];
j++;
}
}
printc("avg w/o %d outliers %lld\n", ITER-j, tot/j);
for (i = 0 ; i < ITER ; i++) {
u64_t diff = (meas[i] > avg) ?
meas[i] - avg :
avg - meas[i];
dev += (diff*diff);
}
dev /= ITER;
printc("deviation^2 = %lld\n", dev);
// printc("%d invocations took %lld\n", ITER, end-start);
return;
}