forked from OSchip/llvm-project
[SBAPI/Target] Expose SetStatistics(bool enable)/GetStatistics().
<rdar://problem/44875808> llvm-svn: 343368
This commit is contained in:
parent
2afc22ed9e
commit
e174746c5e
|
@ -75,6 +75,31 @@ public:
|
|||
|
||||
lldb::SBProcess GetProcess();
|
||||
|
||||
//------------------------------------------------------------------
|
||||
/// Sets whether we should collect statistics on lldb or not.
|
||||
///
|
||||
/// @param[in] v
|
||||
/// A boolean to control the collection.
|
||||
/// @return
|
||||
/// void
|
||||
//------------------------------------------------------------------
|
||||
void SetCollectingStats(bool v);
|
||||
|
||||
//------------------------------------------------------------------
|
||||
/// Returns whether statistics collection are enabled.
|
||||
///
|
||||
/// @return
|
||||
/// true if statistics are currently being collected, false
|
||||
/// otherwise.
|
||||
//------------------------------------------------------------------
|
||||
bool GetCollectingStats();
|
||||
|
||||
//------------------------------------------------------------------
|
||||
/// Returns a dump of the collected statistics.
|
||||
///
|
||||
/// @return
|
||||
/// A SBStructuredData with the statistics collected.
|
||||
//------------------------------------------------------------------
|
||||
lldb::SBStructuredData GetStatistics();
|
||||
|
||||
//------------------------------------------------------------------
|
||||
|
|
|
@ -17,6 +17,15 @@ class TestStatsAPI(TestBase):
|
|||
self.build()
|
||||
exe = self.getBuildArtifact("a.out")
|
||||
target = self.dbg.CreateTarget(exe)
|
||||
|
||||
# Test enabling/disabling stats
|
||||
self.assertFalse(target.GetCollectingStats())
|
||||
target.SetCollectingStats(True)
|
||||
self.assertTrue(target.GetCollectingStats())
|
||||
target.SetCollectingStats(False)
|
||||
self.assertFalse(target.GetCollectingStats())
|
||||
|
||||
# Test the function to get the statistics in JSON'ish.
|
||||
stats = target.GetStatistics()
|
||||
stream = lldb.SBStream()
|
||||
res = stats.GetAsJSON(stream)
|
||||
|
|
|
@ -1019,6 +1019,10 @@ public:
|
|||
void
|
||||
SetLaunchInfo (const lldb::SBLaunchInfo &launch_info);
|
||||
|
||||
void SetCollectingStats(bool v);
|
||||
|
||||
bool GetCollectingStats();
|
||||
|
||||
lldb::SBStructuredData GetStatistics();
|
||||
|
||||
bool
|
||||
|
|
|
@ -202,6 +202,21 @@ SBStructuredData SBTarget::GetStatistics() {
|
|||
return data;
|
||||
}
|
||||
|
||||
void SBTarget::SetCollectingStats(bool v) {
|
||||
TargetSP target_sp(GetSP());
|
||||
if (!target_sp)
|
||||
return;
|
||||
return target_sp->SetCollectingStats(v);
|
||||
}
|
||||
|
||||
bool SBTarget::GetCollectingStats() {
|
||||
TargetSP target_sp(GetSP());
|
||||
if (!target_sp)
|
||||
return false;
|
||||
return target_sp->GetCollectingStats();
|
||||
}
|
||||
|
||||
|
||||
SBProcess SBTarget::LoadCore(const char *core_file) {
|
||||
lldb::SBError error; // Ignored
|
||||
return LoadCore(core_file, error);
|
||||
|
|
Loading…
Reference in New Issue