summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGuenter Bartsch <guenter@users.sourceforge.net>2001-08-14 11:57:40 +0000
committerGuenter Bartsch <guenter@users.sourceforge.net>2001-08-14 11:57:40 +0000
commitdc1ae5d9a88fdf89ab3de73380fefb0e70316305 (patch)
treea823d32a10c85e57fec38ca6ae33231169c4d7a8
parent79afb1ee5937876ef0c6b27c2e33370890003a36 (diff)
downloadxine-lib-dc1ae5d9a88fdf89ab3de73380fefb0e70316305.tar.gz
xine-lib-dc1ae5d9a88fdf89ab3de73380fefb0e70316305.tar.bz2
return of the profiler
CVS patchset: 428 CVS date: 2001/08/14 11:57:40
-rw-r--r--src/xine-engine/audio_decoder.c7
-rw-r--r--src/xine-engine/monitor.c36
-rw-r--r--src/xine-engine/video_decoder.c7
-rw-r--r--src/xine-engine/video_out.c11
-rw-r--r--src/xine-engine/xine.c12
5 files changed, 51 insertions, 22 deletions
diff --git a/src/xine-engine/audio_decoder.c b/src/xine-engine/audio_decoder.c
index 12c731e79..f92c63e55 100644
--- a/src/xine-engine/audio_decoder.c
+++ b/src/xine-engine/audio_decoder.c
@@ -17,7 +17,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*
- * $Id: audio_decoder.c,v 1.26 2001/08/13 17:52:22 jkeil Exp $
+ * $Id: audio_decoder.c,v 1.27 2001/08/14 11:57:40 guenter Exp $
*
*
* functions that implement audio decoding
@@ -166,10 +166,15 @@ void *audio_decoder_loop (void *this_gen) {
this->cur_audio_decoder_plugin = decoder;
this->cur_audio_decoder_plugin->init (this->cur_audio_decoder_plugin, this->audio_out);
+
+ printf ("audio_decoder: using decoder >%s< \n",
+ decoder->get_identifier());
}
+ profiler_start_count (1);
decoder->decode_data (decoder, buf);
+ profiler_stop_count (1);
}
}
} else
diff --git a/src/xine-engine/monitor.c b/src/xine-engine/monitor.c
index 6fb23340e..abf026e07 100644
--- a/src/xine-engine/monitor.c
+++ b/src/xine-engine/monitor.c
@@ -17,7 +17,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*
- * $Id: monitor.c,v 1.1 2001/04/18 22:36:04 f1rmb Exp $
+ * $Id: monitor.c,v 1.2 2001/08/14 11:57:40 guenter Exp $
*
* debug print and profiling functions - implementation
*
@@ -29,6 +29,10 @@
#include "monitor.h"
#include <stdio.h>
+#include <sys/time.h>
+#include <sys/resource.h>
+#include <unistd.h>
+
#define MAX_ID 5
@@ -51,34 +55,32 @@ void profiler_set_label (int id, char *label) {
profiler_label[id] = label;
}
-#ifdef ARCH_X86
-__inline__ unsigned long long int rdtsc()
-{
- unsigned long long int x;
- __asm__ volatile (".byte 0x0f, 0x31" : "=A" (x));
- return x;
-}
-#endif
-
void profiler_start_count (int id) {
-#ifdef ARCH_X86
- profiler_start[id] = rdtsc();
-#endif
+
+ struct rusage usage ;
+
+ getrusage (RUSAGE_SELF, &usage);
+
+ profiler_start[id] = (long long int) usage.ru_utime.tv_sec * 1e6 + usage.ru_utime.tv_usec + (long long int) usage.ru_stime.tv_sec * 1e6 + usage.ru_stime.tv_usec;
}
void profiler_stop_count (int id) {
-#ifdef ARCH_X86
- profiler_times[id] += rdtsc() - profiler_start[id];
-#endif
+
+ struct rusage usage ;
+
+ getrusage (RUSAGE_SELF, &usage);
+
+ profiler_times[id] += (long long int) usage.ru_utime.tv_sec * 1e6 + usage.ru_utime.tv_usec + (long long int) usage.ru_stime.tv_sec * 1e6 + usage.ru_stime.tv_usec - profiler_start[id];
}
void profiler_print_results () {
int i;
- printf ("\n\nPerformance analysis (cpu cycles):\n\n");
+ printf ("\n\nPerformance analysis (usec):\n\n");
for (i=0; i<MAX_ID; i++) {
printf ("%d:\t%s\t%12lld\n", i, profiler_label[i], profiler_times[i]);
}
}
#endif
+
diff --git a/src/xine-engine/video_decoder.c b/src/xine-engine/video_decoder.c
index b6c1f7605..f7c7ccfd2 100644
--- a/src/xine-engine/video_decoder.c
+++ b/src/xine-engine/video_decoder.c
@@ -17,7 +17,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*
- * $Id: video_decoder.c,v 1.36 2001/08/13 17:52:22 jkeil Exp $
+ * $Id: video_decoder.c,v 1.37 2001/08/14 11:57:40 guenter Exp $
*
*/
@@ -132,9 +132,14 @@ void *video_decoder_loop (void *this_gen) {
this->cur_video_decoder_plugin = decoder;
this->cur_video_decoder_plugin->init (this->cur_video_decoder_plugin, this->video_out);
+ printf ("video_decoder: using decoder >%s< \n",
+ decoder->get_identifier());
+
}
+ profiler_start_count (0);
decoder->decode_data (this->cur_video_decoder_plugin, buf);
+ profiler_stop_count (0);
}
break;
diff --git a/src/xine-engine/video_out.c b/src/xine-engine/video_out.c
index 93f6766de..31b96ed8f 100644
--- a/src/xine-engine/video_out.c
+++ b/src/xine-engine/video_out.c
@@ -17,7 +17,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*
- * $Id: video_out.c,v 1.39 2001/08/13 12:52:33 ehasenle Exp $
+ * $Id: video_out.c,v 1.40 2001/08/14 11:57:40 guenter Exp $
*
*/
@@ -180,6 +180,8 @@ static void *video_out_loop (void *this_gen) {
/* sigwait(&vo_mask, &dummysignum); */ /* wait for next timer tick */
pause ();
+ profiler_start_count (2);
+
video_step_new = this->metronom->get_video_rate (this->metronom);
if (video_step_new != video_step) {
video_step = video_step_new;
@@ -196,6 +198,7 @@ static void *video_out_loop (void *this_gen) {
img = this->display_img_buf_queue->first;
if (!img) {
+ profiler_stop_count (2);
continue;
}
@@ -250,6 +253,7 @@ static void *video_out_loop (void *this_gen) {
*/
if (diff<0) {
+ profiler_stop_count (2);
continue;
}
@@ -262,8 +266,10 @@ static void *video_out_loop (void *this_gen) {
img = vo_remove_from_img_buf_queue (this->display_img_buf_queue);
- if (!img)
+ if (!img) {
+ profiler_stop_count (2);
continue;
+ }
pthread_mutex_lock (&img->mutex);
img->bDriverLock = 1;
@@ -285,6 +291,7 @@ static void *video_out_loop (void *this_gen) {
this->driver->display_frame (this->driver, img);
+ profiler_stop_count (2);
}
/*
diff --git a/src/xine-engine/xine.c b/src/xine-engine/xine.c
index 6123aa18d..5b30316ff 100644
--- a/src/xine-engine/xine.c
+++ b/src/xine-engine/xine.c
@@ -17,7 +17,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*
- * $Id: xine.c,v 1.40 2001/08/13 12:52:33 ehasenle Exp $
+ * $Id: xine.c,v 1.41 2001/08/14 11:57:40 guenter Exp $
*
* top-level xine functions
*
@@ -328,6 +328,9 @@ void xine_exit (xine_t *this) {
this->status = XINE_QUIT;
printf ("xine_exit: bye!\n");
+
+ profiler_print_results ();
+
}
void xine_pause (xine_t *this) {
@@ -415,6 +418,13 @@ xine_t *xine_init (vo_driver_t *vo,
xine_debug = config->lookup_int (config, "xine_debug", 0);
/*
+ * set up profiler
+ */
+ profiler_set_label (0, "video decoder ");
+ profiler_set_label (1, "audio decoder/output ");
+ profiler_set_label (2, "video output ");
+
+ /*
* init lock
*/