Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Labels
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
nexedi
cython
Commits
a3e02d9a
Commit
a3e02d9a
authored
May 14, 2011
by
Stefan Behnel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
convert benchmark to Py3
parent
46a9d0fe
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
12 deletions
+12
-12
Demos/benchmarks/richards.py
Demos/benchmarks/richards.py
+12
-12
No files found.
Demos/benchmarks/richards.py
View file @
a3e02d9a
...
...
@@ -135,9 +135,9 @@ def trace(a):
global
layout
layout
-=
1
if
layout
<=
0
:
print
print
()
layout
=
50
print
a
,
print
(
a
,
end
=
''
)
TASKTABSIZE
=
10
...
...
@@ -302,10 +302,10 @@ class IdleTask(Task):
if
i
.
count
==
0
:
return
self
.
hold
()
elif
i
.
control
&
1
==
0
:
i
.
control
/=
2
i
.
control
/
/
=
2
return
self
.
release
(
I_DEVA
)
else
:
i
.
control
=
i
.
control
/
2
^
0xd008
i
.
control
=
i
.
control
/
/
2
^
0xd008
return
self
.
release
(
I_DEVB
)
...
...
@@ -333,7 +333,7 @@ class WorkTask(Task):
pkt
.
ident
=
dest
pkt
.
datum
=
0
for
i
in
BUFSIZE_RANGE
:
#
x
range(BUFSIZE)
for
i
in
BUFSIZE_RANGE
:
# range(BUFSIZE)
w
.
count
+=
1
if
w
.
count
>
26
:
w
.
count
=
1
...
...
@@ -351,7 +351,7 @@ def schedule():
pkt
=
None
if
tracing
:
print
"tcb ="
,
t
.
ident
print
(
"tcb ="
,
t
.
ident
)
if
t
.
isTaskHoldingOrWaiting
():
t
=
t
.
link
...
...
@@ -362,7 +362,7 @@ def schedule():
class
Richards
(
object
):
def
run
(
self
,
iterations
):
for
i
in
x
range
(
iterations
):
for
i
in
range
(
iterations
):
taskWorkArea
.
holdCount
=
0
taskWorkArea
.
qpktCount
=
0
...
...
@@ -403,15 +403,15 @@ def entry_point(iterations):
return
result
,
startTime
,
endTime
def
main
(
entry_point
=
entry_point
,
iterations
=
10
):
print
"Richards benchmark (Python) starting... [%r]"
%
entry_point
print
(
"Richards benchmark (Python) starting... [%r]"
%
entry_point
)
result
,
startTime
,
endTime
=
entry_point
(
iterations
)
if
not
result
:
print
"Incorrect results!"
print
(
"Incorrect results!"
)
return
-
1
print
"finished."
print
(
"finished."
)
total_s
=
endTime
-
startTime
print
"Total time for %d iterations: %.2f secs"
%
(
iterations
,
total_s
)
print
"Average time per iteration: %.2f ms"
%
(
total_s
*
1000
/
iterations
)
print
(
"Total time for %d iterations: %.2f secs"
%
(
iterations
,
total_s
)
)
print
(
"Average time per iteration: %.2f ms"
%
(
total_s
*
1000
/
iterations
)
)
return
42
try
:
...
...
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