Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 14 Aug 2015 00:13:14 +0000 (UTC)
From:      Jan Beich <jbeich@FreeBSD.org>
To:        ports-committers@freebsd.org, svn-ports-all@freebsd.org, svn-ports-head@freebsd.org
Subject:   svn commit: r394199 - in head/devel: . android-tools-simpleperf android-tools-simpleperf/files
Message-ID:  <201508140013.t7E0DEL3025012@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: jbeich
Date: Fri Aug 14 00:13:13 2015
New Revision: 394199
URL: https://svnweb.freebsd.org/changeset/ports/394199

Log:
  devel/android-tools-simpleperf: add new port
  
  simpleperf is a minimal Linux perf implementation for extracting
  sampling information out of perf.data.

Added:
  head/devel/android-tools-simpleperf/
  head/devel/android-tools-simpleperf/Makefile   (contents, props changed)
  head/devel/android-tools-simpleperf/distinfo   (contents, props changed)
  head/devel/android-tools-simpleperf/files/
  head/devel/android-tools-simpleperf/files/Makefile   (contents, props changed)
  head/devel/android-tools-simpleperf/files/patch-base_file.cpp   (contents, props changed)
  head/devel/android-tools-simpleperf/files/patch-base_include_base_logging.h   (contents, props changed)
  head/devel/android-tools-simpleperf/files/patch-base_logging.cpp   (contents, props changed)
  head/devel/android-tools-simpleperf/files/patch-libcutils_threads.c   (contents, props changed)
  head/devel/android-tools-simpleperf/files/patch-liblog_logd__write.c   (contents, props changed)
  head/devel/android-tools-simpleperf/files/patch-simpleperf_dso.cpp   (contents, props changed)
  head/devel/android-tools-simpleperf/files/patch-simpleperf_event__attr.cpp   (contents, props changed)
  head/devel/android-tools-simpleperf/files/patch-simpleperf_record.h   (contents, props changed)
  head/devel/android-tools-simpleperf/files/patch-simpleperf_utils.cpp   (contents, props changed)
  head/devel/android-tools-simpleperf/pkg-descr   (contents, props changed)
Modified:
  head/devel/Makefile   (contents, props changed)

Modified: head/devel/Makefile
==============================================================================
--- head/devel/Makefile	Fri Aug 14 00:12:54 2015	(r394198)
+++ head/devel/Makefile	Fri Aug 14 00:13:13 2015	(r394199)
@@ -66,6 +66,7 @@
     SUBDIR += android-tools-adb-devel
     SUBDIR += android-tools-fastboot
     SUBDIR += android-tools-fastboot-devel
+    SUBDIR += android-tools-simpleperf
     SUBDIR += anjuta
     SUBDIR += anjuta-extras
     SUBDIR += antlr

Added: head/devel/android-tools-simpleperf/Makefile
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/devel/android-tools-simpleperf/Makefile	Fri Aug 14 00:13:13 2015	(r394199)
@@ -0,0 +1,47 @@
+# $FreeBSD$
+
+PORTNAME=	android-tools-simpleperf
+DISTVERSIONPREFIX=	android-
+DISTVERSION=	m-preview-136
+DISTVERSIONSUFFIX=	-g89a2254
+CATEGORIES=	devel
+
+MAINTAINER=	jbeich@FreeBSD.org
+COMMENT=	Android simpleperf tool
+
+LICENSE=	APACHE20
+
+BUILD_DEPENDS=	llvm-config${LLVM_VER}:${PORTSDIR}/devel/llvm${LLVM_VER}
+
+USE_GITHUB=	yes
+GH_ACCOUNT=	android:bionic,core jbeich
+GH_PROJECT=	platform_bionic:bionic platform_system_core:core \
+		platform_system_extras
+GH_TAGNAME=	android-m-preview-232-gb4f2112:bionic \
+		android-m-preview-868-gb81c410:core
+
+USES=		compiler:c++11-lib uidfix
+BUILD_WRKSRC=	${WRKSRC}/simpleperf
+INSTALL_WRKSRC=	${BUILD_WRKSRC}
+MAKEFILE=	${FILESDIR}/Makefile
+MAKE_ENV=	BINDIR="${PREFIX}/bin" LLVM_CONFIG="llvm-config${LLVM_VER}"
+ALL_TARGET=	all
+LDFLAGS+=	-Wl,--as-needed # avoid overlinking (llvm deps)
+PLIST_FILES=	bin/simpleperf
+
+LLVM_VER?=	36 # XXX Move to DEFAULT_VERSIONS
+
+OPTIONS_DEFINE=	TEST
+
+TEST_BUILD_DEPENDS=googletest>=1.6.0:${PORTSDIR}/devel/googletest
+TEST_ALL_TARGET=simpleperf_unit_test
+
+post-extract:
+# Adjust paths relative to extras
+	@(cd ${WRKSRC_core} && ${COPYTREE_SHARE} . ${WRKSRC})
+	@${MV} ${WRKSRC_bionic} ${WRKSRC}/bionic
+
+pre-install-TEST-on:
+	${BUILD_WRKSRC}/simpleperf_unit_test
+
+.include <bsd.port.mk>

