[Lldb-commits] [lldb] r177808 - Added better measurements to test:
Greg Clayton
gclayton at apple.com
Fri Mar 22 18:35:50 PDT 2013
Author: gclayton
Date: Fri Mar 22 20:35:50 2013
New Revision: 177808
URL: http://llvm.org/viewvc/llvm-project?rev=177808&view=rev
Log:
Added better measurements to test:
- memory delta and time for: target create
- memory delta and time for: setting breakpoint at main by name
- time to launch and hit bp at main
- overall memory of target create + bp main + run to main
- ovarall time of target create + bp main + run to main
Modified:
lldb/trunk/tools/lldb-perf/common/clang/lldb_perf_clang.cpp
Modified: lldb/trunk/tools/lldb-perf/common/clang/lldb_perf_clang.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/tools/lldb-perf/common/clang/lldb_perf_clang.cpp?rev=177808&r1=177807&r2=177808&view=diff
==============================================================================
--- lldb/trunk/tools/lldb-perf/common/clang/lldb_perf_clang.cpp (original)
+++ lldb/trunk/tools/lldb-perf/common/clang/lldb_perf_clang.cpp Fri Mar 22 20:35:50 2013
@@ -25,12 +25,21 @@ class ClangTest : public TestCase
public:
ClangTest () :
TestCase(),
- m_set_bp_main_by_name(CreateTimeMeasurement([this] () -> void
- {
- m_target.BreakpointCreateByName("main");
- }, "breakpoint1-relative-time", "Elapsed time to set a breakpoint at main by name, run and hit the breakpoint.")),
- m_delta_memory("breakpoint1-memory-delta", "Memory increase that occurs due to setting a breakpoint at main by name."),
- m_total_memory(),
+ m_time_create_target ([this] () -> void
+ {
+ m_memory_change_create_target.Start();
+ m_target = m_debugger.CreateTarget(m_exe_path.c_str());
+ m_memory_change_create_target.Stop();
+ }, "time-create-target", "The time it takes to create a target."),
+ m_time_set_bp_main([this] () -> void
+ {
+ m_memory_change_break_main.Start();
+ m_target.BreakpointCreateByName("main");
+ m_memory_change_break_main.Stop();
+ }, "time-set-break-main", "Elapsed time it takes to set a breakpoint at 'main' by name."),
+ m_memory_change_create_target(),
+ m_memory_change_break_main(),
+ m_memory_total(),
m_exe_path(),
m_out_path(),
m_launch_info (NULL),
@@ -64,24 +73,23 @@ public:
{
case 0:
{
- m_total_memory.Start();
- printf("creating target...\n");
+ m_memory_total.Start();
m_time_total.Start();
- m_time_to_create_target.Start();
- m_target = m_debugger.CreateTarget(m_exe_path.c_str());
- printf("creating target...done\n");
+
+ // Time creating the target
+ m_time_create_target();
+
+ m_time_set_bp_main();
+
+ m_time_launch_stop_main.Start();
const char *clang_argv[] = { "clang --version", NULL };
- m_delta_memory.Start();
- m_set_bp_main_by_name();
- m_time_to_create_target.Stop();
- m_delta_memory.Stop();
SBLaunchInfo launch_info(clang_argv);
- printf("start\n");
Launch (launch_info);
}
break;
case 1:
puts("stop");
+ m_time_launch_stop_main.Stop();
m_time_total.Stop();
// next_action.StepOver(m_thread);
// break;
@@ -92,7 +100,7 @@ public:
// next_action.StepOver(m_thread);
// break;
default:
- m_total_memory.Stop();
+ m_memory_total.Stop();
next_action.Kill();
break;
}
@@ -103,19 +111,27 @@ public:
{
Results::Dictionary& results_dict = results.GetDictionary();
- m_set_bp_main_by_name.WriteAverageValue(results);
- m_delta_memory.WriteAverageValue(results);
+ m_time_set_bp_main.WriteAverageValue(results);
+ results_dict.Add ("memory-change-create-target",
+ "Memory increase that occurs due to creating the target.",
+ m_memory_change_create_target.GetDeltaValue().GetResult(NULL, NULL));
+
+ results_dict.Add ("memory-change-break-main",
+ "Memory increase that occurs due to setting a breakpoint at main by name.",
+ m_memory_change_break_main.GetDeltaValue().GetResult(NULL, NULL));
- results_dict.Add ("breakpoint1-memory-total",
+ m_time_create_target.WriteAverageValue(results);
+ results_dict.Add ("memory-total-break-main",
"The total memory that the current process is using after setting the first breakpoint.",
- m_total_memory.GetStopValue().GetResult(NULL, NULL));
+ m_memory_total.GetStopValue().GetResult(NULL, NULL));
+ results_dict.AddDouble("time-launch-stop-main",
+ "The time it takes to launch the process and stop at main.",
+ m_time_launch_stop_main.GetDeltaValue());
+
results_dict.AddDouble("time-total",
"The time it takes to create the target, set breakpoint at main, launch clang and hit the breakpoint at main.",
m_time_total.GetDeltaValue());
- results_dict.AddDouble("time-to-create-target",
- "The time it takes to create the clang target.",
- m_time_to_create_target.GetDeltaValue());
results.Write(GetResultFilePath());
}
@@ -165,10 +181,12 @@ public:
private:
// C++ formatters
- TimeMeasurement<std::function<void()>> m_set_bp_main_by_name;
- MemoryMeasurement<std::function<void()>> m_delta_memory;
- MemoryGauge m_total_memory;
- TimeGauge m_time_to_create_target;
+ TimeMeasurement<std::function<void()>> m_time_create_target;
+ TimeMeasurement<std::function<void()>> m_time_set_bp_main;
+ MemoryGauge m_memory_change_create_target;
+ MemoryGauge m_memory_change_break_main;
+ MemoryGauge m_memory_total;
+ TimeGauge m_time_launch_stop_main;
TimeGauge m_time_total;
std::string m_exe_path;
std::string m_out_path;
More information about the lldb-commits
mailing list