Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Times are incorrect when using --profile-only #269

Closed
garryod opened this issue Sep 21, 2021 · 1 comment
Closed

Times are incorrect when using --profile-only #269

garryod opened this issue Sep 21, 2021 · 1 comment
Assignees

Comments

@garryod
Copy link

garryod commented Sep 21, 2021

Describe the bug
Incorrect time or % times are reported when scalene is run with --profile-only

To Reproduce
Implement the following two modules:

# main_module.py
import time

from other_module import sleep_one_second

if __name__=="__main__":
    time.sleep(1.0)
    sleep_one_second()
# other_module.py
import time


def sleep_one_second():
    time.sleep(1.0)

Run scalene --profile-only other_module.py main_module.py

Expected behavior
Either:

  • other_module.py is reported as taking 50% of 2.00s
  • other_module.py is reported as taking 100% of 1.00s

Actual behaviour

                                                                   Memory usage:  (max:   0.00MB, growth rate:   0%)                                                                    
                                 .../other_module.py: % of time = 100.00% out of   2.00s.                                  
       ╷       ╷       ╷       ╷        ╷       ╷               ╷       ╷                                                                                                               
  Line │Time   │–––––– │–––––– │Memory  │–––––– │–––––––––––    │Copy   │                                                                                                               
       │Python │native │system │Python  │net    │timeline/%     │(MB/s) │.../other_module.py                               
╺━━━━━━┿━━━━━━━┿━━━━━━━┿━━━━━━━┿━━━━━━━━┿━━━━━━━┿━━━━━━━━━━━━━━━┿━━━━━━━┿━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━╸
     1 │       │       │       │        │       │               │       │import time                                                                                                    
     2 │       │       │       │        │       │               │       │                                                                                                               
     3 │       │       │       │        │       │               │       │                                                                                                               
     4 │       │       │       │        │       │               │       │def sleep_one_second():                                                                                        
     5 │    1% │       │  99%  │        │       │               │       │    time.sleep(1.0)                                                                                            
     6 │       │       │       │        │       │               │       │                                                                                                               
       │       │       │       │        │       │               │       │                                                                                                               
╶──────┼───────┼───────┼───────┼────────┼───────┼───────────────┼───────┼──────────────────────────────────────────────────────────────────────────────────────────────────────────────╴
       │       │       │       │        │       │               │       │function summary for .../other_module.py          
     4 │    1% │       │  99%  │        │       │               │       │sleep_one_second                                                                                               
       ╵       ╵       ╵       ╵        ╵       ╵               ╵       ╵                                                                                                               

Desktop (please complete the following information):

  • OS: Red Hat Enterprise Linux release 8.4 (Ootpa)
  • Python: Python 3.9.2
  • Scalene: Scalene version 1.3.12
@emeryberger
Copy link
Member

Thanks for the bug report! This has been fixed in the repository version, which will soon be made a new release.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants