Slight growth of memory detected

Abierto
#55 0 comentarios 0 reacciones 0 asignados Ver en GitHub

Nadie ha tomado este issue todavía.

Evaluación

Dificultad
4/5
Tiempo estimado
3-5 días
Aptitud para principiantes
35/100
Tipo de issue
Error
Claridad
Bastante claro
Estado de actividad
Estancado
Stack tecnológico
c, python
Área
networking

Línea de trabajo

Comienza reproduciendo la prueba de memoria proporcionada con get_active_devices y get_interfaces_info, incluido el caso de un nombre de interfaz no válido. Sigue estos puntos de entrada a través de los bindings de Python y la implementación nativa del repositorio, y repite las mediciones después de cualquier investigación. Se considera terminado cuando las llamadas repetidas ya no muestran un crecimiento de memoria medible.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

help wanted

Get this script (GPLv2 Copyright (c) 2011 Red Hat):

import ethtool
import subprocess, sys, os

max = int(sys.argv[1])
nic = sys.argv[2]
total = 0

def memory():
    """ Get current memory usage in MB """
    command = "ps --no-header -o rss -p %s" % os.getpid()
    p = subprocess.Popen(command.split(), stdout=subprocess.PIPE)
    stdout, stderr = p.communicate()
    return int(stdout) / 1024

def measure(fun, arg):
    """ Run given function on given arg max times """
    global total
    print("\n%s on %s" % (fun, arg))
    start = None

    for i in range(max + 1):
        result = fun(arg)
        if i % (max / 10) == 0:
            current = memory()
            # note the memory after the first round warm-up
            if start is None:
                start = current
            print("%s %% ... %s MB" % \
                    (str(100 * i / max).rjust(3), str(current).rjust(3)))
    increase = current - start
    print("Memory increase: %s MB" % increase)
    total += increase

measure(ethtool.get_active_devices, None)
measure(ethtool.get_interfaces_info, nic)
measure(ethtool.get_interfaces_info, 'bad interface name')

print("\nTotal memory increase: %s MB" % total)
if total > 0:
    sys.exit(1)

And run:

$ python3.6 ~/tmp/memory.py 1000000 ens3
<built-in function get_active_devices> on None
0.0 % ... 10.1328125 MB
10.0 % ... 10.13671875 MB
20.0 % ... 10.13671875 MB
30.0 % ... 10.13671875 MB
40.0 % ... 10.13671875 MB
50.0 % ... 10.13671875 MB
60.0 % ... 10.13671875 MB
70.0 % ... 10.13671875 MB
80.0 % ... 10.13671875 MB
90.0 % ... 10.13671875 MB
100.0 % ... 10.13671875 MB
Memory increase: 0.00390625 MB

<built-in function get_interfaces_info> on ens3
0.0 % ... 10.13671875 MB
10.0 % ... 10.13671875 MB
20.0 % ... 10.13671875 MB
30.0 % ... 10.13671875 MB
40.0 % ... 10.13671875 MB
50.0 % ... 10.13671875 MB
60.0 % ... 10.13671875 MB
70.0 % ... 10.13671875 MB
80.0 % ... 10.13671875 MB
90.0 % ... 10.140625 MB
100.0 % ... 10.140625 MB
Memory increase: 0.00390625 MB

<built-in function get_interfaces_info> on bad interface name
0.0 % ... 10.140625 MB
10.0 % ... 10.140625 MB
20.0 % ... 10.140625 MB
30.0 % ... 10.140625 MB
40.0 % ... 10.140625 MB
50.0 % ... 10.140625 MB
60.0 % ... 10.140625 MB
70.0 % ... 10.140625 MB
80.0 % ... 10.140625 MB
90.0 % ... 10.140625 MB
100.0 % ... 10.140625 MB
Memory increase: 0.0 MB

Total memory increase: 0.0078125 MB
Lenguaje dominante
C
Estrellas
16
Forks
11
Métricas de merge de PR
Sin PR fusionados en 30 d

Guía de contribución

No hay ninguna guía de contribución indexada para este repositorio

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de fedora-python/python-ethtool

Todos los issues de fedora-python/python-ethtool

Issues similares

Más issues de C

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.