Added: head/devel/android-tools-simpleperf/distinfo
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/devel/android-tools-simpleperf/distinfo	Fri Aug 14 00:13:13 2015	(r394199)
@@ -0,0 +1,6 @@
+SHA256 (jbeich-platform_system_extras-android-m-preview-136-g89a2254_GH0.tar.gz) = 33813515ba14743085b8e95a4a74025ac4cefd7d308d5870cc8e279ef5380d4a
+SIZE (jbeich-platform_system_extras-android-m-preview-136-g89a2254_GH0.tar.gz) = 665360
+SHA256 (android-platform_bionic-android-m-preview-232-gb4f2112_GH0.tar.gz) = 88767af6ed1b4377c03aee44e61c175f69decc9169eea2b39661c940186eec5e
+SIZE (android-platform_bionic-android-m-preview-232-gb4f2112_GH0.tar.gz) = 3438328
+SHA256 (android-platform_system_core-android-m-preview-868-gb81c410_GH0.tar.gz) = e013cf5538e25d8123bb7e423ab4269826f74d0af3d44e3e316942c2b1b5a362
+SIZE (android-platform_system_core-android-m-preview-868-gb81c410_GH0.tar.gz) = 1335909

Added: head/devel/android-tools-simpleperf/files/Makefile
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/devel/android-tools-simpleperf/files/Makefile	Fri Aug 14 00:13:13 2015	(r394199)
@@ -0,0 +1,73 @@
+# $FreeBSD$
+
+PROG_CXX=simpleperf
+NO_MAN=
+BINDIR?=/usr/bin
+
+SRCS+=	callchain.cpp
+SRCS+=	cmd_dumprecord.cpp
+SRCS+=	cmd_help.cpp
+SRCS+=	cmd_report.cpp
+SRCS+=	command.cpp
+SRCS+=	dso.cpp
+SRCS+=	environment_fake.cpp
+SRCS+=	event_attr.cpp
+SRCS+=	event_type.cpp
+SRCS+=	main.cpp
+SRCS+=	perf_regs.cpp
+SRCS+=	read_elf.cpp
+SRCS+=	record.cpp
+SRCS+=	record_file_reader.cpp
+SRCS+=	sample_tree.cpp
+SRCS+=	thread_tree.cpp
+SRCS+=	utils.cpp
+
+TEST_SRCS+=	command_test.cpp
+TEST_SRCS+=	gtest_main.cpp
+TEST_SRCS+=	record_test.cpp
+TEST_SRCS+=	sample_tree_test.cpp
+
+# required by simpleperf
+.PATH: ${.CURDIR}/../base
+SRCS+=	file.cpp
+SRCS+=	logging.cpp
+SRCS+=	stringprintf.cpp
+SRCS+=	strings.cpp
+
+# required by base
+.PATH:	${.CURDIR}/../liblog
+SRCS+=	fake_log_device.c
+SRCS+=	logd_write.c
+CFLAGS.logd_write.c+=	-DFAKE_LOG_DEVICE=1
+
+# required by base
+.PATH: ${.CURDIR}/../libcutils
+SRCS+= threads.c
+
+CFLAGS+=-D_WITH_GETLINE
+CFLAGS+=-DUSE_BIONIC_UAPI_HEADERS
+CFLAGS+=-I${.CURDIR}/darwin_support
+CFLAGS+=-I${.CURDIR}/../include
+CFLAGS+=-I${.CURDIR}/../base/include
+CFLAGS+=-I${.CURDIR}/../bionic/libc/kernel
+CFLAGS+=$$(${LLVM_CONFIG} --cppflags)
+CFLAGS+=${CFLAGS.${.IMPSRC:T}}
+
+CXXFLAGS+=-std=gnu++11
+CXXFLAGS+=${CFLAGS:N-std*}
+
+TEST_CFLAGS+=	$$(${GTEST_CONFIG} --cppflags)
+.for f in ${TEST_SRCS}
+CFLAGS.${f}+=	${TEST_CFLAGS}
+.endfor
+
+LDADD+=		$$(${LLVM_CONFIG} --system-libs --libs --ldflags)
+TEST_LDADD+=	$$(${GTEST_CONFIG} --libs --ldflags)
+
+LLVM_CONFIG?=	llvm-config
+GTEST_CONFIG?=	gtest-config
+
+simpleperf_unit_test: ${SRCS:R:S/$/.o/:Nmain.o} ${TEST_SRCS:R:S/$/.o/}
+	${CXX} ${CXXFLAGS} ${LDFLAGS} -o $@ $> ${LDADD} ${TEST_LDADD}
+
+.include <bsd.prog.mk>

