changeset 4834:fdb92826250c

max & average benchmarks
author nick
date Sun, 24 Feb 2002 11:23:48 +0000
parents 395844d9d5d6
children 1f59d4d73558
files dec_video.c mencoder.c mplayer.c
diffstat 3 files changed, 41 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/dec_video.c	Sun Feb 24 04:56:54 2002 +0000
+++ b/dec_video.c	Sun Feb 24 11:23:48 2002 +0000
@@ -40,6 +40,8 @@
 
 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 @@
 
 unsigned int t=GetTimer();
 unsigned int t2;
+double tt;
 
   painted = 0;
 #ifdef USE_MP_IMAGE
@@ -1211,7 +1214,10 @@
 }
 #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 @@
     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;
 }
--- a/mencoder.c	Sun Feb 24 04:56:54 2002 +0000
+++ b/mencoder.c	Sun Feb 24 11:23:48 2002 +0000
@@ -150,6 +150,8 @@
 
 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;
--- a/mplayer.c	Sun Feb 24 04:56:54 2002 +0000
+++ b/mplayer.c	Sun Feb 24 11:23:48 2002 +0000
@@ -176,7 +176,10 @@
 // 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 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 @@
 
 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 @@
 /*========================== PLAY AUDIO ============================*/
 while(sh_audio){
   unsigned int t;
+  double tt;
   int playsize;
   
   ao_data.pts=sh_audio->timer*90000.0;
@@ -1602,7 +1608,10 @@
     }
   }
   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 @@
 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) {