[Lldb-commits] [lldb] r179548 - - 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)

Enrico Granata egranata at apple.com
Mon Apr 15 12:07:39 PDT 2013


Author: enrico
Date: Mon Apr 15 14:07:38 2013
New Revision: 179548

URL: http://llvm.org/viewvc/llvm-project?rev=179548&view=rev
Log:
- 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

Modified:
    lldb/trunk/tools/lldb-perf/darwin/sketch/sketch.cpp
    lldb/trunk/tools/lldb-perf/lib/TestCase.cpp
    lldb/trunk/tools/lldb-perf/lib/TestCase.h

Modified: lldb/trunk/tools/lldb-perf/darwin/sketch/sketch.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/tools/lldb-perf/darwin/sketch/sketch.cpp?rev=179548&r1=179547&r2=179548&view=diff
==============================================================================
--- lldb/trunk/tools/lldb-perf/darwin/sketch/sketch.cpp (original)
+++ lldb/trunk/tools/lldb-perf/darwin/sketch/sketch.cpp Mon Apr 15 14:07:38 2013
@@ -171,20 +171,25 @@ public:
         {
             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 @@ public:
         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 @@ public:
             break;
 
         case 2:
+            case 12:
             {
                 DoTest ();
                 next_action.Continue();
@@ -226,6 +235,7 @@ public:
             break;
 
         case 3:
+            case 13:
             {
                 DoTest ();
                 next_action.StepOver(m_thread);
@@ -233,6 +243,8 @@ public:
             break;
 
         case 4:
+            case 14:
+                
             {
                 DoTest ();
                 m_run_expr_measurement(m_thread.GetFrameAtIndex(0),"layoutManager");
@@ -242,6 +254,7 @@ public:
             break;
         
         case 5:
+            case 15:
             {
                 DoTest ();
                 next_action.StepOver(m_thread);
@@ -249,6 +262,7 @@ public:
             break;
 
         case 6:
+            case 16:
             {
                 DoTest ();
                 next_action.StepOver(m_thread);
@@ -256,6 +270,7 @@ public:
             break;
 
         case 7:
+            case 17:
             {
                 DoTest ();
                 m_run_expr_measurement(m_thread.GetFrameAtIndex(0),"@\"an NSString\"");
@@ -266,15 +281,20 @@ public:
             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();

Modified: lldb/trunk/tools/lldb-perf/lib/TestCase.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/tools/lldb-perf/lib/TestCase.cpp?rev=179548&r1=179547&r2=179548&view=diff
==============================================================================
--- lldb/trunk/tools/lldb-perf/lib/TestCase.cpp (original)
+++ lldb/trunk/tools/lldb-perf/lib/TestCase.cpp Mon Apr 15 14:07:38 2013
@@ -292,6 +292,14 @@ TestCase::Loop ()
                 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");

Modified: lldb/trunk/tools/lldb-perf/lib/TestCase.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/tools/lldb-perf/lib/TestCase.h?rev=179548&r1=179547&r2=179548&view=diff
==============================================================================
--- lldb/trunk/tools/lldb-perf/lib/TestCase.h (original)
+++ lldb/trunk/tools/lldb-perf/lib/TestCase.h Mon Apr 15 14:07:38 2013
@@ -30,13 +30,16 @@ public:
 			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 @@ public:
         }
         
         void
+        Relaunch (lldb::SBLaunchInfo l)
+        {
+            type = Type::eRelaunch;
+            thread = lldb::SBThread();
+            launch_info = l;
+        }
+        
+        void
         Kill ()
         {
             type = Type::eKill;





More information about the lldb-commits mailing list