From 5f2178bed7fd32e8d4897627912c0aa8ac11fc69 Mon Sep 17 00:00:00 2001 From: nick Date: Sun, 24 Feb 2002 11:23:48 +0000 Subject: [PATCH] max & average benchmarks git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@4835 b3059339-0415-0410-9bf9-f77b7e298cf2 --- dec_video.c | 13 +++++++++++-- mencoder.c | 2 ++ mplayer.c | 32 ++++++++++++++++++++++++++++---- 3 files changed, 41 insertions(+), 6 deletions(-) diff --git a/dec_video.c b/dec_video.c index acb05b23bd..7cc2041449 100644 --- a/dec_video.c +++ b/dec_video.c @@ -40,6 +40,8 @@ extern int verbose; // defined in mplayer.c extern double video_time_usage; extern double vout_time_usage; +extern double max_video_time_usage; +extern double max_vout_time_usage; extern vo_vaa_t vo_vaa; extern int frameratecode2framerate[16]; @@ -819,6 +821,7 @@ static int double_buff_num = 0; unsigned int t=GetTimer(); unsigned int t2; +double tt; painted = 0; #ifdef USE_MP_IMAGE @@ -1211,7 +1214,10 @@ else if(gCpuCaps.hasMMX){ } #endif -t2=GetTimer();t=t2-t;video_time_usage+=t*0.000001f; +t2=GetTimer();t=t2-t; +tt = t*0.000001f; +video_time_usage+=tt; +if(tt > max_video_time_usage) max_video_time_usage=tt; if(painted) return 1; switch(blit_frame){ case 3: @@ -1268,7 +1274,10 @@ case 2: else video_out->draw_frame(mpi->planes); #endif - t2=GetTimer()-t2;vout_time_usage+=t2*0.000001f; + t2=GetTimer()-t2; + tt=t2*0.000001f; + vout_time_usage+=tt; + if(tt > max_vout_time_usage) max_vout_time_usage = tt; blit_frame=1; break; } diff --git a/mencoder.c b/mencoder.c index 3c36fb3609..9e23f5a5dd 100644 --- a/mencoder.c +++ b/mencoder.c @@ -150,6 +150,8 @@ int verbose=0; // must be global! double video_time_usage=0; double vout_time_usage=0; +double max_video_time_usage=0; +double max_vout_time_usage=0; static double audio_time_usage=0; static int total_time_usage_start=0; static int benchmark=0; diff --git a/mplayer.c b/mplayer.c index 71b64cfa22..4973036eed 100644 --- a/mplayer.c +++ b/mplayer.c @@ -176,7 +176,10 @@ ao_functions_t *audio_out=NULL; // benchmark: double video_time_usage=0; double vout_time_usage=0; +double max_video_time_usage=0; +double max_vout_time_usage=0; static double audio_time_usage=0; +static double max_audio_time_usage=0; static int total_time_usage_start=0; static int benchmark=0; @@ -249,6 +252,7 @@ static float force_fps=0; static int force_srate=0; static int frame_dropping=0; // option 0=no drop 1= drop vo 2= drop decode static int play_n_frames=-1; +static int our_n_frames; // screen info: char* video_driver=NULL; //"mga"; // default @@ -1560,7 +1564,8 @@ InitTimer(); total_time_usage_start=GetTimer(); audio_time_usage=0; video_time_usage=0; vout_time_usage=0; - +max_audio_time_usage=0; max_video_time_usage=0; max_vout_time_usage=0; +our_n_frames=play_n_frames; while(!eof){ // unsigned int aq_total_time=GetTimer(); float aq_sleep_time=0; @@ -1573,6 +1578,7 @@ while(!eof){ /*========================== PLAY AUDIO ============================*/ while(sh_audio){ unsigned int t; + double tt; int playsize; ao_data.pts=sh_audio->timer*90000.0; @@ -1602,7 +1608,10 @@ while(sh_audio){ } } current_module=NULL; // Leave AUDIO decoder module - t=GetTimer()-t;audio_time_usage+=t*0.000001; + t=GetTimer()-t; + tt = t*0.000001f; + audio_time_usage+=tt; + if(tt > max_audio_time_usage) max_audio_time_usage = tt; if(playsize>sh_audio->a_buffer_len) playsize=sh_audio->a_buffer_len; @@ -2840,18 +2849,33 @@ goto_next_file: // don't jump here after ao/vo/getch initialization! if(benchmark){ double tot=video_time_usage+vout_time_usage+audio_time_usage; double total_time_usage; + max_video_time_usage *= our_n_frames; + max_vout_time_usage *= our_n_frames; + max_audio_time_usage *= our_n_frames; total_time_usage_start=GetTimer()-total_time_usage_start; total_time_usage = (float)total_time_usage_start*0.000001; - mp_msg(MSGT_CPLAYER,MSGL_INFO,"\nBENCHMARKs: V:%8.3fs VO:%8.3fs A:%8.3fs Sys:%8.3fs = %8.3fs\n", + mp_msg(MSGT_CPLAYER,MSGL_INFO,"\nAVE BENCHMARKs: V:%8.3fs VO:%8.3fs A:%8.3fs Sys:%8.3fs = %8.3fs\n", video_time_usage,vout_time_usage,audio_time_usage, total_time_usage-tot,total_time_usage); if(total_time_usage>0.0) - mp_msg(MSGT_CPLAYER,MSGL_INFO,"BENCHMARK%%: V:%8.4f%% VO:%8.4f%% A:%8.4f%% Sys:%8.4f%% = %8.4f%%\n", + mp_msg(MSGT_CPLAYER,MSGL_INFO,"AVE BENCHMARK%%: V:%8.4f%% VO:%8.4f%% A:%8.4f%% Sys:%8.4f%% = %8.4f%%\n", 100.0*video_time_usage/total_time_usage, 100.0*vout_time_usage/total_time_usage, 100.0*audio_time_usage/total_time_usage, 100.0*(total_time_usage-tot)/total_time_usage, 100.0); + mp_msg(MSGT_CPLAYER,MSGL_INFO,"\nMAX BENCHMARKs: V:%8.3fs VO:%8.3fs A:%8.3fs\n", + max_video_time_usage,max_vout_time_usage, + max_audio_time_usage); + if(total_time_usage>0.0) + mp_msg(MSGT_CPLAYER,MSGL_INFO,"MAX BENCHMARK%%: V:%8.4f%% VO:%8.4f%% A:%8.4f%% = %8.4f%%\n", + 100.0*max_video_time_usage/total_time_usage, + 100.0*max_vout_time_usage/total_time_usage, + 100.0*max_audio_time_usage/total_time_usage, + 100.0*max_video_time_usage/total_time_usage+ + 100.0*max_vout_time_usage/total_time_usage+ + 100.0*max_audio_time_usage/total_time_usage + ); } if(eof == PT_NEXT_ENTRY || eof == PT_PREV_ENTRY) {