summaryrefslogtreecommitdiff
path: root/src/xine-utils/monitor.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/xine-utils/monitor.c')
-rw-r--r--src/xine-utils/monitor.c31
1 files changed, 16 insertions, 15 deletions
diff --git a/src/xine-utils/monitor.c b/src/xine-utils/monitor.c
index 1a348087c..8cbfdaa72 100644
--- a/src/xine-utils/monitor.c
+++ b/src/xine-utils/monitor.c
@@ -15,12 +15,9 @@
*
* You should have received a copy of the GNU General Public License
* 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.8 2006/06/23 18:24:22 dsalt Exp $
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA
*
* debug print and profiling functions - implementation
- *
*/
#ifdef HAVE_CONFIG_H
@@ -29,7 +26,7 @@
#include <stdio.h>
#include <sys/time.h>
-#include "xineutils.h"
+#include <xine/xineutils.h>
#define MAX_ID 10
@@ -41,13 +38,10 @@ static long profiler_calls[MAX_ID] ;
static const char *profiler_label[MAX_ID] ;
void xine_profiler_init () {
- int i;
- for (i=0; i<MAX_ID; i++) {
- profiler_times[i] = 0;
- profiler_start[i] = 0;
- profiler_calls[i] = 0;
- profiler_label[i] = NULL;
- }
+ memset(profiler_times, 0, sizeof(profiler_times));
+ memset(profiler_start, 0, sizeof(profiler_start));
+ memset(profiler_calls, 0, sizeof(profiler_calls));
+ memset(profiler_label, 0, sizeof(profiler_label));
}
int xine_profiler_allocate_slot (const char *label) {
@@ -64,13 +58,20 @@ int xine_profiler_allocate_slot (const char *label) {
}
-#if defined(ARCH_X86) || defined(ARCH_X86_64)
-__inline__ unsigned long long int rdtsc(void)
+#if defined(ARCH_X86_32)
+static __inline__ unsigned long long int rdtsc(void)
{
unsigned long long int x;
- __asm__ volatile (".byte 0x0f, 0x31" : "=A" (x));
+ __asm__ volatile ("rdtsc\n\t" : "=A" (x));
return x;
}
+#elif defined(ARCH_X86_64)
+static __inline__ unsigned long long int rdtsc(void)
+{
+ unsigned long long int a, d;
+ __asm__ volatile ("rdtsc\n\t" : "=a" (a), "=d" (d));
+ return (d << 32) | (a & 0xffffffff);
+}
#endif
void xine_profiler_start_count (int id) {