Skip to content

Commit

Permalink
Add some profiling and upgrade CI to NodeJS 20
Browse files Browse the repository at this point in the history
nicolargo committed May 6, 2024

Unverified

No user is associated with the committer email.
1 parent d91663a commit 9121b77
Showing 5 changed files with 24 additions and 8 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -106,7 +106,7 @@ jobs:
TAG_ARRAY="${TAG_ARRAY::-1} ]"
echo "Tags to build: $TAG_ARRAY"
echo "::set-output name=tags::$TAG_ARRAY"
echo "tags=$TAG_ARRAY" >> $GITHUB_OUTPUT
build_Docker_image:
runs-on: ubuntu-latest
@@ -130,7 +130,7 @@ jobs:
org.opencontainers.image.url=https://nicolargo.github.io/glances/
- name: Cache Docker layers
uses: actions/cache@v3
uses: actions/cache@v4
with:
path: /tmp/.buildx-cache
key: ${{ runner.os }}-buildx-${{ env.NODE_ENV }}-${{ matrix.os }}-${{ matrix.tag.tag }}
2 changes: 1 addition & 1 deletion .github/workflows/cyber.yml
Original file line number Diff line number Diff line change
@@ -23,6 +23,6 @@ jobs:
severity: 'CRITICAL'

- name: Upload Trivy scan results to GitHub Security tab
uses: github/codeql-action/upload-sarif@v2
uses: github/codeql-action/upload-sarif@v3
with:
sarif_file: 'trivy-results.sarif'
2 changes: 1 addition & 1 deletion .github/workflows/webui.yml
Original file line number Diff line number Diff line change
@@ -16,7 +16,7 @@ jobs:
steps:
- uses: actions/checkout@v4
- name: Glances will be build with Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
cache: 'npm'
23 changes: 19 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
@@ -104,10 +104,25 @@ codespell: ## Run codespell to fix common misspellings in text files
semgrep: ## Run semgrep to find bugs and enforce code standards
./venv-dev/bin/semgrep scan --config=auto

profiling: ## How to start the profiling of the Glances software
@echo "Start a Glances instance and get its PID"
@echo "Run: sudo ./venv-dev/bin/py-spy record -o ./docs/_static/glances-flame.svg -d 60 -s --pid <GLANCES PID>"
@echo "Open the SVG file (./docs/_static/glances-flame.svg) with a Web browser"
profiling-gprof: ## Callgraph profiling (need "apt install graphviz")
@echo "Start Glances for 30 iterations (more or less 1 mins, please do not exit !)"
sleep 3
./venv/bin/python -m cProfile -o ./glances.cprof ./run.py --stop-after 30
./venv-dev/bin/gprof2dot -f pstats ./glances.cprof | dot -Tsvg -o ./docs/_static/glances-cgraph.svg
rm -f ./glances.cprof

profiling-pyinstrument: ## PyInstrument profiling
@echo "Start Glances for 30 iterations (more or less 1 mins, please do not exit !)"
sleep 3
./venv/bin/pip install pyinstrument
./venv/bin/python -m pyinstrument -r html -o ./docs/_static/glances-pyinstrument.html -m glances --stop-after 30

profiling-pyspy: ## Flame profiling (currently not compatible with Python 3.12)
@echo "Start Glances for 30 iterations (more or less 1 mins, please do not exit !)"
sleep 3
./venv-dev/bin/py-spy record -o ./docs/_static/glances-flame.svg -d 60 -s -- ./venv/bin/python ./run.py --stop-after 30

profiling: profiling-gprof profiling-pyinstrument profiling-pyspy ## Profiling of the Glances software

trace-malloc: ## Trace the malloc() calls
@echo "Malloc test is running, please wait ~30 secondes..."
1 change: 1 addition & 0 deletions dev-requirements.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
py-spy
gprof2dot
black
pyright
requirements-parser

0 comments on commit 9121b77

Please sign in to comment.