Metrics de segmentation
Deux metrics seront utilisés pour testé le modèle: Intersection-Over-Union (IoU, Jaccard Index) and the F1 score (Dice coefficient) Références:
- https://www.jeremyjordan.me/evaluating-image-segmentation-models/
- https://towardsdatascience.com/metrics-to-evaluate-your-semantic-segmentation-model-6bcb99639aa2
- https://ilmonteux.github.io/2019/05/10/segmentation-metrics.html
- https://gist.github.com/ilmonteux/8340df952722f3a1030a7d937e701b5a
- https://stats.stackexchange.com/questions/273537/f1-dice-score-vs-iou
- https://docs.computecanada.ca/wiki/MATLAB
- https://www.mathworks.com/help/vision/semantic-segmentation.html?category=semantic-segmentation&s_tid=CRUX_gn_documentation_semantic-segmentation
- https://www.tensorflow.org/tutorials/images/segmentation
- https://stackoverflow.com/questions/58609730/how-to-create-a-one-hot-encoded-matrix-from-a-png-for-per-pixel-classification-i
Intersection-Over-Union (IoU, Jaccard Index)
Références:
F1 score (Dice coefficient)
Références:
Premier script de test
Python 3.6 virtual environment
Python env 3.6
- Python 3.6
- Création de l’environnement Python virtuel
- Installation des modules Python requis
salloc --account=def-germ2201-ab --ntasks=1 --nodes=1 --cpus-per-task=1 --mem=4800M --time=0-3:00
module load python/3.6
# clean the python virtual pyenv36
rm -rf $SLURM_TMPDIR/pyenv36
# create the virtual env
virtualenv --no-download $SLURM_TMPDIR/pyenv36
# activate the python virtual env
source $SLURM_TMPDIR/pyenv36/bin/activate
# check the python and pip version (3.6)
python --version
pip --version
# install requirements
pip3 install --no-index torch
pip3 install --no-index scikit-learn
pip3 install --no-index scikit-image
pip3 install --no-index keras
pip3 install --no-index tensorflow_gpu
pip3 install --no-index jupyter
Préparation des images
from skimage import io
import numpy as np
import os
filename = os.path.join('/home/vincelf/DeepLabv3FineTuning-master/CrackForest/Images', '001.jpg')
im = io.imread(filename)
im.shape
# (320, 480, 3)
im2 = np.expand_dims(im,0)
im2.shape
# (1, 320, 480, 3)
filename = os.path.join('/home/vincelf/DeepLabv3FineTuning-master/CrackForest/Masks', '001_label.PNG')
mask = io.imread(filename)
mask.shape
# (320, 480)
m = np.array(mask)
m2 = np.stack((m,)*3,-1)
m2.shape
# (320, 480, 3)
m3 = np.expand_dims(m2,0)
m3.shape
# (1, 320, 480, 3)
Test avec des images du dataset de deepscene
from skimage import io
import numpy as np
import os
home='/home/vincelf/downloads/freiburg_forest_annotated'
rgb='train/rgb/b102-798_Clipped.jpg'
gt_color='train/GT_color/b102-798_mask.png'
filename = os.path.join(home, rgb)
im = io.imread(filename)
im.shape
filename = os.path.join(home, gt_color)
mask = io.imread(filename)
mask.shape
def iou_score(y_true, y_pred):
intersection = np.logical_and(y_true, y_pred)
union = np.logical_or(y_true, y_pred)
iou_score = np.sum(intersection) / np.sum(union)
return iou_score
iou_score(im,mask)
# Both y_true and y_pred are m x r x c x n where m is the number of images, r is the number of rows, c is the number of columns, and n is the number of classes.
from keras import backend as K
def iou_coef(y_true, y_pred, smooth=1):
intersection = K.sum(K.abs(y_true * y_pred), axis=[1,2,3])
union = K.sum(y_true,[1,2,3])+K.sum(y_pred,[1,2,3])-intersection
iou = K.mean((intersection + smooth) / (union + smooth), axis=0)
return iou
# error returned with tensorflow 1.15.0 et 2.2
iou_coef(im, mask)
from skimage import io
import numpy as np
import os
home_gt='/home/vincelf/downloads/freiburg_forest_annotated/test/GT_color'
gt_color='b1-09517_Clipped.png'
gt_color_f = os.path.join(home_gt, gt_color)
gt_color_img = io.imread(gt_color_f)
gt_color_img.shape
set( tuple(v) for m2d in gt_color_img for v in m2d )
home_pred='/home/vincelf/upload'
color_pred='b1-09517_Clipped_pred_new_color.jpg'
color_pred_f = os.path.join(home_pred, color_pred)
color_pred_img = io.imread(color_pred_f)
color_pred_img.shape
set( tuple(v) for m2d in color_pred_img for v in m2d )
Test 1st implementation
Reference: https://www.jeremyjordan.me/evaluating-image-segmentation-models/
def iou_score(y_true, y_pred):
intersection = np.logical_and(y_true, y_pred)
union = np.logical_or(y_true, y_pred)
iou_score = np.sum(intersection) / np.sum(union)
return iou_score
iou_score(im2,m3)
# 0.011920572916666667
Test 2nd implementation
Reference: https://towardsdatascience.com/metrics-to-evaluate-your-semantic-segmentation-model-6bcb99639aa2
Retourne une erreur
# Both y_true and y_pred are m x r x c x n where m is the number of images, r is the number of rows, c is the number of columns, and n is the number of classes.
from keras import backend as K
def iou_coef(y_true, y_pred, smooth=1):
intersection = K.sum(K.abs(y_true * y_pred), axis=[1,2,3])
union = K.sum(y_true,[1,2,3])+K.sum(y_pred,[1,2,3])-intersection
iou = K.mean((intersection + smooth) / (union + smooth), axis=0)
return iou
iou_coef(im2, m3)
Erreur:
2020-06-05 00:48:26.050960: I tensorflow/stream_executor/platform/default/dso_loader.cc:44] Successfully opened dynamic library libcuda.so.1
2020-06-05 00:48:26.096634: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1561] Found device 0 with properties:
pciBusID: 0000:1e:00.0 name: Tesla V100-SXM2-16GB computeCapability: 7.0
coreClock: 1.53GHz coreCount: 80 deviceMemorySize: 15.78GiB deviceMemoryBandwidth: 836.37GiB/s
2020-06-05 00:48:26.097152: W tensorflow/stream_executor/platform/default/dso_loader.cc:55] Could not load dynamic library 'libcudart.so.10.1'; dlerror: libcudart.so.10.1: cannot open shared object file: No such file or directory
2020-06-05 00:48:26.097521: W tensorflow/stream_executor/platform/default/dso_loader.cc:55] Could not load dynamic library 'libcublas.so.10'; dlerror: libcublas.so.10: cannot open shared object file: No such file or directory
2020-06-05 00:48:26.097727: W tensorflow/stream_executor/platform/default/dso_loader.cc:55] Could not load dynamic library 'libcufft.so.10'; dlerror: libcufft.so.10: cannot open shared object file: No such file or directory
2020-06-05 00:48:26.097878: W tensorflow/stream_executor/platform/default/dso_loader.cc:55] Could not load dynamic library 'libcurand.so.10'; dlerror: libcurand.so.10: cannot open shared object file: No such file or directory
2020-06-05 00:48:26.098051: W tensorflow/stream_executor/platform/default/dso_loader.cc:55] Could not load dynamic library 'libcusolver.so.10'; dlerror: libcusolver.so.10: cannot open shared object file: No such file or directory
2020-06-05 00:48:26.098187: W tensorflow/stream_executor/platform/default/dso_loader.cc:55] Could not load dynamic library 'libcusparse.so.10'; dlerror: libcusparse.so.10: cannot open shared object file: No such file or directory
2020-06-05 00:48:26.098325: W tensorflow/stream_executor/platform/default/dso_loader.cc:55] Could not load dynamic library 'libcudnn.so.7'; dlerror: libcudnn.so.7: cannot open shared object file: No such file or directory
2020-06-05 00:48:26.098334: W tensorflow/core/common_runtime/gpu/gpu_device.cc:1598] Cannot dlopen some GPU libraries. Please make sure the missing libraries mentioned above are installed properly if you would like to use GPU. Follow the guide at https://www.tensorflow.org/install/gpu for how to download and setup the required libraries for your platform.
Skipping registering GPU devices...
2020-06-05 00:48:26.099037: I tensorflow/core/platform/cpu_feature_guard.cc:143] Your CPU supports instructions that this TensorFlow binary was not compiled to use: AVX2 AVX512F FMA
2020-06-05 00:48:26.110382: I tensorflow/core/platform/profile_utils/cpu_utils.cc:102] CPU Frequency: 2400000000 Hz
2020-06-05 00:48:26.110945: I tensorflow/compiler/xla/service/service.cc:168] XLA service 0x45c9ce0 initialized for platform Host (this does not guarantee that XLA will be used). Devices:
2020-06-05 00:48:26.110963: I tensorflow/compiler/xla/service/service.cc:176] StreamExecutor device (0): Host, Default Version
2020-06-05 00:48:26.113305: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1102] Device interconnect StreamExecutor with strength 1 edge matrix:
2020-06-05 00:48:26.113319: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1108]
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "<stdin>", line 2, in iou_coef
File "/localscratch/vincelf.8491172.0/pyenv36/lib/python3.6/site-packages/keras/backend/tensorflow_backend.py", line 1900, in abs
return tf.abs(x)
File "/localscratch/vincelf.8491172.0/pyenv36/lib/python3.6/site-packages/tensorflow/python/util/dispatch.py", line 180, in wrapper
return target(*args, **kwargs)
File "/localscratch/vincelf.8491172.0/pyenv36/lib/python3.6/site-packages/tensorflow/python/ops/math_ops.py", line 268, in abs
return gen_math_ops._abs(x, name=name)
File "/localscratch/vincelf.8491172.0/pyenv36/lib/python3.6/site-packages/tensorflow/python/ops/gen_math_ops.py", line 52, in _abs
_ops.raise_from_not_ok_status(e, name)
File "/localscratch/vincelf.8491172.0/pyenv36/lib/python3.6/site-packages/tensorflow/python/framework/ops.py", line 6653, in raise_from_not_ok_status
six.raise_from(core._status_to_exception(e.code, message), None)
File "<string>", line 3, in raise_from
tensorflow.python.framework.errors_impl.NotFoundError: Could not find valid device for node.
Node:
All kernels registered for op Abs :
device='XLA_GPU'; T in [DT_FLOAT, DT_DOUBLE, DT_INT32, DT_INT16, DT_INT8, DT_INT64, DT_BFLOAT16, DT_HALF]
device='XLA_CPU'; T in [DT_FLOAT, DT_DOUBLE, DT_INT32, DT_INT16, DT_INT8, DT_INT64, DT_BFLOAT16, DT_HALF]
device='XLA_CPU_JIT'; T in [DT_FLOAT, DT_DOUBLE, DT_INT32, DT_INT16, DT_INT8, DT_INT64, DT_BFLOAT16, DT_HALF]
device='XLA_GPU_JIT'; T in [DT_FLOAT, DT_DOUBLE, DT_INT32, DT_INT16, DT_INT8, DT_INT64, DT_BFLOAT16, DT_HALF]
device='GPU'; T in [DT_INT32]
device='GPU'; T in [DT_INT64]
device='GPU'; T in [DT_DOUBLE]
device='GPU'; T in [DT_FLOAT]
device='GPU'; T in [DT_HALF]
device='CPU'; T in [DT_INT64]
device='CPU'; T in [DT_INT32]
device='CPU'; T in [DT_INT16]
device='CPU'; T in [DT_INT8]
device='CPU'; T in [DT_DOUBLE]
device='CPU'; T in [DT_FLOAT]
device='CPU'; T in [DT_BFLOAT16]
device='CPU'; T in [DT_HALF]
[Op:Abs]
Test 3rd implementation
Reference: https://scikit-learn.org/stable/modules/generated/sklearn.metrics.jaccard_score.html
Retourne une erreur
from sklearn.metrics import jaccard_score
jaccard_score(im2, m3, average='samples')
Erreur:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/localscratch/vincelf.8491172.0/pyenv36/lib/python3.6/site-packages/sklearn/utils/validation.py", line 73, in inner_f
return f(**kwargs)
File "/localscratch/vincelf.8491172.0/pyenv36/lib/python3.6/site-packages/sklearn/metrics/_classification.py", line 736, in jaccard_score
pos_label)
File "/localscratch/vincelf.8491172.0/pyenv36/lib/python3.6/site-packages/sklearn/metrics/_classification.py", line 1250, in _check_set_wise_labels
y_type, y_true, y_pred = _check_targets(y_true, y_pred)
File "/localscratch/vincelf.8491172.0/pyenv36/lib/python3.6/site-packages/sklearn/metrics/_classification.py", line 98, in _check_targets
raise ValueError("{0} is not supported".format(y_type))
ValueError: unknown is not supported
Using open source
- https://ilmonteux.github.io/2019/05/10/segmentation-metrics.html
- https://gist.github.com/ilmonteux/8340df952722f3a1030a7d937e701b5a
- https://stats.stackexchange.com/questions/273537/f1-dice-score-vs-iou
Using tensor flow implementation
Using matlab
Références:
- https://docs.computecanada.ca/wiki/MATLAB
- https://www.mathworks.com/help/vision/semantic-segmentation.html?category=semantic-segmentation&s_tid=CRUX_gn_documentation_semantic-segmentation
dynimc allocation of one CPU to test
One cpu the test script will work; to use multiple CPU, it’s another matlab command
salloc --account=def-germ2201-ab --ntasks=1 --nodes=1 --cpus-per-task=1 --mem=4800M --time=0-3:00
Load the matlab module
module load matlab/2018a
Test script
Référence: https://docs.computecanada.ca/wiki/MATLAB
function cosplot()
% MATLAB file example to approximate a sawtooth
% with a truncated Fourier expansion.
nterms=5;
fourbypi=4.0/pi;
np=100;
y(1:np)=pi/2.0;
x(1:np)=linspace(-2.0*pi,2*pi,np);
for k=1:nterms
twokm=2*k-1;
y=y-fourbypi*cos(twokm*x)/twokm^2;
end
plot(x,y)
print -dpsc matlab_test_plot.ps
quit
end
[vincelf@blg5608 matlab]$ salloc --account=def-germ2201-ab --ntasks=1 --nodes=1 --cpus-per-task=1 --mem=4800M --time=0-3:00
salloc: Pending job allocation 8566547
salloc: job 8566547 queued and waiting for resources
salloc: job 8566547 has been allocated resources
salloc: Granted job allocation 8566547
salloc: Waiting for resource configuration
salloc: Nodes blg8610 are ready for job
[vincelf@blg8610 matlab]$ module load matlab/2018a
[vincelf@blg8610 matlab]$ pwd
/home/vincelf/matlab
[vincelf@blg8610 matlab]$ srun matlab -nodisplay -singleCompThread -r "test"
Opening log file: /tmp/java.log.28720
< M A T L A B (R) >
Copyright 1984-2018 The MathWorks, Inc.
R2018a (9.4.0.813654) 64-bit (glnxa64)
February 23, 2018
To get started, type one of these: helpwin, helpdesk, or demo.
For product information, visit www.mathworks.com.
[vincelf@blg8610 matlab]$ squeue -u vincelf
[vincelf@blg8610 matlab]$ seff <jobid>
[vincelf@blg8610 matlab]$ scancel -u vincelf <jobid>
[vincelf@blg8610 matlab]$ ls -al /tmp (pour la job java)
Errors
Matlab: Invalid use of operator
When launching script with absolute path on the command line. launch script with relative path.
[vincelf@blg4121 matlab]$ srun matlab -nodisplay -singleCompThread -r "/home/vincelf/matlab/test"
Opening log file: /tmp/java.log.16513
< M A T L A B (R) >
Copyright 1984-2018 The MathWorks, Inc.
R2018a (9.4.0.813654) 64-bit (glnxa64)
February 23, 2018
To get started, type one of these: helpwin, helpdesk, or demo.
For product information, visit www.mathworks.com.
/home/vincelf/matlab/test
|
Error: Invalid use of operator.
^Csrun: interrupt (one more within 1 sec to abort)
srun: step:8570507.7 task 0: running
^Csrun: interrupt (one more within 1 sec to abort)
srun: step:8570507.7 task 0: running
^Csrun: interrupt (one more within 1 sec to abort)
srun: step:8570507.7 task 0: running
^Csrun: sending Ctrl-C to job 8570507.7
>> >> >> >> >> >> >> >>
srun: Job step aborted: Waiting up to 62 seconds for job step to finish.
slurmstepd: error: *** STEP 8570507.7 ON blg4121 CANCELLED AT 2020-06-07T04:14:12 ***
>> [vincelf@blg4121 matlab]$
[vincelf@blg4121 matlab]$
[vincelf@blg4121 matlab]$ squeue -u vincelf
JOBID USER ACCOUNT NAME ST TIME_LEFT NODES CPUS TRES_PER_N MIN_MEM NODELIST (REASON)
8570507 vincelf def-germ2201 sh R 2:51:01 1 1 N/A 4800M blg4121 (None)
[vincelf@blg4121 matlab]$ scancel -u vincelf 8570507
salloc: Job allocation 8570507 has been revoked.
srun: Job step aborted: Waiting up to 62 seconds for job step to finish.
[vincelf@blg4121 matlab]$ exit
[vincelf@beluga3 matlab]$ salloc --account=def-germ2201-ab --ntasks=1 --nodes=1 --cpus-per-task=1 --mem=4800M --time=0-3:00
salloc: Pending job allocation 8571292
salloc: job 8571292 queued and waiting for resources
salloc: job 8571292 has been allocated resources
salloc: Granted job allocation 8571292
salloc: Waiting for resource configuration
salloc: Nodes blg8339 are ready for job
[vincelf@blg8339 matlab]$ module load matlab/2018a
[vincelf@blg8339 matlab]$ srun matlab -nodisplay -singleCompThread -r "test"
Opening log file: /tmp/java.log.36150
< M A T L A B (R) >
Copyright 1984-2018 The MathWorks, Inc.
R2018a (9.4.0.813654) 64-bit (glnxa64)
February 23, 2018
To get started, type one of these: helpwin, helpdesk, or demo.
For product information, visit www.mathworks.com.
[vincelf@blg8339 matlab]$
Autres métriques
NVIDIA tegrastats, pour les stats mem, cpu, gpu, chaleur, power
Note
- AO: always on,
- PLL: phase locking loop,
- PMIC: power management IC,
- Tdiode: temperature of thermal diode in chip,
- Tboard: temperature of board read from a thermal diode on board. Reference: https://forums.developer.nvidia.com/t/tx1-thermal-sensor-location/43348/2
Les indicateurs matériels suivants sont disponibles sur le Jetson Nano: Référence: https://docs.nvidia.com/jetson/l4t/index.html#page/Tegra%2520Linux%2520Driver%2520Package%2520Development%2520Guide%2FAppendixTegraStats.html%23wwpID0E0SB0HA
Exemple RAM 2072/3956MB (lfb 1x2MB) SWAP 893/1978MB (cached 35MB) IRAM 0/252kB(lfb 252kB) CPU [3%@1479,2%@1479,3%@1479,2%@1479] EMC_FREQ 3%@1600 GR3D_FREQ 0%@921 APE 25 PLL@22.5C CPU@24.5C PMIC@100C GPU@24C AO@31C thermal@24C POM_5V_IN 2159/3257 POM_5V_GPU 124/557 POM_5V_CPU 332/657
- Exécution:
Une seul fois dans un fichier:
$ tegrastats | while read a; do echo "$a" | awk -v now="$(date +%s)" '{OFS=" "}{print now" "$0}' > tegrastats-`date +%Y%m%dT%H%M%S`.log; tegrastats --stop; done
- en mode continue jusqu’au ctrl-c
FILENAME=tegrastats-`date +%Y%m%dT%H%M%S`.log; sudo tegrastats | while read a; do echo "$a" | awk -v now="$(date +%s)" '{OFS=" "}{print now" "$0}' >> ${FILENAME}; done # ou sudo tegrastats > tegrastats.log ctrl-c
- Exemple:
RAM 3300/3956MB (lfb 5x2MB) SWAP 1341/1978MB (cached 5MB) IRAM 0/252kB(lfb 252kB) CPU [18%@1479,13%@1479,15%@1479,26%@1479] EMC_FREQ 29%@1600 GR3D_FREQ 96%@921 APE 25 PLL@32C CPU@35C PMIC@100C GPU@34C AO@42.5C thermal@34C POM_5V_IN 6289/5162 POM_5V_GPU 2495/1845 POM_5V_CPU 1006/743 RAM 3300/3956MB (lfb 5x2MB) SWAP 1341/1978MB (cached 5MB) IRAM 0/252kB(lfb 252kB) CPU [20%@1479,13%@1479,15%@1479,11%@1479] EMC_FREQ 29%@1600 GR3D_FREQ 96%@921 APE 25 PLL@32C CPU@35C PMIC@100C GPU@33.5C AO@42.5C thermal@33.75C POM_5V_IN 6057/5177 POM_5V_GPU 2463/1856 POM_5V_CPU 927/746 RAM 3300/3956MB (lfb 5x2MB) SWAP 1341/1978MB (cached 5MB) IRAM 0/252kB(lfb 252kB) CPU [24%@1479,9%@1479,20%@1479,13%@1479] EMC_FREQ 29%@1600 GR3D_FREQ 97%@921 APE 25 PLL@31.5C CPU@34.5C PMIC@100C GPU@34C AO@42.5C thermal@34C POM_5V_IN 5550/5183 POM_5V_GPU 2309/1863 POM_5V_CPU 567/743 RAM 3300/3956MB (lfb 5x2MB) SWAP 1341/1978MB (cached 5MB) IRAM 0/252kB(lfb 252kB) CPU [13%@1479,14%@1479,14%@1479,26%@1479] EMC_FREQ 29%@1600 GR3D_FREQ 96%@921 APE 25 PLL@31.5C CPU@35C PMIC@100C GPU@34C AO@42.5C thermal@34C POM_5V_IN 5550/5189 POM_5V_GPU 2309/1870 POM_5V_CPU 567/740 RAM 3300/3956MB (lfb 5x2MB) SWAP 1341/1978MB (cached 5MB) IRAM 0/252kB(lfb 252kB) CPU [13%@1479,13%@1479,16%@1479,22%@1479] EMC_FREQ 29%@1600 GR3D_FREQ 99%@921 APE 25 PLL@32C CPU@34.5C PMIC@100C GPU@33.5C AO@42.5C thermal@34C POM_5V_IN 5356/5192 POM_5V_GPU 2150/1875 POM_5V_CPU 568/737 RAM 3301/3956MB (lfb 5x2MB) SWAP 1341/1978MB (cached 5MB) IRAM 0/252kB(lfb 252kB) CPU [13%@1479,11%@1479,15%@1479,26%@1479] EMC_FREQ 29%@1600 GR3D_FREQ 99%@921 APE 25 PLL@31.5C CPU@34.5C PMIC@100C GPU@34C AO@42.5C thermal@34C POM_5V_IN 5242/5192 POM_5V_GPU 2028/1877 POM_5V_CPU 568/735 RAM 3300/3956MB (lfb 5x2MB) SWAP 1341/1978MB (cached 5MB) IRAM 0/252kB(lfb 252kB) CPU [15%@1479,12%@1479,14%@1479,23%@1479] EMC_FREQ 29%@1600 GR3D_FREQ 99%@921 APE 25 PLL@32C CPU@34C PMIC@100C GPU@33.5C AO@42.5C thermal@34.25C POM_5V_IN 4998/5189 POM_5V_GPU 1788/1876 POM_5V_CPU 650/733 RAM 3301/3956MB (lfb 5x2MB) SWAP 1341/1978MB (cached 5MB) IRAM 0/252kB(lfb 252kB) CPU [13%@1479,12%@1479,7%@1479,24%@1479] EMC_FREQ 29%@1600 GR3D_FREQ 99%@921 APE 25 PLL@32C CPU@35C PMIC@100C GPU@34C AO@42.5C thermal@34.5C POM_5V_IN 5315/5191 POM_5V_GPU 1744/1874 POM_5V_CPU 852/735 RAM 3300/3956MB (lfb 5x2MB) SWAP 1341/1978MB (cached 5MB) IRAM 0/252kB(lfb 252kB) CPU [13%@1479,14%@1479,15%@1479,14%@1479] EMC_FREQ 29%@1600 GR3D_FREQ 99%@921 APE 25 PLL@32C CPU@35C PMIC@100C GPU@34C AO@42.5C thermal@34.5C POM_5V_IN 5437/5195 POM_5V_GPU 1742/1872 POM_5V_CPU 972/739 RAM 3300/3956MB (lfb 5x2MB) SWAP 1341/1978MB (cached 5MB) IRAM 0/252kB(lfb 252kB) CPU [11%@1479,17%@1479,23%@1479,10%@1479] EMC_FREQ 29%@1600 GR3D_FREQ 99%@921 APE 25 PLL@32C CPU@34.5C PMIC@100C GPU@34C AO@42.5C thermal@34.75C POM_5V_IN 5080/5193 POM_5V_GPU 1788/1871 POM_5V_CPU 650/738 RAM 3301/3956MB (lfb 5x2MB) SWAP 1341/1978MB (cached 5MB) IRAM 0/252kB(lfb 252kB) CPU [26%@1479,15%@1479,8%@1479,10%@1479] EMC_FREQ 29%@1600 GR3D_FREQ 96%@921 APE 25 PLL@32C CPU@34.5C PMIC@100C GPU@34C AO@43C thermal@34.75C POM_5V_IN 5080/5192 POM_5V_GPU 1828/1870 POM_5V_CPU 568/735 RAM 3301/3956MB (lfb 5x2MB) SWAP 1341/1978MB (cached 5MB) IRAM 0/252kB(lfb 252kB) CPU [29%@1479,17%@1479,11%@1479,12%@1479] EMC_FREQ 29%@1600 GR3D_FREQ 98%@921 APE 25 PLL@32C CPU@34.5C PMIC@100C GPU@34C AO@42.5C thermal@34.5C POM_5V_IN 5356/5194 POM_5V_GPU 2025/1872 POM_5V_CPU 607/733 RAM 3301/3956MB (lfb 5x2MB) SWAP 1341/1978MB (cached 5MB) IRAM 0/252kB(lfb 252kB) CPU [28%@1479,13%@1479,7%@1479,10%@1479] EMC_FREQ 29%@1600 GR3D_FREQ 99%@921 APE 25 PLL@32C CPU@34.5C PMIC@100C GPU@34C AO@43C thermal@34.5C POM_5V_IN 5662/5201 POM_5V_GPU 2265/1878 POM_5V_CPU 606/731 RAM 3301/3956MB (lfb 5x2MB) SWAP 1341/1978MB (cached 5MB) IRAM 0/252kB(lfb 252kB) CPU [26%@1479,14%@1479,9%@1479,7%@1479] EMC_FREQ 29%@1600 GR3D_FREQ 99%@921 APE 25 PLL@32C CPU@35C PMIC@100C GPU@34C AO@42.5C thermal@34.5C POM_5V_IN 5896/5210 POM_5V_GPU 2544/1887 POM_5V_CPU 565/729 RAM 3301/3956MB (lfb 5x2MB) SWAP 1341/1978MB (cached 5MB) IRAM 0/252kB(lfb 252kB) CPU [30%@1479,12%@1479,11%@1479,13%@1479] EMC_FREQ 29%@1600 GR3D_FREQ 92%@921 APE 25 PLL@32C CPU@35C PMIC@100C GPU@34C AO@43C thermal@34.5C POM_5V_IN 5743/5218 POM_5V_GPU 2022/1889 POM_5V_CPU 1011/733 RAM 3301/3956MB (lfb 5x2MB) SWAP 1341/1978MB (cached 5MB) IRAM 0/252kB(lfb 252kB) CPU [12%@1479,12%@1479,11%@1479,11%@1479] EMC_FREQ 29%@1600 GR3D_FREQ 99%@921 APE 25 PLL@32C CPU@34.5C PMIC@100C GPU@34C AO@43C thermal@34.5C POM_5V_IN 6057/5229 POM_5V_GPU 2580/1899 POM_5V_CPU 766/733 RAM 3304/3956MB (lfb 5x2MB) SWAP 1341/1978MB (cached 5MB) IRAM 0/252kB(lfb 252kB) CPU [16%@1479,13%@1479,27%@1479,10%@1479] EMC_FREQ 29%@1600 GR3D_FREQ 99%@921 APE 25 PLL@32C CPU@34.5C PMIC@100C GPU@34C AO@43C thermal@35.25C POM_5V_IN 6128/5241 POM_5V_GPU 2741/1910 POM_5V_CPU 564/731 RAM 3304/3956MB (lfb 5x2MB) SWAP 1341/1978MB (cached 5MB) IRAM 0/252kB(lfb 252kB) CPU [13%@1479,12%@1479,13%@1479,25%@1479] EMC_FREQ 29%@1600 GR3D_FREQ 99%@921 APE 25 PLL@32C CPU@35C PMIC@100C GPU@34.5C AO@43.5C thermal@34.5C POM_5V_IN 6168/5254 POM_5V_GPU 2701/1920 POM_5V_CPU 604/729 RAM 3308/3956MB (lfb 5x2MB) SWAP 1355/1978MB (cached 5MB) IRAM 0/252kB(lfb 252kB) CPU [29%@1479,13%@1479,20%@1479,33%@1479] EMC_FREQ 29%@1600 GR3D_FREQ 99%@921 APE 25 PLL@32.5C CPU@35C PMIC@100C GPU@34.5C AO@43C thermal@34.75C POM_5V_IN 6671/5272 POM_5V_GPU 2808/1932 POM_5V_CPU 882/731 RAM 3310/3956MB (lfb 4x2MB) SWAP 1355/1978MB (cached 5MB) IRAM 0/252kB(lfb 252kB) CPU [25%@1479,12%@1479,23%@1479,28%@1479] EMC_FREQ 29%@1600 GR3D_FREQ 96%@921 APE 25 PLL@32C CPU@35C PMIC@100C GPU@34.5C AO@43C thermal@34.75C POM_5V_IN 5428/5274 POM_5V_GPU 2228/1936 POM_5V_CPU 567/729 RAM 3307/3956MB (lfb 4x2MB) SWAP 1355/1978MB (cached 5MB) IRAM 0/252kB(lfb 252kB) CPU [6%@1479,12%@1479,14%@1479,26%@1479] EMC_FREQ 29%@1600 GR3D_FREQ 99%@921 APE 25 PLL@32C CPU@35.5C PMIC@100C GPU@34.5C AO@43C thermal@34.75C POM_5V_IN 5824/5282 POM_5V_GPU 2503/1943 POM_5V_CPU 605/728
free -m, pour la mémoire utilisée, cache, swap et libre
- Pour garder à l’écran :
$ watch -n 5 free -m
ctrl-c
- Pour logguer successivement:
# sudo free -m -s 1 -t -l > free-`date +%Y%m%dT%H%M%S`.log
FILENAME=free-`date +%Y%m%dT%H%M%S`.log; sudo free -m -s 1 -t -l | while read a; do echo "$a" | awk -v now="$(date +%s)" '{OFS=" "}{if(NF==7) {print now" "$0;} else {print $0;}}' >> ${FILENAME}; done
ctrl-c
- Exemple:
total used free shared buff/cache available
1594438559 Mem: 3956 2377 535 124 1044 1572
Low: 3956 3421 535
High: 0 0 0
Swap: 1978 388 1590
Total: 5934 2765 2125
total used free shared buff/cache available
1594438560 Mem: 3956 2377 534 124 1044 1571
Low: 3956 3422 534
High: 0 0 0
Swap: 1978 388 1590
Total: 5934 2765 2124
total used free shared buff/cache available
1594438561 Mem: 3956 2380 531 124 1044 1568
Low: 3956 3424 531
High: 0 0 0
Swap: 1978 388 1590
Total: 5934 2768 2121
total used free shared buff/cache available
1594438562 Mem: 3956 2376 535 124 1044 1572
Low: 3956 3420 535
High: 0 0 0
Swap: 1978 388 1590
Total: 5934 2764 2125
iotop, pour le IO
Référence: https://www.opsdash.com/blog/disk-monitoring-linux.html
- Installe:
$ sudo apt-get install iotop
- Exécute en mode continue jusqu’au ctrl-c:
$ FILENAME="iotop-`date +%Y%m%dT%H%M%S`.log"; sudo iotop --batch --time --only --processes --kilobytes > $FILENAME
ctrl-c
- Extrait les infos:
- segnet-camera
$ grep -E "segnet" iotop.log
22:57:55 17245 ?sys lefv2603 12849.44 K/s 0.00 K/s 0.00 % 9.61 % segnet-camera --network=fcn-resnet18-deepscene
22:57:56 17245 ?sys lefv2603 29691.41 K/s 0.00 K/s 0.00 % 33.52 % segnet-camera --network=fcn-resnet18-deepscene
22:57:57 17245 ?sys lefv2603 24320.22 K/s 0.00 K/s 0.00 % 27.34 % segnet-camera --network=fcn-resnet18-deepscene
22:57:58 17245 ?sys lefv2603 30579.35 K/s 0.00 K/s 0.00 % 37.04 % segnet-camera --network=fcn-resnet18-deepscene
22:57:59 17245 ?sys lefv2603 23505.52 K/s 0.00 K/s 0.00 % 25.05 % segnet-camera --network=fcn-resnet18-deepscene
22:58:00 17245 ?sys lefv2603 30970.10 K/s 0.00 K/s 0.00 % 36.01 % segnet-camera --network=fcn-resnet18-deepscene
22:58:02 17245 ?sys lefv2603 25219.86 K/s 0.00 K/s 0.00 % 31.23 % segnet-camera --network=fcn-resnet18-deepscene
22:58:03 17245 ?sys lefv2603 27602.30 K/s 0.00 K/s 0.00 % 33.10 % segnet-camera --network=fcn-resnet18-deepscene
22:58:04 17245 ?sys lefv2603 16928.24 K/s 6.90 K/s 0.00 % 7.22 % segnet-camera --network=fcn-resnet18-deepscene
22:58:06 17245 ?sys lefv2603 16325.93 K/s 0.00 K/s 0.00 % 3.96 % segnet-camera --network=fcn-resnet18-deepscene
22:58:08 17245 ?sys lefv2603 5186.13 K/s 3.16 K/s 0.00 % 1.85 % segnet-camera --network=fcn-resnet18-deepscene
22:58:09 17245 ?sys lefv2603 0.00 K/s 6.50 K/s 0.00 % 0.00 % segnet-camera --network=fcn-resnet18-deepscene
22:58:10 17245 ?sys lefv2603 0.00 K/s 3.36 K/s 0.00 % 0.00 % segnet-camera --network=fcn-resnet18-deepscene
22:58:11 17245 ?sys lefv2603 0.00 K/s 6.78 K/s 0.00 % 0.00 % segnet-camera --network=fcn-resnet18-deepscene
22:58:12 17245 ?sys lefv2603 0.00 K/s 6.78 K/s 0.00 % 0.00 % segnet-camera --network=fcn-resnet18-deepscene
22:58:14 17245 ?sys lefv2603 0.00 K/s 3.38 K/s 0.00 % 0.00 % segnet-camera --network=fcn-resnet18-deepscene
22:58:15 17245 ?sys lefv2603 0.00 K/s 6.78 K/s 0.00 % 0.00 % segnet-camera --network=fcn-resnet18-deepscene
22:58:16 17245 ?sys lefv2603 0.00 K/s 3.39 K/s 0.00 % 0.00 % segnet-camera --network=fcn-resnet18-deepscene
22:58:17 17245 ?sys lefv2603 1550.39 K/s 6.80 K/s 0.00 % 0.12 % segnet-camera --network=fcn-resnet18-deepscene
- DISK
$ grep -E "Total DISK" iotop.log
22:57:55 Total DISK READ : 12849.44 K/s | Total DISK WRITE : 0.00 K/s
22:57:56 Total DISK READ : 29691.41 K/s | Total DISK WRITE : 3.48 K/s
22:57:57 Total DISK READ : 24320.22 K/s | Total DISK WRITE : 0.00 K/s
22:57:58 Total DISK READ : 30579.35 K/s | Total DISK WRITE : 0.00 K/s
22:57:59 Total DISK READ : 23505.52 K/s | Total DISK WRITE : 10.46 K/s
22:58:00 Total DISK READ : 30970.10 K/s | Total DISK WRITE : 3.46 K/s
22:58:02 Total DISK READ : 25219.86 K/s | Total DISK WRITE : 13.90 K/s
22:58:03 Total DISK READ : 27602.30 K/s | Total DISK WRITE : 425.98 K/s
22:58:04 Total DISK READ : 22860.72 K/s | Total DISK WRITE : 17.25 K/s
22:58:05 Total DISK READ : 1552.91 K/s | Total DISK WRITE : 1143.16 K/s
22:58:06 Total DISK READ : 18201.47 K/s | Total DISK WRITE : 19.44 K/s
22:58:08 Total DISK READ : 28000.67 K/s | Total DISK WRITE : 31.60 K/s
22:58:09 Total DISK READ : 12615.58 K/s | Total DISK WRITE : 97.54 K/s
22:58:10 Total DISK READ : 9141.37 K/s | Total DISK WRITE : 3.36 K/s
22:58:11 Total DISK READ : 38425.82 K/s | Total DISK WRITE : 10.17 K/s
22:58:12 Total DISK READ : 37416.45 K/s | Total DISK WRITE : 13.56 K/s
22:58:14 Total DISK READ : 38507.38 K/s | Total DISK WRITE : 450.08 K/s
dstat, pour les stats system, cpu, mem
- Installe:
sudo apt-get install dstat
- Exécute jusqu’au ctrl-c
$ sudo dstat -gmrsty -c -C 0,1,2,3,total --output dstat-`date +%Y%m%dT%H%M%S`.log
ctrl-c
- Exemple:
"Dstat 0.7.3 CSV output"
"Author:","Dag Wieers <dag@wieers.com>",,,,"URL:","http://dag.wieers.com/home-made/dstat/"
"Host:","lefv2603-desktop",,,,"User:","lefv2603"
"Cmdline:","dstat -gmrsty -c -C 0,1,2,3,total --output dstat.log",,,,"Date:","08 Jul 2020 23:10:25 EDT"
"paging",,"memory usage",,,,"io/total",,"swap",,"system","system",,"cpu0 usage",,,,,"cpu1 usage",,,,,"cpu2 usage",,,,,"cpu3 usage",,,,,"total cpu usage",,,,
"in","out","used","free","buff","cach","read","writ","used","free","time","int","csw","cpu0 usage:usr","cpu0 usage:sys","cpu0 usage:idl","cpu0 usage:wai","cpu0 usage:stl","cpu1 usage:usr","cpu1 usage:sys","cpu1 usage:idl","cpu1 usage:wai","cpu1 usage:stl","cpu2 usage:usr","cpu2 usage:sys","cpu2 usage:idl","cpu2 usage:wai","cpu2 usage:stl","cpu3 usage:usr","cpu3 usage:sys","cpu3 usage:idl","cpu3 usage:wai","cpu3 usage:stl","total cpu usage:usr","total cpu usage:sys","total cpu usage:idl","total cpu usage:wai","total cpu usage:stl"
37899.432,167917.961,2784907264,924696576,10518528,572469248,22.964,46.010,1407582208,666632192,08-07 23:10:25,2476.053,4135.282,6.071,2.780,88.381,2.768,0,5.846,2.723,88.560,2.871,0,5.897,2.763,88.489,2.851,0,5.846,2.374,89.451,2.329,0,5.915,2.660,88.720,2.705,0
266240,0,2784669696,921223168,10526720,576299008,105,0,1407315968,666898432,08-07 23:10:26,5758,7913,2.970,0.990,92.079,3.960,0,1.010,2.020,96.970,0,0,3.030,3.030,90.909,3.030,0,2,6,92,0,0,2.015,2.771,93.451,1.763,0
151552,0,2784800768,921157632,10526720,576106496,37,0,1407164416,667049984,08-07 23:10:27,5387,8001,2,1,97,0,0,0,1.020,98.980,0,0,0,5,95,0,0,3.030,2.020,94.949,0,0,1.754,2.256,95.990,0,0
0,0,2781556736,924401664,10526720,576106496,0,0,1407164416,667049984,08-07 23:10:28,5569,8296,3.030,1.010,95.960,0,0,0,2.020,97.980,0,0,0.990,3.960,95.050,0,0,1,5,94,0,0,1.250,3,95.750,0,0
0,0,2781515776,924434432,10534912,576106496,0,4,1407164416,667049984,08-07 23:10:29,5661,8362,0,1.010,98.990,0,0,2.020,5.051,92.929,0,0,2,4,93,1,0,0,2.970,97.030,0,0,1.003,3.509,95.489,0,0
0,0,2781581312,924368896,10534912,576106496,0,0,1407164416,667049984,08-07 23:10:30,5769,8511,1.980,1.980,96.040,0,0,0,2.020,97.980,0,0,2,4,94,0,0,4,2,94,0,0,1.754,2.506,95.739,0,0
Combiné pendant l’inférence avec la caméra
$ sudo tegrastats > tegrastats-`date +%Y%m%dT%H%M%S`.log | sudo iotop --batch --time --only --processes --kilobytes > iotop-`date +%Y%m%dT%H%M%S`.log | sudo free -m -s 1 -t -l > free-`date +%Y%m%dT%H%M%S`.log | sudo dstat -gmrsty -c -C 0,1,2,3,total --output dstat-`date +%Y%m%dT%H%M%S`.log | sudo /home/lefv2603/projects/jetson-inference/build/aarch64/bin/segnet-camera --network=fcn-resnet18-deepscene > segnet-camera.output-`date +%Y%m%dT%H%M%S`.log
Traitement
NVidia Tegrastats
tegrastats peut produire différentes traces, selon les éléments hardware qui sont mis à contribution.
trace 40
- la trace produite par NVidia
1594343173 RAM 2410/3956MB (lfb 108x4MB) SWAP 314/1978MB (cached 7MB) CPU [1%@1479,0%@1479,1%@1479,1%@1479] EMC_FREQ 0% GR3D_FREQ 0% PLL@27C CPU@29.5C PMIC@100C GPU@29C AO@38.5C thermal@29C POM_5V_IN 2159/2159 POM_5V_GPU 166/166 POM_5V_CPU 332/332
- quelque nettoyage, et arrangement en colonne, pour une meilleure visibilité
$ cat tegrastats-20200709T230009.log | sed -E 's/[()%\[]|MB|]|kB/ /g' | sed -E 's/[,@]|C / /g' | sed -E 's/ /\t/g' | sed -E 's/\t+/\t/g'
# dans Google sheet, copy => paste & transpose
1 1594343173
2 RAM MB
3 2410/3956
4 lfb Largest Free Block
5 108x4
6 SWAP MB
7 314/1978
8 cached MB
9 7
10 CPU % Mhz
11 1
12 1479
13 0
14 1479
15 1
16 1479
17 1
18 1479
19 EMC_FREQ %/Mhz
20 0
21 GR3D_FREQ %/Mhz
22 0
23 PLL Celcius
24 27
25 CPU Celcius
26 29.5
27 PMIC Celcius
28 100
29 GPU Celcius
30 29
31 AO Celcius
32 38.5
33 thermal Celcius
34 29
35 POM_5V_IN milliwatts cur/avg
36 2159/2159
37 POM_5V_GPU milliwatts cur/avg
38 166/166
39 POM_5V_CPU milliwatts cur/avg
40 332/332
- et le rendu final, avec uniquement les valeurs:
$ cat tegrastats-20200709T230009.log | sed -E 's/[()%\[]|MB|]|kB/ /g' | sed -E 's/[,@]|C / /g' | sed -E 's/ /\t/g' | sed -E 's/\t+/\t/g' | awk -F$"\t" \
'BEGIN { OFS="," }; \
{ \
split($3,RAM,"/"); \
split($7,SWAP,"/"); \
split($36,POM_5V_IN,"/"); \
split($38,POM_5V_GPU,"/"); \
split($40,POM_5V_CPU,"/"); \
print $1,RAM[1],RAM[2],SWAP[1],SWAP[2],$9,$11,$12,$13,$14,$15,$16,$17,$18,$20,$22,$24,$26,$28,$30,$32,$34,POM_5V_IN[1],POM_5V_IN[2],POM_5V_GPU[1],POM_5V_GPU[2],POM_5V_CPU[1],POM_5V_CPU[2]; \
};
END {}; \'
- retourne le résultat suivant:
1594343173,2410,3956,314,1978,7,1,1479,0,1479,1,1479,1,1479,0,0,27,29.5,100,29,38.5,29,2159,2159,166,166,332,332
- header:
unixepochtime,ramused,ramtotal,swapused,swaptotal,cached,cpu1per,cpu1freq,cpu2per,cpu2freq,cpu3per,cpu3freq,cpu4per,cpu4freq,emcfreq,gr3dfreq,plltemp,cputemp,pmictemp,gputemp,aotemp,thermal,pom5vincurr,pom5vinavg,pom5vgpucurr,pom5vgpuavg,pom5vcpucurr,pom5vcpuavg
- commande complète, avec sauvegarde dans un fichier csv
FILENAME="tegrastats-20200719T220319.log";echo "unixepochtime,ramused,ramtotal,swapused,swaptotal,cached,cpu1per,cpu1freq,cpu2per,cpu2freq,cpu3per,cpu3freq,cpu4per,cpu4freq,emcfreq,gr3dfreq,plltemp,cputemp,pmictemp,gputemp,aotemp,thermal,pom5vincurr,pom5vinavg,pom5vgpucurr,pom5vgpuavg,pom5vcpucurr,pom5vcpuavg" > ${FILENAME}.csv; cat ${FILENAME} | sed -E 's/[()%\[]|MB|]|kB/ /g' | sed -E 's/[,@]|C / /g' | sed -E 's/ /\t/g' | sed -E 's/\t+/\t/g' | awk -F$"\t" 'BEGIN { OFS="," }; \
{ \
split($3,RAM,"/"); \
split($7,SWAP,"/"); \
split($36,POM_5V_IN,"/"); \
split($38,POM_5V_GPU,"/"); \
split($40,POM_5V_CPU,"/"); \
print $1,RAM[1],RAM[2],SWAP[1],SWAP[2],$9,$11,$12,$13,$14,$15,$16,$17,$18,$20,$22,$24,$26,$28,$30,$32,$34,POM_5V_IN[1],POM_5V_IN[2],POM_5V_GPU[1],POM_5V_GPU[2],POM_5V_CPU[1],POM_5V_CPU[2]; \
};
END {}; \' >> ${FILENAME}.csv
- Résultat
unixepochtime,ramused,ramtotal,swapused,swaptotal,cached,cpu1per,cpu1freq,cpu2per,cpu2freq,cpu3per,cpu3freq,cpu4per,cpu4freq,emcfreq,gr3dfreq,plltemp,cputemp,pmictemp,gputemp,aotemp,thermal,pom5vincurr,pom5vinavg,pom5vgpucurr,pom5vgpuavg,pom5vcpucurr,pom5vcpuavg 1595210599,1981,3956,0,1978,0,1,1479,1,1479,1,1479,0,1479,0,0,29,30,100,30,39.5,30.25,2201,2201,166,166,332,332
trace 48
Autre version avec la segmentation avec la caméra, oui il y a les stats suivantes en plus: IRAM, IRAM-lfb, EMC_FREQ Mhz, GR3D_FREQ Mhz, APE
- la trace produite par NVidia
1594350022 RAM 2745/3956MB (lfb 11x4MB) SWAP 342/1978MB (cached 14MB) IRAM 0/252kB(lfb 252kB) CPU [6%@1479,0%@1479,1%@1479,3%@1479] EMC_FREQ 2%@1600 GR3D_FREQ 0%@921 APE 25 PLL@28.5C CPU@29.5C PMIC@100C GPU@30C AO@38.5C thermal@29.5C POM_5V_IN 2322/2343 POM_5V_GPU 165/182 POM_5V_CPU 373/400
- quelque nettoyage, et arrangement en colonne, pour une meilleure visibilité
$ cat tegrastats-20200709T230009.log | sed -E 's/[()%\[]|MB|]|kB/ /g' | sed -E 's/[,@]|C / /g' | sed -E 's/ /\t/g' | sed -E 's/\t+/\t/g' # dans Google sheet, copy => paste & transpose 1 1594350022 2 RAM 3 2745/3956 4 lfb 5 11x4 6 SWAP 7 342/1978 8 cached 9 14 10 IRAM 11 0/252 12 lfb 13 252 14 CPU 15 6 16 1479 17 0 18 1479 19 1 20 1479 21 3 22 1479 23 EMC_FREQ 24 2 25 1600 26 GR3D_FREQ 27 0 28 921 29 APE 30 25 31 PLL 32 28.5 33 CPU 34 29.5 35 PMIC 36 100 37 GPU 38 30 39 AO 40 38.5 41 thermal 42 29.5 43 POM_5V_IN 44 2322/2343 45 POM_5V_GPU 46 165/182 47 POM_5V_CPU 48 373/400
- et le rendu final, avec uniquement les valeurs:
$ cat tegrastats-20200709T230009.log | sed -E 's/[()%\[]|MB|]|kB/ /g' | sed -E 's/[,@]|C / /g' | sed -E 's/ /\t/g' | sed -E 's/\t+/\t/g' | awk -F$"\t" \ 'BEGIN { OFS="," }; \ { \ split($3,RAM,"/"); \ split($7,SWAP,"/"); \ split($11,IRAM,"/"); \ split($44,POM_5V_IN,"/"); \ split($46,POM_5V_GPU,"/"); \ split($48,POM_5V_CPU,"/"); \ print $1,RAM[1],RAM[2],SWAP[1],SWAP[2],$9,IRAM[1],IRAM[2],$15,$16,$17,$18,$19,$20,$21,$22,$24,$25,$27,$28,$30,$32,$34,$36,$38,$40,$42,POM_5V_IN[1],POM_5V_IN[2],POM_5V_GPU[1],POM_5V_GPU[2],POM_5V_CPU[1],POM_5V_CPU[2]; \ }; END {}; \'
- donne le résultat suivant:
1594350022,2745,3956,342,1978,14,0,252,6,1479,0,1479,1,1479,3,1479,2,1600,0,921,25,28.5,29.5,100,30,38.5,29.5,2322,2343,165,182,373,400
- header:
unixepochtime,ramused,ramtotal,swapused,swaptotal,cached,iramused,iramtotal,cpu1per,cpu1freq,cpu2per,cpu2freq,cpu3per,cpu3freq,cpu4per,cpu4freq,emcper,emcfreq,gr3dper,gr3dfreq,ape,plltemp,cputemp,pmictemp,gputemp,aotemp,thermal,pom5vincurr,pom5vinavg,pom5vgpucurr,pom5vgpuavg,pom5vcpucurr,pom5vcpuavg
- commande complète, avec sauvegarde dans un fichier csv
FILENAME="tegrastats-20200719T220319.log";echo "unixepochtime,ramused,ramtotal,swapused,swaptotal,cached,iramused,iramtotal,cpu1per,cpu1freq,cpu2per,cpu2freq,cpu3per,cpu3freq,cpu4per,cpu4freq,emcper,emcfreq,gr3dper,gr3dfreq,ape,plltemp,cputemp,pmictemp,gputemp,aotemp,thermal,pom5vincurr,pom5vinavg,pom5vgpucurr,pom5vgpuavg,pom5vcpucurr,pom5vcpuavg" > "${FILENAME}.48.csv" cat "${FILENAME}" | sed -E 's/[()%\[]|MB|]|kB/ /g' | sed -E 's/[,@]|C / /g' | sed -E 's/ /\t/g' | sed -E 's/\t+/\t/g' | awk -F$"\t" \ 'BEGIN { OFS="," }; \ { \ split($3,RAM,"/"); \ split($7,SWAP,"/"); \ split($11,IRAM,"/"); \ split($44,POM_5V_IN,"/"); \ split($46,POM_5V_GPU,"/"); \ split($48,POM_5V_CPU,"/"); \ print $1,RAM[1],RAM[2],SWAP[1],SWAP[2],$9,IRAM[1],IRAM[2],$15,$16,$17,$18,$19,$20,$21,$22,$24,$25,$27,$28,$30,$32,$34,$36,$38,$40,$42,POM_5V_IN[1],POM_5V_IN[2],POM_5V_GPU[1],POM_5V_GPU[2],POM_5V_CPU[1],POM_5V_CPU[2]; \ }; END {}; \' >> "${FILENAME}.48.csv"
- résultat:
unixepochtime,ramused,ramtotal,swapused,swaptotal,cached,iramused,iramtotal,cpu1per,cpu1freq,cpu2per,cpu2freq,cpu3per,cpu3freq,cpu4per,cpu4freq,emcper,emcfreq,gr3dper,gr3dfreq,ape,plltemp,cputemp,pmictemp,gputemp,aotemp,thermal,pom5vincurr,pom5vinavg,pom5vgpucurr,pom5vgpuavg,pom5vcpucurr,pom5vcpuavg 1595289757,2230,3956,0,1978,0,0,252,4,1479,5,1479,50,1479,7,1479,3,1600,0,921,25,28.5,30.5,100,30,39.5,30.75,2488,2488,165,165,579,579 1595289758,2229,3956,0,1978,0,0,252,3,1479,4,1479,18,1479,3,1479,3,1600,0,921,25,28.5,30,100,30,39,30,2525,2506,165,165,621,600 1595289759,2229,3956,0,1978,0,0,252,3,1479,2,1479,17,1479,3,1479,3,1600,0,921,25,29,30.5,100,30,39,30,2608,2540,165,165,703,634
free -m
- cette commande
$ cat free.log | sed -Ee 's/[^[:digit:]]+/ /g' -Ee 's/^ //g' -Ee '/^$/d' | sed -e 'N;N;N;N; s/\n/ /g' -Ee 's/ /,/g'
- transforme ceci :
total used free shared buff/cache available
1594438559 Mem: 3956 2377 535 124 1044 1572
Low: 3956 3421 535
High: 0 0 0
Swap: 1978 388 1590
Total: 5934 2765 2125
total used free shared buff/cache available
1594438560 Mem: 3956 2377 534 124 1044 1571
Low: 3956 3422 534
High: 0 0 0
Swap: 1978 388 1590
Total: 5934 2765 2124
total used free shared buff/cache available
1594438561 Mem: 3956 2380 531 124 1044 1568
Low: 3956 3424 531
High: 0 0 0
Swap: 1978 388 1590
Total: 5934 2768 2121
total used free shared buff/cache available
1594438562 Mem: 3956 2376 535 124 1044 1572
Low: 3956 3420 535
High: 0 0 0
Swap: 1978 388 1590
Total: 5934 2764 2125
- en cela
1594438559,3956,2377,535,124,1044,1572,3956,3421,535,0,0,0,1978,388,1590,5934,2765,2125
1594438560,3956,2377,534,124,1044,1571,3956,3422,534,0,0,0,1978,388,1590,5934,2765,2124
1594438561,3956,2380,531,124,1044,1568,3956,3424,531,0,0,0,1978,388,1590,5934,2768,2121
1594438562,3956,2376,535,124,1044,1572,3956,3420,535,0,0,0,1978,388,1590,5934,2764,2125
- header:
unixepochtime,memtotal,memused,memfree,memshared,membufcache,memavailable,lowtotal,lowused,lowfree,hightotal,highused,highfree,swaptotal,swapused,swapfree,totaltotal,totalused,totalfree
- commande complète, avec sauvegarde dans un fichier
FILENAME="free-20200719T231632.log"; echo "unixepochtime,memtotal,memused,memfree,memshared,membufcache,memavailable,lowtotal,lowused,lowfree,hightotal,highused,highfree,swaptotal,swapused,swapfree,totaltotal,totalused,totalfree" > ${FILENAME}.csv; cat ${FILENAME} | sed -Ee 's/[^[:digit:]]+/ /g' -Ee 's/^ //g' -Ee '/^$/d' | sed -e 'N;N;N;N; s/\n/ /g' -Ee 's/ /,/g' >> ${FILENAME}.csv
- résultat
unixepochtime,memtotal,memused,memfree,memshared,membufcache,memavailable,lowtotal,lowused,lowfree,hightotal,highused,highfree,swaptotal,swapused,swapfree,totaltotal,totalused,totalfree
1595214996,3956,2807,354,246,793,770,3956,3601,354,0,0,0,1978,40,1937,5934,2848,2291
1595214997,3956,2805,356,246,793,769,3956,3599,356,0,0,0,1978,40,1937,5934,2846,2293
1595214998,3956,2805,356,246,793,769,3956,3599,356,0,0,0,1978,40,1937,5934,2846,2293
1595214999,3956,2805,356,246,793,770,3956,3599,356,0,0,0,1978,40,1937,5934,2846,2293
iotop
segnet-camera
- cette commande :
$ grep -E "segnet" iotop.log | sed -E 's/%|(K\/s)//g' | awk -F" " -v logdate="Jul 9, 2020" \
'BEGIN { OFS="," }; \
{ \
split($1,time,":"); \
cmd ="date \"+%s\" -d \""logdate" "time[1]":"time[2]":"time[3]"\""; \
cmd | getline var; \
print var,$5,$6,$7,$8; \
};
END {}; \'
- transforme ceci:
20:30:34 11592 ?sys root 5697.11 K/s 0.00 K/s 0.00 % 0.88 % segnet-camera --network=fcn-resnet18-deepscene
20:30:35 11592 ?sys root 31904.62 K/s 0.00 K/s 0.00 % 8.71 % segnet-camera --network=fcn-resnet18-deepscene
20:30:36 11592 ?sys root 2969.61 K/s 0.00 K/s 0.00 % 6.83 % segnet-camera --network=fcn-resnet18-deepscene
20:30:38 11592 ?sys root 1225.92 K/s 6.02 K/s 0.00 % 1.49 % segnet-camera --network=fcn-resnet18-deepscene
20:30:39 11592 ?sys root 824.32 K/s 6.81 K/s 0.00 % 0.49 % segnet-camera --network=fcn-resnet18-deepscene
20:30:40 11592 ?sys root 0.00 K/s 3.40 K/s 0.00 % 0.00 % segnet-camera --network=fcn-resnet18-deepscene
20:30:41 11592 ?sys root 0.00 K/s 6.69 K/s 0.00 % 0.00 % segnet-camera --network=fcn-resnet18-deepscene
20:30:42 11592 ?sys root 0.00 K/s 3.42 K/s 0.00 % 0.00 % segnet-camera --network=fcn-resnet18-deepscene
20:30:43 11592 ?sys root 0.00 K/s 6.85 K/s 0.00 % 0.00 % segnet-camera --network=fcn-resnet18-deepscene
- en cela:
1594341034,5697.11,0.00,0.00,0.88
1594341035,31904.62,0.00,0.00,8.71
1594341036,2969.61,0.00,0.00,6.83
1594341038,1225.92,6.02,0.00,1.49
1594341039,824.32,6.81,0.00,0.49
1594341040,0.00,3.40,0.00,0.00
1594341041,0.00,6.69,0.00,0.00
1594341042,0.00,3.42,0.00,0.00
1594341043,0.00,6.85,0.00,0.00
- header:
unixepochtime,diskread,diskwrite,swapin,io
- commande complète, avec sauvegarde dans un fichier
$ FILENAME="iotop-20200719T224932.log"; echo "unixepochtime,diskread,diskwrite,swapin,io" > ${FILENAME}.segnet-camera.csv; grep -E "segnet" iotop.log | sed -E 's/%|(K\/s)//g' | awk -F" " -v logdate="Jul 9, 2020" \
'BEGIN { OFS="," }; \
{ \
split($1,time,":"); \
cmd ="date \"+%s\" -d \""logdate" "time[1]":"time[2]":"time[3]"\""; \
cmd | getline var; \
print var,$5,$6,$7,$8; \
};
END {}; \' >> ${FILENAME}.segnet-camera.csv
- résultat
unixepochtime,diskread,diskwrite,swapin,io
1594341034,5697.11,0.00,0.00,0.88
1594341035,31904.62,0.00,0.00,8.71
1594341036,2969.61,0.00,0.00,6.83
1594341038,1225.92,6.02,0.00,1.49
1594341039,824.32,6.81,0.00,0.49
1594341040,0.00,3.40,0.00,0.00
1594341041,0.00,6.69,0.00,0.00
1594341042,0.00,3.42,0.00,0.00
1594341043,0.00,6.85,0.00,0.00
Total disk
- cette commande :
$ FILENAME="iotop-20200719T224932.log"; grep -E "Total DISK" $FILENAME | sed -E 's/\||(K\/s)|(Total DISK READ :)|(Total DISK WRITE :)//g' | awk -F" " -v logdate="Jul 9, 2020" 'BEGIN { OFS="," }; \
{ \
split($1,time,":"); \
cmd ="date \"+%s\" -d \""logdate" "time[1]":"time[2]":"time[3]"\""; \
cmd | getline var; \
print var,$2,$3; \
};
END {}; \'
- transforme ceci:
20:30:34 Total DISK READ : 13141.87 K/s | Total DISK WRITE : 116.97 K/s
20:30:35 Total DISK READ : 35516.96 K/s | Total DISK WRITE : 2.93 K/s
20:30:36 Total DISK READ : 20181.52 K/s | Total DISK WRITE : 11.82 K/s
20:30:38 Total DISK READ : 22590.62 K/s | Total DISK WRITE : 24.10 K/s
20:30:39 Total DISK READ : 19208.00 K/s | Total DISK WRITE : 10.22 K/s
20:30:40 Total DISK READ : 17365.75 K/s | Total DISK WRITE : 6.80 K/s
20:30:41 Total DISK READ : 24771.96 K/s | Total DISK WRITE : 10.03 K/s
20:30:42 Total DISK READ : 10.25 K/s | Total DISK WRITE : 54.67 K/s
20:30:43 Total DISK READ : 5607.93 K/s | Total DISK WRITE : 6.85 K/s
- en cela:
1594341034,13141.87,116.97
1594341035,35516.96,2.93
1594341036,20181.52,11.82
1594341038,22590.62,24.10
1594341039,19208.00,10.22
1594341040,17365.75,6.80
1594341041,24771.96,10.03
1594341042,10.25,54.67
1594341043,5607.93,6.85
- header:
unixepochtime,totaldiskread,totaldiskwrwite
- commande complète, avec sauvegarde dans un fichier csv
$ FILENAME="iotop-20200719T224932.log"; echo "unixepochtime,totaldiskread,totaldiskwrwite" > ${FILENAME}.totaldisk.csv; grep -E "Total DISK" $FILENAME | sed -E 's/\||(K\/s)|(Total DISK READ :)|(Total DISK WRITE :)//g' | awk -F" " -v logdate="Jul 9, 2020" 'BEGIN { OFS="," }; \
{ \
split($1,time,":"); \
cmd ="date \"+%s\" -d \""logdate" "time[1]":"time[2]":"time[3]"\""; \
cmd | getline var; \
print var,$2,$3; \
};
END {}; \' >> ${FILENAME}.totaldisk.csv
- résultat
unixepochtime,totaldiskread,totaldiskwrwite
1594349372,0.00,0.00
1594349374,0.00,10.57
1594349375,0.00,0.00
1594349376,0.00,0.00
1594349377,0.00,0.00
Collecteur de stats
Script qui collecte les trois métriques: tegrastats, free -m et iotop.
Le paramètre est le chemin ou sont enregistrés les fichiers de stats, et sert aussi comme nom du test.
#!/bin/bash
if [ $# -eq 0 ]
then
echo "No arguments supplied"
exit
fi
if [ -z "$1" ]
then
echo "No argument supplied"
fi
REASON=$1
[ -d ${REASON} ] && rm -rf ${REASON}
mkdir ${REASON}
# tegrastats stat collect
TEGRASTATS_FILENAME=${REASON}/"tegrastats-`date +%Y%m%dT%H%M%S`.log"
sudo tegrastats | while read a; do echo "$a" | awk -v now="$(date +%s)" '{OFS=" "}{print now" "$0}' >> ${TEGRASTATS_FILENAME}; done &
# free -m stat collect
FREE_FILENAME=${REASON}/"free-`date +%Y%m%dT%H%M%S`.log"
sudo free -m -s 1 -t -l | while read a; do echo "$a" | awk -v now="$(date +%s)" '{OFS=" "}{if(NF==7) {print now" "$0;} else {print $0;}}' >> ${FREE_FILENAME}; done &
# iotop stat collect
IOTOP_FILENAME=${REASON}/"iotop-`date +%Y%m%dT%H%M%S`.log"
sudo iotop --batch --time --only --processes --kilobytes > ${IOTOP_FILENAME}
wait
echo "done"
Transformateur en CSV
Script qui prend en entré le chemin où sont enregistrés les fichiers de stats, et qui sert aussi comme nom du test.
Transforme les fichiers au format CSV.
#!/bin/bash
if [ $# -eq 0 ]
then
echo "No arguments supplied"
exit
fi
if [ -z "$1" ]
then
echo "No argument supplied"
fi
REASON=$1
# tegrastats stat collect
FILENAME="`ls -1 ${REASON}/tegrastats-*.log`"
# test if IRAM & APE stats present (48s stats)
if [ $(grep -cE "IRAM.*APE" ${FILENAME}) > 0 ]
then
echo "unixepochtime,ramused,ramtotal,swapused,swaptotal,cached,iramused,iramtotal,cpu1per,cpu1freq,cpu2per,cpu2freq,cpu3per,cpu3freq,cpu4per,cpu4freq,emcper,emcfreq,gr3dper,gr3dfreq,ape,plltemp,cputemp,pmictemp,gputemp,aotemp,thermal,pom5vincurr,pom5vinavg,pom5vgpucurr,pom5vgpuavg,pom5vcpucurr,pom5vcpuavg" > "${FILENAME}.48.csv"
cat "${FILENAME}" | sed -E 's/[()%\[]|MB|]|kB/ /g' | sed -E 's/[,@]|C / /g' | sed -E 's/ /\t/g' | sed -E 's/\t+/\t/g' | awk -F$"\t" \
'BEGIN { OFS="," }; \
{ \
split($3,RAM,"/"); \
split($7,SWAP,"/"); \
split($11,IRAM,"/"); \
split($44,POM_5V_IN,"/"); \
split($46,POM_5V_GPU,"/"); \
split($48,POM_5V_CPU,"/"); \
print $1,RAM[1],RAM[2],SWAP[1],SWAP[2],$9,IRAM[1],IRAM[2],$15,$16,$17,$18,$19,$20,$21,$22,$24,$25,$27,$28,$30,$32,$34,$36,$38,$40,$42,POM_5V_IN[1],POM_5V_IN[2],POM_5V_GPU[1],POM_5V_GPU[2],POM_5V_CPU[1],POM_5V_CPU[2]; \
};
END {}; \' >> "${FILENAME}.48.csv"
else
echo "unixepochtime,ramused,ramtotal,swapused,swaptotal,cached,cpu1per,cpu1freq,cpu2per,cpu2freq,cpu3per,cpu3freq,cpu4per,cpu4freq,emcfreq,gr3dfreq,plltemp,cputemp,pmictemp,gputemp,aotemp,thermal,pom5vincurr,pom5vinavg,pom5vgpucurr,pom5vgpuavg,pom5vcpucurr,pom5vcpuavg" > "${FILENAME}.40.csv"
cat "${FILENAME}" | sed -E 's/[()%\[]|MB|]|kB/ /g' | sed -E 's/[,@]|C / /g' | sed -E 's/ /\t/g' | sed -E 's/\t+/\t/g' | awk -F$"\t" 'BEGIN { OFS="," }; \
{ \
split($3,RAM,"/"); \
split($7,SWAP,"/"); \
split($36,POM_5V_IN,"/"); \
split($38,POM_5V_GPU,"/"); \
split($40,POM_5V_CPU,"/"); \
print $1,RAM[1],RAM[2],SWAP[1],SWAP[2],$9,$11,$12,$13,$14,$15,$16,$17,$18,$20,$22,$24,$26,$28,$30,$32,$34,POM_5V_IN[1],POM_5V_IN[2],POM_5V_GPU[1],POM_5V_GPU[2],POM_5V_CPU[1],POM_5V_CPU[2]; \
};
END {}; \' >> "${FILENAME}.40.csv"
fi
# free -m stat collect
FILENAME="`ls -1 ${REASON}/free-*.log`"
echo "unixepochtime,memtotal,memused,memfree,memshared,membufcache,memavailable,lowtotal,lowused,lowfree,hightotal,highused,highfree,swaptotal,swapused,swapfree,totaltotal,totalused,totalfree" > "${FILENAME}.csv"
cat "${FILENAME}" | sed -Ee 's/[^[:digit:]]+/ /g' -Ee 's/^ //g' -Ee '/^$/d' | sed -e 'N;N;N;N; s/\n/ /g' -Ee 's/ /,/g' >> "${FILENAME}.csv"
# iotop
FILENAME="`ls -1 ${REASON}/iotop-*.log`"
# iotop segnet-camera stat to CSV transformation
echo "unixepochtime,diskread,diskwrite,swapin,io" > "${FILENAME}.segnet-camera.csv"
grep -E "segnet-camera" ${FILENAME} | sed -E 's/%|(K\/s)//g' | awk -F" " -v logdate="Jul 20, 2020" \
'BEGIN { OFS="," }; \
{ \
split($1,time,":"); \
cmd ="date \"+%s\" -d \""logdate" "time[1]":"time[2]":"time[3]"\""; \
cmd | getline var; \
print var,$5,$6,$7,$8; \
};
END {}; \' >> "${FILENAME}.segnet-camera.csv"
# iotop total disk stat to CSV transformation
echo "unixepochtime,totaldiskread,totaldiskwrwite" > "${FILENAME}.totaldisk.csv"
grep -E "Total DISK" "$FILENAME" | sed -E 's/\||(K\/s)|(Total DISK READ :)|(Total DISK WRITE :)//g' | awk -F" " -v logdate="Jul 9, 2020" 'BEGIN { OFS="," }; \
{ \
split($1,time,":"); \
cmd ="date \"+%s\" -d \""logdate" "time[1]":"time[2]":"time[3]"\""; \
cmd | getline var; \
print var,$2,$3; \
};
END {}; \' >> "${FILENAME}.totaldisk.csv"
echo "done"
Diagramme
# -*- coding: utf-8 -*-
"""Untitled1.ipynb
Automatically generated by Colaboratory.
Original file is located at
https://colab.research.google.com/drive/1oqDbgStUGPkgC3qx3uzMLaNze_MmmTig
"""
# importing the required module
import matplotlib.pyplot as plt
# x axis values
x = [1,2,3]
# corresponding y axis values
y = [2,4,1]
# plotting the points
plt.plot(x, y)
# naming the x axis
plt.xlabel('x - axis')
# naming the y axis
plt.ylabel('y - axis')
# giving a title to my graph
plt.title('My first graph!')
# function to show the plot
plt.show()
import pandas as pd
import matplotlib.pyplot as plt
plt.style.use('ggplot')
df = pd.read_csv('/content/free-20200721T215303.log.csv')
df.head()
#df.plot(x='unixepochtime', y=['memused'])
fig, ax = plt.subplots(figsize=(10,5))
zeroorigints = [ts - timestamps[0] for ts in df['unixepochtime']]
ax.plot(zeroorigints, df['totaltotal'], label='Memoire totale Mbytes')
ax.plot(zeroorigints, df['totalused'], label='Memoire utilise Mbytes')
ax.plot(zeroorigints, df['totalfree'], label='Memoire libre Mbytes')
ax.axvline(x=0, color='k')
ax.axhline(y=0, color='k')
plt.legend(loc='lower right', bbox_to_anchor=(1, 0.1))
plt.show()
import pandas as pd
import numpy as np
plt.style.use('ggplot')
data = np.loadtxt('/content/free-20200721T215303.log.csv', delimiter=',', skiprows=1)
fig, ax = plt.subplots(figsize=(10,5))
unixepochtime = data[:,0]
totaltotal = data[:,-3]
totalused = data[:,-2]
totalfree = data[:,-1]
zeroorigints = [ts - timestamps[0] for ts in unixepochtime]
ax.plot(zeroorigints, totaltotal, label='Memoire totale Mbytes')
ax.plot(zeroorigints, totalused, label='Memoire utilise Mbytes')
ax.plot(zeroorigints, totalfree, label='Memoire libre Mbytes')
plt.xlabel("Periode en seconde")
plt.ylabel("Utilisation en MBytes")
ax.axvline(x=0, color='k')
ax.axhline(y=0, color='k')
plt.legend(loc='lower right', bbox_to_anchor=(1, 0.1))
plt.show()
import pandas as pd
import matplotlib.pyplot as plt
plt.style.use('ggplot')
df = pd.read_csv('/content/tegrastats-20200721T215303.log.48.csv')
df.head()
fig, ax = plt.subplots(figsize=(10,5))
zeroorigints = [ts - timestamps[0] for ts in df['unixepochtime']]
ax.plot(zeroorigints, df['plltemp'], label='PLL C')
ax.plot(zeroorigints, df['cputemp'], label='CPU C')
#ax.plot(zeroorigints, df['pmictemp'], label='PMIC C')
ax.plot(zeroorigints, df['gputemp'], label='GPU C')
ax.plot(zeroorigints, df['aotemp'], label='AO C')
ax.plot(zeroorigints, df['thermal'], label='Thermal C')
plt.xlabel("Periode en seconde")
plt.ylabel("Temperatude en degre Celcius")
plt.ylim(top=45)
ax.axhline(y=0, color='k')
ax.axvline(x=0, color='k')
plt.legend(loc='lower right', bbox_to_anchor=(1, 0.1))
plt.show()
fig, ax = plt.subplots(figsize=(10,5))
zeroorigints = [ts - timestamps[0] for ts in df['unixepochtime']]
ax.plot(zeroorigints, df['cpu1per'], label='CPU 1 %')
ax.plot(zeroorigints, df['cpu2per'], label='CPU 2 %')
ax.plot(zeroorigints, df['cpu3per'], label='CPU 3 %')
ax.plot(zeroorigints, df['cpu4per'], label='CPU 4 %')
ax.plot(zeroorigints, df['emcper'], label='EMC %')
plt.xlabel("Periode en seconde")
plt.ylabel("Frequence en %")
plt.ylim(top=100)
ax.axhline(y=0, color='k')
ax.axvline(x=0, color='k')
plt.legend(loc='lower right', bbox_to_anchor=(1, 0.1))
plt.show()
fig, ax = plt.subplots(figsize=(10,5))
zeroorigints = [ts - timestamps[0] for ts in df['unixepochtime']]
ax.plot(zeroorigints, df['pom5vincurr'], label='5V IN')
ax.plot(zeroorigints, df['pom5vinavg'], label='5V IN moy.')
ax.plot(zeroorigints, df['pom5vgpucurr'], label='5V GPU')
ax.plot(zeroorigints, df['pom5vgpuavg'], label='5V GPU moy.')
ax.plot(zeroorigints, df['pom5vcpucurr'], label='5V CPU')
ax.plot(zeroorigints, df['pom5vcpuavg'], label='5V CPU moy.')
plt.xlabel("Periode en seconde")
plt.ylabel("Consommation en millivolt")
#plt.ylim(top=100)
ax.axhline(y=0, color='k')
ax.axvline(x=0, color='k')
plt.legend(loc='lower right', bbox_to_anchor=(1, 0.1))
plt.show()
import pandas as pd
import matplotlib.pyplot as plt
plt.style.use('ggplot')
df = pd.read_csv('/content/iotop-20200721T215303.log.totaldisk.csv')
df.head()
fig, ax = plt.subplots(figsize=(10,5))
zeroorigints = [ts - timestamps[0] for ts in df['unixepochtime']]
ax.plot(zeroorigints, df['totaldiskread'], label='Total disk read Kbytes')
ax.plot(zeroorigints, df['totaldiskwrwite'], label='Total disk write Kbytes')
plt.xlabel("Periode en seconde")
plt.ylabel("bandwidth between processes and kernel threads in kilobytes")
#plt.ylim(top=100)
#ax.axhline(y=0, color='k')
#ax.axvline(x=0, color='k')
plt.legend(loc='lower right', bbox_to_anchor=(1, 0.1))
plt.show()