void Movement::mdebug(void (*printFunc)(const uint8_t, float&), uint16_t &index) { // Send all values float tmp; //printFunc("deltaTime", (float)deltaTime); printFunc(R_, *R()); printFunc(RX, *getAccValue_(X_IDX)); printFunc(RY, *getAccValue_(Y_IDX)); printFunc(RZ, *getAccValue_(Z_IDX)); printFunc(RXZ, *getAccValue_(XZ_IDX)); //printFunc(AX, *getAccAngle_(X_IDX)); //printFunc(AY, *getAccAngle_(Y_IDX)); //printFunc(AZ, *getAccAngle_(Z_IDX)); printFunc(GYZ, *getGyroValue_(X_IDX)); printFunc(GXZ, *getGyroValue_(Y_IDX)); printFunc(GXY, *getGyroValue_(Z_IDX)); /*printFunc("EstAyz", *getEstRotAngle_(X_IDX)); printFunc("EstAxz", *getEstRotAngle_(Y_IDX)); printFunc("EstAxy", *getEstRotAngle_(Z_IDX));*/ index++; }
int main(int argc,char *argv[]) { unsigned long long totalTime; unsigned long tid; bool haveFile = false; FILE *f = stdin; int parser = -1; if(argc < 3) { fprintf(stderr,"Usage: %s <format> <input> [<symbolFile>...]\n",argv[0]); return EXIT_FAILURE; } for(size_t i = 0; i < sizeof(parsers) / sizeof(parsers[0]); i++) { if(strcmp(argv[1],parsers[i].name) == 0) { parser = i; break; } } if(parser == -1) { fprintf(stderr,"'%s' is no known format. Use 'i586' or 'mmix'.\n",argv[1]); return EXIT_FAILURE; } if(strcmp(argv[2],"-") != 0) { haveFile = true; f = fopen(argv[2],"r"); if(!f) perror("fopen"); } sym_init(); for(int i = 3; i < argc; i++) sym_addFile(argv[i]); parsers[parser].parse(f); if(haveFile) fclose(f); /* calculate total time and leave all functions that have not been left so far (e.g. main) */ totalTime = 0; for(tid = 0; tid < contextSize; tid++) { if(contexts[tid].current) { leaveFuncs(contexts[tid].root); totalTime += contexts[tid].root->time; } } /* print header */ printf("<?xml version=\"1.0\" encoding=\"ISO-8859-1\"?>\n"); printf("<functionCalls>\n"); printf(" <fileName>dummyFile</fileName>\n"); printf(" <totalTime>%Lu</totalTime>\n",totalTime); printf(" <totalMem>0</totalMem>\n"); for(tid = 0; tid < contextSize; tid++) { if(contexts[tid].current) printFunc(contexts[tid].root,1); } printf("</functionCalls>\n"); return EXIT_SUCCESS; }
/** * kernel print module initialization. */ static int __init print_init(void) { printFunc(); printLine(); printk("version:%s\n",sTestmoduleVersion); return 0; }
void gamePrintInfo(Game* g, Option o) { #ifndef PRINT return; #endif int (*printFunc)(const char*, ...); printFunc = ( o.use_ncurses ) ? &printw : &printf; if ( o.max_tick >= 0 ) printFunc("%d Generation left.\n", o.max_tick); __gamePrint(g, printFunc); }
static void printFunc(sFuncCall *f,int layer) { if(f) { sFuncCall *c = f; while(c != NULL) { printf("%*s<functionCall id=\"%s\">\n",layer * 2," ",c->name); printf("%*s <class></class>\n",layer * 2," "); printf("%*s <function>%s</function>\n",layer * 2," ",c->name); printf("%*s <file>dummyFile</file>\n",layer * 2," "); printf("%*s <line>0</line>\n",layer * 2," "); printf("%*s <mem>0</mem>\n",layer * 2," "); printf("%*s <time>%Lu</time>\n",layer * 2," ",c->time); printf("%*s <calls>%ld</calls>\n",layer * 2," ",c->calls); printf("%*s <subFunctions>\n",layer * 2," "); printFunc(c->child,layer + 1); printf("%*s </subFunctions>\n",layer * 2," "); printf("%*s</functionCall>\n",layer * 2," "); c = c->next; } } }
void zeroFunc(int color, void* arg) { counter[color] = 0; printFunc(color, arg); }