Skip to content

Time display in seconds #320

@petrasvestartas

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():
   ...

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    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