Lines Matching defs:fp
127 static void print_obj(VgFile *fp, const HChar* prefix, obj_node* obj)
132 VG_(fprintf)(fp, "%s(%u)\n", prefix, obj->number);
134 VG_(fprintf)(fp, "%s(%u) %s\n", prefix, obj->number, obj->name);
138 VG_(fprintf)(fp, "%s%s\n", prefix, obj->name);
145 VG_(fprintf)(fp, "mp=%p %p %p\n",
153 static void print_file(VgFile *fp, const char *prefix, const file_node* file)
158 VG_(fprintf)(fp, "%s(%u)\n", prefix, file->number);
160 VG_(fprintf)(fp, "%s(%u) %s\n", prefix, file->number, file->name);
165 VG_(fprintf)(fp, "%s%s\n", prefix, file->name);
171 static void print_fn(VgFile *fp, const HChar* tag, const fn_node* fn)
173 VG_(fprintf)(fp, "%s=",tag);
177 VG_(fprintf)(fp, "(%u)\n", fn->number);
179 VG_(fprintf)(fp, "(%u) %s\n", fn->number, fn->name);
184 VG_(fprintf)(fp, "%s\n", fn->name);
187 static void print_mangled_fn(VgFile *fp, const HChar* tag,
199 VG_(fprintf)(fp, "%s=(%u)\n",
210 VG_(fprintf)(fp, "%s=(%d) %s\n",
219 VG_(fprintf)(fp, "%s=(%u) (%u)", tag,
223 VG_(fprintf)(fp, "'%d", rec_index +1);
225 VG_(fprintf)(fp, "'(%u)",
227 VG_(fprintf)(fp, "\n");
234 VG_(fprintf)(fp, "%s=", tag);
238 VG_(fprintf)(fp, "(%u)\n", cxt->base_number + rec_index);
242 VG_(fprintf)(fp, "(%u) ", cxt->base_number + rec_index);
247 VG_(fprintf)(fp, "%s", cxt->fn[0]->name);
249 VG_(fprintf)(fp, "'%d", rec_index +1);
251 VG_(fprintf)(fp, "'%s", cxt->fn[i]->name);
253 VG_(fprintf)(fp, "\n");
263 static Bool print_fn_pos(VgFile *fp, FnPos* last, BBCC* bbcc)
276 VG_(fprintf)(fp, "rec=%u\n\n", bbcc->rec_index);
290 VG_(fprintf)(fp, "frfn=(spontaneous)\n");
295 print_fn(fp, "frfn", curr_from);
303 print_obj(fp, "ob=", bbcc->cxt->fn[0]->file->obj);
309 print_file(fp, "fl=", bbcc->cxt->fn[0]->file);
316 print_fn(fp, "fn", bbcc->cxt->fn[0]);
326 print_mangled_fn(fp, "fn", bbcc->cxt, bbcc->rec_index);
435 static void fprint_apos(VgFile *fp, AddrPos* curr, AddrPos* last,
447 print_file(fp, "fe=", curr->file);
449 print_file(fp, "fi=", curr->file);
454 VG_(fprintf)(fp, "ln=%u\n", curr->line);
468 void fprint_pos(VgFile *fp, const AddrPos* curr, const AddrPos* last)
471 VG_(fprintf)(fp, "%lu ", curr->addr - curr->bb_addr);
478 VG_(fprintf)(fp, "+%d ", diff);
480 VG_(fprintf)(fp, "* ");
482 VG_(fprintf)(fp, "%d ", diff);
485 VG_(fprintf)(fp, "%#lx ", curr->addr);
493 VG_(fprintf)(fp, "+%d ", diff);
495 VG_(fprintf)(fp, "* ");
497 VG_(fprintf)(fp, "%d ", diff);
500 VG_(fprintf)(fp, "%#lx ", curr->bb_addr);
509 VG_(fprintf)(fp, "+%d ", diff);
511 VG_(fprintf)(fp, "* ");
513 VG_(fprintf)(fp, "%d ", diff);
516 VG_(fprintf)(fp, "%u ", curr->line);
527 void fprint_cost(VgFile *fp, const EventMapping* es, const ULong* cost)
530 VG_(fprintf)(fp, "%s\n", mcost);
541 static void fprint_fcost(VgFile *fp, AddrCost* c, AddrPos* last)
549 fprint_pos(fp, &(c->p), last);
552 fprint_cost(fp, CLG_(dumpmap), c->cost);
561 static void fprint_jcc(VgFile *fp, jCC* jcc, AddrPos* curr, AddrPos* last,
602 print_file(fp, "jfi=", target.file);
607 print_mangled_fn(fp, "jfn",
610 print_fn(fp, "jfn", jcc->to->cxt->fn[0]);
615 VG_(fprintf)(fp, "jcnd=%llu/%llu ",
620 VG_(fprintf)(fp, "jump=%llu ",
624 fprint_pos(fp, &target, last);
625 VG_(fprintf)(fp, "\n");
626 fprint_pos(fp, curr, last);
627 VG_(fprintf)(fp, "\n");
638 print_obj(fp, "cob=", obj);
643 print_file(fp, "cfi=", file);
647 print_mangled_fn(fp, "cfn", jcc->to->cxt, jcc->to->rec_index);
649 print_fn(fp, "cfn", jcc->to->cxt->fn[0]);
652 VG_(fprintf)(fp, "calls=%llu ",
655 fprint_pos(fp, &target, last);
656 VG_(fprintf)(fp, "\n");
657 fprint_pos(fp, curr, last);
658 fprint_cost(fp, CLG_(dumpmap), jcc->cost);
680 static Bool fprint_bbcc(VgFile *fp, BBCC* bbcc, AddrPos* last)
721 fprint_apos(fp, &(currCost->p), last, bbcc->cxt->fn[0]->file);
722 fprint_fcost(fp, currCost, last);
745 fprint_apos(fp, &(currCost->p), last, bbcc->cxt->fn[0]->file);
746 fprint_fcost(fp, currCost, last);
749 fprint_apos(fp, &(currCost->p), last, bbcc->cxt->fn[0]->file);
754 fprint_jcc(fp, jcc, &(currCost->p), last, ecounter);
782 fprint_apos(fp, &(currCost->p), last, bbcc->cxt->fn[0]->file);
783 fprint_fcost(fp, currCost, last);
787 fprint_apos(fp, &(currCost->p), last, bbcc->cxt->fn[0]->file);
796 VG_(fprintf)(fp, "# Skipped\n");
798 fprint_fcost(fp, currCost, last);
807 fprint_jcc(fp, jcc, &(currCost->p), last, ecounter);
815 fprint_apos(fp, &(currCost->p), last, bbcc->cxt->fn[0]->file);
816 fprint_fcost(fp, currCost, last);
818 if (CLG_(clo).dump_bbs) VG_(fprintf)(fp, "\n");
1144 static void fprint_cost_ln(VgFile *fp, const HChar* prefix,
1148 VG_(fprintf)(fp, "%s%s\n", prefix, mcost);
1178 VgFile *fp;
1192 fp = VG_(fopen)(filename, VKI_O_WRONLY|VKI_O_TRUNC, 0);
1196 fp = VG_(fopen)(filename, VKI_O_WRONLY|VKI_O_APPEND, 0);
1197 if (fp && out_counter>1)
1201 if (fp == NULL) {
1202 fp = VG_(fopen)(filename, VKI_O_CREAT|VKI_O_WRONLY,
1204 if (fp == NULL) {
1219 VG_(fprintf)(fp, "version: 1\n");
1222 VG_(fprintf)(fp, "creator: callgrind-" VERSION "\n");
1225 VG_(fprintf)(fp, "pid: %d\n", VG_(getpid)());
1228 VG_(fprintf)(fp, "cmd: %s", cmdbuf);
1231 VG_(fprintf)(fp, "\npart: %d\n", out_counter);
1233 VG_(fprintf)(fp, "thread: %d\n", tid);
1238 VG_(fprintf)(fp, "\n");
1242 VG_(fprintf)(fp, "\ndesc: Option: --skip-plt=%s\n",
1244 VG_(fprintf)(fp, "desc: Option: --collect-jumps=%s\n",
1246 VG_(fprintf)(fp, "desc: Option: --separate-recs=%d\n",
1248 VG_(fprintf)(fp, "desc: Option: --separate-callers=%d\n",
1251 VG_(fprintf)(fp, "desc: Option: --dump-bbs=%s\n",
1253 VG_(fprintf)(fp, "desc: Option: --separate-threads=%s\n",
1257 (*CLG_(cachesim).dump_desc)(fp);
1260 VG_(fprintf)(fp, "\ndesc: Timerange: Basic block %llu - %llu\n",
1263 VG_(fprintf)(fp, "desc: Trigger: %s\n",
1273 VG_(fprintf)(fp, "desc: Option: --fn-skip=%s\n", fnc->name);
1276 VG_(fprintf)(fp, "desc: Option: --fn-dump-at-enter=%s\n",
1280 VG_(fprintf)(fp, "desc: Option: --fn-dump-at-leave=%s\n",
1284 VG_(fprintf)(fp, "desc: Option: --separate-callers%d=%s\n",
1288 VG_(fprintf)(fp, "desc: Option: --separate-recs%d=%s\n",
1297 VG_(fprintf)(fp, "\npositions:%s%s%s\n",
1304 VG_(fprintf)(fp, "events: %s\n", evmap);
1329 fprint_cost_ln(fp, "summary: ", CLG_(dumpmap), sum);
1334 VG_(fprintf)(fp, "\n\n");
1339 return fp;
1343 static void close_dumpfile(VgFile *fp)
1345 if (fp == NULL) return;
1347 fprint_cost_ln(fp, "totals: ", CLG_(dumpmap),
1349 //fprint_fcc_ln(fp, "summary: ", &dump_total_fcc);
1353 VG_(fclose)(fp);