- Adding a relaunch feature to the performance tester: you can use the relaunch if you want to measure multiple runs of your app keeping the same metrics alive. New arguments must be supplied - and the step counter will not be reset (this makes it easy to avoid endless loops)
- Having the Sketch test case relaunch itself
llvm-svn: 179548
diff --git a/lldb/tools/lldb-perf/darwin/sketch/sketch.cpp b/lldb/tools/lldb-perf/darwin/sketch/sketch.cpp
index 66ed9aa..c857836 100644
--- a/lldb/tools/lldb-perf/darwin/sketch/sketch.cpp
+++ b/lldb/tools/lldb-perf/darwin/sketch/sketch.cpp
@@ -171,20 +171,25 @@
{
exit(1);
}
-
+ lldb::SBLaunchInfo launch_info = GetLaunchInfo();
m_target = m_debugger.CreateTarget(m_app_path.c_str());
- const char* file_arg = m_doc_path.c_str();
- const char* persist_arg = "-ApplePersistenceIgnoreState";
- const char* persist_skip = "YES";
- const char* empty = nullptr;
- const char* args[] = {file_arg,persist_arg,persist_skip,empty};
- SBLaunchInfo launch_info (args);
m_file_line_bp_measurement("SKTDocument.m",245);
m_file_line_bp_measurement("SKTDocument.m",283);
m_file_line_bp_measurement("SKTText.m",326);
return Launch (launch_info);
}
+ lldb::SBLaunchInfo
+ GetLaunchInfo ()
+ {
+ const char* file_arg = m_doc_path.c_str();
+ const char* persist_arg = "-ApplePersistenceIgnoreState";
+ const char* persist_skip = "YES";
+ const char* empty = nullptr;
+ const char* args[] = {file_arg,persist_arg,persist_skip,empty};
+ return SBLaunchInfo(args);
+ }
+
void
DoTest ()
{
@@ -199,14 +204,17 @@
switch (counter)
{
case 0:
+ case 10:
{
DoTest ();
- m_file_line_bp_measurement("SKTDocument.m",254);
+ if (counter == 0)
+ m_file_line_bp_measurement("SKTDocument.m",254);
next_action.Continue();
}
break;
case 1:
+ case 11:
{
DoTest ();
m_run_expr_measurement(m_thread.GetFrameAtIndex(0),"properties");
@@ -219,6 +227,7 @@
break;
case 2:
+ case 12:
{
DoTest ();
next_action.Continue();
@@ -226,6 +235,7 @@
break;
case 3:
+ case 13:
{
DoTest ();
next_action.StepOver(m_thread);
@@ -233,6 +243,8 @@
break;
case 4:
+ case 14:
+
{
DoTest ();
m_run_expr_measurement(m_thread.GetFrameAtIndex(0),"layoutManager");
@@ -242,6 +254,7 @@
break;
case 5:
+ case 15:
{
DoTest ();
next_action.StepOver(m_thread);
@@ -249,6 +262,7 @@
break;
case 6:
+ case 16:
{
DoTest ();
next_action.StepOver(m_thread);
@@ -256,6 +270,7 @@
break;
case 7:
+ case 17:
{
DoTest ();
m_run_expr_measurement(m_thread.GetFrameAtIndex(0),"@\"an NSString\"");
@@ -266,15 +281,20 @@
break;
case 8:
+ case 18:
{
DoTest ();
m_run_expr_measurement(m_thread.GetFrameAtIndex(0),"[graphics description]");
m_run_expr_measurement(m_thread.GetFrameAtIndex(0),"[selectionIndexes description]");
m_run_expr_measurement(m_thread.GetFrameAtIndex(0),"(BOOL)NSIntersectsRect(rect, graphicDrawingBounds)");
- next_action.Kill();
}
break;
-
+ case 9:
+ {
+ next_action.Relaunch(GetLaunchInfo());
+ break;
+ }
+
default:
{
next_action.Kill();
diff --git a/lldb/tools/lldb-perf/lib/TestCase.cpp b/lldb/tools/lldb-perf/lib/TestCase.cpp
index ac8c402..b3aef6e 100644
--- a/lldb/tools/lldb-perf/lib/TestCase.cpp
+++ b/lldb/tools/lldb-perf/lib/TestCase.cpp
@@ -292,6 +292,14 @@
m_process.SetSelectedThread(action.thread);
action.thread.StepOver();
break;
+ case ActionWanted::Type::eRelaunch:
+ if (m_process.IsValid())
+ {
+ m_process.Kill();
+ m_process.Clear();
+ }
+ Launch(action.launch_info);
+ break;
case ActionWanted::Type::eKill:
if (m_verbose)
printf("kill\n");
diff --git a/lldb/tools/lldb-perf/lib/TestCase.h b/lldb/tools/lldb-perf/lib/TestCase.h
index 3d2e0e94..8955798 100644
--- a/lldb/tools/lldb-perf/lib/TestCase.h
+++ b/lldb/tools/lldb-perf/lib/TestCase.h
@@ -30,13 +30,16 @@
eStepOver,
eContinue,
eStepOut,
+ eRelaunch,
eKill
} type;
lldb::SBThread thread;
+ lldb::SBLaunchInfo launch_info;
ActionWanted () :
type (Type::eContinue),
- thread ()
+ thread (),
+ launch_info (NULL)
{
}
@@ -62,6 +65,14 @@
}
void
+ Relaunch (lldb::SBLaunchInfo l)
+ {
+ type = Type::eRelaunch;
+ thread = lldb::SBThread();
+ launch_info = l;
+ }
+
+ void
Kill ()
{
type = Type::eKill;