LEFT | RIGHT |
1 /* File format for coverage information | 1 /* File format for coverage information |
2 Copyright (C) 1996, 1997, 1998, 2000, 2002, | 2 Copyright (C) 1996, 1997, 1998, 2000, 2002, |
3 2003, 2004, 2005, 2008, 2009 Free Software Foundation, Inc. | 3 2003, 2004, 2005, 2008, 2009 Free Software Foundation, Inc. |
4 Contributed by Bob Manson <manson@cygnus.com>. | 4 Contributed by Bob Manson <manson@cygnus.com>. |
5 Completely remangled by Nathan Sidwell <nathan@codesourcery.com>. | 5 Completely remangled by Nathan Sidwell <nathan@codesourcery.com>. |
6 | 6 |
7 This file is part of GCC. | 7 This file is part of GCC. |
8 | 8 |
9 GCC is free software; you can redistribute it and/or modify it under | 9 GCC is free software; you can redistribute it and/or modify it under |
10 the terms of the GNU General Public License as published by the Free | 10 the terms of the GNU General Public License as published by the Free |
(...skipping 424 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
435 #define GCOV_TAG_ARCS_NUM(LENGTH) (((LENGTH) - 1) / 2) | 435 #define GCOV_TAG_ARCS_NUM(LENGTH) (((LENGTH) - 1) / 2) |
436 #define GCOV_TAG_LINES ((gcov_unsigned_t)0x01450000) | 436 #define GCOV_TAG_LINES ((gcov_unsigned_t)0x01450000) |
437 #define GCOV_TAG_COUNTER_BASE ((gcov_unsigned_t)0x01a10000) | 437 #define GCOV_TAG_COUNTER_BASE ((gcov_unsigned_t)0x01a10000) |
438 #define GCOV_TAG_COUNTER_LENGTH(NUM) ((NUM) * 2) | 438 #define GCOV_TAG_COUNTER_LENGTH(NUM) ((NUM) * 2) |
439 #define GCOV_TAG_COUNTER_NUM(LENGTH) ((LENGTH) / 2) | 439 #define GCOV_TAG_COUNTER_NUM(LENGTH) ((LENGTH) / 2) |
440 #define GCOV_TAG_OBJECT_SUMMARY ((gcov_unsigned_t)0xa1000000) /* Obsolete */ | 440 #define GCOV_TAG_OBJECT_SUMMARY ((gcov_unsigned_t)0xa1000000) /* Obsolete */ |
441 #define GCOV_TAG_PROGRAM_SUMMARY ((gcov_unsigned_t)0xa3000000) | 441 #define GCOV_TAG_PROGRAM_SUMMARY ((gcov_unsigned_t)0xa3000000) |
442 #define GCOV_TAG_SUMMARY_LENGTH \ | 442 #define GCOV_TAG_SUMMARY_LENGTH \ |
443 (1 + GCOV_COUNTERS_SUMMABLE * (3 + 3 * 2)) | 443 (1 + GCOV_COUNTERS_SUMMABLE * (3 + 3 * 2)) |
444 #define GCOV_TAG_PMU_LOAD_LATENCY_INFO ((gcov_unsigned_t)0xa5000000) | 444 #define GCOV_TAG_PMU_LOAD_LATENCY_INFO ((gcov_unsigned_t)0xa5000000) |
445 #define GCOV_TAG_PMU_LOAD_LATENCY_LENGTH(filename) \ | 445 #define GCOV_TAG_PMU_LOAD_LATENCY_LENGTH() (15) |
446 (gcov_string_length (filename) + 12 + 2) | |
447 #define GCOV_TAG_PMU_BRANCH_MISPREDICT_INFO ((gcov_unsigned_t)0xa7000000) | 446 #define GCOV_TAG_PMU_BRANCH_MISPREDICT_INFO ((gcov_unsigned_t)0xa7000000) |
448 #define GCOV_TAG_PMU_BRANCH_MISPREDICT_LENGTH(filename) \ | 447 #define GCOV_TAG_PMU_BRANCH_MISPREDICT_LENGTH() (8) |
449 (gcov_string_length (filename) + 5 + 2) | |
450 #define GCOV_TAG_PMU_TOOL_HEADER ((gcov_unsigned_t)0xa9000000) | 448 #define GCOV_TAG_PMU_TOOL_HEADER ((gcov_unsigned_t)0xa9000000) |
451 #define GCOV_TAG_MODULE_INFO ((gcov_unsigned_t)0xab000000) | 449 #define GCOV_TAG_MODULE_INFO ((gcov_unsigned_t)0xab000000) |
452 #define GCOV_TAG_PMU_STRING_TABLE_ENTRY ((gcov_unsigned_t)0xad000000) | 450 #define GCOV_TAG_PMU_STRING_TABLE_ENTRY ((gcov_unsigned_t)0xad000000) |
| 451 #define GCOV_TAG_PMU_STRING_TABLE_ENTRY_LENGTH(filename) \ |
| 452 (gcov_string_length (filename) + 1) |
453 | 453 |
454 /* Counters that are collected. */ | 454 /* Counters that are collected. */ |
455 #define GCOV_COUNTER_ARCS 0 /* Arc transitions. */ | 455 #define GCOV_COUNTER_ARCS 0 /* Arc transitions. */ |
456 #define GCOV_COUNTERS_SUMMABLE 1 /* Counters which can be | 456 #define GCOV_COUNTERS_SUMMABLE 1 /* Counters which can be |
457 summaried. */ | 457 summaried. */ |
458 #define GCOV_FIRST_VALUE_COUNTER 1 /* The first of counters used for value | 458 #define GCOV_FIRST_VALUE_COUNTER 1 /* The first of counters used for value |
459 profiling. They must form a consecutive | 459 profiling. They must form a consecutive |
460 interval and their order must match | 460 interval and their order must match |
461 the order of HIST_TYPEs in | 461 the order of HIST_TYPEs in |
462 value-prof.h. */ | 462 value-prof.h. */ |
(...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
629 gcov_unsigned_t lt_10; /* per 10k with latency <= 10 cycles */ | 629 gcov_unsigned_t lt_10; /* per 10k with latency <= 10 cycles */ |
630 gcov_unsigned_t lt_32; /* per 10k with latency <= 32 cycles */ | 630 gcov_unsigned_t lt_32; /* per 10k with latency <= 32 cycles */ |
631 gcov_unsigned_t lt_64; /* per 10k with latency <= 64 cycles */ | 631 gcov_unsigned_t lt_64; /* per 10k with latency <= 64 cycles */ |
632 gcov_unsigned_t lt_256; /* per 10k with latency <= 256 cycles */ | 632 gcov_unsigned_t lt_256; /* per 10k with latency <= 256 cycles */ |
633 gcov_unsigned_t lt_1024; /* per 10k with latency <= 1024 cycles */ | 633 gcov_unsigned_t lt_1024; /* per 10k with latency <= 1024 cycles */ |
634 gcov_unsigned_t gt_1024; /* per 10k with latency > 1024 cycles */ | 634 gcov_unsigned_t gt_1024; /* per 10k with latency > 1024 cycles */ |
635 gcov_unsigned_t wself; /* weighted average cost of this miss in cycles */ | 635 gcov_unsigned_t wself; /* weighted average cost of this miss in cycles */ |
636 gcov_type code_addr; /* the actual miss address (pc+1 for Intel) */ | 636 gcov_type code_addr; /* the actual miss address (pc+1 for Intel) */ |
637 gcov_unsigned_t line; /* line number corresponding to this miss */ | 637 gcov_unsigned_t line; /* line number corresponding to this miss */ |
638 gcov_unsigned_t discriminator; /* discriminator information for this miss */ | 638 gcov_unsigned_t discriminator; /* discriminator information for this miss */ |
639 gcov_unsigned_t filetag; /* location in string table of filename corresp
onding to event */ | 639 gcov_unsigned_t filetag; /* location in string table of filename */ |
640 } gcov_pmu_ll_info_t; | 640 } gcov_pmu_ll_info_t; |
641 | 641 |
642 /* This structure is used during runtime as well as in gcov. */ | 642 /* This structure is used during runtime as well as in gcov. */ |
643 typedef struct load_latency_infos | 643 typedef struct load_latency_infos |
644 { | 644 { |
645 /* An array describing the total number of load latency fields. */ | 645 /* An array describing the total number of load latency fields. */ |
646 gcov_pmu_ll_info_t **ll_array; | 646 gcov_pmu_ll_info_t **ll_array; |
647 /* The total number of entries in the load latency array. */ | 647 /* The total number of entries in the load latency array. */ |
648 unsigned ll_count; | 648 unsigned ll_count; |
649 /* The total number of entries currently allocated in the array. | 649 /* The total number of entries currently allocated in the array. |
650 Used for bookkeeping. */ | 650 Used for bookkeeping. */ |
651 unsigned alloc_ll_count; | 651 unsigned alloc_ll_count; |
652 /* PMU tool header */ | 652 /* PMU tool header */ |
653 gcov_pmu_tool_header_t *pmu_tool_header; | 653 gcov_pmu_tool_header_t *pmu_tool_header; |
654 } ll_infos_t; | 654 } ll_infos_t; |
655 | 655 |
656 /* Available only for PMUs which support PEBS or IBS using pfmon | 656 /* Available only for PMUs which support PEBS or IBS using pfmon |
657 tool. If any field here is changed, the length computation in | 657 tool. If any field here is changed, the length computation in |
658 GCOV_TAG_PMU_BR_MISPREDICT_LENGTH must be updated as well. All | 658 GCOV_TAG_PMU_BR_MISPREDICT_LENGTH must be updated as well. All |
659 percentages are multiplied by 100 to make them out of 10000 and | 659 percentages are multiplied by 100 to make them out of 10000 and |
660 only integer part is kept. */ | 660 only integer part is kept. */ |
661 typedef struct gcov_pmu_branch_mispredict_info | 661 typedef struct gcov_pmu_branch_mispredict_info |
662 { | 662 { |
663 gcov_unsigned_t counts; /* raw count of samples */ | 663 gcov_unsigned_t counts; /* raw count of samples */ |
664 gcov_unsigned_t self; /* per 10k of total samples */ | 664 gcov_unsigned_t self; /* per 10k of total samples */ |
665 gcov_unsigned_t cum; /* per 10k cumulative weight */ | 665 gcov_unsigned_t cum; /* per 10k cumulative weight */ |
666 gcov_type code_addr; /* the actual mispredict address */ | 666 gcov_type code_addr; /* the actual mispredict address */ |
667 gcov_unsigned_t line; /* line number corresponding to this event */ | 667 gcov_unsigned_t line; /* line number corresponding to this event */ |
668 gcov_unsigned_t discriminator; /* discriminator for this event */ | 668 gcov_unsigned_t discriminator; /* discriminator for this event */ |
669 gcov_unsigned_t filetag; /* location in string table of filename corresp
onding to event */ | 669 gcov_unsigned_t filetag; /* location in string table of filename */ |
670 } gcov_pmu_brm_info_t; | 670 } gcov_pmu_brm_info_t; |
671 | 671 |
672 /* This structure is used during runtime as well as in gcov. */ | 672 /* This structure is used during runtime as well as in gcov. */ |
673 typedef struct branch_mispredict_infos | 673 typedef struct branch_mispredict_infos |
674 { | 674 { |
675 /* An array describing the total number of mispredict entries. */ | 675 /* An array describing the total number of mispredict entries. */ |
676 gcov_pmu_brm_info_t **brm_array; | 676 gcov_pmu_brm_info_t **brm_array; |
677 /* The total number of entries in the above array. */ | 677 /* The total number of entries in the above array. */ |
678 unsigned brm_count; | 678 unsigned brm_count; |
679 /* The total number of entries currently allocated in the array. | 679 /* The total number of entries currently allocated in the array. |
680 Used for bookkeeping. */ | 680 Used for bookkeeping. */ |
681 unsigned alloc_brm_count; | 681 unsigned alloc_brm_count; |
682 /* PMU tool header */ | 682 /* PMU tool header */ |
683 gcov_pmu_tool_header_t *pmu_tool_header; | 683 gcov_pmu_tool_header_t *pmu_tool_header; |
684 } brm_infos_t; | 684 } brm_infos_t; |
| 685 |
| 686 typedef struct gcov_pmu_string_table_entry |
| 687 { |
| 688 gcov_unsigned_t index; /* The corresponding string table index */ |
| 689 char* str; /* The string that belongs at this index */ |
| 690 } gcov_pmu_st_entry_t; |
| 691 |
| 692 typedef struct string_table |
| 693 { |
| 694 /* An array describing the total number of string table entries. */ |
| 695 gcov_pmu_st_entry_t **st_array; |
| 696 /* The total number of entries in the above array. */ |
| 697 unsigned st_count; |
| 698 /* The total number of entries currently allocated in the array. |
| 699 Used for bookkeeping. */ |
| 700 unsigned alloc_st_count; |
| 701 /* PMU tool header */ |
| 702 gcov_pmu_tool_header_t *pmu_tool_header; |
| 703 } string_table_t; |
685 | 704 |
686 /* Structures embedded in coveraged program. The structures generated | 705 /* Structures embedded in coveraged program. The structures generated |
687 by write_profile must match these. */ | 706 by write_profile must match these. */ |
688 | 707 |
689 #if IN_LIBGCOV | 708 #if IN_LIBGCOV |
690 /* Information about counters for a single function. */ | 709 /* Information about counters for a single function. */ |
691 struct gcov_ctr_info | 710 struct gcov_ctr_info |
692 { | 711 { |
693 gcov_unsigned_t num; /* number of counters. */ | 712 gcov_unsigned_t num; /* number of counters. */ |
694 gcov_type *values; /* their values. */ | 713 gcov_type *values; /* their values. */ |
(...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
865 GCOV_LINKAGE gcov_type gcov_read_counter (void) ATTRIBUTE_HIDDEN; | 884 GCOV_LINKAGE gcov_type gcov_read_counter (void) ATTRIBUTE_HIDDEN; |
866 GCOV_LINKAGE void gcov_read_summary (struct gcov_summary *) ATTRIBUTE_HIDDEN; | 885 GCOV_LINKAGE void gcov_read_summary (struct gcov_summary *) ATTRIBUTE_HIDDEN; |
867 GCOV_LINKAGE char *gcov_canonical_filename (char *filename) ATTRIBUTE_HIDDEN; | 886 GCOV_LINKAGE char *gcov_canonical_filename (char *filename) ATTRIBUTE_HIDDEN; |
868 GCOV_LINKAGE void | 887 GCOV_LINKAGE void |
869 gcov_read_pmu_load_latency_info (gcov_pmu_ll_info_t *ll_info, | 888 gcov_read_pmu_load_latency_info (gcov_pmu_ll_info_t *ll_info, |
870 gcov_unsigned_t len) ATTRIBUTE_HIDDEN; | 889 gcov_unsigned_t len) ATTRIBUTE_HIDDEN; |
871 GCOV_LINKAGE void | 890 GCOV_LINKAGE void |
872 gcov_read_pmu_branch_mispredict_info (gcov_pmu_brm_info_t *brm_info, | 891 gcov_read_pmu_branch_mispredict_info (gcov_pmu_brm_info_t *brm_info, |
873 gcov_unsigned_t len) ATTRIBUTE_HIDDEN; | 892 gcov_unsigned_t len) ATTRIBUTE_HIDDEN; |
874 GCOV_LINKAGE void | 893 GCOV_LINKAGE void |
| 894 gcov_read_pmu_string_table_entry (gcov_pmu_st_entry_t *entry, |
| 895 gcov_unsigned_t len) ATTRIBUTE_HIDDEN; |
| 896 |
| 897 GCOV_LINKAGE void |
875 gcov_read_pmu_tool_header (gcov_pmu_tool_header_t *tool_header, | 898 gcov_read_pmu_tool_header (gcov_pmu_tool_header_t *tool_header, |
876 gcov_unsigned_t len) ATTRIBUTE_HIDDEN; | 899 gcov_unsigned_t len) ATTRIBUTE_HIDDEN; |
| 900 |
877 #ifndef __GCOV_KERNEL__ | 901 #ifndef __GCOV_KERNEL__ |
878 GCOV_LINKAGE float convert_unsigned_to_pct ( | 902 GCOV_LINKAGE float convert_unsigned_to_pct ( |
879 const unsigned number) ATTRIBUTE_HIDDEN; | 903 const unsigned number) ATTRIBUTE_HIDDEN; |
880 #endif /* __GCOV_KERNEL__ */ | 904 #endif /* __GCOV_KERNEL__ */ |
881 | 905 |
882 #if !IN_LIBGCOV && IN_GCOV != 1 | 906 #if !IN_LIBGCOV && IN_GCOV != 1 |
883 GCOV_LINKAGE void gcov_read_module_info (struct gcov_module_info *mod_info, | 907 GCOV_LINKAGE void gcov_read_module_info (struct gcov_module_info *mod_info, |
884 gcov_unsigned_t len) ATTRIBUTE_HIDDEN; | 908 gcov_unsigned_t len) ATTRIBUTE_HIDDEN; |
885 GCOV_LINKAGE void print_load_latency_line (FILE *fp, | 909 GCOV_LINKAGE void print_load_latency_line (FILE *fp, |
886 const gcov_pmu_ll_info_t *ll_info, | 910 const gcov_pmu_ll_info_t *ll_info, |
887 const enum print_newline); | 911 const enum print_newline); |
888 GCOV_LINKAGE void | 912 GCOV_LINKAGE void |
889 print_branch_mispredict_line (FILE *fp, const gcov_pmu_brm_info_t *brm_info, | 913 print_branch_mispredict_line (FILE *fp, const gcov_pmu_brm_info_t *brm_info, |
890 const enum print_newline); | 914 const enum print_newline); |
| 915 GCOV_LINKAGE void |
| 916 print_pmu_string_table_entry (FILE* fp, const gcov_pmu_st_entry_t *entry, |
| 917 const enum print_newline); |
891 GCOV_LINKAGE void print_pmu_tool_header (FILE *fp, | 918 GCOV_LINKAGE void print_pmu_tool_header (FILE *fp, |
892 gcov_pmu_tool_header_t *tool_header, | 919 gcov_pmu_tool_header_t *tool_header, |
893 const enum print_newline); | 920 const enum print_newline); |
894 #endif | 921 #endif |
895 | 922 |
896 #if IN_GCOV != 1 | 923 #if IN_GCOV != 1 |
897 GCOV_LINKAGE void destroy_pmu_tool_header (gcov_pmu_tool_header_t *tool_header) | 924 GCOV_LINKAGE void destroy_pmu_tool_header (gcov_pmu_tool_header_t *tool_header) |
898 ATTRIBUTE_HIDDEN; | 925 ATTRIBUTE_HIDDEN; |
899 #endif | 926 #endif |
900 | 927 |
901 #if IN_LIBGCOV | 928 #if IN_LIBGCOV |
902 /* Available only in libgcov */ | 929 /* Available only in libgcov */ |
903 GCOV_LINKAGE void gcov_write_counter (gcov_type) ATTRIBUTE_HIDDEN; | 930 GCOV_LINKAGE void gcov_write_counter (gcov_type) ATTRIBUTE_HIDDEN; |
904 GCOV_LINKAGE void gcov_write_tag_length (gcov_unsigned_t, gcov_unsigned_t) | 931 GCOV_LINKAGE void gcov_write_tag_length (gcov_unsigned_t, gcov_unsigned_t) |
905 ATTRIBUTE_HIDDEN; | 932 ATTRIBUTE_HIDDEN; |
906 GCOV_LINKAGE void gcov_write_summary (gcov_unsigned_t /*tag*/, | 933 GCOV_LINKAGE void gcov_write_summary (gcov_unsigned_t /*tag*/, |
907 const struct gcov_summary *) | 934 const struct gcov_summary *) |
908 ATTRIBUTE_HIDDEN; | 935 ATTRIBUTE_HIDDEN; |
909 | 936 GCOV_LINKAGE void |
| 937 gcov_write_tool_header (gcov_pmu_tool_header_t *header) ATTRIBUTE_HIDDEN; |
| 938 GCOV_LINKAGE void |
| 939 gcov_write_ll_line (const gcov_pmu_ll_info_t *ll_info) ATTRIBUTE_HIDDEN; |
| 940 GCOV_LINKAGE void |
| 941 gcov_write_branch_mispredict_line (const gcov_pmu_brm_info_t |
| 942 *brm_info) ATTRIBUTE_HIDDEN; |
| 943 GCOV_LINKAGE void |
| 944 gcov_write_string_table_entry (const gcov_pmu_st_entry_t |
| 945 *st_entry) ATTRIBUTE_HIDDEN; |
910 GCOV_LINKAGE void gcov_write_module_infos (struct gcov_info *mod_info) | 946 GCOV_LINKAGE void gcov_write_module_infos (struct gcov_info *mod_info) |
911 ATTRIBUTE_HIDDEN; | 947 ATTRIBUTE_HIDDEN; |
912 GCOV_LINKAGE const struct dyn_imp_mod ** | 948 GCOV_LINKAGE const struct dyn_imp_mod ** |
913 gcov_get_sorted_import_module_array (struct gcov_info *mod_info, unsigned *len) | 949 gcov_get_sorted_import_module_array (struct gcov_info *mod_info, unsigned *len) |
914 ATTRIBUTE_HIDDEN; | 950 ATTRIBUTE_HIDDEN; |
915 static void gcov_rewrite (void); | 951 static void gcov_rewrite (void); |
916 GCOV_LINKAGE void gcov_seek (gcov_position_t /*position*/) ATTRIBUTE_HIDDEN; | 952 GCOV_LINKAGE void gcov_seek (gcov_position_t /*position*/) ATTRIBUTE_HIDDEN; |
917 GCOV_LINKAGE void gcov_truncate (void) ATTRIBUTE_HIDDEN; | 953 GCOV_LINKAGE void gcov_truncate (void) ATTRIBUTE_HIDDEN; |
918 GCOV_LINKAGE gcov_unsigned_t gcov_string_length (const char *) ATTRIBUTE_HIDDEN; | 954 GCOV_LINKAGE gcov_unsigned_t gcov_string_length (const char *) ATTRIBUTE_HIDDEN; |
919 GCOV_LINKAGE unsigned gcov_gcda_file_size (struct gcov_info *); | 955 GCOV_LINKAGE unsigned gcov_gcda_file_size (struct gcov_info *); |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
966 gcov_var.mode = -1; | 1002 gcov_var.mode = -1; |
967 gcov_var.start = 0; | 1003 gcov_var.start = 0; |
968 gcov_var.offset = 0; | 1004 gcov_var.offset = 0; |
969 _GCOV_fseek (gcov_var.file, 0L, SEEK_SET); | 1005 _GCOV_fseek (gcov_var.file, 0L, SEEK_SET); |
970 } | 1006 } |
971 #endif | 1007 #endif |
972 | 1008 |
973 #endif /* IN_LIBGCOV >= 0 */ | 1009 #endif /* IN_LIBGCOV >= 0 */ |
974 | 1010 |
975 #endif /* GCC_GCOV_IO_H */ | 1011 #endif /* GCC_GCOV_IO_H */ |
LEFT | RIGHT |