Mail Archives: djgpp/1998/01/09/22:47:37
From: | Shaun Jackman <sjackman AT rogers DOT wave DOT ca>
|
Newsgroups: | comp.os.msdos.djgpp
|
Subject: | 30 seconds of run time missing?
|
Date: | Fri, 09 Jan 1998 16:54:40 -0800
|
Organization: | ARC Technologies
|
Lines: | 309
|
Message-ID: | <34B6C6D0.EB8087BF@rogers.wave.ca>
|
NNTP-Posting-Host: | pc-15794.bc.rogers.wave.ca
|
Mime-Version: | 1.0
|
To: | djgpp AT delorie DOT com
|
DJ-Gateway: | from newsgroup comp.os.msdos.djgpp
|
Hello,
I've just started using DJGPP and Allegro. When I compiled and ran my
first test, I got astonishingly bad results. I have no idea why. I used
all the typical flags -m486 -O2 -fomit-frame-pointer etc. The program
runs in 640x480 @ 256 colors. The important part of the code follows.
void play_game() {
install_int(second_timer, 1000); //seond_timer sets fps to frame_count
once a second
install_int(game_timer, 50); //game_timer increments game_time 20
times a second
fps = 0;
frame_count = 0;
seconds_count = 0;
game_time = 0;
quit = false;
while(!quit) {
while(game_time > 0) {
game_time--;
quit = key[KEY_ESC];
if(quit) break;
//code to move actors should be put here
}
clear(screen1);
//code drawing to screen would be put here
textprintf(screen1, datafile[BIG_FONT].dat, 0, 0, 7, "(%d fps)",
fps);
flip();
frame_count++;
}
}
As you can see, it's very simple. Anyways, this only got 25 fps. I only
have a 486sx/66mhz but even the demo that comes with Allegro runs at 25
fps on my computer using double buffering @ 640x480.
I ran a profile on the program (just over 60 seconds execution time),
and got the following.
I'm not quite sure what it all means, but if I'm reading it right it
only account for 34 seconds of run time. Where did the other 30 go?
If anyone can please help me I'd be very grateful. I've appended the
full profile to the end of this e-mail. (sorry about the band-width)
Thanks, and if possible please reply by e-mail as well,
Shaun Jackman
sjackman AT rogers DOT wave DOT ca
--------- BEGIN profile.txt ---------
Flat profile:
Each sample counts as 0.055556 seconds.
% cumulative self self total
time seconds seconds calls Ts/call Ts/call name
57.12 21.39 21.39 _linear_blit8
25.22 30.83 9.44
_linear_clear_to_color8
6.68 33.33 2.50
_vga_set_pallete_range
2.82 34.39 1.06
_linear_draw_character8
1.48 34.94 0.56 rest
1.19 35.39 0.44 __dpmi_int
1.19 35.83 0.44 pack_read
0.89 36.17 0.33 refill_buffer
0.74 36.44 0.28
_cirrus54_bank_done
0.59 36.67 0.22 _cirrus54_bank
0.45 36.83 0.17 _stub_bank_switch
0.45 37.00 0.17 pack_fread
0.30 37.11 0.11 fm_reset
0.15 37.17 0.06 __brk
0.15 37.22 0.06
__djgpp_exception_processor
0.15 37.28 0.06 blit
0.15 37.33 0.06 cirrus_54_scroll
0.15 37.39 0.06 localeconv
0.15 37.44 0.06 putc
0.00 37.44 0.00 1555 0.00 0.00 flip
0.00 37.44 0.00 1295 0.00 0.00 game_timer
0.00 37.44 0.00 64 0.00 0.00 second_timer
0.00 37.44 0.00 1 0.00 0.00 init_game
0.00 37.44 0.00 1 0.00 0.00 init_stars
0.00 37.44 0.00 1 0.00 0.00 main
0.00 37.44 0.00 1 0.00 0.00 new_ship
0.00 37.44 0.00 1 0.00 0.00 play_game
% the percentage of the total running time of the
time program used by this function.
cumulative a running sum of the number of seconds accounted
seconds for by this function and those listed above it.
self the number of seconds accounted for by this
seconds function alone. This is the major sort for this
listing.
calls the number of times this function was invoked, if
this function is profiled, else blank.
self the average number of milliseconds spent in this
ms/call function per call, if this function is profiled,
else blank.
total the average number of milliseconds spent in this
ms/call function and its descendents per call, if this
function is profiled, else blank.
name the name of the function. This is the minor sort
for this listing. The index shows the location of
the function in the gprof listing. If the index is
in parenthesis it shows where it would appear in
the gprof listing if it were to be printed.
Call graph (explanation follows)
granularity: each sample hit covers 4 byte(s) for 0.15% of 37.44 seconds
index % time self children called name
<spontaneous>
[1] 57.1 21.39 0.00 _linear_blit8 [1]
-----------------------------------------------
<spontaneous>
[2] 25.2 9.44 0.00 _linear_clear_to_color8 [2]
-----------------------------------------------
<spontaneous>
[3] 6.7 2.50 0.00 _vga_set_pallete_range [3]
-----------------------------------------------
<spontaneous>
[4] 2.8 1.06 0.00 _linear_draw_character8 [4]
-----------------------------------------------
<spontaneous>
[5] 1.5 0.56 0.00 rest [5]
-----------------------------------------------
<spontaneous>
[6] 1.2 0.44 0.00 __dpmi_int [6]
-----------------------------------------------
<spontaneous>
[7] 1.2 0.44 0.00 pack_read [7]
-----------------------------------------------
<spontaneous>
[8] 0.9 0.33 0.00 refill_buffer [8]
-----------------------------------------------
<spontaneous>
[9] 0.7 0.28 0.00 _cirrus54_bank_done [9]
-----------------------------------------------
<spontaneous>
[10] 0.6 0.22 0.00 _cirrus54_bank [10]
-----------------------------------------------
<spontaneous>
[11] 0.4 0.17 0.00 _stub_bank_switch [11]
-----------------------------------------------
<spontaneous>
[12] 0.4 0.17 0.00 pack_fread [12]
-----------------------------------------------
<spontaneous>
[13] 0.3 0.11 0.00 fm_reset [13]
-----------------------------------------------
<spontaneous>
[14] 0.1 0.06 0.00 __brk [14]
-----------------------------------------------
<spontaneous>
[15] 0.1 0.06 0.00 __djgpp_exception_processor
[15]
-----------------------------------------------
<spontaneous>
[16] 0.1 0.06 0.00 blit [16]
-----------------------------------------------
<spontaneous>
[17] 0.1 0.06 0.00 cirrus_54_scroll [17]
-----------------------------------------------
<spontaneous>
[18] 0.1 0.06 0.00 localeconv [18]
-----------------------------------------------
<spontaneous>
[19] 0.1 0.06 0.00 putc [19]
-----------------------------------------------
0.00 0.00 1555/1555 play_game [31]
[24] 0.0 0.00 0.00 1555 flip [24]
-----------------------------------------------
0.00 0.00 1295/1295 my_timerint [898]
[25] 0.0 0.00 0.00 1295 game_timer [25]
-----------------------------------------------
0.00 0.00 64/64 my_timerint [898]
[26] 0.0 0.00 0.00 64 second_timer [26]
-----------------------------------------------
0.00 0.00 1/1 main [29]
[27] 0.0 0.00 0.00 1 init_game [27]
-----------------------------------------------
0.00 0.00 1/1 play_game [31]
[28] 0.0 0.00 0.00 1 init_stars [28]
-----------------------------------------------
0.00 0.00 1/1 __crt1_startup [52]
[29] 0.0 0.00 0.00 1 main [29]
0.00 0.00 1/1 init_game [27]
0.00 0.00 1/1 play_game [31]
-----------------------------------------------
0.00 0.00 1/1 play_game [31]
[30] 0.0 0.00 0.00 1 new_ship [30]
-----------------------------------------------
0.00 0.00 1/1 main [29]
[31] 0.0 0.00 0.00 1 play_game [31]
0.00 0.00 1555/1555 flip [24]
0.00 0.00 1/1 new_ship [30]
0.00 0.00 1/1 init_stars [28]
-----------------------------------------------
This table describes the call tree of the program, and was sorted by
the total amount of time spent in each function and its children.
Each entry in this table consists of several lines. The line with the
index number at the left hand margin lists the current function.
The lines above it list the functions that called this function,
and the lines below it list the functions this one called.
This line lists:
index A unique number given to each element of the table.
Index numbers are sorted numerically.
The index number is printed next to every function name so
it is easier to look up where the function in the table.
% time This is the percentage of the `total' time that was spent
in this function and its children. Note that due to
different viewpoints, functions excluded by options, etc,
these numbers will NOT add up to 100%.
self This is the total amount of time spent in this function.
children This is the total amount of time propagated into this
function by its children.
called This is the number of times the function was called.
If the function called itself recursively, the number
only includes non-recursive calls, and is followed by
a `+' and the number of recursive calls.
name The name of the current function. The index number is
printed after it. If the function is a member of a
cycle, the cycle number is printed between the
function's name and the index number.
For the function's parents, the fields have the following meanings:
self This is the amount of time that was propagated directly
from the function into this parent.
children This is the amount of time that was propagated from
the function's children into this parent.
called This is the number of times this parent called the
function `/' the total number of times the function
was called. Recursive calls to the function are not
included in the number after the `/'.
name This is the name of the parent. The parent's index
number is printed after it. If the parent is a
member of a cycle, the cycle number is printed between
the name and the index number.
If the parents of the function cannot be determined, the word
`<spontaneous>' is printed in the `name' field, and all the other
fields are blank.
For the function's children, the fields have the following meanings:
self This is the amount of time that was propagated directly
from the child into the function.
children This is the amount of time that was propagated from the
child's children to the function.
called This is the number of times the function called
this child `/' the total number of times the child
was called. Recursive calls by the child are not
listed in the number after the `/'.
name This is the name of the child. The child's index
number is printed after it. If the child is a
member of a cycle, the cycle number is printed
between the name and the index number.
If there are any cycles (circles) in the call graph, there is an
entry for the cycle-as-a-whole. This entry shows who called the
cycle (as parents) and the members of the cycle (as children.)
The `+' recursive calls entry shows the number of function calls that
were internal to the cycle, and the calls entry for each member shows,
for that member, how many times it was called from other members of
the cycle.
Index by function name
[14] __brk [3] _vga_set_pallete_range [29] main
[15] __djgpp_exception_processor [16] blit [30] new_ship
[6] __dpmi_int [17] cirrus_54_scroll [12]
pack_fread
[10] _cirrus54_bank [24] flip [7] pack_read
[9] _cirrus54_bank_done [13] fm_reset [31] play_game
[1] _linear_blit8 [25] game_timer [19] putc
[2] _linear_clear_to_color8 [27] init_game [8]
refill_buffer
[4] _linear_draw_character8 [28] init_stars [5] rest
[11] _stub_bank_switch [18] localeconv [26]
second_timer
--------- END profile.txt ---------
- Raw text -