Skip to content

Commit 35bcf7f

Browse files
committed
Updating Testing Branch & adding benchmarking workflow
1 parent f20ed63 commit 35bcf7f

File tree

2 files changed

+75
-0
lines changed

2 files changed

+75
-0
lines changed
Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
# Performance benchmarking workflow
2+
name: "Build and Run Benchmark"
3+
on:
4+
workflow_dispatch:
5+
push:
6+
branches-ignore:
7+
- 'main'
8+
- '[0-9]+.[0-9]+.[0-9]+'
9+
env:
10+
MLM_LICENSE_TOKEN: ${{ secrets.MLM_LICENSE_TOKEN }}
11+
jobs:
12+
get_version:
13+
runs-on: ubuntu-20.04
14+
outputs:
15+
version: ${{ steps.getversion.outputs.latest_tag }}
16+
steps:
17+
# need fetch-depth:0 to also download the tags
18+
- name: Download OpenTelemetry-Matlab source
19+
uses: actions/checkout@v3
20+
with:
21+
path: opentelemetry-matlab
22+
fetch-depth: 0
23+
- name: Get Version
24+
id: getversion
25+
shell: bash
26+
working-directory: opentelemetry-matlab
27+
run: echo "latest_tag=$(sed -re 's/^v?([[:digit:]]+\.[[:digit:]]+\.[[:digit:]]+)?.*/\1/' <<< $(git describe --tags --abbrev=0))" >> $GITHUB_OUTPUT
28+
benchmark-ubuntu:
29+
# Running on ubuntu-latest would use a glibc version that is incompatible when using the built mex files on a Debian 11
30+
# Instead, run on ubuntu-20.04
31+
runs-on: ubuntu-20.04
32+
needs: get_version
33+
env:
34+
OPENTELEMETRY_MATLAB_INSTALL: "${{ github.workspace }}/otel_matlab_install"
35+
SYSTEM_LIBSTDCPP_PATH: "/usr/lib/x86_64-linux-gnu/libstdc++.so.6"
36+
steps:
37+
- name: Download OpenTelemetry-Matlab source
38+
uses: actions/checkout@v3
39+
with:
40+
path: opentelemetry-matlab
41+
- name: Install ninja-build
42+
run: sudo apt-get install ninja-build
43+
- name: Install MATLAB
44+
uses: matlab-actions/setup-matlab@v2
45+
with:
46+
products: MATLAB_Compiler MATLAB_Compiler_SDK
47+
- name: Build OpenTelemetry-Matlab
48+
working-directory: opentelemetry-matlab
49+
run: |
50+
cmake -S . -B build -G Ninja -DCMAKE_BUILD_TYPE=Release -DWITH_EXAMPLES=ON -DUSE_BATCH_FOR_MCC=ON -DOTEL_MATLAB_VERSION=${{ needs.get_version.outputs.version }} -DCMAKE_INSTALL_PREFIX=${{ env.OPENTELEMETRY_MATLAB_INSTALL }}
51+
cmake --build build --config Release --target install
52+
- name: Run Benchmark
53+
env:
54+
# Add the installation directory to the MATLAB Search Path by
55+
# setting the MATLABPATH environment variable.
56+
MATLABPATH: ${{ env.OPENTELEMETRY_MATLAB_INSTALL }}
57+
uses: matlab-actions/run-command@v2
58+
with:
59+
command: opentelemetry-matlab/test/performance/runPerf
60+
- name: Download previous benchmark data
61+
uses: actions/cache@v4
62+
with:
63+
path: ./cache
64+
key: ${{ runner.os }}-benchmark
65+
- name: Store benchmark result
66+
uses: benchmark-action/github-action-benchmark@v1
67+
with:
68+
tool: 'customSmallerIsBetter'
69+
output-file-path: opentelemetry-matlab/test/performance/Benchmarks/OutputBenchmark.json
70+
external-data-json-path: ./cache/OutputBenchmark.json

test/performance/runPerf.m

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
T = runperf();
2+
u(1:size(T.sampleSummary,1)) = "seconds";
3+
S = struct("name",cellstr(T.sampleSummary.Name),"unit",cellstr(u'),"value",num2cell(T.sampleSummary.Mean));
4+
mkdir("Benchmarks");
5+
writestruct(S,"./Benchmarks/OutputBenchmark.json")

0 commit comments

Comments
 (0)