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
cdcfc326
Verified
Commit
cdcfc326
authored
1 year ago
by
João Magalhães
Browse files
Options
Downloads
Patches
Plain Diff
chore: support for benchmark
In the SDL version.
parent
f7f5e8ee
No related branches found
No related tags found
No related merge requests found
Pipeline
#2825
passed
1 year ago
Stage: build
Stage: test
Stage: deploy
Changes
3
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
.github/workflows/main.yml
+2
-0
2 additions, 0 deletions
.github/workflows/main.yml
CHANGELOG.md
+1
-0
1 addition, 0 deletions
CHANGELOG.md
frontends/sdl/src/main.rs
+16
-7
16 additions, 7 deletions
frontends/sdl/src/main.rs
with
19 additions
and
7 deletions
.github/workflows/main.yml
+
2
−
0
View file @
cdcfc326
...
...
@@ -127,3 +127,5 @@ jobs:
run
:
cd frontends/sdl && cargo build --release
-
name
:
Run release version
run
:
cd frontends/sdl && cargo run --release -- --headless --cycles
10000000
-
name
:
Run benchmark
run
:
cd frontends/sdl && cargo run --release -- --benchmark
This diff is collapsed.
Click to expand it.
CHANGELOG.md
+
1
−
0
View file @
cdcfc326
...
...
@@ -10,6 +10,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Added
*
Support for the
`clock_m()`
function
*
Benchmark CLI option in SDL
### Changed
...
...
This diff is collapsed.
Click to expand it.
frontends/sdl/src/main.rs
+
16
−
7
View file @
cdcfc326
...
...
@@ -226,22 +226,22 @@ impl Emulator {
let
count
=
params
.count
;
let
chunk_size
=
params
.chunk_size
.unwrap_or
(
1
);
let
mut
cycles
=
0
;
let
mut
cycles
=
0
u64
;
let
initial
=
SystemTime
::
now
();
if
chunk_size
>
1
{
for
_
in
0
..
(
count
/
chunk_size
)
{
cycles
+=
self
.system
.clock_m
(
chunk_size
)
as
u
32
;
cycles
+=
self
.system
.clock_m
(
chunk_size
)
as
u
64
;
}
}
else
{
for
_
in
0
..
count
{
cycles
+=
self
.system
.clock
()
as
u
32
;
cycles
+=
self
.system
.clock
()
as
u
64
;
}
}
let
delta
=
initial
.elapsed
()
.unwrap
()
.as_millis
()
as
f
32
/
1000.0
;
let
frequency_mhz
=
cycles
as
f
32
/
delta
/
1000.0
/
1000.0
;
let
delta
=
initial
.elapsed
()
.unwrap
()
.as_millis
()
as
f
64
/
1000.0
;
let
frequency_mhz
=
cycles
as
f
64
/
delta
/
1000.0
/
1000.0
;
println!
(
"Took {:.2} seconds to run {} ticks ({} cycles) ({:.2} Mhz)!"
,
...
...
@@ -607,6 +607,13 @@ struct Args {
#[arg(long,
default_value_t
=
false
,
help
=
"If set no timer will be used"
)]
no_timer
:
bool
,
#[arg(
long,
default_value_t
=
false
,
help
=
"Run in benchmark mode, with no UI"
)]
benchmark
:
bool
,
#[arg(
long,
default_value_t
=
false
,
...
...
@@ -663,7 +670,7 @@ fn main() {
let
options
=
EmulatorOptions
{
auto_mode
:
Some
(
auto_mode
),
unlimited
:
Some
(
args
.unlimited
),
features
:
if
args
.headless
{
features
:
if
args
.headless
||
args
.benchmark
{
Some
(
vec!
[])
}
else
{
Some
(
vec!
[
"video"
,
"audio"
,
"no-vsync"
])
...
...
@@ -677,7 +684,9 @@ fn main() {
// determines if the emulator should run in headless mode or
// not and runs it accordingly, note that if running in headless
// mode the number of cycles to be run may be specified
if
args
.headless
{
if
args
.benchmark
{
emulator
.benchmark
(
Benchmark
::
new
(
500000000
,
None
));
}
else
if
args
.headless
{
emulator
.run_headless
(
if
args
.cycles
>
0
{
Some
(
args
.cycles
)
}
else
{
...
...
This diff is collapsed.
Click to expand it.
João Magalhães
@joamag
mentioned in issue
#27 (closed)
·
1 year ago
mentioned in issue
#27 (closed)
mentioned in issue #27
Toggle commit list
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