From 4ea8b3051ebdd36cd3f1573468f26137484f8778 Mon Sep 17 00:00:00 2001 From: stevenhowes <38082088+stevenhowes@users.noreply.github.com> Date: Sat, 27 Mar 2021 19:53:25 +0000 Subject: [PATCH] Simple profiling --- !TheEsc/!RunImage,ff8 | Bin 15224 -> 15228 bytes !TheEsc/c/CTheEscape | 39 +++++++++++++++++++-------------------- 2 files changed, 19 insertions(+), 20 deletions(-) diff --git a/!TheEsc/!RunImage,ff8 b/!TheEsc/!RunImage,ff8 index 2568d307eadb7954faadf234ca55c9942bb373cc..4b07c6320c152cad3275584cde30afab63801f65 100644 GIT binary patch delta 491 zcmXw$PiPZC6vn?d?7B4?O^TK@Mbec11F2msJp>JG^%_u!AW}TFrBJAPv0egAO9T%J z(P^YX#LXcvU<75P&>9d0528Yj-b}U*5`q|Sg2Fl*@xeFnelzdAk2k;8{;U;a)O|6S zwMg()YsjqEfv&t~WzF!{U0{0;xS^Hf-w%J$PdHs=~g6BK% zOkCRk;rn~Gm~X$7m7|AMh}&cRI6Fu?17Sd7x^%I`&#O zT^e5x3))gODkvD}2>EmTyhUf_?5PE!QC^b+*Hgjj z+(jdzJ2-<25f}$VO$db^q5>a!=*{iULyS$xw?N@`w&(}n1HaEXzu)i6?;J1vS;_{f z{-Gmj5N8WUr@p=g)WtI+sryPBfVm0GE2Y>$>z;b@-8V#B(CKS5yZE!e>RG+vcrjJp zJ&BK)uqtDB-pULzB_y7dJTT=012xTWN(x%#gwhH8kQiJpA!16c&nk~9X|T$&1vNs( zaVOyDxLG-H-OWXNvbrh?XHF5#iTD0aO%49i_LX#-UP>)w7VVc zr8%}7eb_uZSXzMfqEqYVJhjx|pV}3K9xoq`&&j8^X(VX zX2tGLs_AUcBOfPI+O#6!L5+*Up6do(5wT0tL=l!B7^h)T9Y|_4CgPWG5yeDq=oiH! rJHYT~Km(9o17_5ZH1d^Qz*Uh>|6@-TZ?ON-$Wvk?*6R`bS6|UzK`p${ diff --git a/!TheEsc/c/CTheEscape b/!TheEsc/c/CTheEscape index 0f6abe6..2651acc 100644 --- a/!TheEsc/c/CTheEscape +++ b/!TheEsc/c/CTheEscape @@ -13,7 +13,7 @@ unsigned char *buffer; extern int screen; extern struct CompositionElement composition[128]; extern int current_element; - +int lastprofile = 0; #define DISPLAY_MODE 15 #define DISPLAY_X 1280 #define DISPLAY_Y 1024 @@ -23,10 +23,11 @@ extern int current_element; #define MAX_NPCS 5 #define MAX_STARS 5 #define MAX_PROJECTILES 10 - +//#define PROFILE(X) lastprofile = clock(); X; printf("\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t%s %i\n", #X, (clock() - lastprofile)) +#define PROFILE(X) X enum sprite_e{player_ship, durno_ship, ship_trgt, durno_ship2, ship2_trgt, player_shipl,player_shipr,explode_start,explode_shp2,explode_shp3,explode_shp4,explode_shp5,explode_shp6,explode_shp7,explode_end,photon1,photon2,plasma1,plasma2}; -//char *sprites[] = {"player_ship","durno_ship","ship_trgt","durno_ship2","ship2_trgt","player_shipl","player_shipr","explode_shp1","explode_shp2","explode_shp3","explode_shp4","explode_shp5","explode_shp6","explode_shp7","explode_shp8","photon1","photon2","plasma1","plasma2"}; char *sprites[] = {"player_ship","durno_ship","ship_trgt","durno_ship2","ship2_trgt","player_shipl","player_shipr","explode_shp1","explode_shp2","explode_shp3","explode_shp4","explode_shp5","explode_shp6","explode_shp7","explode_shp8","photon1","photon2","plasma1","plasma2"}; + char hudbuffer[63]; enum font_e{sys_12_8,font_max}; @@ -396,10 +397,9 @@ void game_draw_projectiles() void game_draw_stars() { unsigned char i; - + graphics_colour(Stars[0].colour); for(i = 0; i < MAX_STARS; i++) { - graphics_colour(Stars[i].colour); draw_line(Stars[i].location.X,Stars[i].location.Y,Stars[i].location.X,Stars[i].location.Y+Stars[i].length); } } @@ -954,26 +954,25 @@ void game_tick() { lasttick = tick; tick = clock(); - screen_flipbuffer(); screen_clear(); - game_tick_stars(); - game_input_tick(); - game_tick_player(); - game_tick_npcs(); - game_collider_tick(); - game_projectiles_tick(); - game_player_targets_tick(); - game_npcs_tick(); - game_draw_stars(); - game_draw_player(); - game_draw_npcs(); - game_draw_projectiles(); + PROFILE(game_tick_stars()); + PROFILE(game_input_tick()); + PROFILE(game_tick_player()); + PROFILE(game_tick_npcs()); + PROFILE(game_collider_tick()); + PROFILE(game_projectiles_tick()); + PROFILE(game_player_targets_tick()); + PROFILE(game_npcs_tick()); + PROFILE(game_draw_stars()); + PROFILE(game_draw_player()); + PROFILE(game_draw_npcs()); + PROFILE(game_draw_projectiles()); - game_draw_hud(); - game_draw_debugmenu(); + PROFILE(game_draw_hud()); + PROFILE(game_draw_debugmenu()); } int main(int argc, char *argv[])