Skip to content

Adding memory profiling ? #216

Description

@Abdelgha-4

As memory_profiler is no longer maintained, I see this project as a perfect place to continue on it's work and provide a full powerful line_profiler that combine both information on time and memory consumption in one place, providing for instance some profiling results like this:

Line #    Mem usage    Increment     Hits     Time       Line Contents
======================================================================
     3                                                   @profile
     4                                                   def my_func():
     5    7.676 MiB    7.676 MiB        1    0.20 ms         a = [1] * (10 ** 6)
     6  160.301 MiB  152.625 MiB        1    0.25 ms         b = [2] * (2 * 10 ** 7)
     7    7.813 MiB -152.488 MiB        1    0.02 ms         del b
     8    7.813 MiB    0.000 MiB        1    1.200 s         sleep(1.2)
     9    7.813 MiB    0.000 MiB        1    0.01 ms         return a

I'd really like to know what do you think about this possibility ?
I've also an idea of letting the user add more columns to this results based on his use case, for example:

def energy_tracker(time_inc, memory_inc): #maybe other args
    return TIME_RATE * time_inc + MEM_RATE * memory_inc

profiler.register_trackers({"Energy": energy_tracker})

Which would add a new column called Energy with the given formula applied

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions