Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
PoroCYon
oidos
Commits
94c95f90
Commit
94c95f90
authored
Aug 26, 2018
by
Aske Simon Christensen
Browse files
Print instrument memory usage
parent
366c6cb1
Changes
2
Show whitespace changes
Inline
Side-by-side
README.md
View file @
94c95f90
...
@@ -87,6 +87,16 @@ executable is optimizing the size and computation time requirements of the
...
@@ -87,6 +87,16 @@ executable is optimizing the size and computation time requirements of the
music. The
`OidosConvert`
program outputs some statistics about the music
music. The
`OidosConvert`
program outputs some statistics about the music
which can be used to guide this process:
which can be used to guide this process:
**Memory**
: The memory needed to store precomputed sound for this instrument.
For each tone an instrument is played with, the sound is precomputed at the
length of the longest note played by the instrument. Thus, the memory
requirement is proportional to the product of these 2 factors:
-
The number of different tones the instrument is played with
-
The longest note played by the instrument
The memory for precomputed sound is reused for every instrument. The maximum
memory used for all instruments is printed at the end.
**Burden**
: The total computation time requirements of all tracks using this
**Burden**
: The total computation time requirements of all tracks using this
instrument. The time requirement is a product of these 4 factors:
instrument. The time requirement is a product of these 4 factors:
-
The value of the
*modes*
parameter
-
The value of the
*modes*
parameter
...
...
convert/OidosConvert.py
View file @
94c95f90
...
@@ -816,6 +816,8 @@ def printMusicStats(music, ansi):
...
@@ -816,6 +816,8 @@ def printMusicStats(music, ansi):
print
"Music length: %d ticks at %0.2f ticks per minute"
%
(
music
.
length
,
60.0
/
music
.
ticklength
)
print
"Music length: %d ticks at %0.2f ticks per minute"
%
(
music
.
length
,
60.0
/
music
.
ticklength
)
max_memory_mb
=
0
max_memory_instr
=
None
total_burden
=
0
total_burden
=
0
ii
=
None
ii
=
None
for
ti
,
tn
in
enumerate
(
music
.
track_order
):
for
ti
,
tn
in
enumerate
(
music
.
track_order
):
...
@@ -834,9 +836,15 @@ def printMusicStats(music, ansi):
...
@@ -834,9 +836,15 @@ def printMusicStats(music, ansi):
modes
=
instr
.
paramblock
[
0
]
modes
=
instr
.
paramblock
[
0
]
fat
=
instr
.
paramblock
[
1
]
fat
=
instr
.
paramblock
[
1
]
longest
=
float
(
instr
.
paramblock
[
16
])
/
SAMPLERATE
longest
=
float
(
instr
.
paramblock
[
16
])
/
SAMPLERATE
memory
=
len
(
instr
.
tones
)
*
longest
memory_mb
=
memory
*
SAMPLERATE
*
16
/
1024
/
1024
if
memory_mb
>
max_memory_mb
:
max_memory_mb
=
memory_mb
max_memory_instr
=
instr
.
title
burden
=
modes
*
fat
*
len
(
instr
.
tones
)
*
longest
burden
=
modes
*
fat
*
len
(
instr
.
tones
)
*
longest
total_burden
+=
burden
total_burden
+=
burden
print
form
(
"H"
)
%
instr
.
title
print
form
(
"H"
)
%
instr
.
title
print
" Memory: "
+
form
(
" tones X longest = %d X %.3f = B (B %s)"
)
%
(
len
(
instr
.
tones
),
longest
,
memory
,
memory_mb
,
"MB"
)
print
" Burden: "
+
form
(
" modes X fat X tones X longest = %d X %d X %d X %.3f = B"
)
%
(
modes
,
fat
,
len
(
instr
.
tones
),
longest
,
burden
)
print
" Burden: "
+
form
(
" modes X fat X tones X longest = %d X %d X %d X %.3f = B"
)
%
(
modes
,
fat
,
len
(
instr
.
tones
),
longest
,
burden
)
tones
=
""
tones
=
""
for
t
in
instr
.
tones
:
for
t
in
instr
.
tones
:
...
@@ -871,6 +879,7 @@ def printMusicStats(music, ansi):
...
@@ -871,6 +879,7 @@ def printMusicStats(music, ansi):
seconds
=
int
(
round
(
total_burden
/
5000
))
seconds
=
int
(
round
(
total_burden
/
5000
))
print
print
print
"Maximum instrument memory: "
+
form
(
"B %s (H)"
)
%
(
max_memory_mb
,
"MB"
,
max_memory_instr
)
print
"Total burden: "
+
form
(
"B (approximately D on a fast %s)"
)
%
(
total_burden
,
seconds
/
60
,
seconds
%
60
,
"CPU"
)
print
"Total burden: "
+
form
(
"B (approximately D on a fast %s)"
)
%
(
total_burden
,
seconds
/
60
,
seconds
%
60
,
"CPU"
)
...
...
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