Lines Matching refs:cpf
337 CacheProfFile* cpf = malloc(sizeof(CacheProfFile)); in new_CacheProfFile() local
338 if (cpf == NULL) in new_CacheProfFile()
340 cpf->desc_lines = desc_lines; in new_CacheProfFile()
341 cpf->cmd_line = cmd_line; in new_CacheProfFile()
342 cpf->events_line = events_line; in new_CacheProfFile()
343 cpf->n_events = n_events; in new_CacheProfFile()
344 cpf->summary_line = summary_line; in new_CacheProfFile()
345 cpf->outerMap = outerMap; in new_CacheProfFile()
346 cpf->summary = summary; in new_CacheProfFile()
347 return cpf; in new_CacheProfFile()
361 static void ddel_CacheProfFile ( CacheProfFile* cpf ) in ddel_CacheProfFile() argument
364 if (cpf->desc_lines) { in ddel_CacheProfFile()
365 for (p = cpf->desc_lines; *p; p++) in ddel_CacheProfFile()
367 free(cpf->desc_lines); in ddel_CacheProfFile()
369 if (cpf->cmd_line) in ddel_CacheProfFile()
370 free(cpf->cmd_line); in ddel_CacheProfFile()
371 if (cpf->events_line) in ddel_CacheProfFile()
372 free(cpf->events_line); in ddel_CacheProfFile()
373 if (cpf->summary_line) in ddel_CacheProfFile()
374 free(cpf->summary_line); in ddel_CacheProfFile()
375 if (cpf->outerMap) in ddel_CacheProfFile()
376 deleteFM( cpf->outerMap, (void(*)(Word))ddel_FileFn, in ddel_CacheProfFile()
378 if (cpf->summary) in ddel_CacheProfFile()
379 ddel_Counts(cpf->summary); in ddel_CacheProfFile()
381 memset(cpf, 0, sizeof(CacheProfFile)); in ddel_CacheProfFile()
382 free(cpf); in ddel_CacheProfFile()
393 static void show_CacheProfFile ( FILE* f, CacheProfFile* cpf ) in show_CacheProfFile() argument
402 for (d = cpf->desc_lines; *d; d++) in show_CacheProfFile()
404 fprintf(f, "%s\n", cpf->cmd_line); in show_CacheProfFile()
405 fprintf(f, "%s\n", cpf->events_line); in show_CacheProfFile()
407 initIterFM( cpf->outerMap ); in show_CacheProfFile()
408 while (nextIterFM( cpf->outerMap, (Word*)(&topKey), (Word*)(&topVal) )) { in show_CacheProfFile()
419 doneIterFM( cpf->outerMap ); in show_CacheProfFile()
423 for (i = 0; i < cpf->summary->n_counts; i++) in show_CacheProfFile()
424 fprintf(f, " %lld", cpf->summary->counts[i]); in show_CacheProfFile()
536 CacheProfFile* cpf, in handle_counts() argument
551 if (newCounts->n_counts != cpf->n_events) in handle_counts()
564 if (lookupFM( cpf->outerMap, (Word*)(&countsMap), (Word)topKey )) { in handle_counts()
573 addToFM( cpf->outerMap, (Word)topKey, (Word)countsMap ); in handle_counts()
578 addCounts( s, cpf->summary, newCounts ); in handle_counts()
605 CacheProfFile* cpf; in parse_CacheProfFile() local
612 cpf = new_CacheProfFile( NULL, NULL, NULL, 0, NULL, NULL, NULL ); in parse_CacheProfFile()
613 if (cpf == NULL) in parse_CacheProfFile()
631 cpf->desc_lines = malloc( (1+n_tmp_desclines) * sizeof(char*) ); in parse_CacheProfFile()
632 if (cpf->desc_lines == NULL) in parse_CacheProfFile()
635 cpf->desc_lines[n_tmp_desclines] = NULL; in parse_CacheProfFile()
637 cpf->desc_lines[i] = tmp_desclines[i]; in parse_CacheProfFile()
643 cpf->cmd_line = strdup(line); in parse_CacheProfFile()
644 if (cpf->cmd_line == NULL) in parse_CacheProfFile()
656 cpf->events_line = strdup(line); in parse_CacheProfFile()
657 if (cpf->events_line == NULL) in parse_CacheProfFile()
660 cpf->n_events = 0; in parse_CacheProfFile()
661 assert(cpf->events_line[6] == ':'); in parse_CacheProfFile()
662 for (p = &cpf->events_line[6]; *p; p++) { in parse_CacheProfFile()
664 cpf->n_events++; in parse_CacheProfFile()
668 cpf->summary = new_Counts_Zeroed( cpf->n_events ); in parse_CacheProfFile()
669 if (cpf->summary == NULL) in parse_CacheProfFile()
673 cpf->outerMap = newFM ( malloc, free, cmp_FileFn ); in parse_CacheProfFile()
674 if (cpf->outerMap == NULL) in parse_CacheProfFile()
684 handle_counts(s, cpf, curr_fl, curr_fn, line); in parse_CacheProfFile()
713 cpf->summary_line = strdup(line); in parse_CacheProfFile()
714 if (cpf->summary_line == NULL) in parse_CacheProfFile()
724 summaryRead = splitUpCountsLine( s, NULL, &cpf->summary_line[8] ); in parse_CacheProfFile()
727 if (summaryRead->n_counts != cpf->n_events) in parse_CacheProfFile()
730 if (summaryRead->counts[i] != cpf->summary->counts[i]) { in parse_CacheProfFile()
740 if (cpf->summary_line) { in parse_CacheProfFile()
741 free(cpf->summary_line); in parse_CacheProfFile()
742 cpf->summary_line = NULL; in parse_CacheProfFile()
751 return cpf; in parse_CacheProfFile()
852 CacheProfFile *cpf, *cpfTmp; in main() local
882 cpf = NULL; in main()
905 if (cpf == NULL) { in main()
907 cpf = cpfTmp; in main()
911 merge_CacheProfInfo( &src, cpf, cpfTmp ); in main()
919 if (cpf) { in main()
937 show_CacheProfFile( outfile, cpf ); in main()
951 ddel_CacheProfFile( cpf ); in main()