-
-
Notifications
You must be signed in to change notification settings - Fork 405
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Updates to properly handle @profile decorators for CPU time attribution #637
Conversation
@sternj We could use a test for |
This seems like it does the right thing to me, I'm going to put in a test that tests the statement "Given an @Profile decorator on a single function, there is precisely one function in the 'functions' field of the output and it has the name of that function" |
@@ -0,0 +1,65 @@ | |||
#!/usr/bin/env python3 | |||
import numpy as np |
Check notice
Code scanning / CodeQL
Unused import
y = 1 | ||
# w, v = LA.eig(np.diag(arr)) # (1, 2, 3, 4, 5, 6, 7, 8, 9, 10))) | ||
x = [i*i for i in range(0,100000)][99999] | ||
y1 = [i*i for i in range(0,200000)][199999] |
Check notice
Code scanning / CodeQL
Unused local variable
# w, v = LA.eig(np.diag(arr)) # (1, 2, 3, 4, 5, 6, 7, 8, 9, 10))) | ||
x = [i*i for i in range(0,100000)][99999] | ||
y1 = [i*i for i in range(0,200000)][199999] | ||
z1 = [i for i in range(0,300000)][299999] |
Check notice
Code scanning / CodeQL
Unused local variable
Smoketest is currently failing… |
x = 1.01 | ||
return x | ||
|
||
import sys |
Check notice
Code scanning / CodeQL
Unused import
# z = np.multiply(x,x) | ||
# z = np.multiply(z,z) | ||
# z = np.multiply(z,z) | ||
z = z * z |
Check warning
Code scanning / CodeQL
Variable defined multiple times
@profile | ||
def doit3(x): | ||
for i in range(1000000): | ||
z = x + 1 |
Check warning
Code scanning / CodeQL
Variable defined multiple times
def doit3(x): | ||
for i in range(1000000): | ||
z = x + 1 | ||
z = x + 1 |
Check warning
Code scanning / CodeQL
Variable defined multiple times
for j in range(1,3): | ||
x = doit1(x) | ||
x = doit2(x) | ||
x = doit3(x) |
Check warning
Code scanning / CodeQL
Variable defined multiple times
Fixes to restore the
@profile
decorator to its intended semantics (if any code has a@profile
decorator, only profile that code).