Added basic profiling
This commit is contained in:
parent
39c210681a
commit
a935940d35
1 changed files with 25 additions and 25 deletions
50
.github/workflows/profiling.yaml
vendored
50
.github/workflows/profiling.yaml
vendored
|
|
@ -43,28 +43,28 @@ jobs:
|
||||||
id: compare
|
id: compare
|
||||||
run: |
|
run: |
|
||||||
python -c "
|
python -c "
|
||||||
import json
|
import json
|
||||||
with open('base_results.json') as f:
|
with open('base_results.json') as f:
|
||||||
base = json.load(f)
|
base = json.load(f)
|
||||||
with open('head_results.json') as f:
|
with open('head_results.json') as f:
|
||||||
head = json.load(f)
|
head = json.load(f)
|
||||||
cpu_diff = head['total_cpu_samples'] - base['total_cpu_samples']
|
cpu_diff = head['total_cpu_samples'] - base['total_cpu_samples']
|
||||||
memory_diff = head['total_memory_mb'] - base['total_memory_mb']
|
memory_diff = head['total_memory_mb'] - base['total_memory_mb']
|
||||||
with open('profiling_diff.txt', 'w') as f:
|
with open('profiling_diff.txt', 'w') as f:
|
||||||
f.write(f'CPU Usage Difference: {cpu_diff}\\n')
|
f.write(f'CPU Usage Difference: {cpu_diff}\\n')
|
||||||
f.write(f'Memory Usage Difference: {memory_diff:.2f} MB\\n')
|
f.write(f'Memory Usage Difference: {memory_diff:.2f} MB\\n')
|
||||||
"
|
"
|
||||||
|
|
||||||
# Post results to the pull request
|
# Post results to the pull request
|
||||||
- name: Post profiling results to PR
|
- name: Post profiling results to PR
|
||||||
uses: actions/github-script@v6
|
uses: actions/github-script@v6
|
||||||
with:
|
with:
|
||||||
script: |
|
script: |
|
||||||
const fs = require('fs');
|
const fs = require('fs');
|
||||||
const diff = fs.readFileSync('profiling_diff.txt', 'utf-8');
|
const diff = fs.readFileSync('profiling_diff.txt', 'utf-8');
|
||||||
github.rest.issues.createComment({
|
github.rest.issues.createComment({
|
||||||
issue_number: context.issue.number,
|
issue_number: context.issue.number,
|
||||||
owner: context.repo.owner,
|
owner: context.repo.owner,
|
||||||
repo: context.repo.repo,
|
repo: context.repo.repo,
|
||||||
body: `### Profiling Results for code_graph_pipeline.py\n\`\`\`\n${diff}\n\`\`\``
|
body: `### Profiling Results for code_graph_pipeline.py\n\`\`\`\n${diff}\n\`\`\``
|
||||||
});
|
});
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue