* v1.3.0

* ROCm 5.2 and extensions tweaks

* Container workflow + miscellaneous updates

* Misc fixes + timemory submodule update

- timemory submodule update for multiple definitions of variant_apply

* Increase timeouts

* Remove obsolete Julia docs and script

- support for rocprofiler makes rocprof merging obsolete

* Fix cpack testing and combine cpack workflows into single script

* Install components + omnitrace tpl exes

- Improved COMPONENT specification for installs
- Install PAPI executables with omnitrace- prefix and hyphens
- Install Perfetto executables with omnitrace- prefix and hyphens

* Update docs on perfetto and papi command-line tools

* remove ubuntu 22.04 from containers workflow

* remove containers workflow running on all pushes

* Fix CI_SCRIPT_ARGS

* Fix PAPI utils install

* Fixed traced test in workflow + removed return char

- validate-perfetto-proto.py had return character

* Fix test-docker-release.sh script to use correct container

* Release build bc RelWtihDebInfo using too much memory
Этот коммит содержится в:
Jonathan R. Madsen
2022-07-23 03:02:31 -05:00
коммит произвёл GitHub
родитель 0729e1737b
Коммит ea282d9301
28 изменённых файлов: 608 добавлений и 423 удалений
+144
Просмотреть файл
@@ -0,0 +1,144 @@
name: ci-containers
# nightly build
on:
schedule:
- cron: 0 3 * * *
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
env:
GIT_DISCOVERY_ACROSS_FILESYSTEM: 1
jobs:
omnitrace-ci:
runs-on: ubuntu-20.04
strategy:
fail-fast: false
matrix:
include:
- distro: "ubuntu"
version: "18.04"
- distro: "ubuntu"
version: "20.04"
- distro: "opensuse"
version: "15.2"
- distro: "opensuse"
version: "15.3"
- distro: "opensuse"
version: "15.4"
steps:
- uses: actions/checkout@v3
with:
submodules: recursive
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Login to DockerHub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Build CI Container
if: ${{ matrix.rocm-version == 0 }}
timeout-minutes: 45
run: |
pushd docker
./build-docker-ci.sh --distro ${{ matrix.distro }} --versions ${{ matrix.version }} --user ${{ secrets.DOCKERHUB_USERNAME }} --push --jobs 2 --elfutils-version 0.186
popd
omnitrace-release-ubuntu:
runs-on: ubuntu-20.04
strategy:
fail-fast: false
matrix:
os: ["18.04", "20.04"]
rocm-version: ["0.0", "4.5", "5.0", "5.1", "5.2"]
default-rocm: ["5.0"]
steps:
- uses: actions/checkout@v3
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Login to DockerHub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Build Base Container
if: ${{ matrix.rocm-version == 0 }}
timeout-minutes: 45
run: |
pushd docker
./build-docker.sh --distro ubuntu --versions ${{ matrix.os }} --rocm-versions ${{ matrix.default-rocm }} --user ${{ secrets.DOCKERHUB_USERNAME }} --push
popd
- name: Build Base Container
if: ${{ matrix.rocm-version > 0 }}
timeout-minutes: 45
run: |
pushd docker
./build-docker.sh --distro ubuntu --versions ${{ matrix.os }} --rocm-versions ${{ matrix.rocm-version }} --user ${{ secrets.DOCKERHUB_USERNAME }} --push
popd
omnitrace-release-opensuse:
runs-on: ubuntu-20.04
strategy:
fail-fast: false
matrix:
os: ["15.2", "15.3"]
rocm-version: ["0.0", "4.5", "5.0", "5.1", "5.2"]
default-rocm: ["5.0"]
exclude:
- os: "15.2"
rocm-version: "5.1"
- os: "15.2"
rocm-version: "5.2"
steps:
- uses: actions/checkout@v3
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Login to DockerHub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Build Base Container
if: ${{ matrix.rocm-version == 0 }}
timeout-minutes: 45
run: |
pushd docker
./build-docker.sh --distro opensuse --versions ${{ matrix.os }} --rocm-versions ${{ matrix.default-rocm }} --user ${{ secrets.DOCKERHUB_USERNAME }} --push
popd
- name: Build Base Container
if: ${{ matrix.rocm-version > 0 }}
timeout-minutes: 45
run: |
pushd docker
./build-docker.sh --distro opensuse --versions ${{ matrix.os }} --rocm-versions ${{ matrix.rocm-version }} --user ${{ secrets.DOCKERHUB_USERNAME }} --push
popd
-96
Просмотреть файл
@@ -1,96 +0,0 @@
name: cpack-opensuse
on:
push:
branches: [releases/**]
tags: []
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
env:
GIT_DISCOVERY_ACROSS_FILESYSTEM: 1
jobs:
cpack:
runs-on: ubuntu-20.04
strategy:
fail-fast: false
matrix:
os: ["15.2", "15.3"]
rocm-version: ["4.5", "5.0", "5.1"]
extensions: ["--rocm +python --core +python"]
exclude:
- os: "15.2"
rocm-version: "5.1"
steps:
- uses: actions/checkout@v3
with:
submodules: recursive
- name: Build Base Container
timeout-minutes: 20
run: |
pushd docker
./build-docker.sh --distro opensuse --versions ${{ matrix.os }} --rocm-versions ${{ matrix.rocm-version }}
popd
- name: Build Release
timeout-minutes: 150
run: |
pushd docker
./build-docker-release.sh --distro opensuse --versions ${{ matrix.os }} --rocm-versions ${{ matrix.rocm-version }} -- ${{ matrix.extensions }}
popd
- name: List Files
timeout-minutes: 10
run: |
find build-release -type f | egrep '\.(sh|deb|rpm)$'
- name: STGZ Artifacts
timeout-minutes: 10
uses: actions/upload-artifact@v2
with:
name: opensuse-stgz-installers
path: |
build-release/stgz/*.sh
- name: RPM Artifacts
timeout-minutes: 10
uses: actions/upload-artifact@v2
with:
name: opensuse-rpm-installers
path: |
build-release/rpm/*.rpm
# before testing remove any artifacts of the build
- name: Remove Build
timeout-minutes: 10
continue-on-error: true
run: |
mv build-release/stgz/*.sh ./
mv build-release/rpm/*.rpm ./
sudo rm -rf build-release
sudo rm -rf /opt/omnitrace
- name: Test STGZ Install
timeout-minutes: 20
continue-on-error: true
run: |
set -v
for i in omnitrace-*.sh
do
./docker/test-docker-release.sh --distro opensuse --versions ${{ matrix.os }} --rocm-versions ${{ matrix.rocm-version }} -- --stgz ${i}
done
- name: Test RPM Install
timeout-minutes: 20
continue-on-error: true
run: |
set -v
for i in omnitrace-*.rpm
do
./docker/test-docker-release.sh --distro opensuse --versions ${{ matrix.os }} --rocm-versions ${{ matrix.rocm-version }} -- --rpm ${i}
done
-93
Просмотреть файл
@@ -1,93 +0,0 @@
name: cpack-ubuntu
on:
push:
branches: [releases/**]
tags: []
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
env:
GIT_DISCOVERY_ACROSS_FILESYSTEM: 1
jobs:
cpack:
runs-on: ubuntu-20.04
strategy:
fail-fast: false
matrix:
os: ["18.04", "20.04"]
rocm-version: ["4.5", "5.0", "5.1"]
extensions: ["--rocm +python --core +python"]
steps:
- uses: actions/checkout@v3
with:
submodules: recursive
- name: Build Base Container
timeout-minutes: 20
run: |
pushd docker
./build-docker.sh --distro ubuntu --versions ${{ matrix.os }} --rocm-versions ${{ matrix.rocm-version }}
popd
- name: Build Release
timeout-minutes: 150
run: |
pushd docker
./build-docker-release.sh --distro ubuntu --versions ${{ matrix.os }} --rocm-versions ${{ matrix.rocm-version }} -- ${{ matrix.extensions }}
popd
- name: List Files
timeout-minutes: 10
run: |
find build-release -type f | egrep '\.(sh|deb|rpm)$'
- name: STGZ Artifacts
timeout-minutes: 10
uses: actions/upload-artifact@v2
with:
name: ubuntu-stgz-installers
path: |
build-release/stgz/*.sh
- name: DEB Artifacts
timeout-minutes: 10
uses: actions/upload-artifact@v2
with:
name: ubuntu-deb-installers
path: |
build-release/deb/*.deb
# before testing remove any artifacts of the build
- name: Remove Build
timeout-minutes: 10
continue-on-error: true
run: |
mv build-release/stgz/*.sh ./
mv build-release/deb/*.deb ./
sudo rm -rf build-release
sudo rm -rf /opt/omnitrace
- name: Test STGZ Install
timeout-minutes: 20
continue-on-error: true
run: |
set -v
for i in omnitrace-*.sh
do
./docker/test-docker-release.sh --distro ubuntu --versions ${{ matrix.os }} --rocm-versions ${{ matrix.rocm-version }} -- --stgz ${i}
done
- name: Test DEB Install
timeout-minutes: 20
continue-on-error: true
run: |
set -v
for i in omnitrace_*.deb
do
./docker/test-docker-release.sh --distro ubuntu --versions ${{ matrix.os }} --rocm-versions ${{ matrix.rocm-version }} -- --deb ${i}
done
+201
Просмотреть файл
@@ -0,0 +1,201 @@
name: cpack
on:
push:
branches: [main, releases/**]
tags: []
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
env:
GIT_DISCOVERY_ACROSS_FILESYSTEM: 1
jobs:
ubuntu:
runs-on: ubuntu-20.04
strategy:
fail-fast: false
matrix:
os: ["18.04", "20.04"]
rocm-version: ["0.0", "4.5", "5.0", "5.1", "5.2"]
default-rocm: ["5.0"]
steps:
- uses: actions/checkout@v3
with:
submodules: recursive
- name: Configure ROCm Version
if: ${{ matrix.rocm-version == 0 }}
run: |
echo "CI_ROCM_VERSION=${{ matrix.default-rocm }}" >> $GITHUB_ENV
echo "CI_SCRIPT_ARGS=--core +python" >> $GITHUB_ENV
- name: Configure ROCm Version
if: ${{ matrix.rocm-version > 0 }}
run: |
echo "CI_ROCM_VERSION=${{ matrix.rocm-version }}" >> $GITHUB_ENV
echo "CI_SCRIPT_ARGS=--rocm +python" >> $GITHUB_ENV
- name: Build Base Container
timeout-minutes: 20
run: |
pushd docker
./build-docker.sh --distro ubuntu --versions ${{ matrix.os }} --rocm-versions ${CI_ROCM_VERSION}
popd
- name: Build Release
timeout-minutes: 150
run: |
pushd docker
./build-docker-release.sh --distro ubuntu --versions ${{ matrix.os }} --rocm-versions ${CI_ROCM_VERSION} -- ${CI_SCRIPT_ARGS}
popd
- name: List Files
timeout-minutes: 10
run: |
find build-release -type f | egrep '\.(sh|deb|rpm)$'
- name: STGZ Artifacts
timeout-minutes: 10
uses: actions/upload-artifact@v2
with:
name: ubuntu-stgz-installers
path: |
build-release/stgz/*.sh
- name: DEB Artifacts
timeout-minutes: 10
uses: actions/upload-artifact@v2
with:
name: ubuntu-deb-installers
path: |
build-release/deb/*.deb
# before testing remove any artifacts of the build
- name: Remove Build
timeout-minutes: 10
continue-on-error: true
run: |
mv build-release/stgz/*.sh ./
mv build-release/deb/*.deb ./
sudo rm -rf build-release
sudo rm -rf /opt/omnitrace
- name: Test STGZ Install
timeout-minutes: 20
continue-on-error: true
run: |
set -v
for i in omnitrace-*.sh
do
./docker/test-docker-release.sh --distro ubuntu --versions ${{ matrix.os }} --rocm-versions ${CI_ROCM_VERSION} -- --stgz ${i}
done
- name: Test DEB Install
timeout-minutes: 20
continue-on-error: true
run: |
set -v
for i in omnitrace_*.deb
do
./docker/test-docker-release.sh --distro ubuntu --versions ${{ matrix.os }} --rocm-versions ${CI_ROCM_VERSION} -- --deb ${i}
done
opensuse:
runs-on: ubuntu-20.04
strategy:
fail-fast: false
matrix:
os: ["15.2", "15.3"]
rocm-version: ["0.0", "4.5", "5.0", "5.1", "5.2"]
default-rocm: ["5.0"]
exclude:
- os: "15.2"
rocm-version: "5.1"
- os: "15.2"
rocm-version: "5.2"
steps:
- uses: actions/checkout@v3
with:
submodules: recursive
- name: Configure ROCm Version
if: ${{ matrix.rocm-version == 0 }}
run: |
echo "CI_ROCM_VERSION=${{ matrix.default-rocm }}" >> $GITHUB_ENV
echo "CI_SCRIPT_ARGS=--core +python" >> $GITHUB_ENV
- name: Configure ROCm Version
if: ${{ matrix.rocm-version > 0 }}
run: |
echo "CI_ROCM_VERSION=${{ matrix.rocm-version }}" >> $GITHUB_ENV
echo "CI_SCRIPT_ARGS=--rocm +python" >> $GITHUB_ENV
- name: Build Base Container
timeout-minutes: 20
run: |
pushd docker
./build-docker.sh --distro opensuse --versions ${{ matrix.os }} --rocm-versions ${CI_ROCM_VERSION}
popd
- name: Build Release
timeout-minutes: 150
run: |
pushd docker
./build-docker-release.sh --distro opensuse --versions ${{ matrix.os }} --rocm-versions ${CI_ROCM_VERSION} -- ${CI_SCRIPT_ARGS}
popd
- name: List Files
timeout-minutes: 10
run: |
find build-release -type f | egrep '\.(sh|deb|rpm)$'
- name: STGZ Artifacts
timeout-minutes: 10
uses: actions/upload-artifact@v2
with:
name: opensuse-stgz-installers
path: |
build-release/stgz/*.sh
- name: RPM Artifacts
timeout-minutes: 10
uses: actions/upload-artifact@v2
with:
name: opensuse-rpm-installers
path: |
build-release/rpm/*.rpm
# before testing remove any artifacts of the build
- name: Remove Build
timeout-minutes: 10
continue-on-error: true
run: |
mv build-release/stgz/*.sh ./
mv build-release/rpm/*.rpm ./
sudo rm -rf build-release
sudo rm -rf /opt/omnitrace
- name: Test STGZ Install
timeout-minutes: 20
continue-on-error: true
run: |
set -v
for i in omnitrace-*.sh
do
./docker/test-docker-release.sh --distro opensuse --versions ${{ matrix.os }} --rocm-versions ${CI_ROCM_VERSION} -- --stgz ${i}
done
- name: Test RPM Install
timeout-minutes: 20
continue-on-error: true
run: |
set -v
for i in omnitrace-*.rpm
do
./docker/test-docker-release.sh --distro opensuse --versions ${{ matrix.os }} --rocm-versions ${CI_ROCM_VERSION} -- --rpm ${i}
done
+1 -1
Просмотреть файл
@@ -19,7 +19,7 @@ jobs:
opensuse:
runs-on: ubuntu-20.04
container:
image: jrmadsen/omnitrace-ci:opensuse-${{ matrix.os-release }}
image: jrmadsen/omnitrace:ci-base-opensuse-${{ matrix.os-release }}
strategy:
matrix:
compiler: ['g++']
+1 -1
Просмотреть файл
@@ -21,7 +21,7 @@ jobs:
ubuntu-bionic:
runs-on: ubuntu-18.04
container:
image: jrmadsen/omnitrace-ci:ubuntu-18.04
image: jrmadsen/omnitrace:ci-base-ubuntu-18.04
strategy:
matrix:
compiler: ['g++-7', 'g++-8']
+6 -5
Просмотреть файл
@@ -18,7 +18,7 @@ jobs:
ubuntu-focal-external:
runs-on: ubuntu-20.04
container:
image: jrmadsen/omnitrace-ci:ubuntu-20.04
image: jrmadsen/omnitrace:ci-base-ubuntu-20.04
strategy:
matrix:
compiler: ['g++-7', 'g++-8']
@@ -42,7 +42,7 @@ jobs:
lto: 'OFF'
strip: 'ON'
python: 'ON'
build-type: 'RelWithDebInfo'
build-type: 'Release'
mpi-headers: 'ON'
static-libgcc: 'ON'
static-libstdcxx: 'OFF'
@@ -171,7 +171,7 @@ jobs:
ubuntu-focal-external-rocm:
runs-on: ubuntu-20.04
container:
image: jrmadsen/omnitrace-ci:ubuntu-20.04
image: jrmadsen/omnitrace:ci-base-ubuntu-20.04
strategy:
matrix:
compiler: ['g++']
@@ -250,7 +250,7 @@ jobs:
timeout-minutes: 10
run: |
set -v
traced --background
omnitrace-perfetto-traced --background
export OMNITRACE_DEBUG=ON
export OMNITRACE_PERFETTO_BACKEND=system
which omnitrace-avail
@@ -265,10 +265,11 @@ jobs:
omnitrace -e -v 1 -o ls.inst --simulate -- ls
omnitrace -e -v 1 --simulate -- ls
omnitrace -e -v 1 -o ls.inst -- ls
perfetto --out ls-perfetto-trace.proto --txt -c omnitrace.cfg
omnitrace-perfetto --out ls-perfetto-trace.proto --txt -c omnitrace.cfg
./ls.inst
omnitrace -e -v 1 -- ls
du -m ls-perfetto-trace.proto
/opt/conda/envs/py3.8/bin/python ./tests/validate-perfetto-proto.py -p -i ./ls-perfetto-trace.proto
- name: Test User API
timeout-minutes: 10
+6 -5
Просмотреть файл
@@ -245,6 +245,8 @@ endif()
#
# ------------------------------------------------------------------------------#
set(CMAKE_INSTALL_DEFAULT_COMPONENT_NAME core)
add_subdirectory(source)
# ------------------------------------------------------------------------------#
@@ -261,25 +263,23 @@ configure_file(
${PROJECT_BINARY_DIR}/install-tree/modulefiles/${PROJECT_NAME}/${OMNITRACE_VERSION}
@ONLY)
install(
PROGRAMS ${PROJECT_SOURCE_DIR}/scripts/omnitrace-merge.jl
DESTINATION ${CMAKE_INSTALL_BINDIR}
OPTIONAL)
install(
FILES ${PROJECT_SOURCE_DIR}/omnitrace.cfg
DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/${PROJECT_NAME}
COMPONENT setup
OPTIONAL)
install(
FILES ${PROJECT_BINARY_DIR}/install-tree/setup-env.sh
DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/${PROJECT_NAME}
COMPONENT setup
OPTIONAL)
install(
FILES
${PROJECT_BINARY_DIR}/install-tree/modulefiles/${PROJECT_NAME}/${OMNITRACE_VERSION}
DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/modulefiles/${PROJECT_NAME}
COMPONENT setup
OPTIONAL)
# ------------------------------------------------------------------------------#
@@ -308,6 +308,7 @@ endif()
#
# ------------------------------------------------------------------------------#
set(CMAKE_INSTALL_DEFAULT_COMPONENT_NAME core)
include(ConfigInstall)
include(ConfigCPack)
+13 -31
Просмотреть файл
@@ -193,38 +193,17 @@ Visit [ui.perfetto.dev](https://ui.perfetto.dev) in your browser and open up the
![omnitrace-user-api](source/docs/images/omnitrace-user-api.png)
## Merging the traces from rocprof and omnitrace
## Using Perfetto tracing with System Backend
This section requires installing [Julia](https://julialang.org/).
### Installing Julia
Julia is available via Linux package managers or may be available via a module. Debian-based distributions such as Ubuntu can run (as a super-user):
```shell
apt-get install julia
```
Once Julia is installed, install the necessary packages (this operation only needs to be performed once):
```shell
julia -e 'using Pkg; for name in ["JSON", "DataFrames", "Dates", "CSV", "Chain", "PrettyTables"]; Pkg.add(name); end'
```
> ***Using `rocprof` externally for tracing is deprecated. The current version has built-in support for***
> ***recording the GPU activity and HIP API calls. If you want to use an external rocprof, either***
> ***configure CMake with `-DOMNITRACE_USE_ROCTRACER=OFF` or explicitly set `OMNITRACE_ROCTRACER_ENABLED=OFF` in the***
> ***environment.***
Use the `omnitrace-merge.jl` Julia script to merge rocprof and perfetto traces.
```shell
export OMNITRACE_USE_ROCTRACER=OFF
rocprof --hip-trace --roctx-trace --stats ./app.inst
omnitrace-merge.jl results.json omnitrace-app.inst-output/2021-09-02_01.03_PM/*.proto
```
## Use Perfetto tracing with System Backend
Perfetto tracing with the system backend supports multiple processes writing to the same
output file. Thus, it is a useful technique if Omnitrace is built with partial MPI support
because all the perfetto output will be coalesced into a single file. The
installation docs for perfetto can be found [here](https://perfetto.dev/docs/contributing/build-instructions).
If you are building omnitrace from source, you can configure CMake with `OMNITRACE_INSTALL_PERFETTO_TOOLS=ON`
and the `perfetto` and `traced` applications will be installed as part of the build process. However,
it should be noted that to prevent this option from accidentally overwriting an existing perfetto install,
all the perfetto executables installed by omnitrace are prefixed with `omnitrace-perfetto-`, except for the `perfetto`
executable, which is just renamed `omnitrace-perfetto`.
Enable `traced` and `perfetto` in the background:
@@ -234,6 +213,9 @@ traced --background
perfetto --out ./omnitrace-perfetto.proto --txt -c ${OMNITRACE_ROOT}/share/omnitrace.cfg --background
```
> ***NOTE: if the perfetto tools were installed by omnitrace, replace `traced` with `omnitrace-perfetto-traced` and***
> ***`perfetto` with `omnitrace-perfetto`.***
Configure omnitrace to use the perfetto system backend:
```shell
+1 -1
Просмотреть файл
@@ -1 +1 @@
1.3.0dev0
1.3.0
+2
Просмотреть файл
@@ -3,6 +3,8 @@ include_guard(GLOBAL)
include(CMakePackageConfigHelpers)
set(CMAKE_INSTALL_DEFAULT_COMPONENT_NAME config)
install(
EXPORT omnitrace-library-targets
FILE omnitrace-library-targets.cmake
+7 -2
Просмотреть файл
@@ -309,6 +309,7 @@ macro(OMNITRACE_ADD_INTERFACE_LIBRARY _TARGET)
install(
TARGETS ${_TARGET}
DESTINATION ${CMAKE_INSTALL_LIBDIR}
COMPONENT core
EXPORT ${PROJECT_NAME}-library-depends
OPTIONAL)
if(NOT "${ARGN}" STREQUAL "")
@@ -736,6 +737,7 @@ function(OMNITRACE_PYTHON_CONSOLE_SCRIPT SCRIPT_NAME SCRIPT_SUBMODULE)
install(
PROGRAMS ${PROJECT_BINARY_DIR}/bin/${SCRIPT_NAME}-${ARG_VERSION}
DESTINATION ${CMAKE_INSTALL_BINDIR}
COMPONENT python
OPTIONAL)
endif()
@@ -766,6 +768,7 @@ function(OMNITRACE_PYTHON_CONSOLE_SCRIPT SCRIPT_NAME SCRIPT_SUBMODULE)
install(
PROGRAMS ${PROJECT_BINARY_DIR}/bin/${SCRIPT_NAME}
DESTINATION ${CMAKE_INSTALL_BINDIR}
COMPONENT python
OPTIONAL)
endif()
endif()
@@ -814,7 +817,7 @@ function(OMNITRACE_BUILDTREE_TPL _TPL_TARGET _NEW_NAME _BUILD_TREE_DIR)
COMMENT "Creating ${_NEW_NAME} from ${_TPL_TARGET}...")
endfunction()
function(OMNITRACE_INSTALL_TPL _TPL_TARGET _NEW_NAME _BUILD_TREE_DIR)
function(OMNITRACE_INSTALL_TPL _TPL_TARGET _NEW_NAME _BUILD_TREE_DIR _COMPONENT)
get_target_property(_TPL_VERSION ${_TPL_TARGET} VERSION)
get_target_property(_TPL_SOVERSION ${_TPL_TARGET} SOVERSION)
get_target_property(_TPL_NAME ${_TPL_TARGET} OUTPUT_NAME)
@@ -833,13 +836,15 @@ function(OMNITRACE_INSTALL_TPL _TPL_TARGET _NEW_NAME _BUILD_TREE_DIR)
install(
FILES $<TARGET_FILE:${_TPL_TARGET}>
DESTINATION ${CMAKE_INSTALL_LIBDIR}
COMPONENT ${_COMPONENT}
RENAME ${_TPL_PREFIX}${_NEW_NAME}${_TPL_SUFFIX}.${_TPL_VERSION})
install(
FILES
${_BUILD_TREE_DIR}/${_TPL_PREFIX}${_NEW_NAME}${_TPL_SUFFIX}.${_TPL_SOVERSION}
${_BUILD_TREE_DIR}/${_TPL_PREFIX}${_NEW_NAME}${_TPL_SUFFIX}
DESTINATION ${CMAKE_INSTALL_LIBDIR})
DESTINATION ${CMAKE_INSTALL_LIBDIR}
COMPONENT ${_COMPONENT})
endfunction()
+54 -2
Просмотреть файл
@@ -199,11 +199,36 @@ externalproject_add(
${OMNITRACE_PAPI_EXTRA_ENV} ${MAKE_EXECUTABLE} static install
INSTALL_COMMAND "")
file(
WRITE ${PROJECT_BINARY_DIR}/external/papi/build-utils.cmake
"
cmake_minimum_required(VERSION ${CMAKE_VERSION} FATAL_ERROR)
execute_process(
COMMAND ${CMAKE_COMMAND} -E env CFLAGS=-fPIC\\\ -O3\\\ -g ${OMNITRACE_PAPI_EXTRA_ENV}
${MAKE_EXECUTABLE} utils install-utils
WORKING_DIRECTORY ${OMNITRACE_PAPI_SOURCE_DIR}/src
RESULT_VARIABLE _RET
OUTPUT_VARIABLE _OUT
ERROR_VARIABLE _ERR)
if(NOT \${_RET} EQUAL 0)
message(\"\${_OUT}\")
message(FATAL_ERROR \"\${_ERR}\")
endif()
")
add_custom_command(
TARGET omnitrace-papi-build
POST_BUILD
COMMAND ${CMAKE_COMMAND} -P ${PROJECT_BINARY_DIR}/external/papi/build-utils.cmake)
# target for re-executing the installation
add_custom_target(
omnitrace-papi-install
COMMAND ${CMAKE_COMMAND} -E env CFLAGS=-fPIC\ -O3\ -g\ -Wno-stringop-truncation
${OMNITRACE_PAPI_EXTRA_ENV} ${MAKE_EXECUTABLE} static install
COMMAND
${CMAKE_COMMAND} -E env CFLAGS=-fPIC\ -O3\ -g\ -Wno-stringop-truncation
${OMNITRACE_PAPI_EXTRA_ENV} ${MAKE_EXECUTABLE} static utils install install-utils
WORKING_DIRECTORY ${OMNITRACE_PAPI_SOURCE_DIR}/src
COMMENT "Installing PAPI...")
@@ -246,5 +271,32 @@ omnitrace_target_compile_definitions(omnitrace-papi INTERFACE OMNITRACE_USE_PAPI
install(
DIRECTORY ${OMNITRACE_PAPI_INSTALL_DIR}/lib/
DESTINATION ${CMAKE_INSTALL_LIBDIR}/omnitrace
COMPONENT papi
FILES_MATCHING
PATTERN "*.so*")
foreach(
_UTIL_EXE
papi_avail
papi_clockres
papi_command_line
papi_component_avail
papi_cost
papi_decode
papi_error_codes
papi_event_chooser
papi_hardware_avail
papi_hl_output_writer.py
papi_mem_info
papi_multiplex_cost
papi_native_avail
papi_version
papi_xml_event_info)
string(REPLACE "_" "-" _UTIL_EXE_INSTALL_NAME "omnitrace-${_UTIL_EXE}")
install(
PROGRAMS ${OMNITRACE_PAPI_INSTALL_DIR}/bin/${_UTIL_EXE}
DESTINATION ${CMAKE_INSTALL_BINDIR}
COMPONENT papi
RENAME ${_UTIL_EXE_INSTALL_NAME}
OPTIONAL)
endforeach()
+8 -2
Просмотреть файл
@@ -287,17 +287,19 @@ if(OMNITRACE_BUILD_DYNINST)
install(
TARGETS ${_LIB}
DESTINATION ${CMAKE_INSTALL_LIBDIR}/omnitrace
COMPONENT dyninst
PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_LIBDIR}/omnitrace/include)
endif()
endforeach()
omnitrace_install_tpl(dyninstAPI_RT omnitrace-rt
"${PROJECT_BINARY_DIR}/${CMAKE_INSTALL_LIBDIR}")
"${PROJECT_BINARY_DIR}/${CMAKE_INSTALL_LIBDIR}" core)
# for packaging
install(
DIRECTORY ${DYNINST_TPL_STAGING_PREFIX}/lib/
DESTINATION ${CMAKE_INSTALL_LIBDIR}/omnitrace
COMPONENT dyninst
FILES_MATCHING
PATTERN "*${CMAKE_SHARED_LIBRARY_SUFFIX}*")
@@ -616,11 +618,15 @@ endif()
add_subdirectory(external/timemory EXCLUDE_FROM_ALL)
install(TARGETS gotcha DESTINATION ${CMAKE_INSTALL_LIBDIR}/omnitrace)
install(
TARGETS gotcha
DESTINATION ${CMAKE_INSTALL_LIBDIR}/omnitrace
COMPONENT gotcha)
if(OMNITRACE_BUILD_LIBUNWIND)
install(
DIRECTORY ${PROJECT_BINARY_DIR}/external/timemory/external/libunwind/install/lib/
DESTINATION ${CMAKE_INSTALL_LIBDIR}/omnitrace
COMPONENT libunwind
FILES_MATCHING
PATTERN "*${CMAKE_SHARED_LIBRARY_SUFFIX}*")
endif()
+11 -1
Просмотреть файл
@@ -137,19 +137,29 @@ if(OMNITRACE_INSTALL_PERFETTO_TOOLS)
add_custom_target(
omnitrace-perfetto-clean
COMMAND ${OMNITRACE_NINJA_EXECUTABLE} -t clean
COMMAND ${CMAKE_COMMAND} -E rm -rf
${PROJECT_BINARY_DIR}/external/perfetto/src/omnitrace-perfetto-build-stamp
WORKING_DIRECTORY ${OMNITRACE_PERFETTO_BINARY_DIR}
COMMENT "Cleaning Perfetto...")
install(
DIRECTORY ${OMNITRACE_PERFETTO_INSTALL_DIR}/
DESTINATION ${CMAKE_INSTALL_LIBDIR}
DESTINATION ${CMAKE_INSTALL_LIBDIR}/omnitrace
COMPONENT perfetto
FILES_MATCHING
PATTERN "*libperfetto.so*")
foreach(_FILE perfetto traced tracebox traced_probes traced_perf trigger_perfetto)
if("${_FILE}" STREQUAL "perfetto")
string(REPLACE "_" "-" _INSTALL_FILE "omnitrace-${_FILE}")
else()
string(REPLACE "_" "-" _INSTALL_FILE "omnitrace-perfetto-${_FILE}")
endif()
install(
PROGRAMS ${OMNITRACE_PERFETTO_INSTALL_DIR}/${_FILE}
DESTINATION ${CMAKE_INSTALL_BINDIR}
COMPONENT perfetto
RENAME ${_INSTALL_FILE}
OPTIONAL)
endforeach()
endif()
+1 -1
Просмотреть файл
@@ -26,4 +26,4 @@ enable_perfetto_ui = false
extra_cflags = "@OMNITRACE_PERFETTO_C_FLAGS@"
extra_cxxflags = "@OMNITRACE_PERFETTO_CXX_FLAGS@"
extra_ldflags = "@OMNITRACE_PERFETTO_LINK_FLAGS@ -Wl,-rpath=\\\$ORIGIN:\\\$ORIGIN/../lib"
extra_ldflags = "@OMNITRACE_PERFETTO_LINK_FLAGS@ -Wl,-rpath=\\\$ORIGIN:\\\$ORIGIN/../lib:\\\$ORIGIN/../lib/omnitrace"
+3 -3
Просмотреть файл
@@ -4,7 +4,7 @@ set -e
: ${USER:=$(whoami)}
: ${DISTRO:=ubuntu}
: ${VERSIONS:=20.04 18.04}
: ${VERSIONS:=20.04}
: ${NJOBS=$(nproc)}
: ${ELFUTILS_VERSION:=0.186}
: ${PUSH:=0}
@@ -127,7 +127,7 @@ for VERSION in ${VERSIONS}
do
verbose-run docker build . \
-f ${DOCKER_FILE} \
--tag ${USER}/omnitrace-ci:${DISTRO}-${VERSION} \
--tag ${USER}/omnitrace:ci-base-${DISTRO}-${VERSION} \
--build-arg DISTRO=${DISTRO_IMAGE} \
--build-arg VERSION=${VERSION} \
--build-arg NJOBS=${NJOBS} \
@@ -137,7 +137,7 @@ done
if [ "${PUSH}" -gt 0 ]; then
for VERSION in ${VERSIONS}
do
verbose-run docker push ${USER}/omnitrace-ci:${DISTRO}-${VERSION}
verbose-run docker push ${USER}/omnitrace:ci-base-${DISTRO}-${VERSION}
done
fi
+1 -1
Просмотреть файл
@@ -138,6 +138,6 @@ do
TAG=${DISTRO}-${VERSION}
for ROCM_VERSION in ${ROCM_VERSIONS}
do
build-release ${USER}/omnitrace-${TAG}-rocm-${ROCM_VERSION} ${DISTRO}-${VERSION} ${ROCM_VERSION} ${CODE_VERSION} ${SCRIPT_ARGS}
build-release ${USER}/omnitrace:release-base-${TAG}-rocm-${ROCM_VERSION} ${DISTRO}-${VERSION} ${ROCM_VERSION} ${CODE_VERSION} ${SCRIPT_ARGS}
done
done
+31 -25
Просмотреть файл
@@ -1,11 +1,12 @@
#!/usr/bin/env bash
: ${USER:=$(whoami)}
: ${ROCM_VERSIONS:="5.0 4.5 4.3"}
: ${ROCM_VERSIONS:="5.0"}
: ${DISTRO:=ubuntu}
: ${VERSIONS:=20.04 18.04}
: ${VERSIONS:=20.04}
: ${PYTHON_VERSIONS:="6 7 8 9 10"}
: ${BUILD_CI:=""}
: ${PUSH:=0}
set -e
@@ -88,6 +89,9 @@ do
USER=${1}
reset-last
;;
--push)
PUSH=1
;;
"--*")
send-error "Unsupported argument at position $((${n} + 1)) :: ${1}"
;;
@@ -109,6 +113,17 @@ for VERSION in ${VERSIONS}
do
for i in ${ROCM_VERSIONS}
do
CONTAINER=${USER}/omnitrace:release-base-${DISTRO}-${VERSION}-rocm-${i}
ROCM_MAJOR=$(echo ${i} | sed 's/\./ /g' | awk '{print $1}')
ROCM_MINOR=$(echo ${i} | sed 's/\./ /g' | awk '{print $2}')
ROCM_PATCH=$(echo ${i} | sed 's/\./ /g' | awk '{print $3}')
if [ -n "${ROCM_PATCH}" ]; then
ROCM_VERSN=$(( (${ROCM_MAJOR}*10000)+(${ROCM_MINOR}*100)+(${ROCM_PATCH}) ))
ROCM_SEP="."
else
ROCM_VERSN=$(( (${ROCM_MAJOR}*10000)+(${ROCM_MINOR}*100) ))
ROCM_SEP=""
fi
if [ "${DISTRO}" = "ubuntu" ]; then
ROCM_REPO_DIST="ubuntu"
ROCM_REPO_VERSION=${i}
@@ -122,7 +137,7 @@ do
*)
;;
esac
verbose-run docker build . -f ${DOCKER_FILE} --tag ${USER}/omnitrace-${DISTRO}-${VERSION}-rocm-${i} --build-arg DISTRO=${DISTRO} --build-arg VERSION=${VERSION} --build-arg ROCM_REPO_VERSION=${ROCM_REPO_VERSION} --build-arg ROCM_REPO_DIST=${ROCM_REPO_DIST} --build-arg PYTHON_VERSIONS=\"${PYTHON_VERSIONS}\"
verbose-run docker build . -f ${DOCKER_FILE} --tag ${CONTAINER} --build-arg DISTRO=${DISTRO} --build-arg VERSION=${VERSION} --build-arg ROCM_REPO_VERSION=${ROCM_REPO_VERSION} --build-arg ROCM_REPO_DIST=${ROCM_REPO_DIST} --build-arg PYTHON_VERSIONS=\"${PYTHON_VERSIONS}\"
elif [ "${DISTRO}" = "centos" ]; then
case "${VERSION}" in
7)
@@ -153,7 +168,7 @@ do
send-error "Unsupported combination :: ${DISTRO}-${VERSION} + ROCm ${i}"
;;
esac
verbose-run docker build . -f ${DOCKER_FILE} --tag ${USER}/omnitrace-${DISTRO}-${VERSION}-rocm-${i} --build-arg DISTRO=${DISTRO} --build-arg VERSION=${VERSION} --build-arg AMDGPU_RPM=${ROCM_RPM} --build-arg PYTHON_VERSIONS=\"${PYTHON_VERSIONS}\"
verbose-run docker build . -f ${DOCKER_FILE} --tag ${CONTAINER} --build-arg DISTRO=${DISTRO} --build-arg VERSION=${VERSION} --build-arg AMDGPU_RPM=${ROCM_RPM} --build-arg PYTHON_VERSIONS=\"${PYTHON_VERSIONS}\"
elif [ "${DISTRO}" = "opensuse" ]; then
case "${VERSION}" in
15.*)
@@ -165,38 +180,29 @@ do
;;
esac
case "${i}" in
5.1.2)
ROCM_RPM=22.10.2/sle/15/amdgpu-install-22.10.2.50102-1.noarch.rpm
;;
5.1.1)
ROCM_RPM=22.10.1/sle/15/amdgpu-install-22.10.1.50101-1.noarch.rpm
5.2 | 5.2.*)
ROCM_RPM=22.20${ROCM_SEP}${ROCM_PATCH}/sle/${VERSION}/amdgpu-install-22.20.${ROCM_VERSN}-1.noarch.rpm
;;
5.1 | 5.1.0)
ROCM_RPM=22.10/sle/15/amdgpu-install-22.10.50100-1.noarch.rpm
;;
5.0.2)
ROCM_RPM=21.50.2/sle/15/amdgpu-install-21.50.2.50002-1.noarch.rpm
5.1.*)
ROCM_RPM=22.10${ROCM_SEP}${ROCM_PATCH}/sle/15/amdgpu-install-22.10${ROCM_SEP}${ROCM_PATCH}.${ROCM_VERSN}-1.noarch.rpm
;;
5.0.1)
ROCM_RPM=21.50.1/sle/15/amdgpu-install-21.50.1.50001-1.noarch.rpm
5.0 | 5.0.*)
ROCM_RPM=21.50${ROCM_SEP}${ROCM_PATCH}/sle/15/amdgpu-install-21.50${ROCM_SEP}${ROCM_PATCH}.${ROCM_VERSN}-1.noarch.rpm
;;
5.0 | 5.0.0)
ROCM_RPM=21.50/sle/15/amdgpu-install-21.50.50000-1.noarch.rpm
;;
4.5.2)
ROCM_RPM=21.40.2/sle/15/amdgpu-install-21.40.2.40502-1.noarch.rpm
;;
4.5.1)
ROCM_RPM=21.40.1/sle/15/amdgpu-install-21.40.1.40501-1.noarch.rpm
;;
4.5 | 4.5.0)
ROCM_RPM=21.40/sle/15/amdgpu-install-21.40.40500-1.noarch.rpm
4.5 | 4.5.*)
ROCM_RPM=21.40${ROCM_SEP}${ROCM_PATCH}/sle/15/amdgpu-install-21.40${ROCM_SEP}${ROCM_PATCH}.${ROCM_VERSN}-1.noarch.rpm
;;
*)
send-error "Unsupported combination :: ${DISTRO}-${VERSION} + ROCm ${i}"
;;
esac
verbose-run docker build . -f ${DOCKER_FILE} --tag ${USER}/omnitrace-${DISTRO}-${VERSION}-rocm-${i} --build-arg DISTRO=${DISTRO_IMAGE} --build-arg VERSION=${VERSION} --build-arg AMDGPU_RPM=${ROCM_RPM} --build-arg PYTHON_VERSIONS=\"${PYTHON_VERSIONS}\"
verbose-run docker build . -f ${DOCKER_FILE} --tag ${CONTAINER} --build-arg DISTRO=${DISTRO_IMAGE} --build-arg VERSION=${VERSION} --build-arg AMDGPU_RPM=${ROCM_RPM} --build-arg PYTHON_VERSIONS=\"${PYTHON_VERSIONS}\"
fi
if [ "${PUSH}" -ne 0 ]; then
docker push ${CONTAINER}
fi
done
done
+1 -1
Просмотреть файл
@@ -121,6 +121,6 @@ do
TAG=${DISTRO}-${VERSION}
for ROCM_VERSION in ${ROCM_VERSIONS}
do
test-release ${USER}/omnitrace-${TAG}-rocm-${ROCM_VERSION} ${SCRIPT_ARGS}
test-release ${USER}/omnitrace:release-base-${TAG}-rocm-${ROCM_VERSION} ${SCRIPT_ARGS}
done
done
+1
Просмотреть файл
@@ -7,6 +7,7 @@ set(CMAKE_CXX_VISIBILITY_PRESET "default")
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_CLANG_TIDY)
set(CMAKE_INSTALL_DEFAULT_COMPONENT_NAME examples)
option(BUILD_SHARED_LIBS "Build dynamic libraries" ON)
поставляемый
+1 -1
+2 -1
Просмотреть файл
@@ -4,6 +4,7 @@
: ${BUILD_DIR:=build-release}
: ${VERSION:=0.0.4}
: ${ROCM_VERSION:=4.5.0}
: ${BOOST_VERSION:=1.69.0}
: ${NJOBS:=12}
: ${DISTRO:=""}
: ${LTO:="OFF"}
@@ -163,7 +164,7 @@ OMNITRACE_GENERAL_ARGS="-DOMNITRACE_CPACK_SYSTEM_NAME=${DISTRO} -DOMNITRACE_ROCM
OMNITRACE_BUILD_ARGS="-DOMNITRACE_BUILD_TESTING=OFF -DOMNITRACE_BUILD_EXAMPLES=OFF -DOMNITRACE_BUILD_PAPI=ON -DOMNITRACE_BUILD_LTO=${LTO} -DOMNITRACE_BUILD_HIDDEN_VISIBILITY=${HIDDEN_VIZ} -DOMNITRACE_BUILD_STATIC_LIBGCC=${LIBGCC} -DOMNITRACE_BUILD_STATIC_LIBSTDCXX=${LIBSTDCXX}"
OMNITRACE_USE_ARGS="-DOMNITRACE_USE_MPI_HEADERS=ON -DOMNITRACE_USE_OMPT=ON -DOMNITRACE_USE_PAPI=ON"
TIMEMORY_ARGS="-DTIMEMORY_USE_LIBUNWIND=ON -DTIMEMORY_BUILD_LIBUNWIND=ON -DTIMEMORY_BUILD_PORTABLE=ON"
DYNINST_ARGS="-DOMNITRACE_BUILD_DYNINST=ON -DDYNINST_USE_OpenMP=ON $(echo -DDYNINST_BUILD_{TBB,BOOST,ELFUTILS,LIBIBERTY}=ON)"
DYNINST_ARGS="-DOMNITRACE_BUILD_DYNINST=ON -DDYNINST_USE_OpenMP=ON $(echo -DDYNINST_BUILD_{TBB,BOOST,ELFUTILS,LIBIBERTY}=ON) -DDYNINST_BOOST_DOWNLOAD_VERSION=${BOOST_VERSION}"
STANDARD_ARGS="${CMAKE_ARGS} ${OMNITRACE_GENERAL_ARGS} ${OMNITRACE_USE_ARGS} ${OMNITRACE_BUILD_ARGS} ${TIMEMORY_ARGS} ${DYNINST_ARGS} ${EXTRA_ARGS}"
SCRIPT_DIR=$(realpath $(dirname ${BASH_SOURCE[0]}))
-43
Просмотреть файл
@@ -1,43 +0,0 @@
#!/usr/bin/env julia
using Base: String
using JSON, DataFrames, Dates, CSV
function check_input_args()
message = "Needs only one json file and at least one trace data file(s)."
@assert length(ARGS) >= 2 && occursin(".json", join(ARGS)) message
json_file, trace_files = nothing, String[]
for arg in ARGS
@assert Base.Filesystem.ispath(arg) "'$(arg)' not found!"
if endswith(arg, ".json")
json_file = arg
else
push!(trace_files, arg)
end
end
json_file, trace_files
end
json_file, trace_files = check_input_args()
out = JSON.parsefile(json_file)
for trace in trace_files
@info "processing $(trace) ..."
f = tempname() * ".json"
run(`trace_to_text json $trace $f`)
todo = JSON.parsefile(f)
out["traceEvents"] = vcat(
out["traceEvents"],
get(todo, "traceEvents", [])
)
out["systemTraceEvents"] = (*)(
get(out, "systemTraceEvents", ""),
get(todo, "systemTraceEvents", "")
)
end
output_file = replace("$(string(now())).json", ":" => "-")
open(output_file, "w") do f
write(f, JSON.json(out))
@info "output file: $(output_file)"
end
+1 -1
Просмотреть файл
@@ -35,5 +35,5 @@ set_target_properties(
install(
TARGETS omnitrace-avail
DESTINATION bin
DESTINATION ${CMAKE_INSTALL_BINDIR}
OPTIONAL)
+1 -1
Просмотреть файл
@@ -25,5 +25,5 @@ set_target_properties(
install(
TARGETS omnitrace-critical-trace
DESTINATION bin
DESTINATION ${CMAKE_INSTALL_BINDIR}
OPTIONAL)
+5
Просмотреть файл
@@ -132,6 +132,11 @@ PAPI components from different namespaces:
OMNITRACE_PAPI_EVENTS = PAPI_TOT_INS perf::CACHE-REFERENCES perf::CACHE-MISSES
```
> ***If omnitrace was configured with `OMNITRACE_BUILD_PAPI=ON` (the default), the standard PAPI command line tools such as***
> ***`papi_avail`, `papi_event_chooser`, etc. will not be able to provide information about the PAPI library used by omnitrace***
> ***(omnitrace statically links to libpapi). However, all of these tools are installed with the prefix `omnitrace-` and all***
> ***underscores are replaced with hypens, e.g. `papi_avail` -> `omnitrace-papi-avail`.***
#### OMNITRACE_ROCM_EVENTS
Omnitrace reads the ROCm events from the `${ROCM_PATH}/lib/rocprofiler/metrics.xml` file. Use the `ROCP_METRICS` environment
+105 -105
Просмотреть файл
@@ -1,105 +1,105 @@
#!/usr/bin/env python3
import sys
import argparse
from perfetto.trace_processor import TraceProcessor
def validate_perfetto(data, labels, counts, depths):
expected = []
for litr, citr, ditr in zip(labels, counts, depths):
entry = []
_label = litr
if ditr > 0:
_label = "{}".format(litr)
entry = [_label, citr, ditr]
expected.append(entry)
for ditr, eitr in zip(data, expected):
_label = ditr["label"]
_count = ditr["count"]
_depth = ditr["depth"]
if _label != eitr[0]:
raise RuntimeError(f"Mismatched prefix: {_label} vs. {eitr[0]}")
if _count != eitr[1]:
raise RuntimeError(f"Mismatched count: {_count} vs. {eitr[1]}")
if _depth != eitr[2]:
raise RuntimeError(f"Mismatched depth: {_depth} vs. {eitr[2]}")
if __name__ == "__main__":
parser = argparse.ArgumentParser()
parser.add_argument(
"-l", "--labels", nargs="+", type=str, help="Expected labels", default=[]
)
parser.add_argument(
"-c", "--counts", nargs="+", type=int, help="Expected counts", default=[]
)
parser.add_argument(
"-d", "--depths", nargs="+", type=int, help="Expected depths", default=[]
)
parser.add_argument(
"-m", "--categories", nargs="+", help="Perfetto categories", default=[]
)
parser.add_argument(
"-p", "--print", action="store_true", help="Print the processed perfetto data"
)
parser.add_argument("-i", "--input", type=str, help="Input file", required=True)
args = parser.parse_args()
if len(args.labels) != len(args.counts) or len(args.labels) != len(args.depths):
raise RuntimeError(
"The same number of labels, counts, and depths must be specified"
)
tp = TraceProcessor(trace=(args.input))
pdata = {}
# get data from perfetto
qr_it = tp.query("SELECT name, depth, category FROM slice")
# loop over data rows from perfetto
for row in qr_it:
if args.categories and row.category not in args.categories:
continue
if row.name not in pdata:
pdata[row.name] = {}
if row.depth not in pdata[row.name]:
pdata[row.name][row.depth] = 0
# accumulate the call-count per name and per depth
pdata[row.name][row.depth] += 1
perfetto_data = []
for name, itr in pdata.items():
for depth, count in itr.items():
_e = {}
_e["label"] = name
_e["count"] = count
_e["depth"] = depth
perfetto_data.append(_e)
# demo display of data
if args.print:
for itr in perfetto_data:
n = 0 if itr["depth"] < 2 else itr["depth"] - 1
lbl = "{}{}{}".format(
" " * n, "|_" if itr["depth"] > 0 else "", itr["label"]
)
print("| {:40} | {:6} | {:6} |".format(lbl, itr["count"], itr["depth"]))
ret = 0
try:
validate_perfetto(
perfetto_data,
args.labels,
args.counts,
args.depths,
)
except RuntimeError as e:
print(f"{e}")
ret = 1
if ret == 0:
print(f"{args.input} validated")
sys.exit(ret)
#!/usr/bin/env python3
import sys
import argparse
from perfetto.trace_processor import TraceProcessor
def validate_perfetto(data, labels, counts, depths):
expected = []
for litr, citr, ditr in zip(labels, counts, depths):
entry = []
_label = litr
if ditr > 0:
_label = "{}".format(litr)
entry = [_label, citr, ditr]
expected.append(entry)
for ditr, eitr in zip(data, expected):
_label = ditr["label"]
_count = ditr["count"]
_depth = ditr["depth"]
if _label != eitr[0]:
raise RuntimeError(f"Mismatched prefix: {_label} vs. {eitr[0]}")
if _count != eitr[1]:
raise RuntimeError(f"Mismatched count: {_count} vs. {eitr[1]}")
if _depth != eitr[2]:
raise RuntimeError(f"Mismatched depth: {_depth} vs. {eitr[2]}")
if __name__ == "__main__":
parser = argparse.ArgumentParser()
parser.add_argument(
"-l", "--labels", nargs="+", type=str, help="Expected labels", default=[]
)
parser.add_argument(
"-c", "--counts", nargs="+", type=int, help="Expected counts", default=[]
)
parser.add_argument(
"-d", "--depths", nargs="+", type=int, help="Expected depths", default=[]
)
parser.add_argument(
"-m", "--categories", nargs="+", help="Perfetto categories", default=[]
)
parser.add_argument(
"-p", "--print", action="store_true", help="Print the processed perfetto data"
)
parser.add_argument("-i", "--input", type=str, help="Input file", required=True)
args = parser.parse_args()
if len(args.labels) != len(args.counts) or len(args.labels) != len(args.depths):
raise RuntimeError(
"The same number of labels, counts, and depths must be specified"
)
tp = TraceProcessor(trace=(args.input))
pdata = {}
# get data from perfetto
qr_it = tp.query("SELECT name, depth, category FROM slice")
# loop over data rows from perfetto
for row in qr_it:
if args.categories and row.category not in args.categories:
continue
if row.name not in pdata:
pdata[row.name] = {}
if row.depth not in pdata[row.name]:
pdata[row.name][row.depth] = 0
# accumulate the call-count per name and per depth
pdata[row.name][row.depth] += 1
perfetto_data = []
for name, itr in pdata.items():
for depth, count in itr.items():
_e = {}
_e["label"] = name
_e["count"] = count
_e["depth"] = depth
perfetto_data.append(_e)
# demo display of data
if args.print:
for itr in perfetto_data:
n = 0 if itr["depth"] < 2 else itr["depth"] - 1
lbl = "{}{}{}".format(
" " * n, "|_" if itr["depth"] > 0 else "", itr["label"]
)
print("| {:40} | {:6} | {:6} |".format(lbl, itr["count"], itr["depth"]))
ret = 0
try:
validate_perfetto(
perfetto_data,
args.labels,
args.counts,
args.depths,
)
except RuntimeError as e:
print(f"{e}")
ret = 1
if ret == 0:
print(f"{args.input} validated")
sys.exit(ret)