mirror of
https://github.com/nicolargo/glances.git
synced 2024-12-24 17:51:49 +03:00
Add unitary test for memory profiling
This commit is contained in:
parent
91b6b4aff7
commit
056e9d2940
12
Makefile
12
Makefile
@ -74,6 +74,18 @@ trace-malloc: ## Trace the malloc() calls
|
||||
memory-leak: ## Profile memory leaks
|
||||
./venv/bin/python -m glances -C ./conf/glances.conf --memory-leak
|
||||
|
||||
memory-profiling: ## Profile memory usage
|
||||
@echo "It's a very long test (~4 hours)..."
|
||||
rm -f mprofile_*.dat
|
||||
@echo "1/2 - Start memory profiling with the history option enable"
|
||||
./venv/bin/mprof run -T 1 -C run.py -C ./conf/glances.conf --stop-after 2400 --quiet
|
||||
./venv/bin/mprof plot --output ./docs/_static/glances-memory-profiling-with-history.png
|
||||
rm -f mprofile_*.dat
|
||||
@echo "2/2 - Start memory profiling with the history option disable"
|
||||
./venv/bin/mprof run -T 1 -C run.py -C ./conf/glances.conf --disable-history --stop-after 2400 --quiet
|
||||
./venv/bin/mprof plot --output ./docs/_static/glances-memory-profiling-without-history.png
|
||||
rm -f mprofile_*.dat
|
||||
|
||||
# ===================================================================
|
||||
# Docs
|
||||
# ===================================================================
|
||||
|
@ -10,8 +10,8 @@ refresh=2
|
||||
# Does Glances should check if a newer version is available on PyPI ?
|
||||
check_update=true
|
||||
# History size (maximum number of values)
|
||||
# Default is 3600 seconds (1 hour)
|
||||
history_size=3600
|
||||
# Default is 1200 values (~1h with the default refresh rate)
|
||||
history_size=1200
|
||||
|
||||
##############################################################################
|
||||
# User interface
|
||||
|
@ -6,3 +6,5 @@ flake8
|
||||
autopep8
|
||||
autoflake
|
||||
codespell
|
||||
memory-profiler
|
||||
matplotlib
|
BIN
docs/_static/glances-memory-profiling-with-history.png
vendored
Normal file
BIN
docs/_static/glances-memory-profiling-with-history.png
vendored
Normal file
Binary file not shown.
After Width: | Height: | Size: 49 KiB |
BIN
docs/_static/glances-memory-profiling-without-history.png
vendored
Normal file
BIN
docs/_static/glances-memory-profiling-without-history.png
vendored
Normal file
Binary file not shown.
After Width: | Height: | Size: 58 KiB |
@ -178,13 +178,13 @@ class GlancesPlugin(object):
|
||||
|
||||
def update_stats_history(self):
|
||||
"""Update stats history."""
|
||||
# Build the history
|
||||
if self.get_export() and self.history_enable():
|
||||
# If the plugin data is a dict, the dict's key should be used
|
||||
if self.get_key() is None:
|
||||
item_name = ''
|
||||
else:
|
||||
item_name = self.get_key()
|
||||
# Build the history
|
||||
if self.get_export() and self.history_enable():
|
||||
for i in self.get_items_history_list():
|
||||
if isinstance(self.get_export(), list):
|
||||
# Stats is a list of data
|
||||
|
Loading…
Reference in New Issue
Block a user