aboutsummaryrefslogtreecommitdiff
path: root/lldb/source/Target/Statistics.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'lldb/source/Target/Statistics.cpp')
-rw-r--r--lldb/source/Target/Statistics.cpp55
1 files changed, 51 insertions, 4 deletions
diff --git a/lldb/source/Target/Statistics.cpp b/lldb/source/Target/Statistics.cpp
index 1b205c533519..ebddad837d14 100644
--- a/lldb/source/Target/Statistics.cpp
+++ b/lldb/source/Target/Statistics.cpp
@@ -34,7 +34,8 @@ json::Value StatsSuccessFail::ToJSON() const {
}
static double elapsed(const StatsTimepoint &start, const StatsTimepoint &end) {
- StatsDuration elapsed = end.time_since_epoch() - start.time_since_epoch();
+ StatsDuration::Duration elapsed =
+ end.time_since_epoch() - start.time_since_epoch();
return elapsed.count();
}
@@ -52,12 +53,26 @@ json::Value ModuleStats::ToJSON() const {
module.try_emplace("identifier", identifier);
module.try_emplace("symbolTableParseTime", symtab_parse_time);
module.try_emplace("symbolTableIndexTime", symtab_index_time);
+ module.try_emplace("symbolTableLoadedFromCache", symtab_loaded_from_cache);
+ module.try_emplace("symbolTableSavedToCache", symtab_saved_to_cache);
module.try_emplace("debugInfoParseTime", debug_parse_time);
module.try_emplace("debugInfoIndexTime", debug_index_time);
module.try_emplace("debugInfoByteSize", (int64_t)debug_info_size);
+ module.try_emplace("debugInfoIndexLoadedFromCache",
+ debug_info_index_loaded_from_cache);
+ module.try_emplace("debugInfoIndexSavedToCache",
+ debug_info_index_saved_to_cache);
return module;
}
+llvm::json::Value ConstStringStats::ToJSON() const {
+ json::Object obj;
+ obj.try_emplace<int64_t>("bytesTotal", stats.GetBytesTotal());
+ obj.try_emplace<int64_t>("bytesUsed", stats.GetBytesUsed());
+ obj.try_emplace<int64_t>("bytesUnused", stats.GetBytesUnused());
+ return obj;
+}
+
json::Value TargetStats::ToJSON(Target &target) {
CollectStats(target);
@@ -80,7 +95,8 @@ json::Value TargetStats::ToJSON(Target &target) {
elapsed(*m_launch_or_attach_time, *m_first_public_stop_time);
target_metrics_json.try_emplace("firstStopTime", elapsed_time);
}
- target_metrics_json.try_emplace("targetCreateTime", m_create_time.count());
+ target_metrics_json.try_emplace("targetCreateTime",
+ m_create_time.get().count());
json::Array breakpoints_array;
double totalBreakpointResolveTime = 0.0;
@@ -144,6 +160,10 @@ llvm::json::Value DebuggerStats::ReportStatistics(Debugger &debugger,
double symtab_index_time = 0.0;
double debug_parse_time = 0.0;
double debug_index_time = 0.0;
+ uint32_t symtabs_loaded = 0;
+ uint32_t symtabs_saved = 0;
+ uint32_t debug_index_loaded = 0;
+ uint32_t debug_index_saved = 0;
uint64_t debug_info_size = 0;
if (target) {
json_targets.emplace_back(target->ReportStatistics());
@@ -167,13 +187,30 @@ llvm::json::Value DebuggerStats::ReportStatistics(Debugger &debugger,
}
module_stat.uuid = module->GetUUID().GetAsString();
module_stat.triple = module->GetArchitecture().GetTriple().str();
- module_stat.symtab_parse_time = module->GetSymtabParseTime().count();
- module_stat.symtab_index_time = module->GetSymtabIndexTime().count();
+ module_stat.symtab_parse_time = module->GetSymtabParseTime().get().count();
+ module_stat.symtab_index_time = module->GetSymtabIndexTime().get().count();
+ Symtab *symtab = module->GetSymtab();
+ if (symtab) {
+ module_stat.symtab_loaded_from_cache = symtab->GetWasLoadedFromCache();
+ if (module_stat.symtab_loaded_from_cache)
+ ++symtabs_loaded;
+ module_stat.symtab_saved_to_cache = symtab->GetWasSavedToCache();
+ if (module_stat.symtab_saved_to_cache)
+ ++symtabs_saved;
+ }
SymbolFile *sym_file = module->GetSymbolFile();
if (sym_file) {
module_stat.debug_index_time = sym_file->GetDebugInfoIndexTime().count();
module_stat.debug_parse_time = sym_file->GetDebugInfoParseTime().count();
module_stat.debug_info_size = sym_file->GetDebugInfoSize();
+ module_stat.debug_info_index_loaded_from_cache =
+ sym_file->GetDebugInfoIndexWasLoadedFromCache();
+ if (module_stat.debug_info_index_loaded_from_cache)
+ ++debug_index_loaded;
+ module_stat.debug_info_index_saved_to_cache =
+ sym_file->GetDebugInfoIndexWasSavedToCache();
+ if (module_stat.debug_info_index_saved_to_cache)
+ ++debug_index_saved;
}
symtab_parse_time += module_stat.symtab_parse_time;
symtab_index_time += module_stat.symtab_index_time;
@@ -183,13 +220,23 @@ llvm::json::Value DebuggerStats::ReportStatistics(Debugger &debugger,
json_modules.emplace_back(module_stat.ToJSON());
}
+ ConstStringStats const_string_stats;
+ json::Object json_memory{
+ {"strings", const_string_stats.ToJSON()},
+ };
+
json::Object global_stats{
{"targets", std::move(json_targets)},
{"modules", std::move(json_modules)},
+ {"memory", std::move(json_memory)},
{"totalSymbolTableParseTime", symtab_parse_time},
{"totalSymbolTableIndexTime", symtab_index_time},
+ {"totalSymbolTablesLoadedFromCache", symtabs_loaded},
+ {"totalSymbolTablesSavedToCache", symtabs_saved},
{"totalDebugInfoParseTime", debug_parse_time},
{"totalDebugInfoIndexTime", debug_index_time},
+ {"totalDebugInfoIndexLoadedFromCache", debug_index_loaded},
+ {"totalDebugInfoIndexSavedToCache", debug_index_saved},
{"totalDebugInfoByteSize", debug_info_size},
};
return std::move(global_stats);