Skip to content

Commit 38ff2e6

Browse files
committed
new instrumentation for cuda
1 parent 87301a8 commit 38ff2e6

File tree

1 file changed

+30
-22
lines changed

1 file changed

+30
-22
lines changed

codeflash/code_utils/instrument_existing_tests.py

Lines changed: 30 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -595,27 +595,10 @@ def create_wrapper_function(mode: TestingMode = TestingMode.BEHAVIOR) -> ast.Fun
595595
ast.Assign(
596596
targets=[
597597
ast.Name(id='codeflash_duration', ctx=ast.Store())],
598-
value=ast.BinOp(
599-
left=ast.Call(
600-
func=ast.Attribute(
601-
value=ast.Name(id='start', ctx=ast.Load()),
602-
attr='elapsed_time',
603-
ctx=ast.Load()),
604-
args=[
605-
ast.Name(id='end', ctx=ast.Load())],
606-
keywords=[]),
607-
op=ast.Mult(),
608-
right=ast.Constant(value=1000000)), lineno = lineno + 16),
609-
],
610-
handlers=[
611-
ast.ExceptHandler(
612-
type=ast.Name(id="Exception", ctx=ast.Load()),
613-
name="e",
614-
body=[
615-
ast.Assign(
616-
targets=[
617-
ast.Name(id='codeflash_duration', ctx=ast.Store())],
618-
value=ast.BinOp(
598+
value=ast.Call(
599+
func=ast.Name(id='int', ctx=ast.Load()),
600+
args=[
601+
ast.BinOp(
619602
left=ast.Call(
620603
func=ast.Attribute(
621604
value=ast.Name(id='start', ctx=ast.Load()),
@@ -625,7 +608,32 @@ def create_wrapper_function(mode: TestingMode = TestingMode.BEHAVIOR) -> ast.Fun
625608
ast.Name(id='end', ctx=ast.Load())],
626609
keywords=[]),
627610
op=ast.Mult(),
628-
right=ast.Constant(value=1000000)), lineno=lineno + 18),
611+
right=ast.Constant(value=1000000))],
612+
keywords=[]), lineno = lineno + 16),
613+
],
614+
handlers=[
615+
ast.ExceptHandler(
616+
type=ast.Name(id="Exception", ctx=ast.Load()),
617+
name="e",
618+
body=[
619+
ast.Assign(
620+
targets=[
621+
ast.Name(id='codeflash_duration', ctx=ast.Store())],
622+
value=ast.Call(
623+
func=ast.Name(id='int', ctx=ast.Load()),
624+
args=[
625+
ast.BinOp(
626+
left=ast.Call(
627+
func=ast.Attribute(
628+
value=ast.Name(id='start', ctx=ast.Load()),
629+
attr='elapsed_time',
630+
ctx=ast.Load()),
631+
args=[
632+
ast.Name(id='end', ctx=ast.Load())],
633+
keywords=[]),
634+
op=ast.Mult(),
635+
right=ast.Constant(value=1000000))],
636+
keywords=[]), lineno=lineno + 18),
629637
ast.Assign(
630638
targets=[ast.Name(id="exception", ctx=ast.Store())],
631639
value=ast.Name(id="e", ctx=ast.Load()),

0 commit comments

Comments
 (0)