Skip to content

Time display in seconds #320

Description

@petrasvestartas

Hi,

How can I display time in seconds with full precision like screenshot below:

Image

Currently it is displayed in microseconds, and if i change output type to seconds, I get only one number after comma.
I need a number of seconds and all the 7 numbers after it.

This is how I use line_profiler in my code:

from line_profiler import LineProfiler
from functools import wraps


def profile(func):
    """Decorator for line-by-line profiling of functions."""
    @wraps(func)
    def wrapper(*args, **kwargs):
        profiler = LineProfiler()
        profiler.add_function(func)
        wrapped = profiler(func)
        result = wrapped(*args, **kwargs)
        profiler.print_stats(rich=True)  # Print output in seconds
        return result
    return wrapper

@profile
def my_method():
   ...

Activity

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