summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authornicolargo <nicolashennion@gmail.com>2024-05-06 11:55:37 +0200
committernicolargo <nicolashennion@gmail.com>2024-05-06 11:55:37 +0200
commit9121b777630cd11d67199fec005d56f50a750aae (patch)
tree5c230c64d429883f9f6d127802e3e24b8c10762c
parentd91663a428cbfee1041799cc0b5a6d87cc831e46 (diff)
Add some profiling and upgrade CI to NodeJS 20
-rw-r--r--.github/workflows/build.yml4
-rw-r--r--.github/workflows/cyber.yml2
-rw-r--r--.github/workflows/webui.yml2
-rw-r--r--Makefile23
-rw-r--r--dev-requirements.txt1
5 files changed, 24 insertions, 8 deletions
diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml
index e4801a64..88385df1 100644
--- a/.github/workflows/build.yml
+++ b/.github/workflows/build.yml
@@ -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 }}
diff --git a/.github/workflows/cyber.yml b/.github/workflows/cyber.yml
index 27a2c9b7..16752ca4 100644
--- a/.github/workflows/cyber.yml
+++ b/.github/workflows/cyber.yml
@@ -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'
diff --git a/.github/workflows/webui.yml b/.github/workflows/webui.yml
index 077b0b81..bc75b108 100644
--- a/.github/workflows/webui.yml
+++ b/.github/workflows/webui.yml
@@ -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'
diff --git a/Makefile b/Makefile
index a44396a4..c61a300d 100644
--- a/Makefile
+++ b/Makefile
@@ -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..."
diff --git a/dev-requirements.txt b/dev-requirements.txt
index a93efd06..502cec3c 100644
--- a/dev-requirements.txt
+++ b/dev-requirements.txt
@@ -1,4 +1,5 @@
py-spy
+gprof2dot
black
pyright
requirements-parser