From e2539cd396df8a5311dff7e1f66896ff9ccb1be7 Mon Sep 17 00:00:00 2001 From: Vasilije <8619304+Vasilije1990@users.noreply.github.com> Date: Wed, 4 Dec 2024 18:35:06 +0100 Subject: [PATCH] Added basic profiling --- .github/workflows/profiling.yaml | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/.github/workflows/profiling.yaml b/.github/workflows/profiling.yaml index 1031d7bc0..7355dc74f 100644 --- a/.github/workflows/profiling.yaml +++ b/.github/workflows/profiling.yaml @@ -66,23 +66,23 @@ jobs: # Compare profiling results - name: Compare profiling results - run: | + run: | python -c " - import json - try: - with open('base_results.json') as f: - base = json.load(f) - with open('head_results.json') as f: - head = json.load(f) - cpu_diff = head.get('total_cpu_samples_python', 0) - base.get('total_cpu_samples_python', 0) - memory_diff = head.get('malloc_samples', 0) - base.get('malloc_samples', 0) - with open('profiling_diff.txt', 'w') as f: - f.write(f'CPU Usage Difference: {cpu_diff}\\n') - f.write(f'Memory Usage Difference: {memory_diff} bytes\\n') - except Exception as e: - with open('profiling_diff.txt', 'w') as f: - f.write(f'Error comparing profiling results: {e}\\n') - " + import json + try: + with open('base_results.json') as f: + base = json.load(f) + with open('head_results.json') as f: + head = json.load(f) + cpu_diff = head.get('total_cpu_samples_python', 0) - base.get('total_cpu_samples_python', 0) + memory_diff = head.get('malloc_samples', 0) - base.get('malloc_samples', 0) + with open('profiling_diff.txt', 'w') as f: + f.write(f'CPU Usage Difference: {cpu_diff}\\n') + f.write(f'Memory Usage Difference: {memory_diff} bytes\\n') + except Exception as e: + with open('profiling_diff.txt', 'w') as f: + f.write(f'Error comparing profiling results: {e}\\n') + " # Post results to the pull request - name: Post profiling results to PR