summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGreg Clayton <gclayton@apple.com>2013-03-21 00:30:04 +0000
committerGreg Clayton <gclayton@apple.com>2013-03-21 00:30:04 +0000
commit384dc726b06052f99688b2768e30518f2f5ec6c8 (patch)
treeaaebea0a99e17fe30d81f1456c8ba84d5e41cd61
parentbd180cb623b7e7b97c9179319b7562e3faa32fbc (diff)
downloadbcm5719-llvm-384dc726b06052f99688b2768e30518f2f5ec6c8.tar.gz
bcm5719-llvm-384dc726b06052f99688b2768e30518f2f5ec6c8.zip
Added a lldb-perf test case that will be used to time various aspects of debugging clang with LLDB.
This test case will measure memory usage and expression timings in frame zero and at higher frames. llvm-svn: 177617
-rwxr-xr-xlldb/tools/lldb-perf/common/clang/build-clang.sh10
-rw-r--r--lldb/tools/lldb-perf/common/clang/lldb_perf_clang.cpp141
-rw-r--r--lldb/tools/lldb-perf/lldbperf.xcodeproj/project.pbxproj118
3 files changed, 269 insertions, 0 deletions
diff --git a/lldb/tools/lldb-perf/common/clang/build-clang.sh b/lldb/tools/lldb-perf/common/clang/build-clang.sh
new file mode 100755
index 00000000000..9506b43c58a
--- /dev/null
+++ b/lldb/tools/lldb-perf/common/clang/build-clang.sh
@@ -0,0 +1,10 @@
+#!/bin/bash
+
+mkdir llvm-build
+cd llvm-build
+svn co --revision 176809 http://llvm.org/svn/llvm-project/llvm/trunk llvm
+( cd llvm/tools ; svn co --revision 176809 http://llvm.org/svn/llvm-project/cfe/trunk clang )
+mkdir build
+cd build
+../llvm/configure --enable-targets=x86_64,arm --build=x86_64-apple-darwin10 --enable-optimized --disable-assertions
+make -j8
diff --git a/lldb/tools/lldb-perf/common/clang/lldb_perf_clang.cpp b/lldb/tools/lldb-perf/common/clang/lldb_perf_clang.cpp
new file mode 100644
index 00000000000..e7610f5f8b5
--- /dev/null
+++ b/lldb/tools/lldb-perf/common/clang/lldb_perf_clang.cpp
@@ -0,0 +1,141 @@
+//===-- lldb_perf_clang.cpp -------------------------------------*- C++ -*-===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+#include <CoreFoundation/CoreFoundation.h>
+
+#include "lldb-perf/lib/Timer.h"
+#include "lldb-perf/lib/Metric.h"
+#include "lldb-perf/lib/Measurement.h"
+#include "lldb-perf/lib/TestCase.h"
+#include "lldb-perf/lib/Xcode.h"
+
+#include <iostream>
+#include <unistd.h>
+#include <fstream>
+
+using namespace lldb_perf;
+
+class ClangTest : public TestCase
+{
+public:
+ ClangTest () : TestCase()
+ {
+ m_set_bp_main_by_name = CreateTimeMeasurement([this] () -> void {
+ m_target.BreakpointCreateByName("main");
+ }, "break at \"main\"", "time set a breakpoint at main by name, run and hit the breakpoint");
+ }
+
+ virtual
+ ~ClangTest ()
+ {
+ }
+
+ virtual bool
+ Setup (int argc, const char** argv)
+ {
+ m_app_path.assign(argv[1]);
+ m_out_path.assign(argv[2]);
+ m_target = m_debugger.CreateTarget(m_app_path.c_str());
+ m_set_bp_main_by_name();
+ const char *clang_argv[] = { "clang --version", NULL };
+ SBLaunchInfo launch_info(clang_argv);
+ return Launch (launch_info);
+ }
+
+ void
+ DoTest ()
+ {
+ }
+
+ virtual void
+ TestStep (int counter, ActionWanted &next_action)
+ {
+ switch (counter)
+ {
+ case 0:
+ m_target.BreakpointCreateByLocation("fmts_tester.mm", 68);
+ next_action.Continue();
+ break;
+ case 1:
+ DoTest ();
+ next_action.Continue();
+ break;
+ case 2:
+ DoTest ();
+ next_action.Continue();
+ break;
+ case 3:
+ DoTest ();
+ next_action.Continue();
+ break;
+ case 4:
+ DoTest ();
+ next_action.Continue();
+ break;
+ case 5:
+ DoTest ();
+ next_action.Continue();
+ break;
+ case 6:
+ DoTest ();
+ next_action.Continue();
+ break;
+ case 7:
+ DoTest ();
+ next_action.Continue();
+ break;
+ case 8:
+ DoTest ();
+ next_action.Continue();
+ break;
+ case 9:
+ DoTest ();
+ next_action.Continue();
+ break;
+ case 10:
+ DoTest ();
+ next_action.Continue();
+ break;
+ default:
+ next_action.Kill();
+ break;
+ }
+ }
+
+ void
+ Results ()
+ {
+ CFCMutableArray array;
+ m_set_bp_main_by_name.Write(array);
+
+ CFDataRef xmlData = CFPropertyListCreateData(kCFAllocatorDefault, array.get(), kCFPropertyListXMLFormat_v1_0, 0, NULL);
+
+ CFURLRef file = CFURLCreateFromFileSystemRepresentation(NULL, (const UInt8*)m_out_path.c_str(), m_out_path.size(), FALSE);
+
+ CFURLWriteDataAndPropertiesToResource(file,xmlData,NULL,NULL);
+ }
+
+private:
+ // C++ formatters
+ TimeMeasurement<std::function<void()>> m_set_bp_main_by_name;
+ std::string m_app_path;
+ std::string m_out_path;
+
+};
+
+// argv[1] == path to app
+// argv[2] == path to result
+int main(int argc, const char * argv[])
+{
+ ClangTest test;
+ test.SetVerbose(true);
+ TestCase::Run(test, argc, argv);
+ return 0;
+}
+
diff --git a/lldb/tools/lldb-perf/lldbperf.xcodeproj/project.pbxproj b/lldb/tools/lldb-perf/lldbperf.xcodeproj/project.pbxproj
index d78f73af060..a402bfab6eb 100644
--- a/lldb/tools/lldb-perf/lldbperf.xcodeproj/project.pbxproj
+++ b/lldb/tools/lldb-perf/lldbperf.xcodeproj/project.pbxproj
@@ -22,6 +22,10 @@
/* End PBXAggregateTarget section */
/* Begin PBXBuildFile section */
+ 26DBAD6216FA63F0008243D2 /* lldb_perf_clang.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 26DBAD4916FA637D008243D2 /* lldb_perf_clang.cpp */; };
+ 26DBAD6316FA66DC008243D2 /* liblldbperf.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 4C1E373916F4035D00FF10BB /* liblldbperf.a */; };
+ 26DBAD6416FA66E0008243D2 /* LLDB.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 264B3DE816F7E47600D1E7AB /* LLDB.framework */; };
+ 26DBAD6516FA66EA008243D2 /* CoreFoundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 4C1E37DB16F7A03900FF10BB /* CoreFoundation.framework */; };
4C1E374E16F407C800FF10BB /* Gauge.h in Headers */ = {isa = PBXBuildFile; fileRef = 4C1E374216F407C800FF10BB /* Gauge.h */; };
4C1E374F16F407C800FF10BB /* Measurement.h in Headers */ = {isa = PBXBuildFile; fileRef = 4C1E374316F407C800FF10BB /* Measurement.h */; };
4C1E375016F407C800FF10BB /* MemoryGauge.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4C1E374416F407C800FF10BB /* MemoryGauge.cpp */; };
@@ -146,7 +150,22 @@
};
/* End PBXContainerItemProxy section */
+/* Begin PBXCopyFilesBuildPhase section */
+ 26DBAD5716FA63B1008243D2 /* CopyFiles */ = {
+ isa = PBXCopyFilesBuildPhase;
+ buildActionMask = 2147483647;
+ dstPath = /usr/share/man/man1/;
+ dstSubfolderSpec = 0;
+ files = (
+ );
+ runOnlyForDeploymentPostprocessing = 1;
+ };
+/* End PBXCopyFilesBuildPhase section */
+
/* Begin PBXFileReference section */
+ 26DBAD4816FA637D008243D2 /* build-clang.sh */ = {isa = PBXFileReference; lastKnownFileType = text.script.sh; path = "build-clang.sh"; sourceTree = "<group>"; };
+ 26DBAD4916FA637D008243D2 /* lldb_perf_clang.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = lldb_perf_clang.cpp; sourceTree = "<group>"; };
+ 26DBAD5916FA63B1008243D2 /* lldb-perf-clang */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = "lldb-perf-clang"; sourceTree = BUILT_PRODUCTS_DIR; };
4C1E373916F4035D00FF10BB /* liblldbperf.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = liblldbperf.a; sourceTree = BUILT_PRODUCTS_DIR; };
4C1E374216F407C800FF10BB /* Gauge.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Gauge.h; sourceTree = "<group>"; };
4C1E374316F407C800FF10BB /* Measurement.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Measurement.h; sourceTree = "<group>"; };
@@ -189,6 +208,16 @@
/* End PBXFileReference section */
/* Begin PBXFrameworksBuildPhase section */
+ 26DBAD5616FA63B1008243D2 /* Frameworks */ = {
+ isa = PBXFrameworksBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ 26DBAD6516FA66EA008243D2 /* CoreFoundation.framework in Frameworks */,
+ 26DBAD6416FA66E0008243D2 /* LLDB.framework in Frameworks */,
+ 26DBAD6316FA66DC008243D2 /* liblldbperf.a in Frameworks */,
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ };
4C1E373616F4035D00FF10BB /* Frameworks */ = {
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
@@ -226,11 +255,29 @@
/* End PBXFrameworksBuildPhase section */
/* Begin PBXGroup section */
+ 26DBAD4616FA637D008243D2 /* common */ = {
+ isa = PBXGroup;
+ children = (
+ 26DBAD4716FA637D008243D2 /* clang */,
+ );
+ path = common;
+ sourceTree = "<group>";
+ };
+ 26DBAD4716FA637D008243D2 /* clang */ = {
+ isa = PBXGroup;
+ children = (
+ 26DBAD4816FA637D008243D2 /* build-clang.sh */,
+ 26DBAD4916FA637D008243D2 /* lldb_perf_clang.cpp */,
+ );
+ path = clang;
+ sourceTree = "<group>";
+ };
4C1E373016F4035D00FF10BB = {
isa = PBXGroup;
children = (
4C86C5C316F7A35000844407 /* lldb.xcodeproj */,
4C1E37B516F79E6600FF10BB /* Darwin */,
+ 26DBAD4616FA637D008243D2 /* common */,
4C1E375A16F4081300FF10BB /* cfcpp */,
4C1E374116F407C800FF10BB /* lib */,
4C1E373A16F4035D00FF10BB /* Products */,
@@ -245,6 +292,7 @@
4C1E376D16F4087A00FF10BB /* lldb-perf-sketch */,
4C1E37BA16F79E9D00FF10BB /* lldb-perf-formatters */,
4C86C5D116F7CC8900844407 /* format-tester */,
+ 26DBAD5916FA63B1008243D2 /* lldb-perf-clang */,
);
name = Products;
sourceTree = "<group>";
@@ -373,6 +421,23 @@
/* End PBXHeadersBuildPhase section */
/* Begin PBXNativeTarget section */
+ 26DBAD5816FA63B1008243D2 /* lldb-perf-clang */ = {
+ isa = PBXNativeTarget;
+ buildConfigurationList = 26DBAD5F16FA63B1008243D2 /* Build configuration list for PBXNativeTarget "lldb-perf-clang" */;
+ buildPhases = (
+ 26DBAD5516FA63B1008243D2 /* Sources */,
+ 26DBAD5616FA63B1008243D2 /* Frameworks */,
+ 26DBAD5716FA63B1008243D2 /* CopyFiles */,
+ );
+ buildRules = (
+ );
+ dependencies = (
+ );
+ name = "lldb-perf-clang";
+ productName = lldb_perf_clang;
+ productReference = 26DBAD5916FA63B1008243D2 /* lldb-perf-clang */;
+ productType = "com.apple.product-type.tool";
+ };
4C1E373816F4035D00FF10BB /* lldbperf */ = {
isa = PBXNativeTarget;
buildConfigurationList = 4C1E373D16F4035D00FF10BB /* Build configuration list for PBXNativeTarget "lldbperf" */;
@@ -471,6 +536,7 @@
4C1E373816F4035D00FF10BB /* lldbperf */,
4C1E376C16F4087A00FF10BB /* lldb-perf-sketch */,
4C1E37B916F79E9D00FF10BB /* lldb-perf-formatters */,
+ 26DBAD5816FA63B1008243D2 /* lldb-perf-clang */,
4C86C5D016F7CC8900844407 /* format-tester */,
4C1E37E316F7A0A500FF10BB /* All Perf Tests */,
);
@@ -530,6 +596,14 @@
/* End PBXReferenceProxy section */
/* Begin PBXSourcesBuildPhase section */
+ 26DBAD5516FA63B1008243D2 /* Sources */ = {
+ isa = PBXSourcesBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ 26DBAD6216FA63F0008243D2 /* lldb_perf_clang.cpp in Sources */,
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ };
4C1E373516F4035D00FF10BB /* Sources */ = {
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
@@ -603,6 +677,42 @@
/* End PBXTargetDependency section */
/* Begin XCBuildConfiguration section */
+ 26DBAD6016FA63B1008243D2 /* Debug */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ CLANG_ENABLE_MODULES = YES;
+ CLANG_ENABLE_OBJC_ARC = YES;
+ FRAMEWORK_SEARCH_PATHS = (
+ "$(inherited)",
+ "$(SRCROOT)/../../build/Debug",
+ );
+ GCC_PREPROCESSOR_DEFINITIONS = (
+ "DEBUG=1",
+ "$(inherited)",
+ );
+ OTHER_LDFLAGS = "-Wl,-rpath,@loader_path/../../../../build/Debug";
+ PRODUCT_NAME = "$(TARGET_NAME)";
+ SDKROOT = macosx;
+ USER_HEADER_SEARCH_PATHS = "$(SRCROOT)/../ $(SRCROOT)/../../include/";
+ };
+ name = Debug;
+ };
+ 26DBAD6116FA63B1008243D2 /* Release */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ CLANG_ENABLE_MODULES = YES;
+ CLANG_ENABLE_OBJC_ARC = YES;
+ FRAMEWORK_SEARCH_PATHS = (
+ "$(inherited)",
+ "$(SRCROOT)/../../build/Debug",
+ );
+ OTHER_LDFLAGS = "-Wl,-rpath,@loader_path/../../../../build/Debug";
+ PRODUCT_NAME = "$(TARGET_NAME)";
+ SDKROOT = macosx;
+ USER_HEADER_SEARCH_PATHS = "$(SRCROOT)/../ $(SRCROOT)/../../include/";
+ };
+ name = Release;
+ };
4C1E373B16F4035D00FF10BB /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
@@ -776,6 +886,14 @@
/* End XCBuildConfiguration section */
/* Begin XCConfigurationList section */
+ 26DBAD5F16FA63B1008243D2 /* Build configuration list for PBXNativeTarget "lldb-perf-clang" */ = {
+ isa = XCConfigurationList;
+ buildConfigurations = (
+ 26DBAD6016FA63B1008243D2 /* Debug */,
+ 26DBAD6116FA63B1008243D2 /* Release */,
+ );
+ defaultConfigurationIsVisible = 0;
+ };
4C1E373416F4035D00FF10BB /* Build configuration list for PBXProject "lldbperf" */ = {
isa = XCConfigurationList;
buildConfigurations = (
OpenPOWER on IntegriCloud