Add HitCount into Breakpoint statistics

Turns out breakpoint statistics is missing hitCount.
This patches adds the hitCount field.

Differential Revision: https://reviews.llvm.org/D145203
This commit is contained in:
Jeffrey Tan
2023-03-02 16:03:35 -08:00
parent 072e07a9d5
commit 83263aeceb
2 changed files with 30 additions and 7 deletions

View File

@@ -532,12 +532,12 @@ void Breakpoint::ModulesChanged(ModuleList &module_list, bool load,
locations_with_no_section.Add(break_loc_sp);
continue;
}
if (!break_loc_sp->IsEnabled())
continue;
SectionSP section_sp(section_addr.GetSection());
// If we don't have a Section, that means this location is a raw
// address that we haven't resolved to a section yet. So we'll have to
// look in all the new modules to resolve this location. Otherwise, if
@@ -554,9 +554,9 @@ void Breakpoint::ModulesChanged(ModuleList &module_list, bool load,
}
}
}
size_t num_to_delete = locations_with_no_section.GetSize();
for (size_t i = 0; i < num_to_delete; i++)
m_locations.RemoveLocation(locations_with_no_section.GetByIndex(i));
@@ -1132,12 +1132,13 @@ json::Value Breakpoint::GetStatistics() {
bp.try_emplace("resolveTime", m_resolve_time.get().count());
bp.try_emplace("numLocations", (int64_t)GetNumLocations());
bp.try_emplace("numResolvedLocations", (int64_t)GetNumResolvedLocations());
bp.try_emplace("hitCount", (int64_t)GetHitCount());
bp.try_emplace("internal", IsInternal());
if (!m_kind_description.empty())
bp.try_emplace("kindDescription", m_kind_description);
// Put the full structured data for reproducing this breakpoint in a key/value
// pair named "details". This allows the breakpoint's details to be visible
// in the stats in case we need to reproduce a breakpoint that has long
// in the stats in case we need to reproduce a breakpoint that has long
// resolve times
StructuredData::ObjectSP bp_data_sp = SerializeToStructuredData();
if (bp_data_sp) {