Add some profiling and upgrade CI to NodeJS 20

pull/2758/head
nicolargo 2024-05-06 11:55:37 +02:00
parent d91663a428
commit 9121b77763
5 changed files with 24 additions and 8 deletions

View File

@ -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 }}

View File

@ -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'

View File

@ -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'

View File

@ -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..."

View File

@ -1,4 +1,5 @@
py-spy
gprof2dot
black
pyright
requirements-parser