Added: head/devel/android-tools-simpleperf/files/patch-base_file.cpp
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/devel/android-tools-simpleperf/files/patch-base_file.cpp	Fri Aug 14 00:13:13 2015	(r394199)
@@ -0,0 +1,10 @@
+--- base/file.cpp.orig	2015-08-12 23:28:08 UTC
++++ base/file.cpp
+@@ -21,6 +21,7 @@
+ #include <sys/stat.h>
+ #include <sys/types.h>
+ 
++#include <cstring> // strerror
+ #include <string>
+ 
+ #include "base/macros.h"  // For TEMP_FAILURE_RETRY on Darwin.

Added: head/devel/android-tools-simpleperf/files/patch-base_include_base_logging.h
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/devel/android-tools-simpleperf/files/patch-base_include_base_logging.h	Fri Aug 14 00:13:13 2015	(r394199)
@@ -0,0 +1,10 @@
+--- base/include/base/logging.h.orig	2015-08-12 23:28:08 UTC
++++ base/include/base/logging.h
+@@ -25,6 +25,7 @@
+ #endif
+ #endif
+ 
++#include <cerrno> // errno
+ #include <functional>
+ #include <memory>
+ #include <ostream>

Added: head/devel/android-tools-simpleperf/files/patch-base_logging.cpp
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/devel/android-tools-simpleperf/files/patch-base_logging.cpp	Fri Aug 14 00:13:13 2015	(r394199)
@@ -0,0 +1,18 @@
+--- base/logging.cpp.orig	2015-08-12 23:28:08 UTC
++++ base/logging.cpp
+@@ -23,12 +23,14 @@
+ #include <libgen.h>
+ 
+ // For getprogname(3) or program_invocation_short_name.
+-#if defined(__ANDROID__) || defined(__APPLE__)
++#if !defined(_WIN32) && !defined(__GLIBC__)
+ #include <stdlib.h>
+ #elif defined(__GLIBC__)
+ #include <errno.h>
+ #endif
+ 
++#include <cstring> // strlen
++#include <cstdio>  // fprintf
+ #include <iostream>
+ #include <limits>
+ #include <sstream>

Added: head/devel/android-tools-simpleperf/files/patch-libcutils_threads.c
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/devel/android-tools-simpleperf/files/patch-libcutils_threads.c	Fri Aug 14 00:13:13 2015	(r394199)
@@ -0,0 +1,38 @@
+--- libcutils/threads.c.orig	2015-08-12 23:28:08 UTC
++++ libcutils/threads.c
+@@ -29,6 +29,14 @@
+ #include <unistd.h>
+ #elif defined(_WIN32)
+ #include <windows.h>
++#elif defined(__DragonFly__)
++#include <unistd.h>
++#elif defined(__FreeBSD__)
++#include <sys/param.h>
++#include <sys/thr.h>
++#include <pthread_np.h>
++#elif defined(__NetBSD__)
++#include <lwp.h>
+ #endif
+ 
+ // No definition needed for Android because we'll just pick up bionic's copy.
+@@ -40,6 +48,20 @@ pid_t gettid() {
+   return syscall(__NR_gettid);
+ #elif defined(_WIN32)
+   return GetCurrentThreadId();
++#elif defined(__DragonFly__)
++  return lwp_gettid();
++#elif defined(__NetBSD__)
++  return _lwp_self();
++#elif defined(__FreeBSD__)
++#  if __FreeBSD_version > 900030
++    return pthread_getthreadid_np();
++#  else
++    long lwpid;
++    thr_self(&lwpid);
++    return lwpid;
++#  endif
++#else
++  return (intptr_t) pthread_self();
+ #endif
+ }
+ #endif  // __ANDROID__

Added: head/devel/android-tools-simpleperf/files/patch-liblog_logd__write.c
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/devel/android-tools-simpleperf/files/patch-liblog_logd__write.c	Fri Aug 14 00:13:13 2015	(r394199)
@@ -0,0 +1,12 @@
+--- liblog/logd_write.c.orig	2015-05-27 20:24:08 UTC
++++ liblog/logd_write.c
+@@ -22,7 +22,9 @@
+ #include <pthread.h>
+ #endif
+ #include <stdarg.h>
++#if (FAKE_LOG_DEVICE == 0)
+ #include <stdatomic.h>
++#endif
+ #include <stdio.h>
+ #include <stdlib.h>
+ #include <string.h>

Added: head/devel/android-tools-simpleperf/files/patch-simpleperf_dso.cpp
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/devel/android-tools-simpleperf/files/patch-simpleperf_dso.cpp	Fri Aug 14 00:13:13 2015	(r394199)
@@ -0,0 +1,10 @@
+--- simpleperf/dso.cpp.orig	2015-08-12 01:49:40 UTC
++++ simpleperf/dso.cpp
+@@ -16,6 +16,7 @@
+ 
+ #include "dso.h"
+ 
++#include <limits.h> // ULLONG_MAX
+ #include <stdlib.h>
+ #include <base/logging.h>
+ #include "environment.h"

Added: head/devel/android-tools-simpleperf/files/patch-simpleperf_event__attr.cpp
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/devel/android-tools-simpleperf/files/patch-simpleperf_event__attr.cpp	Fri Aug 14 00:13:13 2015	(r394199)
@@ -0,0 +1,10 @@
+--- simpleperf/event_attr.cpp.orig	2015-08-12 01:49:40 UTC
++++ simpleperf/event_attr.cpp
+@@ -18,6 +18,7 @@
+ 
+ #include <inttypes.h>
+ #include <stdio.h>
++#include <string.h> // memset
+ #include <string>
+ #include <unordered_map>
+ 

Added: head/devel/android-tools-simpleperf/files/patch-simpleperf_record.h
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/devel/android-tools-simpleperf/files/patch-simpleperf_record.h	Fri Aug 14 00:13:13 2015	(r394199)
@@ -0,0 +1,10 @@
+--- simpleperf/record.h.orig	2015-08-12 01:49:40 UTC
++++ simpleperf/record.h
+@@ -19,6 +19,7 @@
+ 
+ #include <sys/types.h>
+ 
++#include <memory> // unique_ptr
+ #include <string>
+ #include <vector>
+ 

Added: head/devel/android-tools-simpleperf/files/patch-simpleperf_utils.cpp
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/devel/android-tools-simpleperf/files/patch-simpleperf_utils.cpp	Fri Aug 14 00:13:13 2015	(r394199)
@@ -0,0 +1,10 @@
+--- simpleperf/utils.cpp.orig	2015-08-12 01:49:40 UTC
++++ simpleperf/utils.cpp
+@@ -20,6 +20,7 @@
+ #include <errno.h>
+ #include <stdarg.h>
+ #include <stdio.h>
++#include <string.h> // strcmp
+ #include <sys/stat.h>
+ #include <unistd.h>
+ 

Added: head/devel/android-tools-simpleperf/pkg-descr
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/devel/android-tools-simpleperf/pkg-descr	Fri Aug 14 00:13:13 2015	(r394199)
@@ -0,0 +1,2 @@
+simpleperf is a minimal Linux perf implementation for extracting
+sampling information out of perf.data.



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201508140013.t7E0DEL3025012>