Administrator
2023-12-15 3da5d1ef00cf7665c2d37f837e6845c92d22e31c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
import io
import time
 
from line_profiler import LineProfiler
 
 
def test1(args):
    print(args)
    time.sleep(2)
    return 1
 
 
if __name__ == "__main__":
    lp = LineProfiler()
    lp_wrap = lp(test1)
    result = lp_wrap("123123")
    print(result)
    output = io.StringIO()
    lp.print_stats(stream=output)
    with open(f"test.txt", 'w') as f:
        f.write(output.getvalue())