Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
C
code_block_timer
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
OpenEdx
code_block_timer
Commits
9b08e26b
Commit
9b08e26b
authored
Dec 16, 2014
by
John Eskew
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add setup.py and __init__.py
parent
07147334
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
33 additions
and
2 deletions
+33
-2
README.md
+2
-2
code_block_timer/__init__.py
+20
-0
setup.py
+11
-0
No files found.
README.md
View file @
9b08e26b
...
@@ -2,5 +2,5 @@ Python module which puts timing around Python code blocks.
...
@@ -2,5 +2,5 @@ Python module which puts timing around Python code blocks.
Features
Features
--------
--------
*
Nesting of timers - higher level timers continue to tick during lower-level timers starting/stopping.
*
Nesting of timers - higher level timers continue to tick during lower-level timers starting/stopping.
(TBD)
*
Timing storage in a SQLite DB.
*
Timing storage in a SQLite DB.
(TBD)
code_block_timer/__init__.py
0 → 100644
View file @
9b08e26b
from
timeit
import
default_timer
class
CodeBlockTimer
(
object
):
def
__init__
(
self
,
block_desc
,
verbose
=
False
):
self
.
block_desc
=
block_desc
self
.
verbose
=
verbose
self
.
timer
=
default_timer
def
__enter__
(
self
):
self
.
start
=
self
.
timer
()
return
self
def
__exit__
(
self
,
*
args
):
end
=
self
.
timer
()
self
.
elapsed_secs
=
end
-
self
.
start
self
.
elapsed
=
self
.
elapsed_secs
*
1000
# millisecs
if
self
.
verbose
:
print
'{}: elapsed time: {} ms'
.
format
(
self
.
block_desc
,
self
.
elapsed
)
setup.py
0 → 100644
View file @
9b08e26b
from
setuptools
import
setup
setup
(
name
=
"code_block_timer"
,
version
=
"0.0.1"
,
packages
=
[
"code_block_timer"
,
],
author_email
=
'jeskew@edx.org'
)
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment