Skip to content

Add way to apply profiling to an entire class (or file) #21

Open

Description

@timabbott

line_profiler has been is super useful for me, but it can be a bit tedious to add the decorator on every function in a code path to profile. It seems like it would be possible to support applying the decorator to a class wrapping every class method, which would be nice syntax.

I think it'd also be interesting to support doing so to every function declared in entire file or project/entrypoint, but I'm less sure what the right syntax for that is.

Activity

  1. ta946 commented on Jun 12, 2020

    @ta946

    i had the same thoughts, i didnt want to decorate every single function manually and wanted to wrap a class so i came up with an admittedly hacky way of doing it and decided i might aswell share it with everyone else because i really enjoy line_profiler

    im not sure if the devs will approve of the hacky method (hopefully it might give them an idea for a better solution?) so i thought id let you know about the commit incase you wanted to grab it yourself
    #24 #23 #22 are the PRs i submitted. ive merged those PRs into a fork https://github.com/ta946/line_profiler temporarily until the devs integrate a solution, i do not plan to keep it up to date

    the command line arguments and how to use them are described in #24

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions