-
Notifications
You must be signed in to change notification settings - Fork 720
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Perfetto (https://perfetto.dev/) is a system profiling, app tracing and trace analysis framework. We started using Perfetto for studying a few performance-related problems for OpenBMC-related systems (both the BMC and the host) and we feel it would be good if Perfetto is included into OpenEmbedded, since embedded systems are usually expected to have predictable performance characteristics, and having a good set of performance analysis tools would make this work easier.
- Loading branch information
1 parent
a9e6d16
commit 6499604
Showing
1 changed file
with
145 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,145 @@ | ||
LICENSE = "Apache-2.0 & Unknown" | ||
LIC_FILES_CHKSUM = "file://LICENSE;md5=f87516e0b698007e9e75a1fe1012b390 \ | ||
file://buildtools/android-unwinding/libunwindstack/LICENSE_BSD;md5=6e0dc88b22ba6908afbc1a1d8abbb148 \ | ||
file://buildtools/benchmark/LICENSE;md5=3b83ef96387f14655fc854ddc3c6bd57 \ | ||
file://buildtools/googletest/LICENSE;md5=cbbd27594afd089daa160d3a16dd515a \ | ||
file://buildtools/jsoncpp/LICENSE;md5=fa2a23dd1dc6c139f35105379d76df2b \ | ||
file://buildtools/jsoncpp/devtools/licenseupdater.py;md5=891928af1911fc7d5a4383b63dd0ae66 \ | ||
file://buildtools/libbacktrace/LICENSE;md5=24b5b3feec63c4be0975e1fea5100440 \ | ||
file://buildtools/libcxx/LICENSE.TXT;md5=55d89dd7eec8d3b4204b680e27da3953 \ | ||
file://buildtools/libcxx/utils/google-benchmark/LICENSE;md5=3b83ef96387f14655fc854ddc3c6bd57 \ | ||
file://buildtools/libcxxabi/LICENSE.TXT;md5=7b9334635b542c56868400a46b272b1e \ | ||
file://buildtools/libunwind/LICENSE.TXT;md5=f66970035d12f196030658b11725e1a1 \ | ||
file://buildtools/linenoise/LICENSE;md5=faa55ac8cbebebcb4a84fe1ea2879578 \ | ||
file://buildtools/lzma/Java/Tukaani/COPYING;md5=3d9c8c11183717c7a0539a9afccec6e4 \ | ||
file://buildtools/protobuf/LICENSE;md5=37b5762e07f0af8c74ce80a8bda4266b \ | ||
file://buildtools/sqlite_src/LICENSE.md;md5=82c5c312251c7bb3f775273ef25592e2 \ | ||
file://buildtools/sqlite_src/autoconf/tea/license.terms;md5=5e0405ae78edb434653628790bb02b17 \ | ||
file://buildtools/zlib/LICENSE;md5=f09575dbfb09420642318b413159496f \ | ||
file://debian/copyright;md5=4e08364c82141f181de69d0a2b89d612 \ | ||
file://python/LICENSE;md5=c602a632c34ade9c78a976734077bce7" | ||
|
||
SRC_URI = "git://github.com/google/perfetto.git;protocol=https" | ||
SRC_URI[sha256sum] = "3d92dc8f561ea6a83f3efdea33c5aeefa4a3cd98f9739190efd9c33c30bcbdf0" | ||
SRCREV = "5bd3f582c075d0d026c5fe0b5e291d34dee0d976" | ||
|
||
DEPENDS += " ninja-native" | ||
DEPENDS += " curl-native" | ||
DEPENDS += " ca-certificates-native" | ||
|
||
# To avoid the GNU_HASH warning | ||
TARGET_CC_ARCH += "${LDFLAGS}" | ||
|
||
S = "${WORKDIR}/git" | ||
|
||
FILES:${PN}:append = " \ | ||
${bindir}/tracebox \ | ||
" | ||
|
||
# Perfetto includes an "install-build-deps" script. It requires network connection. | ||
do_fetch () { | ||
# Fixme: This PATH is for making curl visible to bitbake, there should be a better way | ||
export CURL_CA_BUNDLE=`dirname dirname ${PSEUDO_PREFIX}`"/ca-certificates-native/etc/ssl/certs/ca-certificates.crt" | ||
export PATH=$PATH":/usr/bin" | ||
|
||
if [ ! -d perfetto -a ! -d perfetto.git ]; then | ||
# FIXME: Make this work with base_do_fetch | ||
HTTPS_SRCURI=`echo "${SRC_URI}"|sed "s/git\:\/\//https:\/\//g;s/;protocol=.*//g"` | ||
|
||
# The bare Git repository for copying into git2 | ||
git clone --bare $HTTPS_SRCURI | ||
|
||
if [ -f git2/github.com.google.perfetto.git.lock ]; then | ||
rm git2/github.com.google.perfetto.git.lock | ||
fi | ||
if [ -d git2/github.com.google.perfetto.git ]; then | ||
rm -rf git2/github.com.google.perfetto.git | ||
fi | ||
|
||
mv perfetto.git git2/github.com.google.perfetto.git | ||
touch git2/github.com.google.perfetto.git.done | ||
|
||
# The ordinary Git repository | ||
git clone $HTTPS_SRCURI | ||
|
||
cd perfetto | ||
git reset --hard ${SRCREV} | ||
echo "Running tools/install-build-deps script" | ||
python3 tools/install-build-deps | ||
cd .. | ||
tar cfz perfetto.tar.gz perfetto | ||
touch perfetto.tar.gz.done | ||
rm -r -f perfetto | ||
fi | ||
} | ||
|
||
do_unpack() { | ||
tar xfz ../../../../../downloads/perfetto.tar.gz | ||
[ -d git ] && rm -r -f git | ||
mv perfetto git | ||
} | ||
|
||
# Run the GN (Generate Ninja) script using the Linux-Arm configuration | ||
# and replace the compiler flags | ||
do_configure () { | ||
SYSROOT=`echo $CC | grep -oi "\-\-sysroot=.*" | sed -s "s/--sysroot=//g"` | ||
BUILD_DIR=${WORKDIR}"/build" | ||
|
||
echo "Installing dependencies" | ||
tools/install-build-deps | ||
|
||
CC_BIN=`echo $CC | awk '{print $1}'` | ||
CXX_BIN=`echo $CXX | awk '{print $1}'` | ||
STRIP_BIN=`echo $STRIP | awk '{print $1}'` | ||
|
||
ARGS="is_debug=false " # Tell gn to use release mode | ||
ARGS=$ARGS" is_clang=false" | ||
ARGS=$ARGS" target_os=\"linux\"" | ||
ARGS=$ARGS" target_cpu=\"arm\"" | ||
ARGS=$ARGS" target_cc=\"$CC_BIN\"" # Use Yocto's CC | ||
ARGS=$ARGS" target_cxx=\"$CXX_BIN\"" # Use Yocto's CXX | ||
ARGS=$ARGS" target_strip=\"$STRIP_BIN\"" # | ||
ARGS=$ARGS" target_sysroot=\"$SYSROOT\"" | ||
ARGS=$ARGS" target_linker=\"$CC_BIN\"" | ||
ARGS=$ARGS" target_ar=\"$AR\"" # Use Yocto's AR | ||
ARGS="'$ARGS'" | ||
cmd="tools/gn gen --args=$ARGS $BUILD_DIR" | ||
|
||
echo $cmd | ||
# Use eval, not just call $cmd, due to escaping of single quotation marks | ||
eval $cmd | ||
|
||
cd $BUILD_DIR | ||
# Eliminate a few incompatible build flags | ||
REPLACES="s/-Wl,--icf=all//g" | ||
REPLACES=$REPLACES";s/-Werror//g" | ||
REPLACES=$REPLACES";s/-mfpu=neon//g" | ||
REPLACES=$REPLACES";s/-fcolor-diagnostics//g" | ||
REPLACES=$REPLACES";s/=format-security//g" | ||
REPLACES=$REPLACES";s/-std=c++11/-std=c++17/g" | ||
REPLACES=$REPLACES";s/-fdiagnostics-show-template-tree//g" | ||
REPLACES=$REPLACES";s/-D_FORTIFY_SOURCE=2//g" | ||
REPLACES=$REPLACES";s/-fuse-ld=\S*/-fuse-ld=gold/g" | ||
find . -name "*.ninja" | xargs sed $REPLACES -i | ||
|
||
# Done processing the Ninja files | ||
} | ||
|
||
# Perfetto generates a few different binaries, such as traced and traced_probes and perfetto. | ||
# The "tracebox" is a busybox that combines the 3 above and provides a single stop for doing the trace capture work, so we only build "tracebox" here. | ||
do_compile () { | ||
cd ${WORKDIR}/build/ | ||
ninja -C . tracebox | ||
} | ||
|
||
do_install () { | ||
BUILD_DIR=${WORKDIR}/build/ | ||
BIN_DIR=${D}${bindir} | ||
|
||
install -d -m0755 $BIN_DIR | ||
install $BUILD_DIR/tracebox $BIN_DIR/tracebox | ||
} | ||
|
||
do_package_qa() { | ||
echo "Skipping package_qa to silence the GNU_HASH error" | ||
} |