torchcell.profiling.time_method

time_method(func: Callable[[...], Any]) → Callable[[...], Any][source]

Time a function/method execution when profiling is enabled.

Works with functions, instance methods, class methods, and static methods. Zero overhead when disabled (single boolean check).

Usage:

@time_method
def my_function():
    pass

class MyClass:
    @time_method
    def my_method(self):
        pass