Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
boytacean
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
João Magalhães
boytacean
Commits
0da5c767
Verified
Commit
0da5c767
authored
1 year ago
by
João Magalhães
Browse files
Options
Downloads
Patches
Plain Diff
chore: better printing of info
parent
17dc77fb
Branches
Branches containing commit
Tags
Tags containing commit
1 merge request
!36
Support for Python
Pipeline
#3604
passed
1 year ago
Stage: build
Stage: test
Changes
3
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
examples/python/bench.py
+3
-3
3 additions, 3 deletions
examples/python/bench.py
examples/python/pocket.py
+2
-2
2 additions, 2 deletions
examples/python/pocket.py
examples/python/pocket_pyboy.py
+2
-2
2 additions, 2 deletions
examples/python/pocket_pyboy.py
with
7 additions
and
7 deletions
examples/python/bench.py
+
3
−
3
View file @
0da5c767
...
@@ -3,12 +3,12 @@ from boytacean import GameBoy, CPU_FREQ
...
@@ -3,12 +3,12 @@ from boytacean import GameBoy, CPU_FREQ
CLOCK_COUNT
=
100000000
CLOCK_COUNT
=
100000000
gb
=
GameBoy
(
ppu_enabled
=
False
,
apu_enabled
=
False
,
serial_enabled
=
False
)
gb
=
GameBoy
(
apu_enabled
=
False
,
serial_enabled
=
False
)
gb
.
load
()
gb
.
load
()
gb
.
load_rom
(
"
../../res/roms/demo/pocket.gb
"
)
gb
.
load_rom
(
"
../../res/roms/demo/pocket.gb
"
)
start
=
time
()
start
=
time
()
cycles
=
gb
.
clocks
(
CLOCK_COUNT
)
cycles
=
gb
.
clocks
(
CLOCK_COUNT
)
total
=
time
()
-
start
total
=
time
()
-
start
print
(
f
"
Time taken:
{
total
}
seconds
"
)
print
(
f
"
Time taken:
{
total
:
.
2
f
}
seconds
"
)
print
(
f
"
Speedup:
{
cycles
/
(
CPU_FREQ
*
total
)
}
x
"
)
print
(
f
"
Speedup:
{
cycles
/
(
CPU_FREQ
*
total
)
:
.
2
f
}
x
"
)
gb
.
save_image
(
"
pocket.png
"
)
gb
.
save_image
(
"
pocket.png
"
)
This diff is collapsed.
Click to expand it.
examples/python/pocket.py
+
2
−
2
View file @
0da5c767
...
@@ -10,6 +10,6 @@ start = time()
...
@@ -10,6 +10,6 @@ start = time()
for
_
in
range
(
FRAME_COUNT
):
for
_
in
range
(
FRAME_COUNT
):
gb
.
next_frame
()
gb
.
next_frame
()
total
=
time
()
-
start
total
=
time
()
-
start
print
(
f
"
Time taken:
{
total
}
seconds
"
)
print
(
f
"
Time taken:
{
total
:
.
2
f
}
seconds
"
)
print
(
f
"
Speedup:
{
FRAME_COUNT
/
total
/
60
}
x
"
)
print
(
f
"
Speedup:
{
FRAME_COUNT
/
total
/
60
:
.
2
f
}
x
"
)
gb
.
save_image
(
"
pocket.png
"
)
gb
.
save_image
(
"
pocket.png
"
)
This diff is collapsed.
Click to expand it.
examples/python/pocket_pyboy.py
+
2
−
2
View file @
0da5c767
...
@@ -10,6 +10,6 @@ with PyBoy("../../res/roms/demo/pocket.gb", disable_renderer=True) as pyboy:
...
@@ -10,6 +10,6 @@ with PyBoy("../../res/roms/demo/pocket.gb", disable_renderer=True) as pyboy:
for
_
in
range
(
FRAME_COUNT
):
for
_
in
range
(
FRAME_COUNT
):
pyboy
.
tick
()
pyboy
.
tick
()
total
=
time
()
-
start
total
=
time
()
-
start
print
(
f
"
Time taken:
{
total
}
seconds
"
)
print
(
f
"
Time taken:
{
total
:
.
2
f
}
seconds
"
)
print
(
f
"
Speedup:
{
FRAME_COUNT
/
total
/
60
}
x
"
)
print
(
f
"
Speedup:
{
FRAME_COUNT
/
total
/
60
:
.
2
f
}
x
"
)
pyboy
.
screen_image
().
save
(
"
pocket_pyboy.png
"
)
pyboy
.
screen_image
().
save
(
"
pocket_pyboy.png
"
)
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment