static void read_profile (void) { if (gcov_open (auto_profile_file, 1) == 0) { error ("cannot open profile file %s", auto_profile_file); return; } if (gcov_read_unsigned () != GCOV_DATA_MAGIC) { error ("AutoFDO profile magic number does not match"); return; } /* Skip the version number. */ unsigned version = gcov_read_unsigned (); if (version != AUTO_PROFILE_VERSION) { error ("AutoFDO profile version %u does match %u", version, AUTO_PROFILE_VERSION); return; } /* Skip the empty integer. */ gcov_read_unsigned (); /* string_table. */ afdo_string_table = new string_table (); if (!afdo_string_table->read()) { error ("cannot read string table from %s", auto_profile_file); return; } /* autofdo_source_profile. */ afdo_source_profile = autofdo_source_profile::create (); if (afdo_source_profile == NULL) { error ("cannot read function profile from %s", auto_profile_file); return; } /* autofdo_module_profile. */ fake_read_autofdo_module_profile (); }
static void read_profile (void) { if (gcov_open (auto_profile_file, 1) == 0) error ("Cannot open profile file %s.", auto_profile_file); if (gcov_read_unsigned () != GCOV_DATA_MAGIC) error ("AutoFDO profile magic number does not mathch."); /* Skip the version number. */ unsigned version = gcov_read_unsigned (); if (version != AUTO_PROFILE_VERSION) error ("AutoFDO profile version %u does match %u.", version, AUTO_PROFILE_VERSION); /* Skip the empty integer. */ gcov_read_unsigned (); /* string_table. */ afdo_string_table = new string_table (); if (!afdo_string_table->read()) error ("Cannot read string table from %s.", auto_profile_file); /* autofdo_source_profile. */ afdo_source_profile = autofdo_source_profile::create (); if (afdo_source_profile == NULL) error ("Cannot read function profile from %s.", auto_profile_file); /* autofdo_module_profile. */ fake_read_autofdo_module_profile (); /* Read in the working set. */ if (gcov_read_unsigned () != GCOV_TAG_AFDO_WORKING_SET) error ("Cannot read working set from %s.", auto_profile_file); /* Skip the length of the section. */ gcov_read_unsigned (); gcov_working_set_t set[128]; for (unsigned i = 0; i < 128; i++) { set[i].num_counters = gcov_read_unsigned (); set[i].min_counter = gcov_read_counter (); } add_working_set (set); }